From a2a5e4033e15a5312ab1216019eacce35570d842 Mon Sep 17 00:00:00 2001 From: Bojan Rosko Date: Fri, 29 Nov 2024 09:58:14 +0000 Subject: [PATCH] init --- tests/tt_metal/test_utils/env_vars.hpp | 11 ++++++----- tt_metal/common/metal_soc_descriptor.cpp | 2 +- tt_metal/llrt/get_platform_architecture.hpp | 17 +++++++++-------- tt_metal/third_party/umd | 2 +- .../reduction/prod/device/prod_op_all.cpp | 2 +- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/tt_metal/test_utils/env_vars.hpp b/tests/tt_metal/test_utils/env_vars.hpp index 449fcfcb017..9a9cfb4a818 100644 --- a/tests/tt_metal/test_utils/env_vars.hpp +++ b/tests/tt_metal/test_utils/env_vars.hpp @@ -6,6 +6,7 @@ #include "common/utils.hpp" #include "umd/device/device_api_metal.h" +#include "umd/device/tt_cluster_descriptor.h" #include @@ -43,11 +44,11 @@ inline std::string get_umd_arch_name() { return get_env_arch_name(); } - std::vector physical_mmio_device_ids = tt::umd::Cluster::detect_available_device_ids(); - tt::ARCH arch = detect_arch(physical_mmio_device_ids.at(0)); - for (int dev_index = 1; dev_index < physical_mmio_device_ids.size(); dev_index++) { - chip_id_t device_id = physical_mmio_device_ids.at(dev_index); - tt::ARCH detected_arch = detect_arch(device_id); + auto cluster_desc = tt_ClusterDescriptor::create(); + const std::unordered_set &device_ids = cluster_desc->get_all_chips(); + tt::ARCH arch = cluster_desc->get_arch(*device_ids.begin()); + for (auto device_id : device_ids) { + tt::ARCH detected_arch = cluster_desc->get_arch(device_id); TT_FATAL( arch == detected_arch, "Expected all devices to be {} but device {} is {}", diff --git a/tt_metal/common/metal_soc_descriptor.cpp b/tt_metal/common/metal_soc_descriptor.cpp index e4aa3683491..a702c9f75e8 100644 --- a/tt_metal/common/metal_soc_descriptor.cpp +++ b/tt_metal/common/metal_soc_descriptor.cpp @@ -357,7 +357,7 @@ void metal_SocDescriptor::update_pcie_cores(const BoardType& board_type) { return; } switch (board_type) { - case DEFAULT: { // Workaround for BHs running FW that does not return board type in the cluster yaml + case UNKNOWN: { // Workaround for BHs running FW that does not return board type in the cluster yaml this->pcie_cores = {CoreCoord(11, 0)}; } break; case P150A: { diff --git a/tt_metal/llrt/get_platform_architecture.hpp b/tt_metal/llrt/get_platform_architecture.hpp index f83bd38f258..1d969532064 100644 --- a/tt_metal/llrt/get_platform_architecture.hpp +++ b/tt_metal/llrt/get_platform_architecture.hpp @@ -8,6 +8,7 @@ #include "tt_metal/common/tt_backend_api_types.hpp" #include "tt_metal/common/assert.hpp" +#include "umd/device/tt_cluster_descriptor.h" #include "umd/device/cluster.h" namespace tt::tt_metal { @@ -47,8 +48,8 @@ namespace tt::tt_metal { * @endcode * * @see tt::get_arch_from_string - * @see tt::umd::Cluster::detect_available_device_ids - * @see detect_arch + * @see tt_ClusterDescriptor::detect_arch + * @see tt_ClusterDescriptor::get_arch */ inline tt::ARCH get_platform_architecture() { auto arch = tt::ARCH::Invalid; @@ -57,12 +58,12 @@ inline tt::ARCH get_platform_architecture() { TT_FATAL(arch_env, "ARCH_NAME env var needed for VCS"); arch = tt::get_arch_from_string(arch_env); } else { - std::vector physical_mmio_device_ids = tt::umd::Cluster::detect_available_device_ids(); - if (!physical_mmio_device_ids.empty()) { - arch = detect_arch(physical_mmio_device_ids.at(0)); - for (int i = 1; i < physical_mmio_device_ids.size(); ++i) { - chip_id_t device_id = physical_mmio_device_ids.at(i); - tt::ARCH detected_arch = detect_arch(device_id); + auto cluster_desc = tt_ClusterDescriptor::create(); + if (cluster_desc->get_number_of_chips() > 0) { + const std::unordered_set &device_ids = cluster_desc->get_all_chips(); + arch = cluster_desc->get_arch(*device_ids.begin()); + for (auto device_id : device_ids) { + tt::ARCH detected_arch = cluster_desc->get_arch(device_id); TT_FATAL( arch == detected_arch, "Expected all devices to be {} but device {} is {}", diff --git a/tt_metal/third_party/umd b/tt_metal/third_party/umd index b3b5f1aebde..a17dd0a1db9 160000 --- a/tt_metal/third_party/umd +++ b/tt_metal/third_party/umd @@ -1 +1 @@ -Subproject commit b3b5f1aebdec1ad499339e3d18dd0fbc2a059947 +Subproject commit a17dd0a1db9873a7f1436784ce3bb5bbcc4691d2 diff --git a/ttnn/cpp/ttnn/operations/reduction/prod/device/prod_op_all.cpp b/ttnn/cpp/ttnn/operations/reduction/prod/device/prod_op_all.cpp index b4e4c7e0a42..7f51d3de4cf 100644 --- a/ttnn/cpp/ttnn/operations/reduction/prod/device/prod_op_all.cpp +++ b/ttnn/cpp/ttnn/operations/reduction/prod/device/prod_op_all.cpp @@ -46,7 +46,7 @@ operation::ProgramWithCallbacks Prod_op::create_program( Tensor prod_all(const Tensor& input, const MemoryConfig& output_mem_config) { Tensor result = ttnn::tiled_prod( operation::run(Prod_op{.output_mem_config = output_mem_config}, {input}).at(0), output_mem_config); - auto arch_env = detect_arch(); + auto arch_env = tt_ClusterDescriptor::detect_arch((chip_id_t)0); if (arch_env == tt::ARCH::WORMHOLE_B0) { return ttnn::numpy::prod_result_computation_WH_B0( result, result.get_dtype(), result.get_layout(), result.device(), output_mem_config);