diff --git a/tests/tt_metal/tt_metal/unit_tests_common/basic/test_device_init.cpp b/tests/tt_metal/tt_metal/unit_tests_common/basic/test_device_init.cpp index 5d4be665782..ce94be41ce7 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/basic/test_device_init.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/basic/test_device_init.cpp @@ -11,26 +11,26 @@ #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/hostdevcommon/common_runtime_address_map.h" // FIXME: Should remove dependency on this -#include "tt_metal/test_utils/env_vars.hpp" #include "tt_metal/impl/dispatch/command_queue.hpp" -#include "tt_metal/test_utils/stimulus.hpp" +#include "tt_metal/test_utils/env_vars.hpp" #include "tt_metal/test_utils/print_helpers.hpp" +#include "tt_metal/test_utils/stimulus.hpp" using namespace tt; using namespace tt::test_utils; class DeviceParamFixture : public ::testing::TestWithParam { -protected: + protected: tt::ARCH arch = tt::get_arch_from_string(get_env_arch_name()); }; -namespace unit_tests_common::basic::test_device_init{ +namespace unit_tests_common::basic::test_device_init { void launch_program(tt_metal::Device *device, tt_metal::Program &program) { - if (getenv("TT_METAL_SLOW_DISPATCH_MODE")){ + if (getenv("TT_METAL_SLOW_DISPATCH_MODE")) { tt_metal::detail::LaunchProgram(device, program); - }else { - CommandQueue& cq = device->command_queue(); + } else { + CommandQueue &cq = device->command_queue(); EnqueueProgram(cq, program, false); Finish(cq); } @@ -39,17 +39,21 @@ void launch_program(tt_metal::Device *device, tt_metal::Program &program) { /// @brief load_blank_kernels into all cores and will launch /// @param device /// @return -bool load_all_blank_kernels(tt_metal::Device* device) { +bool load_all_blank_kernels(tt_metal::Device *device) { bool pass = true; tt_metal::Program program = tt_metal::CreateProgram(); CoreCoord compute_grid_size = device->compute_with_storage_grid_size(); CoreRange all_cores = CoreRange(CoreCoord(0, 0), CoreCoord(compute_grid_size.x - 1, compute_grid_size.y - 1)); CreateKernel( - program, "tt_metal/kernels/dataflow/blank.cpp", all_cores, + program, + "tt_metal/kernels/dataflow/blank.cpp", + all_cores, DataMovementConfig{.processor = DataMovementProcessor::RISCV_1, .noc = NOC::RISCV_1_default}); CreateKernel( - program, "tt_metal/kernels/dataflow/blank.cpp", all_cores, + program, + "tt_metal/kernels/dataflow/blank.cpp", + all_cores, DataMovementConfig{.processor = DataMovementProcessor::RISCV_0, .noc = NOC::RISCV_0_default}); CreateKernel(program, "tt_metal/kernels/compute/blank.cpp", all_cores, ComputeConfig{}); @@ -62,13 +66,13 @@ bool load_all_blank_kernels(tt_metal::Device* device) { INSTANTIATE_TEST_SUITE_P(DeviceInit, DeviceParamFixture, ::testing::Values(1, tt::tt_metal::GetNumAvailableDevices())); -TEST_P(DeviceParamFixture, DISABLED_DeviceInitializeAndTeardown) { // see issue #6659 +TEST_P(DeviceParamFixture, DeviceInitializeAndTeardown) { unsigned int num_devices = GetParam(); if (arch == tt::ARCH::GRAYSKULL && num_devices > 1) { GTEST_SKIP(); } ASSERT_TRUE(num_devices > 0); - std::vector devices (num_devices); + std::vector devices(num_devices); for (unsigned int id = 0; id < num_devices; id++) { devices.at(id) = tt::tt_metal::CreateDevice(id); } @@ -77,23 +81,23 @@ TEST_P(DeviceParamFixture, DISABLED_DeviceInitializeAndTeardown) { // see issue } } -TEST_P(DeviceParamFixture, DeviceLoadBlankKernels){ +TEST_P(DeviceParamFixture, DeviceLoadBlankKernels) { unsigned int num_devices = GetParam(); unsigned int num_pci_devices = tt::tt_metal::GetNumPCIeDevices(); if ((arch == tt::ARCH::GRAYSKULL && num_devices > 1) || (num_devices > num_pci_devices)) { GTEST_SKIP(); } ASSERT_TRUE(num_devices > 0); - std::vector devices (num_devices); + std::vector devices(num_devices); for (unsigned int id = 0; id < num_devices; id++) { devices.at(id) = (tt::tt_metal::CreateDevice(id)); } tt::Cluster::instance().set_internal_routing_info_for_ethernet_cores(true); - for (auto device: devices) { + for (auto device : devices) { ASSERT_TRUE(unit_tests_common::basic::test_device_init::load_all_blank_kernels(device)); } tt::Cluster::instance().set_internal_routing_info_for_ethernet_cores(false); - for (auto device: devices) { + for (auto device : devices) { ASSERT_TRUE(tt::tt_metal::CloseDevice(device)); } }