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

UMD create_mock_cluster and fix PhysicalCoordinate #15411

Merged
merged 9 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tt_metal/distributed/mesh_configurations/N300.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"logical_to_physical_coordinates": [
[[0, 0], [0, 0, 0, 0]], [[0, 1], [0, 1, 0, 0]]
[[0, 0], [0, 0, 0, 0, 0]], [[0, 1], [0, 0, 1, 0, 0]]
]
}
4 changes: 2 additions & 2 deletions tt_metal/distributed/mesh_configurations/T3000.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"logical_to_physical_coordinates": [
[[0, 0], [0, 0, 0, 0]], [[0, 1], [0, 1, 0, 0]], [[0, 2], [0, 2, 0, 0]], [[0, 3], [0, 3, 0, 0]],
[[1, 0], [1, 0, 0, 0]], [[1, 1], [1, 1, 0, 0]], [[1, 2], [1, 2, 0, 0]], [[1, 3], [1, 3, 0, 0]]
[[0, 0], [0, 0, 0, 0, 0]], [[0, 1], [0, 0, 1, 0, 0]], [[0, 2], [0, 0, 2, 0, 0]], [[0, 3], [0, 0, 3, 0, 0]],
[[1, 0], [0, 1, 0, 0, 0]], [[1, 1], [0, 1, 1, 0, 0]], [[1, 2], [0, 1, 2, 0, 0]], [[1, 3], [0, 1, 3, 0, 0]]
]
}
64 changes: 32 additions & 32 deletions tt_metal/distributed/mesh_configurations/TG.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
{
"logical_to_physical_coordinates": [
[[0, 0], [7, 3, 0, 1]],
[[0, 1], [7, 2, 0, 1]],
[[0, 2], [7, 1, 0, 1]],
[[0, 3], [7, 0, 0, 1]],
[[1, 0], [6, 3, 0, 1]],
[[1, 1], [6, 2, 0, 1]],
[[1, 2], [6, 1, 0, 1]],
[[1, 3], [6, 0, 0, 1]],
[[2, 0], [5, 3, 0, 1]],
[[2, 1], [5, 2, 0, 1]],
[[2, 2], [5, 1, 0, 1]],
[[2, 3], [5, 0, 0, 1]],
[[3, 0], [4, 3, 0, 1]],
[[3, 1], [4, 2, 0, 1]],
[[3, 2], [4, 1, 0, 1]],
[[3, 3], [4, 0, 0, 1]],
[[4, 0], [3, 3, 0, 1]],
[[4, 1], [3, 2, 0, 1]],
[[4, 2], [3, 1, 0, 1]],
[[4, 3], [3, 0, 0, 1]],
[[5, 0], [2, 3, 0, 1]],
[[5, 1], [2, 2, 0, 1]],
[[5, 2], [2, 1, 0, 1]],
[[5, 3], [2, 0, 0, 1]],
[[6, 0], [1, 3, 0, 1]],
[[6, 1], [1, 2, 0, 1]],
[[6, 2], [1, 1, 0, 1]],
[[6, 3], [1, 0, 0, 1]],
[[7, 0], [0, 3, 0, 1]],
[[7, 1], [0, 2, 0, 1]],
[[7, 2], [0, 1, 0, 1]],
[[7, 3], [0, 0, 0, 1]]
[[0, 0], [0, 7, 3, 0, 1]],
[[0, 1], [0, 7, 2, 0, 1]],
[[0, 2], [0, 7, 1, 0, 1]],
[[0, 3], [0, 7, 0, 0, 1]],
[[1, 0], [0, 6, 3, 0, 1]],
[[1, 1], [0, 6, 2, 0, 1]],
[[1, 2], [0, 6, 1, 0, 1]],
[[1, 3], [0, 6, 0, 0, 1]],
[[2, 0], [0, 5, 3, 0, 1]],
[[2, 1], [0, 5, 2, 0, 1]],
[[2, 2], [0, 5, 1, 0, 1]],
[[2, 3], [0, 5, 0, 0, 1]],
[[3, 0], [0, 4, 3, 0, 1]],
[[3, 1], [0, 4, 2, 0, 1]],
[[3, 2], [0, 4, 1, 0, 1]],
[[3, 3], [0, 4, 0, 0, 1]],
[[4, 0], [0, 3, 3, 0, 1]],
[[4, 1], [0, 3, 2, 0, 1]],
[[4, 2], [0, 3, 1, 0, 1]],
[[4, 3], [0, 3, 0, 0, 1]],
[[5, 0], [0, 2, 3, 0, 1]],
[[5, 1], [0, 2, 2, 0, 1]],
[[5, 2], [0, 2, 1, 0, 1]],
[[5, 3], [0, 2, 0, 0, 1]],
[[6, 0], [0, 1, 3, 0, 1]],
[[6, 1], [0, 1, 2, 0, 1]],
[[6, 2], [0, 1, 1, 0, 1]],
[[6, 3], [0, 1, 0, 0, 1]],
[[7, 0], [0, 0, 3, 0, 1]],
[[7, 1], [0, 0, 2, 0, 1]],
[[7, 2], [0, 0, 1, 0, 1]],
[[7, 3], [0, 0, 0, 0, 1]]
]
}
128 changes: 64 additions & 64 deletions tt_metal/distributed/mesh_configurations/TGG.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
{
"logical_to_physical_coordinates": [
[[0, 0], [0, 3, 0, 1]],
[[0, 1], [0, 2, 0, 1]],
[[0, 2], [0, 1, 0, 1]],
[[0, 3], [0, 0, 0, 1]],
[[1, 0], [1, 3, 0, 1]],
[[1, 1], [1, 2, 0, 1]],
[[1, 2], [1, 1, 0, 1]],
[[1, 3], [1, 0, 0, 1]],
[[2, 0], [2, 3, 0, 1]],
[[2, 1], [2, 2, 0, 1]],
[[2, 2], [2, 1, 0, 1]],
[[2, 3], [2, 0, 0, 1]],
[[3, 0], [3, 3, 0, 1]],
[[3, 1], [3, 2, 0, 1]],
[[3, 2], [3, 1, 0, 1]],
[[3, 3], [3, 0, 0, 1]],
[[4, 0], [4, 3, 0, 1]],
[[4, 1], [4, 2, 0, 1]],
[[4, 2], [4, 1, 0, 1]],
[[4, 3], [4, 0, 0, 1]],
[[5, 0], [5, 3, 0, 1]],
[[5, 1], [5, 2, 0, 1]],
[[5, 2], [5, 1, 0, 1]],
[[5, 3], [5, 0, 0, 1]],
[[6, 0], [6, 3, 0, 1]],
[[6, 1], [6, 2, 0, 1]],
[[6, 2], [6, 1, 0, 1]],
[[6, 3], [6, 0, 0, 1]],
[[7, 0], [7, 3, 0, 1]],
[[7, 1], [7, 2, 0, 1]],
[[7, 2], [7, 1, 0, 1]],
[[7, 3], [7, 0, 0, 1]],
[[0, 4], [0, 0, 0, 2]],
[[0, 5], [0, 1, 0, 2]],
[[0, 6], [0, 2, 0, 2]],
[[0, 7], [0, 3, 0, 2]],
[[1, 4], [1, 0, 0, 2]],
[[1, 5], [1, 1, 0, 2]],
[[1, 6], [1, 2, 0, 2]],
[[1, 7], [1, 3, 0, 2]],
[[2, 4], [2, 0, 0, 2]],
[[2, 5], [2, 1, 0, 2]],
[[2, 6], [2, 2, 0, 2]],
[[2, 7], [2, 3, 0, 2]],
[[3, 4], [3, 0, 0, 2]],
[[3, 5], [3, 1, 0, 2]],
[[3, 6], [3, 2, 0, 2]],
[[3, 7], [3, 3, 0, 2]],
[[4, 4], [4, 0, 0, 2]],
[[4, 5], [4, 1, 0, 2]],
[[4, 6], [4, 2, 0, 2]],
[[4, 7], [4, 3, 0, 2]],
[[5, 4], [5, 0, 0, 2]],
[[5, 5], [5, 1, 0, 2]],
[[5, 6], [5, 2, 0, 2]],
[[5, 7], [5, 3, 0, 2]],
[[6, 4], [6, 0, 0, 2]],
[[6, 5], [6, 1, 0, 2]],
[[6, 6], [6, 2, 0, 2]],
[[6, 7], [6, 3, 0, 2]],
[[7, 4], [7, 0, 0, 2]],
[[7, 5], [7, 1, 0, 2]],
[[7, 6], [7, 2, 0, 2]],
[[7, 7], [7, 3, 0, 2]]
[[0, 0], [0, 0, 3, 0, 1]],
[[0, 1], [0, 0, 2, 0, 1]],
[[0, 2], [0, 0, 1, 0, 1]],
[[0, 3], [0, 0, 0, 0, 1]],
[[1, 0], [0, 1, 3, 0, 1]],
[[1, 1], [0, 1, 2, 0, 1]],
[[1, 2], [0, 1, 1, 0, 1]],
[[1, 3], [0, 1, 0, 0, 1]],
[[2, 0], [0, 2, 3, 0, 1]],
[[2, 1], [0, 2, 2, 0, 1]],
[[2, 2], [0, 2, 1, 0, 1]],
[[2, 3], [0, 2, 0, 0, 1]],
[[3, 0], [0, 3, 3, 0, 1]],
[[3, 1], [0, 3, 2, 0, 1]],
[[3, 2], [0, 3, 1, 0, 1]],
[[3, 3], [0, 3, 0, 0, 1]],
[[4, 0], [0, 4, 3, 0, 1]],
[[4, 1], [0, 4, 2, 0, 1]],
[[4, 2], [0, 4, 1, 0, 1]],
[[4, 3], [0, 4, 0, 0, 1]],
[[5, 0], [0, 5, 3, 0, 1]],
[[5, 1], [0, 5, 2, 0, 1]],
[[5, 2], [0, 5, 1, 0, 1]],
[[5, 3], [0, 5, 0, 0, 1]],
[[6, 0], [0, 6, 3, 0, 1]],
[[6, 1], [0, 6, 2, 0, 1]],
[[6, 2], [0, 6, 1, 0, 1]],
[[6, 3], [0, 6, 0, 0, 1]],
[[7, 0], [0, 7, 3, 0, 1]],
[[7, 1], [0, 7, 2, 0, 1]],
[[7, 2], [0, 7, 1, 0, 1]],
[[7, 3], [0, 7, 0, 0, 1]],
[[0, 4], [0, 0, 0, 0, 2]],
[[0, 5], [0, 0, 1, 0, 2]],
[[0, 6], [0, 0, 2, 0, 2]],
[[0, 7], [0, 0, 3, 0, 2]],
[[1, 4], [0, 1, 0, 0, 2]],
[[1, 5], [0, 1, 1, 0, 2]],
[[1, 6], [0, 1, 2, 0, 2]],
[[1, 7], [0, 1, 3, 0, 2]],
[[2, 4], [0, 2, 0, 0, 2]],
[[2, 5], [0, 2, 1, 0, 2]],
[[2, 6], [0, 2, 2, 0, 2]],
[[2, 7], [0, 2, 3, 0, 2]],
[[3, 4], [0, 3, 0, 0, 2]],
[[3, 5], [0, 3, 1, 0, 2]],
[[3, 6], [0, 3, 2, 0, 2]],
[[3, 7], [0, 3, 3, 0, 2]],
[[4, 4], [0, 4, 0, 0, 2]],
[[4, 5], [0, 4, 1, 0, 2]],
[[4, 6], [0, 4, 2, 0, 2]],
[[4, 7], [0, 4, 3, 0, 2]],
[[5, 4], [0, 5, 0, 0, 2]],
[[5, 5], [0, 5, 1, 0, 2]],
[[5, 6], [0, 5, 2, 0, 2]],
[[5, 7], [0, 5, 3, 0, 2]],
[[6, 4], [0, 6, 0, 0, 2]],
[[6, 5], [0, 6, 1, 0, 2]],
[[6, 6], [0, 6, 2, 0, 2]],
[[6, 7], [0, 6, 3, 0, 2]],
[[7, 4], [0, 7, 0, 0, 2]],
[[7, 5], [0, 7, 1, 0, 2]],
[[7, 6], [0, 7, 2, 0, 2]],
[[7, 7], [0, 7, 3, 0, 2]]
]
}
2 changes: 1 addition & 1 deletion tt_metal/distributed/mesh_configurations/device.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"logical_to_physical_coordinates": [
[[0, 0], [0, 0, 0, 0]]
[[0, 0], [0, 0, 0, 0, 0]]
]
}
10 changes: 8 additions & 2 deletions tt_metal/distributed/mesh_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,16 @@ static std::unordered_map<LogicalCoordinate, PhysicalCoordinate> load_translatio

std::unordered_map<LogicalCoordinate, PhysicalCoordinate> result;
for (const auto& mapping : j[key]) {
if (mapping.size() != 2 || mapping[0].size() != 2 || mapping[1].size() != 4) {
if (mapping.size() != 2 || mapping[0].size() != 2 || mapping[1].size() != 5) {
throw std::runtime_error("Invalid coordinate format in JSON file: " + filename);
}
result.emplace(LogicalCoordinate{mapping[0][0], mapping[0][1]}, PhysicalCoordinate{mapping[1][1], mapping[1][0], mapping[1][2], mapping[1][3]});
result.emplace(LogicalCoordinate{mapping[0][0], mapping[0][1]}, PhysicalCoordinate{
aliuTT marked this conversation as resolved.
Show resolved Hide resolved
mapping[1][0], // cluster_id
mapping[1][2], // x
mapping[1][1], // y
mapping[1][3], // rack
mapping[1][4] // shelf
});
}

return result;
Expand Down
12 changes: 2 additions & 10 deletions tt_metal/llrt/tt_cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,8 @@ void Cluster::generate_cluster_descriptor() {

// Cluster descriptor yaml not available for Blackhole bring up
if (this->target_type_ == TargetDevice::Simulator) {
// Cannot use tt::umd::Cluster::detect_available_device_ids because that returns physical device IDs
std::vector<chip_id_t> physical_mmio_device_ids;
std::set<chip_id_t> logical_mmio_device_ids;
physical_mmio_device_ids = tt_SimulationDevice::detect_available_device_ids();
for (chip_id_t logical_mmio_device_id = 0; logical_mmio_device_id < physical_mmio_device_ids.size();
logical_mmio_device_id++) {
logical_mmio_device_ids.insert(logical_mmio_device_id);
}
this->cluster_desc_ =
tt_ClusterDescriptor::create_for_grayskull_cluster(logical_mmio_device_ids, physical_mmio_device_ids);
// Passing simulator reported physical devices as logical devices.
this->cluster_desc_ = tt_ClusterDescriptor::create_mock_cluster(tt_SimulationDevice::detect_available_device_ids(), this->arch_);
} else {
this->cluster_desc_ = tt_ClusterDescriptor::create_from_yaml(this->cluster_desc_path_);
for (const auto &chip_id : this->cluster_desc_->get_all_chips()) {
Expand Down
2 changes: 1 addition & 1 deletion tt_metal/third_party/umd
Submodule umd updated 103 files
Loading