Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend MeshTensor read/write APIs to support uneven sharding #18735

Open
wants to merge 3 commits into
base: jchu/ttnn-integration-with-mesh
Choose a base branch
from

Conversation

omilyutin-tt
Copy link
Contributor

@omilyutin-tt omilyutin-tt commented Mar 6, 2025

Ticket

N/A

Problem description

MeshBuffer-backed Tensors should support uneven shards.

What's changed

Changes to read/write paths + tests.

Checklist

  • Post commit
  • New/Existing tests provide coverage for changes

Comment on lines +878 to +880

// Set storage with the populated metadata.
mesh_tensor.set_storage(mesh_storage);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errm... was this just not doing anything before? 😱

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was using the same mesh buffer behind the scenes, but there was no metadata to populate, so just worked :)

std::shared_ptr<Buffer> buffer;
std::shared_ptr<distributed::MeshBuffer> mesh_buffer;
std::map<distributed::MeshCoordinate, TensorSpec> specs;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not add it as a constructor argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a path that creates DeviceStorage for a single device... I think there are more changes upcoming that touch this, I think we need to tackle this separately.

Comment on lines +91 to +97
bool operator==(const MeshCoordinate& lhs, const MeshCoordinate& rhs);
bool operator!=(const MeshCoordinate& lhs, const MeshCoordinate& rhs);
bool operator<(const MeshCoordinate& lhs, const MeshCoordinate& rhs);
bool operator>(const MeshCoordinate& lhs, const MeshCoordinate& rhs);
bool operator<=(const MeshCoordinate& lhs, const MeshCoordinate& rhs);
bool operator>=(const MeshCoordinate& lhs, const MeshCoordinate& rhs);
std::ostream& operator<<(std::ostream& os, const MeshCoordinate& shape);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment on lines +807 to +810
DeviceStorage device_storage(mesh_buffer);
device_storage.specs = specs;
device_storage.strategy = storage.strategy;
return device_storage;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably move away from direct access like this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, I was just going to say. Should be class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants