From 6e23edda1d6b279255a8a32bcbc5cdd2cab9fadb Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Fri, 25 Oct 2024 21:42:08 +0000 Subject: [PATCH 01/26] #0: Changing test names --- .../test_create_kernel_from_string.cpp | 6 +- .../tt_metal/test_kernel_path_env_var.cpp | 8 +-- .../tt_metal/unit_tests/basic/device.cpp | 10 +-- .../basic/initialize_semaphores.cpp | 6 +- .../unit_tests/basic/runtime_args.cpp | 14 ++-- .../tt_metal/unit_tests/basic/test_noc.cpp | 6 +- .../unit_tests/basic/test_soc_descriptor.cpp | 4 +- .../unit_tests/buffer/test_banked.cpp | 40 +++++------ .../buffer/test_simple_l1_buffer.cpp | 12 ++-- .../test_CircularBuffer_allocation.cpp | 16 ++--- .../test_CircularBuffer_creation.cpp | 4 +- .../unit_tests/compute/test_broadcast.cpp | 2 +- .../test_copy_block_matmul_partials.cpp | 6 +- .../unit_tests/compute/test_cumsum.cpp | 4 +- .../compute/test_dropout_sfpu_compute.cpp | 2 +- .../unit_tests/compute/test_reconfig.cpp | 4 +- .../unit_tests/compute/test_reduce.cpp | 18 ++--- .../unit_tests/compute/test_sfpu_compute.cpp | 12 ++-- .../test_single_core_binary_compute.cpp | 30 ++++----- .../basic/test_device_init.cpp | 2 +- .../basic/test_kernel_creation.cpp | 6 +- .../common/test_dispatch.cpp | 12 ++-- .../compute/matmul/test_matmul_X_tile.cpp | 10 +-- .../matmul/test_matmul_large_block.cpp | 2 +- .../matmul/test_matmul_multi_core_X_dram.cpp | 4 +- ...ti_core_multi_dram_in0_mcast_in1_mcast.cpp | 2 +- ...matmul_multi_core_multi_dram_inX_mcast.cpp | 4 +- .../matmul/test_matmul_single_core.cpp | 4 +- .../compute/test_flatten.cpp | 2 +- .../dprint/test_eth_cores.cpp | 4 +- .../dprint/test_invalid_print_core.cpp | 2 +- .../dprint/test_mute_device.cpp | 2 +- .../dprint/test_mute_print_server.cpp | 2 +- .../dprint/test_print_all_harts.cpp | 2 +- .../dprint/test_print_before_finish.cpp | 2 +- .../dprint/test_print_hanging.cpp | 2 +- .../dprint/test_print_tensix_dest.cpp | 6 +- .../dprint/test_raise_wait.cpp | 2 +- .../unit_tests_common/dram/test_dram.cpp | 4 +- .../dram/test_dram_to_l1_multicast.cpp | 4 +- .../unit_tests_common/watcher/test_assert.cpp | 14 ++-- .../watcher/test_link_training.cpp | 2 +- .../watcher/test_noc_sanitize.cpp | 12 ++-- .../watcher/test_noc_sanitize_delays.cpp | 2 +- .../unit_tests_common/watcher/test_pause.cpp | 2 +- .../watcher/test_ringbuf.cpp | 14 ++-- .../command_queue/test_EnqueueProgram.cpp | 66 +++++++++---------- .../command_queue/test_EnqueueTrace.cpp | 10 +-- .../command_queue/test_HostAsyncCQ.cpp | 8 +-- .../compute/sfpu/sfpu_compute.cpp | 6 +- .../multichip/test_eth_EnqueueProgram.cpp | 12 ++-- .../test_eth_ring_gather_EnqueueProgram.cpp | 4 +- .../pipelining/basic_pipeline.cpp | 2 +- .../streams/test_autonomous_relay_streams.cpp | 12 ++-- .../command_queue/test_EnqueueProgram.cpp | 2 +- .../command_queue/test_EnqueueTrace.cpp | 6 +- .../tests/run_many_times.cpp | 2 +- 57 files changed, 230 insertions(+), 230 deletions(-) diff --git a/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp b/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp index fcf79a112f0..5ddcd8f773d 100644 --- a/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp +++ b/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp @@ -37,7 +37,7 @@ class ProgramWithKernelCreatedFromStringFixture : public CommonFixture { std::map device_ids_to_devices_; }; -TEST_F(ProgramWithKernelCreatedFromStringFixture, DataMovementKernel) { +TEST_F(ProgramWithKernelCreatedFromStringFixture, TensixDataMovementKernel) { const CoreRange cores({0, 0}, {1, 1}); const string &kernel_src_code = R"( #include "debug/dprint.h" @@ -62,7 +62,7 @@ TEST_F(ProgramWithKernelCreatedFromStringFixture, DataMovementKernel) { }; } -TEST_F(ProgramWithKernelCreatedFromStringFixture, ComputeKernel) { +TEST_F(ProgramWithKernelCreatedFromStringFixture, TensixComputeKernel) { const CoreRange cores({0, 0}, {1, 1}); const string &kernel_src_code = R"( #include "debug/dprint.h" @@ -94,7 +94,7 @@ TEST_F(ProgramWithKernelCreatedFromStringFixture, ComputeKernel) { }; } -TEST_F(ProgramWithKernelCreatedFromStringFixture, EthernetKernel) { +TEST_F(ProgramWithKernelCreatedFromStringFixture, ActiveEthEthernetKernel) { const string &kernel_src_code = R"( #include "debug/dprint.h" #include "dataflow_api.h" diff --git a/tests/tt_metal/tt_metal/test_kernel_path_env_var.cpp b/tests/tt_metal/tt_metal/test_kernel_path_env_var.cpp index aceb624577e..68a84d904c0 100644 --- a/tests/tt_metal/tt_metal/test_kernel_path_env_var.cpp +++ b/tests/tt_metal/tt_metal/test_kernel_path_env_var.cpp @@ -104,13 +104,13 @@ class CompileProgramWithKernelPathEnvVarFixture : public ::testing::Test { } }; -TEST_F(CompileProgramWithKernelPathEnvVarFixture, KernelUnderMetalRootDir) { +TEST_F(CompileProgramWithKernelPathEnvVarFixture, TensixKernelUnderMetalRootDir) { const string &kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/reader_unary_push_4.cpp"; create_kernel(kernel_file); detail::CompileProgram(this->device_, this->program_); } -TEST_F(CompileProgramWithKernelPathEnvVarFixture, KernelUnderKernelRootDir) { +TEST_F(CompileProgramWithKernelPathEnvVarFixture, TensixKernelUnderKernelRootDir) { const string &orig_kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/reader_unary_push_4.cpp"; const string &new_kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/new_kernel.cpp"; this->setup_kernel_dir(orig_kernel_file, new_kernel_file); @@ -119,7 +119,7 @@ TEST_F(CompileProgramWithKernelPathEnvVarFixture, KernelUnderKernelRootDir) { this->cleanup_kernel_dir(); } -TEST_F(CompileProgramWithKernelPathEnvVarFixture, KernelUnderMetalRootDirAndKernelRootDir) { +TEST_F(CompileProgramWithKernelPathEnvVarFixture, TensixKernelUnderMetalRootDirAndKernelRootDir) { const string &kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/reader_unary_push_4.cpp"; this->setup_kernel_dir(kernel_file, kernel_file); this->create_kernel(kernel_file); @@ -127,7 +127,7 @@ TEST_F(CompileProgramWithKernelPathEnvVarFixture, KernelUnderMetalRootDirAndKern this->cleanup_kernel_dir(); } -TEST_F(CompileProgramWithKernelPathEnvVarFixture, NonExistentKernel) { +TEST_F(CompileProgramWithKernelPathEnvVarFixture, TensixNonExistentKernel) { const string &kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/non_existent_kernel.cpp"; this->create_kernel(kernel_file); EXPECT_THROW(detail::CompileProgram(this->device_, this->program_), std::exception); diff --git a/tests/tt_metal/tt_metal/unit_tests/basic/device.cpp b/tests/tt_metal/tt_metal/unit_tests/basic/device.cpp index 4dc272cfb24..b42547eb32b 100644 --- a/tests/tt_metal/tt_metal/unit_tests/basic/device.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/basic/device.cpp @@ -81,7 +81,7 @@ bool dram_ping( } } // namespace unit_tests::basic::device -TEST_F(BasicFixture, SingleDeviceHarvestingPrints) { +TEST_F(BasicFixture, TensixSingleDeviceHarvestingPrints) { auto arch = tt::get_arch_from_string(get_umd_arch_name()); tt::tt_metal::Device* device; const unsigned int device_id = 0; @@ -163,7 +163,7 @@ TEST_F(DeviceFixture, PingIllegalDramChannels) { } } -TEST_F(DeviceFixture, PingAllLegalL1Cores) { +TEST_F(DeviceFixture, TensixPingAllLegalL1Cores) { for (unsigned int id = 0; id < num_devices_; id++) { { size_t start_byte_address = devices_.at(id)->get_base_allocator_addr(HalMemType::L1); @@ -198,7 +198,7 @@ TEST_F(DeviceFixture, PingAllLegalL1Cores) { } } -TEST_F(DeviceFixture, PingIllegalL1Cores) { +TEST_F(DeviceFixture, TensixPingIllegalL1Cores) { for (unsigned int id = 0; id < num_devices_; id++) { auto grid_size = devices_.at(id)->logical_grid_size(); grid_size.x++; @@ -215,7 +215,7 @@ TEST_F(DeviceFixture, PingIllegalL1Cores) { // 2. Launch a kernel to read and increment the value in each bank // 3. Host validates that the value from step 1 has been incremented // Purpose of this test is to ensure that L1 reader/writer APIs do not target harvested cores -TEST_F(DeviceFixture, ValidateKernelDoesNotTargetHarvestedCores) { +TEST_F(DeviceFixture, TensixValidateKernelDoesNotTargetHarvestedCores) { for (unsigned int id = 0; id < num_devices_; id++) { uint32_t num_l1_banks = this->devices_.at(id)->num_banks(BufferType::L1); std::vector host_input(1); @@ -280,7 +280,7 @@ TEST_F(DeviceFixture, TestDeviceToHostMemChannelAssignment) { } // Test to ensure writing from 16B aligned L1 address to 16B aligned PCIe address works -TEST_F(DeviceFixture, TestL1ToPCIeAt16BAlignedAddress) { +TEST_F(DeviceFixture, TensixTestL1ToPCIeAt16BAlignedAddress) { tt_metal::Program program = tt_metal::CreateProgram(); Device *device = this->devices_.at(0); EXPECT_TRUE(device->is_mmio_capable()); diff --git a/tests/tt_metal/tt_metal/unit_tests/basic/initialize_semaphores.cpp b/tests/tt_metal/tt_metal/unit_tests/basic/initialize_semaphores.cpp index 9be219332a0..5ddaea5c543 100644 --- a/tests/tt_metal/tt_metal/unit_tests/basic/initialize_semaphores.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/basic/initialize_semaphores.cpp @@ -102,7 +102,7 @@ void try_creating_more_than_max_num_semaphores( } // namespace unit_tests::initialize_semaphores -TEST_F(DeviceFixture, InitializeLegalSemaphores) { +TEST_F(DeviceFixture, TensixInitializeLegalSemaphores) { for (unsigned int id = 0; id < num_devices_; id++) { tt_metal::Program program = tt_metal::CreateProgram(); CoreRange core_range({0, 0}, {1, 1}); @@ -111,7 +111,7 @@ TEST_F(DeviceFixture, InitializeLegalSemaphores) { } } -TEST_F(DeviceFixture, InitializeIllegalSemaphores) { +TEST_F(DeviceFixture, TensixInitializeIllegalSemaphores) { for (unsigned int id = 0; id < num_devices_; id++) { tt_metal::Program program = tt_metal::CreateProgram(); CoreRange core_range({0, 0}, {1, 1}); @@ -121,7 +121,7 @@ TEST_F(DeviceFixture, InitializeIllegalSemaphores) { } } -TEST_F(DeviceFixture, CreateMultipleSemaphoresOnSameCore) { +TEST_F(DeviceFixture, TensixCreateMultipleSemaphoresOnSameCore) { tt_metal::Program program = tt_metal::CreateProgram(); CoreCoord core0(0,0); diff --git a/tests/tt_metal/tt_metal/unit_tests/basic/runtime_args.cpp b/tests/tt_metal/tt_metal/unit_tests/basic/runtime_args.cpp index 520d04986d2..1d524f4c502 100644 --- a/tests/tt_metal/tt_metal/unit_tests/basic/runtime_args.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/basic/runtime_args.cpp @@ -168,7 +168,7 @@ bool verify_results( } // Write unique and common runtime args to device and readback to verify written correctly. -TEST_F(DeviceFixture, LegallyModifyRTArgsDataMovement) { +TEST_F(DeviceFixture, TensixLegallyModifyRTArgsDataMovement) { for (unsigned int id = 0; id < num_devices_; id++) { // First run the program with the initial runtime args CoreRange first_core_range(CoreCoord(0, 0), CoreCoord(1, 1)); @@ -214,7 +214,7 @@ TEST_F(DeviceFixture, LegallyModifyRTArgsDataMovement) { } } -TEST_F(DeviceFixture, LegallyModifyRTArgsCompute) { +TEST_F(DeviceFixture, TensixLegallyModifyRTArgsCompute) { for (unsigned int id = 0; id < num_devices_; id++) { // First run the program with the initial runtime args CoreRange first_core_range(CoreCoord(0, 0), CoreCoord(1, 1)); @@ -244,7 +244,7 @@ TEST_F(DeviceFixture, LegallyModifyRTArgsCompute) { } // Don't cover all cores of kernel with SetRuntimeArgs. Verify that correct offset used to access common runtime args. -TEST_F(DeviceFixture, SetRuntimeArgsSubsetOfCoresCompute) { +TEST_F(DeviceFixture, TensixSetRuntimeArgsSubsetOfCoresCompute) { for (unsigned int id = 0; id < num_devices_; id++) { // First run the program with the initial runtime args CoreRange first_core_range(CoreCoord(0, 0), CoreCoord(1, 1)); @@ -272,7 +272,7 @@ TEST_F(DeviceFixture, SetRuntimeArgsSubsetOfCoresCompute) { } // Different unique runtime args per core. Not overly special, but verify that it works. -TEST_F(DeviceFixture, SetRuntimeArgsUniqueValuesCompute) { +TEST_F(DeviceFixture, TensixSetRuntimeArgsUniqueValuesCompute) { for (unsigned int id = 0; id < num_devices_; id++) { // First run the program with the initial runtime args CoreRange first_core_range(CoreCoord(0, 0), CoreCoord(1, 1)); @@ -305,7 +305,7 @@ TEST_F(DeviceFixture, SetRuntimeArgsUniqueValuesCompute) { // Some cores have more unique runtime args than others. Unused in kernel, but API supports it, so verify it works and that // common runtime args are appropriately offset by amount from core(s) with most unique runtime args. -TEST_F(DeviceFixture, SetRuntimeArgsVaryingLengthPerCore) { +TEST_F(DeviceFixture, TensixSetRuntimeArgsVaryingLengthPerCore) { for (unsigned int id = 0; id < num_devices_; id++) { // First run the program with the initial runtime args @@ -356,7 +356,7 @@ TEST_F(DeviceFixture, SetRuntimeArgsVaryingLengthPerCore) { } // Too many unique and common runtime args, overflows allowed space and throws expected exception from both unique/common APIs. -TEST_F(DeviceFixture, IllegalTooManyRuntimeArgs) { +TEST_F(DeviceFixture, TensixIllegalTooManyRuntimeArgs) { for (unsigned int id = 0; id < num_devices_; id++) { CoreRange first_core_range(CoreCoord(1, 1), CoreCoord(2, 2)); CoreRangeSet core_range_set(first_core_range); @@ -376,7 +376,7 @@ TEST_F(DeviceFixture, IllegalTooManyRuntimeArgs) { } } -TEST_F(DeviceFixture, IllegallyModifyRTArgs) { +TEST_F(DeviceFixture, TensixIllegallyModifyRTArgs) { for (unsigned int id = 0; id < num_devices_; id++) { // First run the program with the initial runtime args CoreRange first_core_range(CoreCoord(0, 0), CoreCoord(1, 1)); diff --git a/tests/tt_metal/tt_metal/unit_tests/basic/test_noc.cpp b/tests/tt_metal/tt_metal/unit_tests/basic/test_noc.cpp index 278e5289e28..18a243f6f4a 100644 --- a/tests/tt_metal/tt_metal/unit_tests/basic/test_noc.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/basic/test_noc.cpp @@ -72,7 +72,7 @@ void read_translation_table (Device* device, CoreCoord logical_node, std::vector -TEST_F(BasicFixture, VerifyNocNodeIDs) { +TEST_F(BasicFixture, TensixVerifyNocNodeIDs) { auto arch = tt::get_arch_from_string(get_umd_arch_name()); tt::tt_metal::Device* device; const unsigned int device_id = 0; @@ -95,7 +95,7 @@ TEST_F(BasicFixture, VerifyNocNodeIDs) { } ASSERT_TRUE(tt::tt_metal::CloseDevice(device)); } -TEST_F(BasicFixture, VerifyNocIdentityTranslationTable) { +TEST_F(BasicFixture, TensixVerifyNocIdentityTranslationTable) { auto arch = tt::get_arch_from_string(get_umd_arch_name()); if (arch == tt::ARCH::BLACKHOLE) { GTEST_SKIP(); @@ -133,7 +133,7 @@ TEST_F(BasicFixture, VerifyNocIdentityTranslationTable) { // Tests that kernel can write to and read from a stream register address // This is meant to exercise noc_inline_dw_write API -TEST_F(DeviceFixture, DirectedStreamRegWriteRead) { +TEST_F(DeviceFixture, TensixDirectedStreamRegWriteRead) { CoreCoord start_core{0, 0}; const uint32_t stream_id = 0; const uint32_t stream_reg = 4; diff --git a/tests/tt_metal/tt_metal/unit_tests/basic/test_soc_descriptor.cpp b/tests/tt_metal/tt_metal/unit_tests/basic/test_soc_descriptor.cpp index 1fb0e630fd9..a9806ec5bda 100644 --- a/tests/tt_metal/tt_metal/unit_tests/basic/test_soc_descriptor.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/basic/test_soc_descriptor.cpp @@ -43,7 +43,7 @@ namespace unit_tests::basic::soc_desc { // This test ensures that no logical core maps to a harvested row -TEST_F(BasicFixture, ValidateLogicalToPhysicalCoreCoordHostMapping) { +TEST_F(BasicFixture, TensixValidateLogicalToPhysicalCoreCoordHostMapping) { size_t num_devices = tt_metal::GetNumAvailableDevices(); ASSERT_TRUE(num_devices > 0); tt::ARCH arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); @@ -67,7 +67,7 @@ TEST_F(BasicFixture, ValidateLogicalToPhysicalCoreCoordHostMapping) { } } -TEST_F(DeviceFixture, ValidateMetalSocDescriptors) { +TEST_F(DeviceFixture, TensixValidateMetalSocDescriptors) { for (chip_id_t device_id = 0; device_id < this->num_devices_; device_id++) { const metal_SocDescriptor &soc_desc = tt::Cluster::instance().get_soc_desc(device_id); diff --git a/tests/tt_metal/tt_metal/unit_tests/buffer/test_banked.cpp b/tests/tt_metal/tt_metal/unit_tests/buffer/test_banked.cpp index 9f1d68e7440..0479cf75db4 100644 --- a/tests/tt_metal/tt_metal/unit_tests/buffer/test_banked.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/buffer/test_banked.cpp @@ -264,14 +264,14 @@ detail::LaunchProgram(device, program); } // end namespace local_test_functions -TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedL1ReaderOnly) { +TEST_F(DeviceFixture, TensixTestSingleCoreSingleTileBankedL1ReaderOnly) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; EXPECT_TRUE(local_test_functions::reader_cb_writer(this->devices_.at(id), test_config, true, false)); } } -TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedL1ReaderOnly) { +TEST_F(DeviceFixture, TensixTestSingleCoreMultiTileBankedL1ReaderOnly) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; TT_FATAL(this->devices_.at(id)->num_banks(BufferType::L1) % 2 == 0, "Error"); @@ -289,7 +289,7 @@ TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedL1ReaderOnly) { } } -TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedDramReaderOnly) { +TEST_F(DeviceFixture, TensixTestSingleCoreSingleTileBankedDramReaderOnly) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; test_config.input_buffer_type = BufferType::DRAM; @@ -298,7 +298,7 @@ TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedDramReaderOnly) { } } -TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedDramReaderOnly) { +TEST_F(DeviceFixture, TensixTestSingleCoreMultiTileBankedDramReaderOnly) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; TT_FATAL(this->devices_.at(id)->num_banks(BufferType::DRAM) % 2 == 0, "Error"); @@ -318,14 +318,14 @@ TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedDramReaderOnly) { } } -TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedL1WriterOnly) { +TEST_F(DeviceFixture, TensixTestSingleCoreSingleTileBankedL1WriterOnly) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; EXPECT_TRUE(local_test_functions::reader_cb_writer(this->devices_.at(id), test_config, false, true)); } } -TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedL1WriterOnly) { +TEST_F(DeviceFixture, TensixTestSingleCoreMultiTileBankedL1WriterOnly) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; TT_FATAL(this->devices_.at(id)->num_banks(BufferType::L1) % 2 == 0, "Error"); @@ -343,7 +343,7 @@ TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedL1WriterOnly) { } } -TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedDramWriterOnly) { +TEST_F(DeviceFixture, TensixTestSingleCoreSingleTileBankedDramWriterOnly) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; test_config.input_buffer_type = BufferType::DRAM; @@ -352,7 +352,7 @@ TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedDramWriterOnly) { } } -TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedDramWriterOnly) { +TEST_F(DeviceFixture, TensixTestSingleCoreMultiTileBankedDramWriterOnly) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; TT_FATAL(this->devices_.at(id)->num_banks(BufferType::DRAM) % 2 == 0, "Error"); @@ -372,14 +372,14 @@ TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedDramWriterOnly) { } } -TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedL1ReaderAndWriter) { +TEST_F(DeviceFixture, TensixTestSingleCoreSingleTileBankedL1ReaderAndWriter) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; EXPECT_TRUE(local_test_functions::reader_cb_writer(this->devices_.at(id), test_config, true, true)); } } -TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedL1ReaderAndWriter) { +TEST_F(DeviceFixture, TensixTestSingleCoreMultiTileBankedL1ReaderAndWriter) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; size_t num_tiles = this->devices_.at(id)->num_banks(BufferType::L1); @@ -397,7 +397,7 @@ TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedL1ReaderAndWriter) { } } -TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedDramReaderAndWriter) { +TEST_F(DeviceFixture, TensixTestSingleCoreSingleTileBankedDramReaderAndWriter) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; test_config.input_buffer_type = BufferType::DRAM; @@ -406,7 +406,7 @@ TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedDramReaderAndWriter) { } } -TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedDramReaderAndWriter) { +TEST_F(DeviceFixture, TensixTestSingleCoreMultiTileBankedDramReaderAndWriter) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; size_t num_tiles = this->devices_.at(id)->num_banks(BufferType::L1); @@ -426,7 +426,7 @@ TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedDramReaderAndWriter) { } } -TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedDramReaderAndL1Writer) { +TEST_F(DeviceFixture, TensixTestSingleCoreSingleTileBankedDramReaderAndL1Writer) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; test_config.input_buffer_type = BufferType::DRAM; @@ -434,7 +434,7 @@ TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedDramReaderAndL1Writer) { } } -TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedDramReaderAndL1Writer) { +TEST_F(DeviceFixture, TensixTestSingleCoreMultiTileBankedDramReaderAndL1Writer) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; test_config.input_buffer_type = BufferType::DRAM; @@ -454,7 +454,7 @@ TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedDramReaderAndL1Writer) { } } -TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedL1ReaderAndDramWriter) { +TEST_F(DeviceFixture, TensixTestSingleCoreSingleTileBankedL1ReaderAndDramWriter) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; test_config.output_buffer_type = BufferType::DRAM; @@ -462,7 +462,7 @@ TEST_F(DeviceFixture, TestSingleCoreSingleTileBankedL1ReaderAndDramWriter) { } } -TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedL1ReaderAndDramWriter) { +TEST_F(DeviceFixture, TensixTestSingleCoreMultiTileBankedL1ReaderAndDramWriter) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; test_config.output_buffer_type = BufferType::DRAM; @@ -482,7 +482,7 @@ TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedL1ReaderAndDramWriter) { } } -TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedL1ReaderDataCopyL1Writer) { +TEST_F(DeviceFixture, TensixTestSingleCoreMultiTileBankedL1ReaderDataCopyL1Writer) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; size_t num_tiles = this->devices_.at(id)->num_banks(BufferType::L1); @@ -501,7 +501,7 @@ TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedL1ReaderDataCopyL1Writer) { } } -TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedDramReaderDataCopyDramWriter) { +TEST_F(DeviceFixture, TensixTestSingleCoreMultiTileBankedDramReaderDataCopyDramWriter) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; size_t num_tiles = this->devices_.at(id)->num_banks(BufferType::DRAM); @@ -521,7 +521,7 @@ TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedDramReaderDataCopyDramWriter) } } -TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedL1ReaderDataCopyDramWriter) { +TEST_F(DeviceFixture, TensixTestSingleCoreMultiTileBankedL1ReaderDataCopyDramWriter) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; size_t num_tiles = this->devices_.at(id)->num_banks(BufferType::L1); @@ -542,7 +542,7 @@ TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedL1ReaderDataCopyDramWriter) { } } -TEST_F(DeviceFixture, TestSingleCoreMultiTileBankedDramReaderDataCopyL1Writer) { +TEST_F(DeviceFixture, TensixTestSingleCoreMultiTileBankedDramReaderDataCopyL1Writer) { for (unsigned int id = 0; id < num_devices_; id++) { BankedConfig test_config; size_t num_tiles = this->devices_.at(id)->num_banks(BufferType::L1); diff --git a/tests/tt_metal/tt_metal/unit_tests/buffer/test_simple_l1_buffer.cpp b/tests/tt_metal/tt_metal/unit_tests/buffer/test_simple_l1_buffer.cpp index 80146a83635..2ad3095e2e1 100644 --- a/tests/tt_metal/tt_metal/unit_tests/buffer/test_simple_l1_buffer.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/buffer/test_simple_l1_buffer.cpp @@ -160,7 +160,7 @@ TEST_F(DeviceFixture, TestSimpleL1BufferWriteOnlyHi) { } } -TEST_F(DeviceFixture, TestSimpleL1ReadWriteTileLo) { +TEST_F(DeviceFixture, TensixTestSimpleL1ReadWriteTileLo) { for (unsigned int id = 0; id < num_devices_; id++) { size_t lo_address = 768 * 1024; ASSERT_TRUE(SimpleTiledL1WriteCBRead( @@ -172,7 +172,7 @@ TEST_F(DeviceFixture, TestSimpleL1ReadWriteTileLo) { } } -TEST_F(DeviceFixture, TestSimpleL1ReadWriteTileHi) { +TEST_F(DeviceFixture, TensixTestSimpleL1ReadWriteTileHi) { for (unsigned int id = 0; id < num_devices_; id++) { size_t hi_address = this->devices_.at(id)->l1_size_per_core() - (24 * 1024); ASSERT_TRUE(SimpleTiledL1WriteCBRead( @@ -184,7 +184,7 @@ TEST_F(DeviceFixture, TestSimpleL1ReadWriteTileHi) { } } -TEST_F(DeviceFixture, TestSimpleL1ReadWritex2y2TileLo) { +TEST_F(DeviceFixture, TensixTestSimpleL1ReadWritex2y2TileLo) { for (unsigned int id = 0; id < num_devices_; id++) { size_t lo_address = 768 * 1024; ASSERT_TRUE(SimpleTiledL1WriteCBRead( @@ -196,7 +196,7 @@ TEST_F(DeviceFixture, TestSimpleL1ReadWritex2y2TileLo) { } } -TEST_F(DeviceFixture, TestSimpleL1ReadWritex2y2TileHi) { +TEST_F(DeviceFixture, TensixTestSimpleL1ReadWritex2y2TileHi) { for (unsigned int id = 0; id < num_devices_; id++) { size_t hi_address = this->devices_.at(id)->l1_size_per_core() - (24 * 1024); ASSERT_TRUE(SimpleTiledL1WriteCBRead( @@ -208,7 +208,7 @@ TEST_F(DeviceFixture, TestSimpleL1ReadWritex2y2TileHi) { } } -TEST_F(DeviceFixture, TestBufferL1ReadWriteTileLo) { +TEST_F(DeviceFixture, TensixTestBufferL1ReadWriteTileLo) { for (unsigned int id = 0; id < num_devices_; id++) { size_t lo_address = 768 * 1024; ASSERT_TRUE(SimpleTiledL1WriteCBRead( @@ -220,7 +220,7 @@ TEST_F(DeviceFixture, TestBufferL1ReadWriteTileLo) { } } -TEST_F(DeviceFixture, TestBufferL1ReadWriteTileHi) { +TEST_F(DeviceFixture, TensixTestBufferL1ReadWriteTileHi) { for (unsigned int id = 0; id < num_devices_; id++) { size_t hi_address = this->devices_.at(id)->l1_size_per_core() - (24 * 1024); ASSERT_TRUE(SimpleTiledL1WriteCBRead( diff --git a/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_allocation.cpp b/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_allocation.cpp index 1df5ec9cdfd..7ca851abb2a 100644 --- a/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_allocation.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_allocation.cpp @@ -66,7 +66,7 @@ TEST_F(DeviceFixture, TestCircularBuffersSequentiallyPlaced) { } } -TEST_F(DeviceFixture, TestCircularBufferSequentialAcrossAllCores) { +TEST_F(DeviceFixture, TensixTestCircularBufferSequentialAcrossAllCores) { for (unsigned int id = 0; id < num_devices_; id++) { Program program; CBConfig cb_config; @@ -108,7 +108,7 @@ TEST_F(DeviceFixture, TestCircularBufferSequentialAcrossAllCores) { } } -TEST_F(DeviceFixture, TestValidCircularBufferAddress) { +TEST_F(DeviceFixture, TensixTestValidCircularBufferAddress) { for (unsigned int id = 0; id < num_devices_; id++) { Program program; CBConfig cb_config; @@ -149,7 +149,7 @@ TEST_F(DeviceFixture, TestValidCircularBufferAddress) { } } -TEST_F(DeviceFixture, TestCircularBuffersAndL1BuffersCollision) { +TEST_F(DeviceFixture, TensixTestCircularBuffersAndL1BuffersCollision) { for (unsigned int id = 0; id < num_devices_; id++) { Program program; uint32_t page_size = TileSize(tt::DataFormat::Float16_b); @@ -181,7 +181,7 @@ TEST_F(DeviceFixture, TestCircularBuffersAndL1BuffersCollision) { } } -TEST_F(DeviceFixture, TestValidUpdateCircularBufferSize) { +TEST_F(DeviceFixture, TensixTestValidUpdateCircularBufferSize) { for (unsigned int id = 0; id < num_devices_; id++) { Program program; CBConfig cb_config; @@ -215,7 +215,7 @@ TEST_F(DeviceFixture, TestValidUpdateCircularBufferSize) { } } -TEST_F(DeviceFixture, TestInvalidUpdateCircularBufferSize) { +TEST_F(DeviceFixture, TensixTestInvalidUpdateCircularBufferSize) { for (unsigned int id = 0; id < num_devices_; id++) { Program program; CBConfig cb_config; @@ -245,7 +245,7 @@ TEST_F(DeviceFixture, TestInvalidUpdateCircularBufferSize) { } } -TEST_F(DeviceFixture, TestUpdateCircularBufferAddress) { +TEST_F(DeviceFixture, TensixTestUpdateCircularBufferAddress) { for (unsigned int id = 0; id < num_devices_; id++) { Program program; CBConfig cb_config; @@ -284,7 +284,7 @@ TEST_F(DeviceFixture, TestUpdateCircularBufferAddress) { } } -TEST_F(DeviceFixture, TestUpdateCircularBufferPageSize) { +TEST_F(DeviceFixture, TensixTestUpdateCircularBufferPageSize) { for (unsigned int id = 0; id < num_devices_; id++) { Device *device = this->devices_.at(id); Program program; @@ -360,7 +360,7 @@ TEST_F(DeviceFixture, TestUpdateCircularBufferPageSize) { } } -TEST_F(DeviceFixture, TestDataCopyWithUpdatedCircularBufferConfig) { +TEST_F(DeviceFixture, TensixTestDataCopyWithUpdatedCircularBufferConfig) { for (unsigned int id = 0; id < num_devices_; id++) { Program program; CoreCoord core(0, 0); diff --git a/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_creation.cpp b/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_creation.cpp index e60cb20da03..5292d45b020 100644 --- a/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_creation.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_creation.cpp @@ -46,7 +46,7 @@ bool test_cb_config_written_to_core(Program &program, Device *device, const Core return pass; } -TEST_F(DeviceFixture, TestCreateCircularBufferAtValidIndices) { +TEST_F(DeviceFixture, TensixTestCreateCircularBufferAtValidIndices) { CBConfig cb_config; CoreRange cr({0, 0}, {0, 1}); @@ -95,7 +95,7 @@ TEST_F(DeviceFixture, TestCreateCircularBufferWithMismatchingConfig) { EXPECT_ANY_THROW(CircularBufferConfig(cb_config.page_size, {{0, cb_config.data_format}}).set_page_size(1, cb_config.page_size)); } -TEST_F(DeviceFixture, TestCreateCircularBufferAtOverlappingIndex) { +TEST_F(DeviceFixture, TensixTestCreateCircularBufferAtOverlappingIndex) { Program program; CBConfig cb_config; diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_broadcast.cpp b/tests/tt_metal/tt_metal/unit_tests/compute/test_broadcast.cpp index 43963dc422e..c26fcf4c981 100644 --- a/tests/tt_metal/tt_metal/unit_tests/compute/test_broadcast.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/compute/test_broadcast.cpp @@ -293,7 +293,7 @@ class BroadcastParametrizedDeviceFixture : public DeviceFixture, public testing::WithParamInterface { }; -TEST_P(BroadcastParametrizedDeviceFixture, ComputeSingleTileBroadcast) { +TEST_P(BroadcastParametrizedDeviceFixture, TensixComputeSingleTileBroadcast) { unit_tests::compute::broadcast::BroadcastConfig test_config = GetParam(); for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_copy_block_matmul_partials.cpp b/tests/tt_metal/tt_metal/unit_tests/compute/test_copy_block_matmul_partials.cpp index 54b747da19a..8fae6bd2f93 100644 --- a/tests/tt_metal/tt_metal/unit_tests/compute/test_copy_block_matmul_partials.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/compute/test_copy_block_matmul_partials.cpp @@ -170,7 +170,7 @@ void run_single_core_copy_block_matmul_partials(tt_metal::Device* device, const // - matmul_pack_tile //////////////////////////////////////////////////////////////////////////// -TEST_F(DeviceFixture, DISABLED_ComputeCopyBlockSingle) { +TEST_F(DeviceFixture, DISABLED_TensixComputeCopyBlockSingle) { for (bool fp32_dest_acc_en : {true, false}) { // FP32 dest acc not possible for GS if ((fp32_dest_acc_en == true) && (this->arch_ == tt::ARCH::GRAYSKULL)) continue; @@ -185,7 +185,7 @@ TEST_F(DeviceFixture, DISABLED_ComputeCopyBlockSingle) { } } } -TEST_F(DeviceFixture, ComputeCopyBlockMultiple) { +TEST_F(DeviceFixture, TensixComputeCopyBlockMultiple) { for (bool fp32_dest_acc_en : {true, false}) { // FP32 dest acc not possible for GS if ((fp32_dest_acc_en == true) && (this->arch_ == tt::ARCH::GRAYSKULL)) continue; @@ -204,7 +204,7 @@ TEST_F(DeviceFixture, ComputeCopyBlockMultiple) { } } -TEST_F(DeviceFixture, ComputeCopyBlockComputeBottleneck) { +TEST_F(DeviceFixture, TensixComputeCopyBlockComputeBottleneck) { for (bool fp32_dest_acc_en : {true, false}) { // FP32 dest acc not possible for GS if ((fp32_dest_acc_en == true) && (this->arch_ == tt::ARCH::GRAYSKULL)) continue; diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_cumsum.cpp b/tests/tt_metal/tt_metal/unit_tests/compute/test_cumsum.cpp index 66119879e6c..5bcd766d02c 100644 --- a/tests/tt_metal/tt_metal/unit_tests/compute/test_cumsum.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/compute/test_cumsum.cpp @@ -179,7 +179,7 @@ void run_single_core_cumsum(tt_metal::Device* device, const CumsumConfig& test_c } } -TEST_F(DeviceFixture, ComputeCumsumColumnwise) { +TEST_F(DeviceFixture, TensixComputeCumsumColumnwise) { auto arch = this->arch_; if (arch == tt::ARCH::GRAYSKULL) { GTEST_SKIP(); // Not implemented for GRAYSKULL @@ -201,7 +201,7 @@ TEST_F(DeviceFixture, ComputeCumsumColumnwise) { } } -TEST_F(DeviceFixture, ComputeCumsumRowwise) { +TEST_F(DeviceFixture, TensixComputeCumsumRowwise) { auto arch = this->arch_; if (arch == tt::ARCH::GRAYSKULL) { GTEST_SKIP(); // Not implemented for GRAYSKULL diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_dropout_sfpu_compute.cpp b/tests/tt_metal/tt_metal/unit_tests/compute/test_dropout_sfpu_compute.cpp index 655aeb87cfe..e0f1a53b062 100644 --- a/tests/tt_metal/tt_metal/unit_tests/compute/test_dropout_sfpu_compute.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/compute/test_dropout_sfpu_compute.cpp @@ -239,7 +239,7 @@ void test_dropout(tt_metal::Device* device, const DropoutConfig& test_config) { } -TEST_F(DeviceFixture, ComputeDropout) { +TEST_F(DeviceFixture, TensixComputeDropout) { if (this->arch_ != tt::ARCH::WORMHOLE_B0) { GTEST_SKIP(); } diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_reconfig.cpp b/tests/tt_metal/tt_metal/unit_tests/compute/test_reconfig.cpp index b55c6329938..df7f9810809 100644 --- a/tests/tt_metal/tt_metal/unit_tests/compute/test_reconfig.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/compute/test_reconfig.cpp @@ -324,7 +324,7 @@ bool single_core_reconfig(tt_metal::Device* device, const ReconfigConfig& test_c // - pack_reconfig_l1_acc //////////////////////////////////////////////////////////////////////////// -TEST_F(DeviceFixture, TileCopyReconfigExplicitSplitDstAcc) { +TEST_F(DeviceFixture, TensixTileCopyReconfigExplicitSplitDstAcc) { auto arch = this->arch_; if (arch == tt::ARCH::GRAYSKULL) { GTEST_SKIP(); @@ -363,7 +363,7 @@ TEST_F(DeviceFixture, TileCopyReconfigExplicitSplitDstAcc) { } } -TEST_F(DeviceFixture, TileCopyReconfigL1Acc) { +TEST_F(DeviceFixture, TensixTileCopyReconfigL1Acc) { auto arch = this->arch_; if (arch == tt::ARCH::GRAYSKULL) { GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_reduce.cpp b/tests/tt_metal/tt_metal/unit_tests/compute/test_reduce.cpp index 926af4510f7..6ccc3164056 100644 --- a/tests/tt_metal/tt_metal/unit_tests/compute/test_reduce.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/compute/test_reduce.cpp @@ -384,7 +384,7 @@ void run_single_core_reduce_program(tt_metal::Device* device, const ReduceConfig using namespace unit_tests::compute::reduce; -TEST_F(DeviceFixture, ComputeReduceH) { +TEST_F(DeviceFixture, TensixComputeReduceH) { if (this->arch_ != tt::ARCH::BLACKHOLE) { // (issue #10181: disabling due to sporadic failures in slow dispatch mode) GTEST_SKIP(); @@ -422,7 +422,7 @@ TEST_F(DeviceFixture, ComputeReduceH) { } } -TEST_F(DeviceFixture, ComputeReduceW) { +TEST_F(DeviceFixture, TensixComputeReduceW) { std::vector shape = {1, 3, 17*TILE_HEIGHT, 19*TILE_WIDTH}; std::vector result_shape = {shape[0], shape[1], shape[2], 32}; for (uint8_t math_fid = uint8_t(MathFidelity::LoFi); math_fid <= uint8_t(MathFidelity::HiFi4); math_fid++) { @@ -457,7 +457,7 @@ TEST_F(DeviceFixture, ComputeReduceW) { } } // Disabled due to GH issue #14510 -TEST_F(DeviceFixture, DISABLED_ComputeReduceHW) { +TEST_F(DeviceFixture, DISABLED_TensixComputeReduceHW) { std::vector shape = {1, 2, 7*TILE_HEIGHT, 5*TILE_WIDTH}; std::vector result_shape = {shape[0], shape[1], 32, 32}; for (uint8_t math_fid = uint8_t(MathFidelity::LoFi); math_fid <= uint8_t(MathFidelity::HiFi4); math_fid++) { @@ -493,7 +493,7 @@ TEST_F(DeviceFixture, DISABLED_ComputeReduceHW) { } } -TEST_F(DeviceFixture, ComputeReduceHMathOnly) { +TEST_F(DeviceFixture, TensixComputeReduceHMathOnly) { if (this->arch_ != tt::ARCH::BLACKHOLE) { // (issue #10181: disabling due to sporadic failures in slow dispatch mode) GTEST_SKIP(); @@ -532,7 +532,7 @@ TEST_F(DeviceFixture, ComputeReduceHMathOnly) { } } -TEST_F(DeviceFixture, ComputeReduceWMathOnly) { +TEST_F(DeviceFixture, TensixComputeReduceWMathOnly) { std::vector shape = {1, 3, 17*TILE_HEIGHT, 19*TILE_WIDTH}; std::vector result_shape = {shape[0], shape[1], shape[2], 32}; for (uint8_t math_fid = uint8_t(MathFidelity::LoFi); math_fid <= uint8_t(MathFidelity::HiFi4); math_fid++) { @@ -568,7 +568,7 @@ TEST_F(DeviceFixture, ComputeReduceWMathOnly) { } } // Disabled due to GH issue #14510 -TEST_F(DeviceFixture, DISABLED_ComputeReduceHWMathOnly) { +TEST_F(DeviceFixture, DISABLED_TensixComputeReduceHWMathOnly) { std::vector shape = {1, 2, 7*TILE_HEIGHT, 5*TILE_WIDTH}; std::vector result_shape = {shape[0], shape[1], 32, 32}; for (uint8_t math_fid = uint8_t(MathFidelity::LoFi); math_fid <= uint8_t(MathFidelity::HiFi4); math_fid++) { @@ -605,7 +605,7 @@ TEST_F(DeviceFixture, DISABLED_ComputeReduceHWMathOnly) { } } -TEST_F(DeviceFixture, ComputeReduceHShortInit) { +TEST_F(DeviceFixture, TensixComputeReduceHShortInit) { if (this->arch_ != tt::ARCH::BLACKHOLE) { // (issue #10181: disabling due to sporadic failures in slow dispatch mode) GTEST_SKIP(); @@ -644,7 +644,7 @@ TEST_F(DeviceFixture, ComputeReduceHShortInit) { } } -TEST_F(DeviceFixture, ComputeReduceWShortInit) { +TEST_F(DeviceFixture, TensixComputeReduceWShortInit) { std::vector shape = {1, 3, 17*TILE_HEIGHT, 19*TILE_WIDTH}; std::vector result_shape = {shape[0], shape[1], shape[2], 32}; for (uint8_t math_fid = uint8_t(MathFidelity::LoFi); math_fid <= uint8_t(MathFidelity::HiFi4); math_fid++) { @@ -680,7 +680,7 @@ TEST_F(DeviceFixture, ComputeReduceWShortInit) { } } // Disabled due to GH issue #14510 -TEST_F(DeviceFixture, DISABLED_ComputeReduceHWShortInit) { +TEST_F(DeviceFixture, DISABLED_TensixComputeReduceHWShortInit) { std::vector shape = {1, 2, 7*TILE_HEIGHT, 5*TILE_WIDTH}; std::vector result_shape = {shape[0], shape[1], 32, 32}; for (uint8_t math_fid = uint8_t(MathFidelity::LoFi); math_fid <= uint8_t(MathFidelity::HiFi4); math_fid++) { diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_sfpu_compute.cpp b/tests/tt_metal/tt_metal/unit_tests/compute/test_sfpu_compute.cpp index 35ffb316d01..a3c1a77cc29 100644 --- a/tests/tt_metal/tt_metal/unit_tests/compute/test_sfpu_compute.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/compute/test_sfpu_compute.cpp @@ -228,7 +228,7 @@ bool run_sfpu_all_same_buffer(tt_metal::Device* device, const SfpuConfig& test_c class SingleCoreSingleDeviceSfpuParameterizedFixture : public DeviceFixture, public testing::WithParamInterface> { }; -TEST_P(SingleCoreSingleDeviceSfpuParameterizedFixture, SfpuCompute) { +TEST_P(SingleCoreSingleDeviceSfpuParameterizedFixture, TensixSfpuCompute) { size_t num_tiles = std::get<0>(GetParam()); string sfpu_op = std::get<1>(GetParam()); @@ -272,7 +272,7 @@ class SingleCoreSingleDeviceSfpuParameterizedApproxFixture : public DeviceFixture, public testing::WithParamInterface> {}; -TEST_P(SingleCoreSingleDeviceSfpuParameterizedApproxFixture, SfpuCompute) { +TEST_P(SingleCoreSingleDeviceSfpuParameterizedApproxFixture, TensixSfpuCompute) { size_t num_tiles = std::get<0>(GetParam()); string sfpu_op = std::get<1>(GetParam()); @@ -318,7 +318,7 @@ INSTANTIATE_TEST_SUITE_P( std::make_tuple(4, "log"), std::make_tuple(4, "tanh"))); -TEST_F(DeviceFixture, DISABLED_MultiContinguousCoreSingleTileSfpuApproxCompute) { +TEST_F(DeviceFixture, DISABLED_TensixMultiContinguousCoreSingleTileSfpuApproxCompute) { CoreRange core_range({0, 0}, {1, 0}); CoreRangeSet core_range_set({core_range}); unit_tests::compute::sfpu::SfpuConfig test_config = { @@ -356,7 +356,7 @@ TEST_F(DeviceFixture, DISABLED_MultiContinguousCoreSingleTileSfpuApproxCompute) EXPECT_TRUE(run_sfpu_all_same_buffer(devices_.at(0), test_config)); } -TEST_F(DeviceFixture, DISABLED_MultiContinguousCoreMultiTileSfpuApproxCompute) { +TEST_F(DeviceFixture, DISABLED_TensixMultiContinguousCoreMultiTileSfpuApproxCompute) { CoreRange core_range({0, 0}, {1, 0}); CoreRangeSet core_range_set({core_range}); unit_tests::compute::sfpu::SfpuConfig test_config = { @@ -394,7 +394,7 @@ TEST_F(DeviceFixture, DISABLED_MultiContinguousCoreMultiTileSfpuApproxCompute) { test_config.sfpu_op = "tanh"; EXPECT_TRUE(run_sfpu_all_same_buffer(devices_.at(0), test_config)); } -TEST_F(DeviceFixture, DISABLED_AllCoreSingleTileSfpuApproxCompute) { +TEST_F(DeviceFixture, DISABLED_TensixAllCoreSingleTileSfpuApproxCompute) { unit_tests::compute::sfpu::SfpuConfig test_config = { .tile_byte_size = 2 * 32 * 32, .l1_input_data_format = tt::DataFormat::Float16_b, @@ -433,7 +433,7 @@ TEST_F(DeviceFixture, DISABLED_AllCoreSingleTileSfpuApproxCompute) { test_config.sfpu_op = "tanh"; EXPECT_TRUE(run_sfpu_all_same_buffer(devices_.at(0), test_config)); } -TEST_F(DeviceFixture, DISABLED_AllCoreMultiTileSfpuApproxCompute) { +TEST_F(DeviceFixture, DISABLED_TensixAllCoreMultiTileSfpuApproxCompute) { unit_tests::compute::sfpu::SfpuConfig test_config = { .tile_byte_size = 2 * 32 * 32, .l1_input_data_format = tt::DataFormat::Float16_b, diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_single_core_binary_compute.cpp b/tests/tt_metal/tt_metal/unit_tests/compute/test_single_core_binary_compute.cpp index 3be28d9843e..721daa15c22 100644 --- a/tests/tt_metal/tt_metal/unit_tests/compute/test_single_core_binary_compute.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/compute/test_single_core_binary_compute.cpp @@ -278,7 +278,7 @@ bool single_core_binary(tt_metal::Device* device, const SingleCoreBinaryConfig& } } // namespace unit_tests::compute::binary -TEST_F(DeviceFixture, BinaryComputeSingleCoreSingleTileAdd) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreSingleTileAdd) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; unit_tests::compute::binary::SingleCoreBinaryConfig test_config = { @@ -296,7 +296,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreSingleTileAdd) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreSingleTileSub) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreSingleTileSub) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; unit_tests::compute::binary::SingleCoreBinaryConfig test_config = { @@ -314,7 +314,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreSingleTileSub) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreSingleTileMul) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreSingleTileMul) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; unit_tests::compute::binary::SingleCoreBinaryConfig test_config = { @@ -332,7 +332,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreSingleTileMul) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreSingleTileAddFullInit) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreSingleTileAddFullInit) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; unit_tests::compute::binary::SingleCoreBinaryConfig test_config = { @@ -351,7 +351,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreSingleTileAddFullInit) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreSingleTileSubFullInit) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreSingleTileSubFullInit) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; unit_tests::compute::binary::SingleCoreBinaryConfig test_config = { @@ -370,7 +370,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreSingleTileSubFullInit) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreSingleTileMulFullInit) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreSingleTileMulFullInit) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; unit_tests::compute::binary::SingleCoreBinaryConfig test_config = { @@ -389,7 +389,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreSingleTileMulFullInit) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileAddWithDestReuse) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreMultiTileAddWithDestReuse) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; unit_tests::compute::binary::SingleCoreBinaryConfig test_config = { @@ -407,7 +407,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileAddWithDestReuse) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileSubWithDestReuse) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreMultiTileSubWithDestReuse) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; unit_tests::compute::binary::SingleCoreBinaryConfig test_config = { @@ -425,7 +425,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileSubWithDestReuse) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileMulWithDestReuse) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreMultiTileMulWithDestReuse) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; unit_tests::compute::binary::SingleCoreBinaryConfig test_config = { @@ -443,7 +443,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileMulWithDestReuse) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileAdd) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreMultiTileAdd) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; unit_tests::compute::binary::SingleCoreBinaryConfig test_config = { @@ -461,7 +461,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileAdd) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileSub) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreMultiTileSub) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; unit_tests::compute::binary::SingleCoreBinaryConfig test_config = { @@ -479,7 +479,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileSub) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileMul) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreMultiTileMul) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; unit_tests::compute::binary::SingleCoreBinaryConfig test_config = { @@ -497,7 +497,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileMul) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileAddDestAcc) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreMultiTileAddDestAcc) { auto arch = this->arch_; if (arch == tt::ARCH::GRAYSKULL) { GTEST_SKIP(); @@ -521,7 +521,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileAddDestAcc) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileSubDestAcc) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreMultiTileSubDestAcc) { auto arch = this->arch_; if (arch == tt::ARCH::GRAYSKULL) { GTEST_SKIP(); @@ -545,7 +545,7 @@ TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileSubDestAcc) { } } -TEST_F(DeviceFixture, BinaryComputeSingleCoreMultiTileMulDestAcc) { +TEST_F(DeviceFixture, TensixBinaryComputeSingleCoreMultiTileMulDestAcc) { auto arch = this->arch_; if (arch == tt::ARCH::GRAYSKULL) { GTEST_SKIP(); 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 f4dfae4d653..1db610062ce 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 @@ -92,7 +92,7 @@ TEST_P(DeviceParamFixture, DeviceInitializeAndTeardown) { } } -TEST_P(DeviceParamFixture, DeviceLoadBlankKernels) { +TEST_P(DeviceParamFixture, TensixDeviceLoadBlankKernels) { 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)) { diff --git a/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp b/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp index 68dc974545a..6b95ca30074 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp @@ -14,7 +14,7 @@ using namespace tt; // Ensures we can successfully create kernels on available compute grid -TEST_F(CommonFixture, CreateKernelsOnComputeCores) { +TEST_F(CommonFixture, TensixCreateKernelsOnComputeCores) { for (unsigned int id = 0; id < devices_.size(); id++) { tt_metal::Program program = CreateProgram(); CoreCoord compute_grid = devices_.at(id)->compute_with_storage_grid_size(); @@ -30,7 +30,7 @@ TEST_F(CommonFixture, CreateKernelsOnComputeCores) { } // Ensure we cannot create kernels on storage cores -TEST_F(CommonFixture, CreateKernelsOnStorageCores) { +TEST_F(CommonFixture, TensixCreateKernelsOnStorageCores) { for (unsigned int id=0; id < devices_.size(); id++) { if (devices_.at(id)->storage_only_cores().empty()) { GTEST_SKIP() << "This test only runs on devices with storage only cores"; @@ -47,7 +47,7 @@ TEST_F(CommonFixture, CreateKernelsOnStorageCores) { } } -TEST_F(CommonFixture, CreateKernelsOnDispatchCores) { +TEST_F(CommonFixture, TensixIdleEthCreateKernelsOnDispatchCores) { if (getenv("TT_METAL_SLOW_DISPATCH_MODE")) { GTEST_SKIP() << "This test is only supported in fast dispatch mode"; } diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp b/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp index d8e3a4fefe1..a5288527ff3 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp @@ -89,7 +89,7 @@ static void test_sems_across_core_types(CommonFixture *fixture, } } -TEST_F(CommonFixture, TestEthBlank) { +TEST_F(CommonFixture, EthTestBlank) { Device *device = devices_[0]; Program program = CreateProgram(); @@ -113,7 +113,7 @@ TEST_F(CommonFixture, TestEthBlank) { } } -TEST_F(CommonFixture, TestTensixInitLocalMemory) { +TEST_F(CommonFixture, TensixTestInitLocalMemory) { // This test will hang/assert if there is a failure @@ -136,7 +136,7 @@ TEST_F(CommonFixture, TestTensixInitLocalMemory) { this->RunProgram(device, program); } -TEST_F(CommonFixture, TestEthInitLocalMemory) { +TEST_F(CommonFixture, EthTestInitLocalMemory) { // This test will hang/assert if there is a failure @@ -167,11 +167,11 @@ TEST_F(CommonFixture, TestEthInitLocalMemory) { } } -TEST_F(CommonFixture, TestSemaphoresTensixActiveEth) { +TEST_F(CommonFixture, TensixActiveEthTestSemaphores) { test_sems_across_core_types(this, this->devices_, true); } -TEST_F(CommonFixture, TestSemaphoresTensixIdleEth) { +TEST_F(CommonFixture, TensixIdleEthTestSemaphores) { if (not this->slow_dispatch_) { GTEST_SKIP(); } @@ -181,7 +181,7 @@ TEST_F(CommonFixture, TestSemaphoresTensixIdleEth) { // This test was written to cover issue #12738 (CBs for workers showing up on // active eth cores) -TEST_F(CommonFixture, TestCBsAcrossWorkerEth) { +TEST_F(CommonFixture, TensixActiveEthTestCBsAcrossDifferentCoreTypes) { uint32_t intermediate_cb = 24; uint32_t out_cb = 16; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp index 3c452584cdf..88849d33472 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp @@ -351,7 +351,7 @@ using namespace unit_tests_common::matmul::test_matmul_X_tile; } */ -TEST_F(CommonFixture, MatmulSingleTile){ +TEST_F(CommonFixture, TensixMatmulSingleTile){ for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; for (bool fp32_dest_acc_en : {true, false}) { @@ -377,7 +377,7 @@ TEST_F(CommonFixture, MatmulSingleTile){ } } -TEST_F(CommonFixture, MatmulMultiTile){ +TEST_F(CommonFixture, TensixMatmulMultiTile){ for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; for (bool fp32_dest_acc_en : {true, false}) { @@ -410,7 +410,7 @@ TEST_F(CommonFixture, MatmulMultiTile){ } } -TEST_F(CommonFixture, MatmulBlock){ +TEST_F(CommonFixture, TensixMatmulBlock){ for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; for (bool fp32_dest_acc_en : {true, false}) { @@ -441,7 +441,7 @@ TEST_F(CommonFixture, MatmulBlock){ } } -TEST_F(CommonFixture, MatmulBlockInitShort){ +TEST_F(CommonFixture, TensixMatmulBlockInitShort){ for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; for (bool fp32_dest_acc_en : {true, false}) { @@ -472,7 +472,7 @@ TEST_F(CommonFixture, MatmulBlockInitShort){ } } -TEST_F(CommonFixture, MatmulBlockInitShortWithDt){ +TEST_F(CommonFixture, TensixMatmulBlockInitShortWithDt){ for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; for (bool fp32_dest_acc_en : {true, false}) { diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp index 42061795180..2db444f66a7 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp @@ -365,7 +365,7 @@ bool matmul_large_block(CommonFixture *fixture, tt_metal::Device *device, bool a } -TEST_F(CommonFixture, MatmulLargeBlock) { +TEST_F(CommonFixture, TensixMatmulLargeBlock) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue;; tt::log_info(tt::LogTest, "Math Fidelity = {}", i); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp index 8371a43d96c..1fa16fa1570 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp @@ -498,7 +498,7 @@ bool matmul_multi_core_multi_dram(CommonFixture *fixture, tt_metal::Device *devi } -TEST_F(CommonFixture, MatmulMultiCoreSingleDRAM){ +TEST_F(CommonFixture, TensixMatmulMultiCoreSingleDRAM){ const char* arch = getenv("ARCH_NAME"); if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ log_info(LogTest, "This test is only supported in slow dispatch mode"); @@ -512,7 +512,7 @@ TEST_F(CommonFixture, MatmulMultiCoreSingleDRAM){ } } -TEST_F(CommonFixture, MatmulMultiCoreMultiDRAM){ +TEST_F(CommonFixture, TensixMatmulMultiCoreMultiDRAM){ // need to update move_tiles_to_dram to support both slow and fast if (getenv("TT_METAL_SLOW_DISPATCH_MODE")){ log_info(LogTest, "This test is not supported in slow dispatch mode, need to update move_tiles_to_dram.."); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp index 6dff35cf86f..69e743782ae 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp @@ -473,7 +473,7 @@ bool matmul_multi_core_multi_dram_in0_mcast_in1_mcast(tt_metal::Device *device){ } // namespace unit_tests_common::matmul::test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast -TEST_F(CommonFixture, MatmulMultiCoreMultiDRAMIn0MCastIn1MCast) { +TEST_F(CommonFixture, TensixMatmulMultiCoreMultiDRAMIn0MCastIn1MCast) { if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ tt::log_info(tt::LogTest, "This test is only supported in slow dispatch mode"); GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp index 2dfa1ec9ba3..611db2e65ca 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp @@ -390,7 +390,7 @@ bool matmul_multi_core_multi_dram_inX_mcast(tt_metal::Device *device, int in1_or } } // namespace unit_tests_common::matmul::test_matmul_multi_core -TEST_F(CommonFixture, MatmulMultiCoreMultiDRAMIn0MCast) { +TEST_F(CommonFixture, TensixMatmulMultiCoreMultiDRAMIn0MCast) { if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ tt::log_info(tt::LogTest, "This test is only supported in slow dispatch mode"); GTEST_SKIP(); @@ -400,7 +400,7 @@ TEST_F(CommonFixture, MatmulMultiCoreMultiDRAMIn0MCast) { } } -TEST_F(CommonFixture, MatmulMultiCoreMultiDRAMIn1MCast) { +TEST_F(CommonFixture, TensixMatmulMultiCoreMultiDRAMIn1MCast) { if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ tt::log_info(tt::LogTest, "This test is only supported in slow dispatch mode"); GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp index 167cfb880ed..88c539367c3 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp @@ -216,7 +216,7 @@ bool matmul_single_core(CommonFixture *fixture, tt_metal::Device *device, int M, } } // namespace unit_tests_common::matmul::test_matmul_single_core -TEST_F (CommonFixture, MatmulSingleCoreSmall){ +TEST_F (CommonFixture, TensixMatmulSingleCoreSmall){ uint32_t M = 4; uint32_t K = 4; uint32_t N = 4; @@ -227,7 +227,7 @@ TEST_F (CommonFixture, MatmulSingleCoreSmall){ } } -TEST_F (CommonFixture, MatmulSingleCore){ +TEST_F (CommonFixture, TensixMatmulSingleCore){ if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ log_info(LogTest, "Fast dispatch buffer memory issue, skipping for now"); GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp index 5dbadc80812..b84918d946a 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp @@ -191,7 +191,7 @@ bool flatten(CommonFixture *fixture, tt_metal::Device *device, uint32_t num_tile } -TEST_F(CommonFixture, Flatten){ +TEST_F(CommonFixture, TensixFlatten){ // TODO: Re-enable when #7264 is fixed GTEST_SKIP(); uint32_t num_tiles_r = 2; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp index 38ece0f5ca0..39f47d9b020 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp @@ -81,7 +81,7 @@ static void RunTest(DPrintFixture* fixture, Device* device, bool active) { } } -TEST_F(DPrintFixture, TestPrintEthCores) { +TEST_F(DPrintFixture, ActiveEthTestPrint) { for (Device* device : this->devices_) { // Skip if no ethernet cores on this device if (device->get_active_ethernet_cores(true).size() == 0) { @@ -96,7 +96,7 @@ TEST_F(DPrintFixture, TestPrintEthCores) { ); } } -TEST_F(DPrintFixture, TestPrintIEthCores) { +TEST_F(DPrintFixture, IdleEthTestPrint) { if (!this->IsSlowDispatch()) { log_info(tt::LogTest, "FD-on-idle-eth not supported."); GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp index 11b89c90dfe..b3e7088b615 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp @@ -12,7 +12,7 @@ ////////////////////////////////////////////////////////////////////////////////////////// using namespace tt::tt_metal; -TEST(DPrintErrorChecking, TestPrintInvalidCore) { +TEST(DPrintErrorChecking, TensixTestPrintInvalidCore) { // Set DPRINT enabled on a mix of invalid and valid cores. Previously this would hang during // device setup, but not the print server should simply ignore the invalid cores. std::map> dprint_cores; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp index 8440e242ac6..0b9e661ce16 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp @@ -77,7 +77,7 @@ static void RunTest(DPrintFixture* fixture, Device* device) { } } -TEST_F(DPrintFixtureDisableDevices, TestPrintMuteDevice) { +TEST_F(DPrintFixtureDisableDevices, TensixTestPrintMuteDevice) { for (Device* device : this->devices_) { this->RunTestOnDevice(CMAKE_UNIQUE_NAMESPACE::RunTest, device); } diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp index 3798288e27c..5cabeb1a3a4 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp @@ -66,7 +66,7 @@ static void RunTest(DPrintFixture* fixture, Device* device) { } } -TEST_F(DPrintFixture, TestPrintMuting) { +TEST_F(DPrintFixture, TensixTestPrintMuting) { for (Device* device : this->devices_) { this->RunTestOnDevice(CMAKE_UNIQUE_NAMESPACE::RunTest, device); } diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp index 42d7382b5bb..e40c3fa4cfe 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp @@ -192,7 +192,7 @@ static void RunTest(DPrintFixture* fixture, Device* device) { } } -TEST_F(DPrintFixture, TestPrintFromAllHarts) { +TEST_F(DPrintFixture, TensixTestPrintFromAllHarts) { for (Device* device : this->devices_) { this->RunTestOnDevice(CMAKE_UNIQUE_NAMESPACE::RunTest, device); } diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp index 0370b51f3f2..c4781ce67aa 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp @@ -58,7 +58,7 @@ static void RunTest(DPrintFixture* fixture, Device* device) { ); } -TEST_F(DPrintFixture, TestPrintFinish) { +TEST_F(DPrintFixture, TensixTestPrintFinish) { auto devices = this->devices_; // Run only on the first device, as this tests disconnects devices and this can cause // issues on multi-device setups. diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp index a707ffff86c..b8be9466260 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp @@ -56,7 +56,7 @@ try { } } -TEST_F(DPrintFixture, TestPrintHanging) { +TEST_F(DPrintFixture, TensixTestPrintHanging) { // Skip this test for slow dipatch for now. Due to how llrt currently sits below device, it's // tricky to check print server status from the finish loop for slow dispatch. Once issue #4363 // is resolved, we should add a check for print server handing in slow dispatch as well. diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp index 1f73a7bc736..a58737414bd 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp @@ -230,7 +230,7 @@ static bool reader_datacopy_writer( return input_data == output_data; } -TEST_F(DPrintFixture, TestDestPrintFloat16b) { +TEST_F(DPrintFixture, TensixTestDestPrintFloat16b) { // Setup test configuration DestPrintTestConfig test_config = { .num_tiles = 2, @@ -246,7 +246,7 @@ TEST_F(DPrintFixture, TestDestPrintFloat16b) { this->devices_[0]); } -TEST_F(DPrintFixture, TestDestPrintFloat32) { +TEST_F(DPrintFixture, TensixTestDestPrintFloat32) { // Setup test configuration DestPrintTestConfig test_config = { .num_tiles = 2, @@ -266,7 +266,7 @@ TEST_F(DPrintFixture, TestDestPrintFloat32) { this->devices_[0]); } -TEST_F(DPrintFixture, TestDestPrintFloat32RemapAndSwizzle) { +TEST_F(DPrintFixture, TensixTestDestPrintFloat32RemapAndSwizzle) { // Setup test configuration DestPrintTestConfig test_config = { .num_tiles = 3, diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp index 0786c960813..96b59573269 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp @@ -279,7 +279,7 @@ static void RunTest(DPrintFixture* fixture, Device* device) { } } -TEST_F(DPrintFixture, TestPrintRaiseWait) { +TEST_F(DPrintFixture, TensixTestPrintRaiseWait) { for (Device* device : this->devices_) { this->RunTestOnDevice(CMAKE_UNIQUE_NAMESPACE::RunTest, device); } diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram.cpp index 9b2f241bb72..2bdae62bc21 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram.cpp @@ -139,7 +139,7 @@ bool dram_single_core (CommonFixture* fixture, tt_metal::Device *device, const D } } -TEST_F(CommonFixture, DRAMLoopbackSingleCore){ +TEST_F(CommonFixture, TensixDRAMLoopbackSingleCore){ uint32_t buffer_size = 2 * 1024 * 25; std::vector src_vec = create_random_vector_of_bfloat16( buffer_size, 100, std::chrono::system_clock::now().time_since_epoch().count()); @@ -155,7 +155,7 @@ TEST_F(CommonFixture, DRAMLoopbackSingleCore){ } } -TEST_F(CommonFixture, DRAMLoopbackSingleCoreDB){ +TEST_F(CommonFixture, TensixDRAMLoopbackSingleCoreDB){ if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ tt::log_info(tt::LogTest, "This test is only supported in slow dispatch mode"); GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp index 39bac896ea0..378a0f51629 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp @@ -123,7 +123,7 @@ bool dram_to_l1_multicast(CommonFixture* fixture, tt_metal::Device *device, cons } } -TEST_F(CommonFixture, DRAMtoL1Multicast){ +TEST_F(CommonFixture, TensixDRAMtoL1Multicast){ unit_tests_common::dram::test_dram_to_l1_multicast::DRAMtoL1MulticastConfig test_config = { .dest_buffer_addr = 200 * 1024, .target_grid_offset = 1, @@ -133,7 +133,7 @@ TEST_F(CommonFixture, DRAMtoL1Multicast){ ASSERT_TRUE(unit_tests_common::dram::test_dram_to_l1_multicast::dram_to_l1_multicast(this, devices_.at(id), test_config)); } } -TEST_F(CommonFixture, DRAMtoL1MulticastLoopbackSrc){ +TEST_F(CommonFixture, TensixDRAMtoL1MulticastLoopbackSrc){ unit_tests_common::dram::test_dram_to_l1_multicast::DRAMtoL1MulticastConfig test_config = { .dest_buffer_addr = 500 * 1024, .target_grid_offset = 0, diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp index 8f5ca5efc46..2802d2d1401 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp @@ -177,7 +177,7 @@ static void RunTest(WatcherFixture *fixture, Device *device, riscv_id_t riscv_ty EXPECT_TRUE(expected == get_watcher_exception_message()); } -TEST_F(WatcherFixture, TestWatcherAssertBrisc) { +TEST_F(WatcherFixture, TensixTestWatcherAssertBrisc) { if (this->slow_dispatch_) GTEST_SKIP(); @@ -188,7 +188,7 @@ TEST_F(WatcherFixture, TestWatcherAssertBrisc) { ); } -TEST_F(WatcherFixture, TestWatcherAssertNCrisc) { +TEST_F(WatcherFixture, TensixTestWatcherAssertNCrisc) { if (this->slow_dispatch_) GTEST_SKIP(); this->RunTestOnDevice( @@ -197,7 +197,7 @@ TEST_F(WatcherFixture, TestWatcherAssertNCrisc) { ); } -TEST_F(WatcherFixture, TestWatcherAssertTrisc0) { +TEST_F(WatcherFixture, TensixTestWatcherAssertTrisc0) { if (this->slow_dispatch_) GTEST_SKIP(); this->RunTestOnDevice( @@ -206,7 +206,7 @@ TEST_F(WatcherFixture, TestWatcherAssertTrisc0) { ); } -TEST_F(WatcherFixture, TestWatcherAssertTrisc1) { +TEST_F(WatcherFixture, TensixTestWatcherAssertTrisc1) { if (this->slow_dispatch_) GTEST_SKIP(); this->RunTestOnDevice( @@ -215,7 +215,7 @@ TEST_F(WatcherFixture, TestWatcherAssertTrisc1) { ); } -TEST_F(WatcherFixture, TestWatcherAssertTrisc2) { +TEST_F(WatcherFixture, TensixTestWatcherAssertTrisc2) { if (this->slow_dispatch_) GTEST_SKIP(); this->RunTestOnDevice( @@ -224,7 +224,7 @@ TEST_F(WatcherFixture, TestWatcherAssertTrisc2) { ); } -TEST_F(WatcherFixture, TestWatcherAssertErisc) { +TEST_F(WatcherFixture, ActiveEthTestWatcherAssertErisc) { if (this->slow_dispatch_) GTEST_SKIP(); this->RunTestOnDevice( @@ -233,7 +233,7 @@ TEST_F(WatcherFixture, TestWatcherAssertErisc) { ); } -TEST_F(WatcherFixture, TestWatcherAssertIErisc) { +TEST_F(WatcherFixture, IdleEthTestWatcherAssertIErisc) { if (!this->IsSlowDispatch()) { log_info(tt::LogTest, "FD-on-idle-eth not supported."); GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp index dd23509745b..07578ecc9c2 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp @@ -15,7 +15,7 @@ using namespace tt::tt_metal; static void RunTest(WatcherFixture* fixture, Device* device) { } -TEST_F(WatcherFixture, TestWatcherEthLinkCheck) { +TEST_F(WatcherFixture, ActiveEthTestWatcherEthLinkCheck) { // Eth link retraining only supported on WH for now, this test is also dispatch-agnostic so just pick one. if (this->slow_dispatch_ || this->arch_ != tt::ARCH::WORMHOLE_B0 || this->devices_.size() == 1) { log_info(LogTest, "Test only runs on fast dispatch + multi-chip WH, skipping..."); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp index 416ffece9bd..eeedaa9aa6d 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp @@ -225,7 +225,7 @@ void CheckHostSanitization(Device *device) { } } -TEST_F(WatcherFixture, TestWatcherSanitize) { +TEST_F(WatcherFixture, TensixTestWatcherSanitize) { // Skip this test for slow dipatch for now. Due to how llrt currently sits below device, it's // tricky to check watcher server status from the finish loop for slow dispatch. Once issue #4363 // is resolved, we should add a check for print server handing in slow dispatch as well. @@ -244,7 +244,7 @@ TEST_F(WatcherFixture, TestWatcherSanitize) { ); } -TEST_F(WatcherFixture, TestWatcherSanitizeAlignmentL1) { +TEST_F(WatcherFixture, TensixTestWatcherSanitizeAlignmentL1) { if (this->slow_dispatch_) GTEST_SKIP(); this->RunTestOnDevice( @@ -256,7 +256,7 @@ TEST_F(WatcherFixture, TestWatcherSanitizeAlignmentL1) { ); } -TEST_F(WatcherFixture, TestWatcherSanitizeAlignmentDRAM) { +TEST_F(WatcherFixture, TensixTestWatcherSanitizeAlignmentDRAM) { if (this->slow_dispatch_) GTEST_SKIP(); this->RunTestOnDevice( @@ -268,7 +268,7 @@ TEST_F(WatcherFixture, TestWatcherSanitizeAlignmentDRAM) { ); } -TEST_F(WatcherFixture, TestWatcherSanitizeAlignmentDRAMNCrisc) { +TEST_F(WatcherFixture, TensixTestWatcherSanitizeAlignmentDRAMNCrisc) { if (this->slow_dispatch_) GTEST_SKIP(); this->RunTestOnDevice( @@ -280,13 +280,13 @@ TEST_F(WatcherFixture, TestWatcherSanitizeAlignmentDRAMNCrisc) { ); } -TEST_F(WatcherFixture, TestWatcherSanitizeEth) { +TEST_F(WatcherFixture, ActiveEthTestWatcherSanitizeEth) { if (this->slow_dispatch_) GTEST_SKIP(); this->RunTestOnDevice(RunTestEth, this->devices_[0]); } -TEST_F(WatcherFixture, TestWatcherSanitizeIEth) { +TEST_F(WatcherFixture, IdleEthTestWatcherSanitizeIEth) { if (!this->IsSlowDispatch()) { log_info(tt::LogTest, "FD-on-idle-eth not supported."); GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp index 600872d58ac..c8c6b6c154b 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp @@ -154,7 +154,7 @@ void RunDelayTestOnCore(WatcherDelayFixture* fixture, Device* device, CoreCoord EXPECT_TRUE((read_vec[0] >> 24) == 0x3); } -TEST_F(WatcherDelayFixture, TestWatcherSanitizeInsertDelays) { +TEST_F(WatcherDelayFixture, TensixTestWatcherSanitizeInsertDelays) { if (this->slow_dispatch_) GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp index f358a30ebad..a7c3d048712 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp @@ -134,7 +134,7 @@ static void RunTest(WatcherFixture* fixture, Device* device) { } } -TEST_F(WatcherFixture, TestWatcherPause) { +TEST_F(WatcherFixture, TensixTestWatcherPause) { for (Device* device : this->devices_) { this->RunTestOnDevice(CMAKE_UNIQUE_NAMESPACE::RunTest, device); } diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp index cc2727ef71d..0bed2d67a86 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp @@ -142,7 +142,7 @@ static void RunTest(WatcherFixture *fixture, Device *device, riscv_id_t riscv_ty ); } -TEST_F(WatcherFixture, TestWatcherRingBufferBrisc) { +TEST_F(WatcherFixture, TensixTestWatcherRingBufferBrisc) { for (Device* device : this->devices_) { this->RunTestOnDevice( [](WatcherFixture *fixture, Device *device){RunTest(fixture, device, DebugBrisc);}, @@ -150,7 +150,7 @@ TEST_F(WatcherFixture, TestWatcherRingBufferBrisc) { ); } } -TEST_F(WatcherFixture, TestWatcherRingBufferNCrisc) { +TEST_F(WatcherFixture, TensixTestWatcherRingBufferNCrisc) { for (Device* device : this->devices_) { this->RunTestOnDevice( [](WatcherFixture *fixture, Device *device){RunTest(fixture, device, DebugNCrisc);}, @@ -158,7 +158,7 @@ TEST_F(WatcherFixture, TestWatcherRingBufferNCrisc) { ); } } -TEST_F(WatcherFixture, TestWatcherRingBufferTrisc0) { +TEST_F(WatcherFixture, TensixTestWatcherRingBufferTrisc0) { for (Device* device : this->devices_) { this->RunTestOnDevice( [](WatcherFixture *fixture, Device *device){RunTest(fixture, device, DebugTrisc0);}, @@ -166,7 +166,7 @@ TEST_F(WatcherFixture, TestWatcherRingBufferTrisc0) { ); } } -TEST_F(WatcherFixture, TestWatcherRingBufferTrisc1) { +TEST_F(WatcherFixture, TensixTestWatcherRingBufferTrisc1) { for (Device* device : this->devices_) { this->RunTestOnDevice( [](WatcherFixture *fixture, Device *device){RunTest(fixture, device, DebugTrisc1);}, @@ -174,7 +174,7 @@ TEST_F(WatcherFixture, TestWatcherRingBufferTrisc1) { ); } } -TEST_F(WatcherFixture, TestWatcherRingBufferTrisc2) { +TEST_F(WatcherFixture, TensixTestWatcherRingBufferTrisc2) { for (Device* device : this->devices_) { this->RunTestOnDevice( [](WatcherFixture *fixture, Device *device){RunTest(fixture, device, DebugTrisc2);}, @@ -182,7 +182,7 @@ TEST_F(WatcherFixture, TestWatcherRingBufferTrisc2) { ); } } -TEST_F(WatcherFixture, TestWatcherRingBufferErisc) { +TEST_F(WatcherFixture, ActiveEthTestWatcherRingBufferErisc) { for (Device* device : this->devices_) { this->RunTestOnDevice( [](WatcherFixture *fixture, Device *device){RunTest(fixture, device, DebugErisc);}, @@ -190,7 +190,7 @@ TEST_F(WatcherFixture, TestWatcherRingBufferErisc) { ); } } -TEST_F(WatcherFixture, TestWatcherRingBufferIErisc) { +TEST_F(WatcherFixture, IdleEthTestWatcherRingBufferIErisc) { if (!this->IsSlowDispatch()) { log_info(tt::LogTest, "FD-on-idle-eth not supported."); GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp index 90a7b9221a3..201e6bcc3c5 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp @@ -651,7 +651,7 @@ namespace basic_tests { namespace compiler_workaround_hardware_bug_tests { -TEST_F(CommandQueueSingleCardFixture, TestArbiterDoesNotHang) { +TEST_F(CommandQueueSingleCardFixture, TensixTestArbiterDoesNotHang) { for (Device *device : devices_) { Program program; @@ -669,7 +669,7 @@ TEST_F(CommandQueueSingleCardFixture, TestArbiterDoesNotHang) { } namespace single_core_tests { -TEST_F(CommandQueueSingleCardFixture, TestSingleCbConfigCorrectlySentSingleCore) { +TEST_F(CommandQueueSingleCardFixture, TensixTestSingleCbConfigCorrectlySentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -682,7 +682,7 @@ TEST_F(CommandQueueSingleCardFixture, TestSingleCbConfigCorrectlySentSingleCore) } } -TEST_F(CommandQueueSingleCardFixture, TestMultiCbSeqConfigCorrectlySentSingleCore) { +TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCbSeqConfigCorrectlySentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -699,7 +699,7 @@ TEST_F(CommandQueueSingleCardFixture, TestMultiCbSeqConfigCorrectlySentSingleCor } } -TEST_F(CommandQueueSingleCardFixture, TestMultiCbRandomConfigCorrectlySentSingleCore) { +TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCbRandomConfigCorrectlySentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -716,7 +716,7 @@ TEST_F(CommandQueueSingleCardFixture, TestMultiCbRandomConfigCorrectlySentSingle } } -TEST_F(CommandQueueSingleCardFixture, TestMultiCBSharedAddressSpaceSentSingleCore) { +TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCBSharedAddressSpaceSentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -770,7 +770,7 @@ TEST_F(CommandQueueSingleCardFixture, TestMultiCBSharedAddressSpaceSentSingleCor } } -TEST_F(CommandQueueSingleCardFixture, TestSingleCbConfigCorrectlyUpdateSizeSentSingleCore) { +TEST_F(CommandQueueSingleCardFixture, TensixTestSingleCbConfigCorrectlyUpdateSizeSentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -783,7 +783,7 @@ TEST_F(CommandQueueSingleCardFixture, TestSingleCbConfigCorrectlyUpdateSizeSentS } } -TEST_F(CommandQueueSingleCardFixture, TestSingleSemaphoreConfigCorrectlySentSingleCore) { +TEST_F(CommandQueueSingleCardFixture, TensixTestSingleSemaphoreConfigCorrectlySentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -794,7 +794,7 @@ TEST_F(CommandQueueSingleCardFixture, TestSingleSemaphoreConfigCorrectlySentSing } } -TEST_F(CommandQueueSingleCardFixture, TestAutoInsertedBlankBriscKernelInDeviceDispatchMode) { +TEST_F(CommandQueueSingleCardFixture, TensixTestAutoInsertedBlankBriscKernelInDeviceDispatchMode) { for (Device *device : devices_) { Program program; @@ -812,7 +812,7 @@ TEST_F(CommandQueueSingleCardFixture, TestAutoInsertedBlankBriscKernelInDeviceDi } // Sanity test for setting and verifying common and unique runtime args to a single core, the simplest case. -TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanitySingleCoreCompute) { +TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanitySingleCoreCompute) { CoreRange cr0({0, 0}, {0, 0}); CoreRangeSet cr_set({cr0}); DummyProgramConfig dummy_program_config = {.cr_set = cr_set}; @@ -822,7 +822,7 @@ TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanitySingleCoreComput } // Sanity test for setting and verifying common and unique runtime args to single cores via ERISC. Some arch may return 0 active eth cores, that's okay. -TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanitySingleCoreDataMovementErisc) { +TEST_F(CommandQueueSingleCardFixture, ActiveEthIncrementRuntimeArgsSanitySingleCoreDataMovementErisc) { for (Device *device : devices_) { for (const auto ð_core : device->get_active_ethernet_cores(true)) { CoreRange cr0(eth_core); @@ -836,7 +836,7 @@ TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanitySingleCoreDataMo // Sanity test for setting and verifying common and unique runtime args to single cores via ERISC(IDLE). Some arch may return 0 active eth cores, that's okay. // FIXME - Re-enable when FD-on-idle-eth is supported -TEST_F(CommandQueueSingleCardFixture, DISABLED_IncrementRuntimeArgsSanitySingleCoreDataMovementEriscIdle) { +TEST_F(CommandQueueSingleCardFixture, DISABLED_ActiveEthIncrementRuntimeArgsSanitySingleCoreDataMovementEriscIdle) { for (Device *device : devices_) { for (const auto ð_core : device->get_active_ethernet_cores(true)) { CoreRange cr0(eth_core); @@ -850,7 +850,7 @@ TEST_F(CommandQueueSingleCardFixture, DISABLED_IncrementRuntimeArgsSanitySingleC // Sanity test for setting and verifying common and unique runtime args to single cores via inactive ERISC cores. Some arch may return 0 active eth cores, that's okay. // FIXME - Re-enable when FD-on-idle-eth is supported -TEST_F(CommandQueueSingleCardFixture, DISABLED_IncrementRuntimeArgsSanitySingleCoreDataMovementEriscInactive) { +TEST_F(CommandQueueSingleCardFixture, DISABLED_IdleEthIncrementRuntimeArgsSanitySingleCoreDataMovementEriscInactive) { for (Device *device : devices_) { for (const auto ð_core : device->get_inactive_ethernet_cores()) { CoreRange cr0(eth_core); @@ -862,7 +862,7 @@ TEST_F(CommandQueueSingleCardFixture, DISABLED_IncrementRuntimeArgsSanitySingleC } } -TEST_F(CommandQueueSingleCardFixture, TestRuntimeArgsCorrectlySentSingleCore) { +TEST_F(CommandQueueSingleCardFixture, TensixTestRuntimeArgsCorrectlySentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -876,7 +876,7 @@ TEST_F(CommandQueueSingleCardFixture, TestRuntimeArgsCorrectlySentSingleCore) { } // end namespace single_core_tests namespace multicore_tests { -TEST_F(CommandQueueSingleCardFixture, TestAllCbConfigsCorrectlySentMultiCore) { +TEST_F(CommandQueueSingleCardFixture, TensixTestAllCbConfigsCorrectlySentMultiCore) { CBConfig cb_config = {.num_pages = 1, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; std::vector cb_config_vector(NUM_CIRCULAR_BUFFERS, cb_config); @@ -896,7 +896,7 @@ TEST_F(CommandQueueSingleCardFixture, TestAllCbConfigsCorrectlySentMultiCore) { } } -TEST_F(CommandQueueSingleCardFixture, TestAllCbConfigsCorrectlySentUpdateSizeMultiCore) { +TEST_F(CommandQueueSingleCardFixture, TensixTestAllCbConfigsCorrectlySentUpdateSizeMultiCore) { CBConfig cb_config = {.num_pages = 1, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; std::vector cb_config_vector(NUM_CIRCULAR_BUFFERS, cb_config); @@ -916,7 +916,7 @@ TEST_F(CommandQueueSingleCardFixture, TestAllCbConfigsCorrectlySentUpdateSizeMul } } -TEST_F(CommandQueueSingleCardFixture, TestMultiCbConfigsCorrectlySentUpdateSizeMultiCore) { +TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCbConfigsCorrectlySentUpdateSizeMultiCore) { CBConfig cb_config_0 = {.cb_id = 0, .num_pages = 1, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; CBConfig cb_config_1 = {.cb_id = 1, .num_pages = 2, .page_size = 4096, .data_format = tt::DataFormat::Float16_b}; CBConfig cb_config_2 = {.cb_id = 2, .num_pages = 2, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; @@ -937,7 +937,7 @@ TEST_F(CommandQueueSingleCardFixture, TestMultiCbConfigsCorrectlySentUpdateSizeM } } -TEST_F(CommandQueueSingleCardFixture, TestAllCbConfigsCorrectlySentMultipleCoreRanges) { +TEST_F(CommandQueueSingleCardFixture, TensixTestAllCbConfigsCorrectlySentMultipleCoreRanges) { CBConfig cb_config = {.num_pages = 1, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; std::vector cb_config_vector(NUM_CIRCULAR_BUFFERS, cb_config); @@ -958,7 +958,7 @@ TEST_F(CommandQueueSingleCardFixture, TestAllCbConfigsCorrectlySentMultipleCoreR } } -TEST_F(CommandQueueSingleCardFixture, TestAllCbConfigsCorrectlySentUpdateSizeMultipleCoreRanges) { +TEST_F(CommandQueueSingleCardFixture, TensixTestAllCbConfigsCorrectlySentUpdateSizeMultipleCoreRanges) { CBConfig cb_config = {.num_pages = 1, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; std::vector cb_config_vector(NUM_CIRCULAR_BUFFERS, cb_config); @@ -979,7 +979,7 @@ TEST_F(CommandQueueSingleCardFixture, TestAllCbConfigsCorrectlySentUpdateSizeMul } } -TEST_F(CommandQueueSingleCardFixture, TestMultiCbConfigsCorrectlySentUpdateSizeMultipleCoreRanges) { +TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCbConfigsCorrectlySentUpdateSizeMultipleCoreRanges) { CBConfig cb_config_0 = {.cb_id = 0, .num_pages = 1, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; CBConfig cb_config_1 = {.cb_id = 1, .num_pages = 2, .page_size = 4096, .data_format = tt::DataFormat::Float16_b}; CBConfig cb_config_2 = {.cb_id = 2, .num_pages = 2, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; @@ -1001,7 +1001,7 @@ TEST_F(CommandQueueSingleCardFixture, TestMultiCbConfigsCorrectlySentUpdateSizeM } } -TEST_F(CommandQueueSingleCardFixture, TestAllSemConfigsCorrectlySentMultiCore) { +TEST_F(CommandQueueSingleCardFixture, TensixTestAllSemConfigsCorrectlySentMultiCore) { for (Device *device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1014,7 +1014,7 @@ TEST_F(CommandQueueSingleCardFixture, TestAllSemConfigsCorrectlySentMultiCore) { } } -TEST_F(CommandQueueSingleCardFixture, TestAllSemaphoreConfigsCorrectlySentMultipleCoreRanges) { +TEST_F(CommandQueueSingleCardFixture, TensixTestAllSemaphoreConfigsCorrectlySentMultipleCoreRanges) { for (Device *device : devices_) { CoreRange first_cr({0, 0}, {1, 1}); @@ -1054,7 +1054,7 @@ TEST_F(CommandQueueSingleCardFixture, TestAllSemaphoreConfigsCorrectlySentMultip } } -TEST_F(CommandQueueSingleCardFixture, TestAllRuntimeArgsCorrectlySentMultiCore) { +TEST_F(CommandQueueSingleCardFixture, TensixTestAllRuntimeArgsCorrectlySentMultiCore) { for (Device *device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1066,7 +1066,7 @@ TEST_F(CommandQueueSingleCardFixture, TestAllRuntimeArgsCorrectlySentMultiCore) } } -TEST_F(CommandQueueSingleCardFixture, TestAllRuntimeArgsCorrectlySentMultiCore_255_PerKernel) { +TEST_F(CommandQueueSingleCardFixture, TensixTestAllRuntimeArgsCorrectlySentMultiCore_255_PerKernel) { for (Device *device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1078,7 +1078,7 @@ TEST_F(CommandQueueSingleCardFixture, TestAllRuntimeArgsCorrectlySentMultiCore_2 } } -TEST_F(CommandQueueSingleCardFixture, TestSendRuntimeArgsMultiCoreRange) { +TEST_F(CommandQueueSingleCardFixture, TensixTestSendRuntimeArgsMultiCoreRange) { for (Device* device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1092,7 +1092,7 @@ TEST_F(CommandQueueSingleCardFixture, TestSendRuntimeArgsMultiCoreRange) { } } -TEST_F(CommandQueueSingleCardFixture, TestSendRuntimeArgsMultiNonOverlappingCoreRange) { +TEST_F(CommandQueueSingleCardFixture, TensixTestSendRuntimeArgsMultiNonOverlappingCoreRange) { // Core ranges get merged in kernel groups, this one does not for (Device* device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1107,7 +1107,7 @@ TEST_F(CommandQueueSingleCardFixture, TestSendRuntimeArgsMultiNonOverlappingCore } } -TEST_F(CommandQueueSingleCardFixture, TestUpdateRuntimeArgsMultiCoreRange) { +TEST_F(CommandQueueSingleCardFixture, TensixTestUpdateRuntimeArgsMultiCoreRange) { for (Device* device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1122,7 +1122,7 @@ TEST_F(CommandQueueSingleCardFixture, TestUpdateRuntimeArgsMultiCoreRange) { } // Sanity test for setting and verifying common and unique runtime args to multiple cores. -TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanityMultiCoreCompute) { +TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreCompute) { CoreRange cr0({1, 1}, {2, 2}); CoreRange cr1({3, 3}, {4, 4}); CoreRangeSet cr_set(std::vector{cr0, cr1}); @@ -1133,7 +1133,7 @@ TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanityMultiCoreCompute } // Max number of 255 unique RT args. -TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanityMultiCoreCompute_255_UniqueArgs) { +TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreCompute_255_UniqueArgs) { CoreRange cr0({1, 1}, {2, 2}); CoreRange cr1({3, 3}, {4, 4}); CoreRangeSet cr_set(std::vector{cr0, cr1}); @@ -1144,7 +1144,7 @@ TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanityMultiCoreCompute } // Max number of 255 common RT args. -TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanityMultiCoreCompute_255_CommonArgs) { +TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreCompute_255_CommonArgs) { CoreRange cr0({1, 1}, {2, 2}); CoreRange cr1({3, 3}, {4, 4}); CoreRangeSet cr_set(std::vector{cr0, cr1}); @@ -1155,7 +1155,7 @@ TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanityMultiCoreCompute } // Sanity test for setting and verifying common and unique runtime args to multiple cores via BRISC. -TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanityMultiCoreDataMovementBrisc) { +TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreDataMovementBrisc) { CoreRange cr0({1, 1}, {2, 2}); CoreRange cr1({3, 3}, {4, 4}); CoreRangeSet cr_set(std::vector{cr0, cr1}); @@ -1166,7 +1166,7 @@ TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanityMultiCoreDataMov } // Sanity test for setting and verifying common and unique runtime args to multiple cores via NCRISC. -TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanityMultiCoreDataMovementNcrisc) { +TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreDataMovementNcrisc) { CoreRange cr0({1, 1}, {2, 2}); CoreRange cr1({3, 3}, {4, 4}); CoreRangeSet cr_set(std::vector{cr0, cr1}); @@ -1183,7 +1183,7 @@ TEST_F(CommandQueueSingleCardFixture, IncrementRuntimeArgsSanityMultiCoreDataMov namespace stress_tests { -TEST_F(CommandQueueSingleCardFixture, DISABLED_TestFillDispatchCoreBuffer) { +TEST_F(CommandQueueSingleCardFixture, DISABLED_TensixTestFillDispatchCoreBuffer) { uint32_t NUM_ITER = 100000; for (Device *device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1197,7 +1197,7 @@ TEST_F(CommandQueueSingleCardFixture, DISABLED_TestFillDispatchCoreBuffer) { } } -TEST_F(CommandQueueFixture, TestRandomizedProgram) { +TEST_F(CommandQueueFixture, TensixTestRandomizedProgram) { uint32_t NUM_PROGRAMS = 100; uint32_t MAX_LOOP = 100; uint32_t page_size = 1024; diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp index dbac6e5dac4..da46c682e98 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp @@ -91,7 +91,7 @@ constexpr bool kBlocking = true; constexpr bool kNonBlocking = false; vector blocking_flags = {kBlocking, kNonBlocking}; -TEST_F(SingleDeviceTraceFixture, InstantiateTraceSanity) { +TEST_F(SingleDeviceTraceFixture, TensixInstantiateTraceSanity) { Setup(2048); CommandQueue& command_queue = this->device_->command_queue(); @@ -123,7 +123,7 @@ TEST_F(SingleDeviceTraceFixture, InstantiateTraceSanity) { ReleaseTrace(this->device_, tid); } -TEST_F(SingleDeviceTraceFixture, EnqueueProgramTraceCapture) { +TEST_F(SingleDeviceTraceFixture, TensixEnqueueProgramTraceCapture) { Setup(2048); auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); @@ -166,7 +166,7 @@ TEST_F(SingleDeviceTraceFixture, EnqueueProgramTraceCapture) { ReleaseTrace(this->device_, tid); } -TEST_F(SingleDeviceTraceFixture, EnqueueProgramDeviceCapture) { +TEST_F(SingleDeviceTraceFixture, TensixEnqueueProgramDeviceCapture) { Setup(2048); auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); @@ -217,7 +217,7 @@ TEST_F(SingleDeviceTraceFixture, EnqueueProgramDeviceCapture) { ReleaseTrace(this->device_, tid); } -TEST_F(SingleDeviceTraceFixture, EnqueueTwoProgramTrace) { +TEST_F(SingleDeviceTraceFixture, TensixEnqueueTwoProgramTrace) { Setup(6144); // Get command queue from device for this test, since its running in async mode CommandQueue& command_queue = this->device_->command_queue(); @@ -293,7 +293,7 @@ TEST_F(SingleDeviceTraceFixture, EnqueueTwoProgramTrace) { } } -TEST_F(SingleDeviceTraceFixture, EnqueueMultiProgramTraceBenchmark) { +TEST_F(SingleDeviceTraceFixture, TensixEnqueueMultiProgramTraceBenchmark) { Setup(6144); CommandQueue& command_queue = this->device_->command_queue(); diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_HostAsyncCQ.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_HostAsyncCQ.cpp index e4eceaffb9c..25f72bfa6ef 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_HostAsyncCQ.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_HostAsyncCQ.cpp @@ -200,7 +200,7 @@ bool flatten(Device *device, uint32_t num_tiles_r = 5, uint32_t num_tiles_c = 5) namespace host_command_queue_tests { -TEST_F(CommandQueueFixture, TestAsyncCommandQueueSanityAndProfile) { +TEST_F(CommandQueueFixture, TensixTestAsyncCommandQueueSanityAndProfile) { auto& command_queue = this->device_->command_queue(); auto current_mode = CommandQueue::default_mode(); command_queue.set_mode(CommandQueue::CommandQueueMode::ASYNC); @@ -263,7 +263,7 @@ TEST_F(CommandQueueFixture, DISABLED_TestAsyncBufferRW) { command_queue.set_mode(current_mode); } -TEST_F(CommandQueueFixture, DISABLED_TestAsyncCBAllocation) { +TEST_F(CommandQueueFixture, DISABLED_TensixTestAsyncCBAllocation) { // Test asynchronous allocation of buffers and their assignment to CBs auto& command_queue = this->device_->command_queue(); auto current_mode = CommandQueue::default_mode(); @@ -306,7 +306,7 @@ TEST_F(CommandQueueFixture, DISABLED_TestAsyncCBAllocation) { command_queue.set_mode(current_mode); } -TEST_F(CommandQueueFixture, DISABLED_TestAsyncAssertForDeprecatedAPI) { +TEST_F(CommandQueueFixture, DISABLED_TensixTestAsyncAssertForDeprecatedAPI) { auto& command_queue = this->device_->command_queue(); auto current_mode = CommandQueue::default_mode(); command_queue.set_mode(CommandQueue::CommandQueueMode::ASYNC); @@ -332,7 +332,7 @@ TEST_F(CommandQueueFixture, DISABLED_TestAsyncAssertForDeprecatedAPI) { command_queue.set_mode(current_mode); } -TEST_F(CommandQueueFixture, DISABLED_TestAsyncFlattenStress){ +TEST_F(CommandQueueFixture, DISABLED_TensixTestAsyncFlattenStress){ auto& command_queue = this->device_->command_queue(); auto current_mode = CommandQueue::default_mode(); command_queue.set_mode(CommandQueue::CommandQueueMode::ASYNC); diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp index 06cd4a16177..442428347b4 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp @@ -233,7 +233,7 @@ bool run_sfpu_all_same_buffer(CommandQueue & cq, const SfpuConfig& test_config) class SingleCoreSingleCardSfpuParameterizedFixture : public CommandQueueSingleCardFixture, public testing::WithParamInterface> { }; -TEST_P(SingleCoreSingleCardSfpuParameterizedFixture, SfpuCompute) { +TEST_P(SingleCoreSingleCardSfpuParameterizedFixture, TensixSfpuCompute) { for (Device* device_: devices_) { size_t num_tiles = std::get<0>(GetParam()); string sfpu_op = std::get<1>(GetParam()); @@ -279,7 +279,7 @@ class SingleCoreSingleCardSfpuParameterizedApproxFixture : public CommandQueueSingleCardFixture, public testing::WithParamInterface> {}; -TEST_P(SingleCoreSingleCardSfpuParameterizedApproxFixture, SfpuCompute) { +TEST_P(SingleCoreSingleCardSfpuParameterizedApproxFixture, TensixSfpuCompute) { for (Device* device_: devices_) { size_t num_tiles = std::get<0>(GetParam()); string sfpu_op = std::get<1>(GetParam()); @@ -326,7 +326,7 @@ class MultiCoreSingleCardSfpuParameterizedApproxFixture : public CommandQueueSingleCardFixture, public testing::WithParamInterface> {}; -TEST_P(MultiCoreSingleCardSfpuParameterizedApproxFixture, AllCoreMultiTileSfpuApproxCompute) { +TEST_P(MultiCoreSingleCardSfpuParameterizedApproxFixture, TensixAllCoreMultiTileSfpuApproxCompute) { for (Device* device_: devices_) { size_t num_tiles = std::get<0>(GetParam()); diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp index ef05c731489..cf5d37e7a98 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp @@ -555,7 +555,7 @@ bool chip_to_chip_interleaved_buffer_transfer( } } // namespace fd_unit_tests::erisc::kernels -TEST_F(CommandQueueSingleCardFixture, EnqueueDummyProgramOnEthCore) { +TEST_F(CommandQueueSingleCardFixture, ActiveEthEnqueueDummyProgram) { for (const auto& device : devices_) { for (const auto& eth_core : device->get_active_ethernet_cores(true)) { ASSERT_TRUE(fd_unit_tests::erisc::kernels::test_dummy_EnqueueProgram_with_runtime_args(device, eth_core)); @@ -563,7 +563,7 @@ TEST_F(CommandQueueSingleCardFixture, EnqueueDummyProgramOnEthCore) { } } -TEST_F(CommandQueueSingleCardFixture, EthKernelsNocReadNoSend) { +TEST_F(CommandQueueSingleCardFixture, ActiveEthEthKernelsNocReadNoSend) { using namespace CMAKE_UNIQUE_NAMESPACE; const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; @@ -579,7 +579,7 @@ TEST_F(CommandQueueSingleCardFixture, EthKernelsNocReadNoSend) { } } -TEST_F(CommandQueueSingleCardFixture, EthKernelsNocWriteNoReceive) { +TEST_F(CommandQueueSingleCardFixture, ActiveEthEthKernelsNocWriteNoReceive) { using namespace CMAKE_UNIQUE_NAMESPACE; const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; @@ -595,7 +595,7 @@ TEST_F(CommandQueueSingleCardFixture, EthKernelsNocWriteNoReceive) { } } -TEST_F(CommandQueueMultiDeviceFixture, EthKernelsDirectSendAllConnectedChips) { +TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsDirectSendAllConnectedChips) { using namespace CMAKE_UNIQUE_NAMESPACE; const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; const size_t dst_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; @@ -646,7 +646,7 @@ TEST_F(CommandQueueMultiDeviceFixture, EthKernelsDirectSendAllConnectedChips) { } } -TEST_F(CommandQueueMultiDeviceFixture, EthKernelsSendDramBufferAllConnectedChips) { +TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsSendDramBufferAllConnectedChips) { for (const auto& sender_device : devices_) { for (const auto& receiver_device : devices_) { if (sender_device->id() >= receiver_device->id()) { @@ -678,7 +678,7 @@ TEST_F(CommandQueueMultiDeviceFixture, EthKernelsSendDramBufferAllConnectedChips } } -TEST_F(CommandQueueMultiDeviceFixture, EthKernelsSendInterleavedBufferAllConnectedChips) { +TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsSendInterleavedBufferAllConnectedChips) { using namespace CMAKE_UNIQUE_NAMESPACE; for (const auto& sender_device : devices_) { for (const auto& receiver_device : devices_) { diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_ring_gather_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_ring_gather_EnqueueProgram.cpp index df20eec8c8d..1894fde0ef9 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_ring_gather_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_ring_gather_EnqueueProgram.cpp @@ -460,7 +460,7 @@ bool eth_interleaved_ring_gather_sender_receiver_kernels( } } // namespace fd_unit_tests::erisc::kernels -TEST_F(CommandQueueMultiDeviceFixture, EthKernelsDirectRingGatherAllChips) { +TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsDirectRingGatherAllChips) { using namespace CMAKE_UNIQUE_NAMESPACE; if (num_devices_ < 4) { GTEST_SKIP(); @@ -476,7 +476,7 @@ TEST_F(CommandQueueMultiDeviceFixture, EthKernelsDirectRingGatherAllChips) { device_ring, WORD_SIZE, src_eth_l1_byte_address, dst_eth_l1_byte_address, sem_l1_byte_address)); } -TEST_F(CommandQueueMultiDeviceFixture, EthKernelsInterleavedRingGatherAllChips) { +TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsInterleavedRingGatherAllChips) { using namespace CMAKE_UNIQUE_NAMESPACE; if (num_devices_ < 4) { GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp index 3fc76d32d74..26493c92af6 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp @@ -245,7 +245,7 @@ void create_and_run_row_pipeline(tt_metal::Device* device, const PipelineRowConf } // namespace unit_tests::create_pipeline -TEST_F(CommandQueueFixture, TestPipelineAcrossRows) { +TEST_F(CommandQueueFixture, TensixTestPipelineAcrossRows) { if (this->arch_ != tt::ARCH::GRAYSKULL) { GTEST_SKIP(); } diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp index 74080be0bb8..fdf9d5b19cc 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp @@ -648,7 +648,7 @@ void build_and_run_autonomous_stream_test( } // namespace tt -TEST_F(CommandQueueFixture, DISABLED_TestAutonomousRelayStreams) { +TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreams) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); if (arch == tt::ARCH::GRAYSKULL) { @@ -691,7 +691,7 @@ TEST_F(CommandQueueFixture, DISABLED_TestAutonomousRelayStreams) { return; } -TEST_F(CommandQueueFixture, DISABLED_TestAutonomousRelayStreamsSmallPackets) { +TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsSmallPackets) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); if (arch == tt::ARCH::GRAYSKULL) { @@ -734,7 +734,7 @@ TEST_F(CommandQueueFixture, DISABLED_TestAutonomousRelayStreamsSmallPackets) { return; } -TEST_F(CommandQueueFixture, DISABLED_TestAutonomousRelayStreamsLoopingShort) { +TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingShort) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); if (arch == tt::ARCH::GRAYSKULL) { @@ -780,7 +780,7 @@ TEST_F(CommandQueueFixture, DISABLED_TestAutonomousRelayStreamsLoopingShort) { // Too long to run in post commit and these kernels are currently only live in these unit tests anyways // so we just enable a couple of the unit tests to ensure nobody accidentally introduces compile errors // or anything like that -TEST_F(CommandQueueFixture, DISABLED_TestAutonomousRelayStreamsLoopingRandomShort) { +TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingRandomShort) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); // if (num_devices != 8) { @@ -835,7 +835,7 @@ TEST_F(CommandQueueFixture, DISABLED_TestAutonomousRelayStreamsLoopingRandomShor // Too long to run in post commit and these kernels are currently only live in these unit tests anyways // so we just enable a couple of the unit tests to ensure nobody accidentally introduces compile errors // or anything like that -TEST_F(CommandQueueFixture, DISABLED_TestAutonomousRelayStreamsLoopingLong) { +TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingLong) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); // if (num_devices != 8) { @@ -885,7 +885,7 @@ TEST_F(CommandQueueFixture, DISABLED_TestAutonomousRelayStreamsLoopingLong) { // Too long to run in post commit and these kernels are currently only live in these unit tests anyways // so we just enable a couple of the unit tests to ensure nobody accidentally introduces compile errors // or anything like that -TEST_F(CommandQueueFixture, DISABLED_TestAutonomousRelayStreamsSweep) { +TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsSweep) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); if (arch == tt::ARCH::GRAYSKULL) { diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp index 4e407df6d4e..248b829ab13 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp @@ -79,7 +79,7 @@ std::pair, std::vector> create_runtime_args(bool namespace stress_tests { -TEST_F(MultiCommandQueueSingleDeviceFixture, TestRandomizedProgram) { +TEST_F(MultiCommandQueueSingleDeviceFixture, TensixTestRandomizedProgram) { uint32_t NUM_PROGRAMS = 100; uint32_t MAX_LOOP = 100; uint32_t page_size = 1024; diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp index 0f9c35adb96..ea960df1259 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp @@ -70,7 +70,7 @@ Program create_simple_unary_program(const Buffer& input, const Buffer& output) { // the eager mode results namespace basic_tests { -TEST_F(SingleDeviceTraceFixture, EnqueueOneProgramTrace) { +TEST_F(SingleDeviceTraceFixture, TensixEnqueueOneProgramTrace) { Setup(2048, 2); auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); @@ -111,7 +111,7 @@ TEST_F(SingleDeviceTraceFixture, EnqueueOneProgramTrace) { ReleaseTrace(this->device_, tid); } -TEST_F(SingleDeviceTraceFixture, EnqueueOneProgramTraceLoops) { +TEST_F(SingleDeviceTraceFixture, TensixEnqueueOneProgramTraceLoops) { Setup(4096, 2); auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); @@ -162,7 +162,7 @@ TEST_F(SingleDeviceTraceFixture, EnqueueOneProgramTraceLoops) { ReleaseTrace(this->device_, trace_id); } -TEST_F(SingleDeviceTraceFixture, EnqueueOneProgramTraceBenchmark) { +TEST_F(SingleDeviceTraceFixture, TensixEnqueueOneProgramTraceBenchmark) { Setup(6144, 2); auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); diff --git a/tests/tt_metal/tt_metal/unit_tests_frequent/tests/run_many_times.cpp b/tests/tt_metal/tt_metal/unit_tests_frequent/tests/run_many_times.cpp index 75116172d4d..61b161f7530 100644 --- a/tests/tt_metal/tt_metal/unit_tests_frequent/tests/run_many_times.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_frequent/tests/run_many_times.cpp @@ -114,7 +114,7 @@ void RunTest(Device *device) { } } -TEST(Common, AllCoresRunManyTimes) { +TEST(Common, TensixRunManyTimes) { auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); // Skip fast dispatch until it's supported for remote device. if (!slow_dispatch) From 125b89a2c79ad06ded0d9853e79e5f2461f457a9 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Mon, 28 Oct 2024 16:12:42 +0000 Subject: [PATCH 02/26] #0: More renaming --- .../test_CircularBuffer_allocation.cpp | 2 +- .../test_single_core_matmul_compute.cpp | 8 ++++---- .../unit_tests/compute/test_transpose.cpp | 4 ++-- .../compute/test_untilize_tilize.cpp | 18 +++++++++--------- .../tt_metal/unit_tests/dram/direct.cpp | 8 ++++---- .../unit_tests/ethernet/basic_eth_kernels.cpp | 18 +++++++++--------- .../ethernet/buffer_movement_kernels.cpp | 8 ++++---- .../unit_tests/ethernet/device_cluster_api.cpp | 10 +++++----- .../ethernet/erisc_app_direct_send.cpp | 8 ++++---- .../unit_tests/ethernet/galaxy_cluster_api.cpp | 4 ++-- .../fast_dispatch_kernels/test_write_host.cpp | 6 +++--- 11 files changed, 47 insertions(+), 47 deletions(-) diff --git a/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_allocation.cpp b/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_allocation.cpp index 7ca851abb2a..a3fd2d2c9c4 100644 --- a/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_allocation.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_allocation.cpp @@ -39,7 +39,7 @@ void validate_cb_address(Program &program, Device *device, const CoreRangeSet &c } } -TEST_F(DeviceFixture, TestCircularBuffersSequentiallyPlaced) { +TEST_F(DeviceFixture, TensixTestCircularBuffersSequentiallyPlaced) { for (unsigned int id = 0; id < num_devices_; id++) { Program program; CBConfig cb_config; diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_single_core_matmul_compute.cpp b/tests/tt_metal/tt_metal/unit_tests/compute/test_single_core_matmul_compute.cpp index 140874255df..df5583ecf29 100644 --- a/tests/tt_metal/tt_metal/unit_tests/compute/test_single_core_matmul_compute.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/compute/test_single_core_matmul_compute.cpp @@ -604,22 +604,22 @@ bool blocked_matmul(tt_metal::Device* device, uint32_t M, uint32_t K, uint32_t N } } // namespace unit_tests::compute::matmul -TEST_F(DeviceFixture, TestSingleCoreSingleTileComputeMatmul) { +TEST_F(DeviceFixture, TensixTestSingleCoreSingleTileComputeMatmul) { for (unsigned int id = 0; id < num_devices_; id++) { ASSERT_TRUE(unit_tests::compute::matmul::single_tile_matmul(this->devices_.at(id))); } } -TEST_F(DeviceFixture, TestSingleCoreSingleBlockSingleTileComputeMatmul) { +TEST_F(DeviceFixture, TensixTestSingleCoreSingleBlockSingleTileComputeMatmul) { for (unsigned int id = 0; id < num_devices_; id++) { ASSERT_TRUE(unit_tests::compute::matmul::single_block_matmul(this->devices_.at(id), 1, 1, 1)); } } -TEST_F(DeviceFixture, TestSingleCoreSingleBlockSingleTileAccumulationComputeMatmul) { +TEST_F(DeviceFixture, TensixTestSingleCoreSingleBlockSingleTileAccumulationComputeMatmul) { for (unsigned int id = 0; id < num_devices_; id++) { ASSERT_TRUE(unit_tests::compute::matmul::single_block_matmul(this->devices_.at(id), 1, 2, 1)); } } -TEST_F(DeviceFixture, TestSingleCoreSingleBlockSingleTileNoAccumulationComputeMatmul) { +TEST_F(DeviceFixture, TensixTestSingleCoreSingleBlockSingleTileNoAccumulationComputeMatmul) { for (unsigned int id = 0; id < num_devices_; id++) { ASSERT_TRUE(unit_tests::compute::matmul::single_block_matmul(this->devices_.at(id), 2, 1, 2)); } diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_transpose.cpp b/tests/tt_metal/tt_metal/unit_tests/compute/test_transpose.cpp index 26fcf5069d0..53781734a61 100644 --- a/tests/tt_metal/tt_metal/unit_tests/compute/test_transpose.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/compute/test_transpose.cpp @@ -187,7 +187,7 @@ void run_single_core_transpose(tt_metal::Device* device, const TransposeConfig& } // namespace unit_tests::compute::transpose -TEST_F(DeviceFixture, ComputeTransposeWH) { +TEST_F(DeviceFixture, TensixComputeTransposeWH) { unit_tests::compute::transpose::TransposeConfig test_config = { .short_init = false, .single_tile_size = 2 * 1024, @@ -196,7 +196,7 @@ TEST_F(DeviceFixture, ComputeTransposeWH) { unit_tests::compute::transpose::run_single_core_transpose(this->devices_.at(0), test_config); } -TEST_F(DeviceFixture, ComputeTransposeWHShortInit) { +TEST_F(DeviceFixture, TensixComputeTransposeWHShortInit) { unit_tests::compute::transpose::TransposeConfig test_config = { .short_init = true, .single_tile_size = 2 * 1024, diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_untilize_tilize.cpp b/tests/tt_metal/tt_metal/unit_tests/compute/test_untilize_tilize.cpp index c3add81f771..29e8ba09b78 100644 --- a/tests/tt_metal/tt_metal/unit_tests/compute/test_untilize_tilize.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/compute/test_untilize_tilize.cpp @@ -307,7 +307,7 @@ void run_single_core_tilize_program(tt_metal::Device* device, const TestConfig& Following tests are for Unpack Tilize ***************************************/ -TEST_F(DeviceFixture, ComputeUnpackTilize) { +TEST_F(DeviceFixture, TensixComputeUnpackTilize) { vector > num_tiles = {{1, 1}, {1, 2}, {2, 1}, {1, 4}, {2, 2}, {4, 1}}; for(auto num_tile : num_tiles) { for (bool fp32_dest_acc_en : {true, false}) { @@ -330,7 +330,7 @@ TEST_F(DeviceFixture, ComputeUnpackTilize) { } } -TEST_F(DeviceFixture, ComputeUnpackTilizeA_B) { +TEST_F(DeviceFixture, TensixComputeUnpackTilizeA_B) { auto arch = this->arch_; if (arch == tt::ARCH::GRAYSKULL) { GTEST_SKIP(); @@ -349,7 +349,7 @@ TEST_F(DeviceFixture, ComputeUnpackTilizeA_B) { } } -TEST_F(DeviceFixture, ComputeUnpackTilizeShortInit) { +TEST_F(DeviceFixture, TensixComputeUnpackTilizeShortInit) { vector > num_tiles = {{1, 1}, {1, 2}, {2, 1}, {1, 4}, {2, 2}, {4, 1}}; for(auto num_tile : num_tiles) { for (bool fp32_dest_acc_en : {true, false}) { @@ -377,7 +377,7 @@ TEST_F(DeviceFixture, ComputeUnpackTilizeShortInit) { Following tests are for Unpack Untilize ***************************************/ -TEST_F(DeviceFixture, ComputeUnpackUntilize) { +TEST_F(DeviceFixture, TensixComputeUnpackUntilize) { vector > num_tiles = {{1, 1}, {1, 2}, {2, 1}, {1, 4}, {2, 2}, {4, 1}}; for(auto num_tile : num_tiles) { for (bool fp32_dest_acc_en : {true, false}) { @@ -400,7 +400,7 @@ TEST_F(DeviceFixture, ComputeUnpackUntilize) { } } -TEST_F(DeviceFixture, ComputeUnpackUntilizeShortInit) { +TEST_F(DeviceFixture, TensixComputeUnpackUntilizeShortInit) { vector > num_tiles = {{1, 1}, {1, 2}, {2, 1}, {1, 4}, {2, 2}, {4, 1}}; for(auto num_tile : num_tiles) { for (bool fp32_dest_acc_en : {true, false}) { @@ -427,7 +427,7 @@ TEST_F(DeviceFixture, ComputeUnpackUntilizeShortInit) { /************************************** Following tests are for pack untilize ***************************************/ -TEST_F(DeviceFixture, ComputePackUntilize) { +TEST_F(DeviceFixture, TensixComputePackUntilize) { vector > num_tiles = {{1, 1}, {1, 2}, {2, 1}, {1, 4}, {2, 2}, {4, 1}}; for(auto num_tile : num_tiles) { for (bool fp32_dest_acc_en : {true, false}) { @@ -450,7 +450,7 @@ TEST_F(DeviceFixture, ComputePackUntilize) { } } -TEST_F(DeviceFixture, ComputePackUntilizeShortInit) { +TEST_F(DeviceFixture, TensixComputePackUntilizeShortInit) { vector > num_tiles = {{1, 1}, {1, 2}, {2, 1}, {1, 4}, {2, 2}, {4, 1}}; for(auto num_tile : num_tiles) { for (bool fp32_dest_acc_en : {true, false}) { @@ -474,7 +474,7 @@ TEST_F(DeviceFixture, ComputePackUntilizeShortInit) { } } -TEST_F(DeviceFixture, ComputePackUntilizeDst) { +TEST_F(DeviceFixture, TensixComputePackUntilizeDst) { vector > num_tiles = {{1, 1}, {1, 2}, {2, 1}, {1, 4}, {2, 2}, {4, 1}}; for(auto num_tile : num_tiles) { for (bool dst_full_sync_en : {true, false}) { @@ -495,7 +495,7 @@ TEST_F(DeviceFixture, ComputePackUntilizeDst) { //Tests pack_untilize with tiny tile dims. //Row dim 1x32, which is faces = 2, rows = 1 //Row dim 1x16, which is faces = 1, rows = 1 -TEST_F(DeviceFixture, ComputePackUntilizeDstTinyTile) { +TEST_F(DeviceFixture, TensixComputePackUntilizeDstTinyTile) { vector > test_config_values = {{1, 1, 1, 1}, {1, 1, 2, 1}, {1, 2, 2, 1}}; uint32_t face_c_dim = 16; for(auto test_config_value : test_config_values) { diff --git a/tests/tt_metal/tt_metal/unit_tests/dram/direct.cpp b/tests/tt_metal/tt_metal/unit_tests/dram/direct.cpp index 5c86e8feadf..3defe49c6ec 100644 --- a/tests/tt_metal/tt_metal/unit_tests/dram/direct.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/dram/direct.cpp @@ -372,7 +372,7 @@ bool reader_datacopy_writer(tt_metal::Device* device, const ReaderDatacopyWriter } } // namespace unit_tests::dram::direct -TEST_F(DeviceFixture, SingleCoreDirectDramReaderOnly) { +TEST_F(DeviceFixture, TensixSingleCoreDirectDramReaderOnly) { for (unsigned int id = 0; id < num_devices_; id++) { uint32_t l1_unreserved_base = devices_.at(id)->get_base_allocator_addr(HalMemType::L1); ASSERT_TRUE( @@ -383,7 +383,7 @@ TEST_F(DeviceFixture, SingleCoreDirectDramReaderOnly) { unit_tests::dram::direct::reader_only(devices_.at(id), 16 * 1024, l1_unreserved_base, CoreCoord(0, 0))); } } -TEST_F(DeviceFixture, SingleCoreDirectDramWriterOnly) { +TEST_F(DeviceFixture, TensixSingleCoreDirectDramWriterOnly) { for (unsigned int id = 0; id < num_devices_; id++) { uint32_t l1_unreserved_base = devices_.at(id)->get_base_allocator_addr(HalMemType::L1); ASSERT_TRUE( @@ -394,7 +394,7 @@ TEST_F(DeviceFixture, SingleCoreDirectDramWriterOnly) { unit_tests::dram::direct::writer_only(devices_.at(id), 16 * 1024, l1_unreserved_base, CoreCoord(0, 0))); } } -TEST_F(DeviceFixture, SingleCoreDirectDramReaderWriter) { +TEST_F(DeviceFixture, TensixSingleCoreDirectDramReaderWriter) { unit_tests::dram::direct::ReaderWriterConfig test_config = { .num_tiles = 1, .tile_byte_size = 2 * 32 * 32, @@ -409,7 +409,7 @@ TEST_F(DeviceFixture, SingleCoreDirectDramReaderWriter) { ASSERT_TRUE(unit_tests::dram::direct::reader_writer(devices_.at(id), test_config)); } } -TEST_F(DeviceFixture, SingleCoreDirectDramReaderDatacopyWriter) { +TEST_F(DeviceFixture, TensixSingleCoreDirectDramReaderDatacopyWriter) { unit_tests::dram::direct::ReaderDatacopyWriterConfig test_config = { .num_tiles = 1, .tile_byte_size = 2 * 32 * 32, diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp index 4b35868852e..78ba87d64dd 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp @@ -301,7 +301,7 @@ bool noc_reader_and_writer_kernels( return pass; } -TEST_F(N300DeviceFixture, EthKernelsNocReadNoSend) { +TEST_F(N300DeviceFixture, ActiveEthEthKernelsNocReadNoSend) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); const auto& device_0 = devices_.at(0); @@ -328,7 +328,7 @@ TEST_F(N300DeviceFixture, EthKernelsNocReadNoSend) { } } -TEST_F(N300DeviceFixture, EthKernelsNocWriteNoReceive) { +TEST_F(N300DeviceFixture, ActiveEthEthKernelsNocWriteNoReceive) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); const auto& device_0 = devices_.at(0); @@ -473,7 +473,7 @@ bool eth_direct_sender_receiver_kernels( } // namespace unit_tests::erisc::kernels -TEST_F(N300DeviceFixture, EthKernelsDirectSendChip0ToChip1) { +TEST_F(N300DeviceFixture, ActiveEthEthKernelsDirectSendChip0ToChip1) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); const auto& device_0 = devices_.at(0); @@ -522,7 +522,7 @@ TEST_F(N300DeviceFixture, EthKernelsDirectSendChip0ToChip1) { } } -TEST_F(N300DeviceFixture, EthKernelsDirectSendChip1ToChip0) { +TEST_F(N300DeviceFixture, ActiveEthEthKernelsDirectSendChip1ToChip0) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); const auto& device_0 = devices_.at(0); @@ -571,7 +571,7 @@ TEST_F(N300DeviceFixture, EthKernelsDirectSendChip1ToChip0) { } } -TEST_F(DeviceFixture, EthKernelsDirectSendAllConnectedChips) { +TEST_F(DeviceFixture, ActiveEthEthKernelsDirectSendAllConnectedChips) { using namespace CMAKE_UNIQUE_NAMESPACE; const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; const size_t dst_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; @@ -622,7 +622,7 @@ TEST_F(DeviceFixture, EthKernelsDirectSendAllConnectedChips) { } } -TEST_F(N300DeviceFixture, EthKernelsBidirectionalDirectSend) { +TEST_F(N300DeviceFixture, ActiveEthEthKernelsBidirectionalDirectSend) { using namespace CMAKE_UNIQUE_NAMESPACE; const auto& device_0 = devices_.at(0); const auto& device_1 = devices_.at(1); @@ -708,7 +708,7 @@ TEST_F(N300DeviceFixture, EthKernelsBidirectionalDirectSend) { } } -TEST_F(N300DeviceFixture, EthKernelsRepeatedDirectSends) { +TEST_F(N300DeviceFixture, ActiveEthEthKernelsRepeatedDirectSends) { using namespace CMAKE_UNIQUE_NAMESPACE; const auto& device_0 = devices_.at(0); const auto& device_1 = devices_.at(1); @@ -741,7 +741,7 @@ TEST_F(N300DeviceFixture, EthKernelsRepeatedDirectSends) { } } -TEST_F(N300DeviceFixture, EthKernelsRandomDirectSendTests) { +TEST_F(N300DeviceFixture, ActiveEthEthKernelsRandomDirectSendTests) { using namespace CMAKE_UNIQUE_NAMESPACE; srand(0); const auto& device_0 = devices_.at(0); @@ -785,7 +785,7 @@ TEST_F(N300DeviceFixture, EthKernelsRandomDirectSendTests) { receiver_core)); } } -TEST_F(N300DeviceFixture, EthKernelsRandomEthPacketSizeDirectSendTests) { +TEST_F(N300DeviceFixture, ActiveEthEthKernelsRandomEthPacketSizeDirectSendTests) { srand(0); const auto& device_0 = devices_.at(0); const auto& device_1 = devices_.at(1); diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp index dd9c95aab8f..6d0dd564a96 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp @@ -280,7 +280,7 @@ bool chip_to_chip_interleaved_buffer_transfer( } // namespace unit_tests::erisc::kernels -TEST_F(N300DeviceFixture, EthKernelsSendDramBufferChip0ToChip1) { +TEST_F(N300DeviceFixture, ActiveEthEthKernelsSendDramBufferChip0ToChip1) { const auto& sender_device = devices_.at(0); const auto& receiver_device = devices_.at(1); @@ -298,7 +298,7 @@ TEST_F(N300DeviceFixture, EthKernelsSendDramBufferChip0ToChip1) { } } -TEST_F(N300DeviceFixture, EthKernelsSendDramBufferChip1ToChip0) { +TEST_F(N300DeviceFixture, ActiveEthEthKernelsSendDramBufferChip1ToChip0) { const auto& sender_device = devices_.at(1); const auto& receiver_device = devices_.at(0); @@ -316,7 +316,7 @@ TEST_F(N300DeviceFixture, EthKernelsSendDramBufferChip1ToChip0) { } } -TEST_F(N300DeviceFixture, EthKernelsSendInterleavedBufferChip0ToChip1) { +TEST_F(N300DeviceFixture, ActiveEthEthKernelsSendInterleavedBufferChip0ToChip1) { GTEST_SKIP(); const auto& sender_device = devices_.at(0); const auto& receiver_device = devices_.at(1); @@ -368,7 +368,7 @@ TEST_F(N300DeviceFixture, EthKernelsSendInterleavedBufferChip0ToChip1) { } } -TEST_F(DeviceFixture, EthKernelsSendInterleavedBufferAllConnectedChips) { +TEST_F(DeviceFixture, ActiveEthEthKernelsSendInterleavedBufferAllConnectedChips) { for (const auto& sender_device : devices_) { for (const auto& receiver_device : devices_) { if (sender_device->id() == receiver_device->id()) { diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/device_cluster_api.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/device_cluster_api.cpp index 312b65a63d9..0c6491dab32 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/device_cluster_api.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/device_cluster_api.cpp @@ -23,7 +23,7 @@ namespace unit_tests::multichip::cluster { // Run this on Nebula X2 only, validate etherent core apis are correct // Known connectivity: chip 0 (x=9, y=6) <--> chip 1 (x=9, y=0) // chip 0 (x=1, y=6) <--> chip 1 (x=1, y=0) -TEST_F(N300DeviceFixture, ValidateEthernetConnectivity) { +TEST_F(N300DeviceFixture, EthValidateEthernetConnectivity) { const auto& device_0 = this->devices_.at(0); const auto& device_1 = this->devices_.at(1); @@ -79,13 +79,13 @@ TEST_F(N300DeviceFixture, ValidateEthernetConnectivity) { ASSERT_TRUE(chip_1_eth_noc_coords_returned == chip_1_eth_noc_coords_expected); } -TEST_F(N300DeviceFixture, InvalidLogicalEthernetCore) { +TEST_F(N300DeviceFixture, EthInvalidLogicalEthernetCore) { const auto& device_0 = this->devices_.at(0); EXPECT_ANY_THROW(device_0->ethernet_core_from_logical_core(CoreCoord(1, 0))); EXPECT_ANY_THROW(device_0->ethernet_core_from_logical_core(CoreCoord(0, 16))); } -TEST_F(N300DeviceFixture, ValidateAllEthernetCoreMapping) { +TEST_F(N300DeviceFixture, EthValidateAllEthernetCoreMapping) { static std::map expected_mapping_logical_to_physical = { {CoreCoord(0, 0), CoreCoord(9, 0)}, {CoreCoord(0, 1), CoreCoord(1, 0)}, @@ -112,7 +112,7 @@ TEST_F(N300DeviceFixture, ValidateAllEthernetCoreMapping) { } } -TEST_F(N300DeviceFixture, ValidatePhysicalCoreConversion) { +TEST_F(N300DeviceFixture, EthValidatePhysicalCoreConversion) { static std::map expected_mapping_logical_to_physical = { {CoreCoord(0, 0), CoreCoord(9, 0)}, {CoreCoord(0, 1), CoreCoord(1, 0)}, @@ -141,7 +141,7 @@ TEST_F(N300DeviceFixture, ValidatePhysicalCoreConversion) { EXPECT_ANY_THROW(device_0->physical_core_from_logical_core(CoreCoord(0, 0), CoreType::PCIE)); } -TEST_F(N300DeviceFixture, ValidateEthernetSockets) { +TEST_F(N300DeviceFixture, ActiveEthValidateEthernetSockets) { const auto& device_0 = this->devices_.at(0); const auto& device_1 = this->devices_.at(1); diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/erisc_app_direct_send.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/erisc_app_direct_send.cpp index 6de3291f65c..8009a5d7f82 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/erisc_app_direct_send.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/erisc_app_direct_send.cpp @@ -140,7 +140,7 @@ bool send_over_eth( } // namespace unit_tests::erisc::direct_send -TEST_F(N300DeviceFixture, SingleEthCoreDirectSendChip0ToChip1) { +TEST_F(N300DeviceFixture, EthSingleCoreDirectSendChip0ToChip1) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); ASSERT_TRUE(this->num_devices_ == 2); @@ -170,7 +170,7 @@ TEST_F(N300DeviceFixture, SingleEthCoreDirectSendChip0ToChip1) { device_0, device_1, sender_core_1, receiver_core_1, WORD_SIZE * MAX_NUM_WORDS)); } -TEST_F(N300DeviceFixture, SingleEthCoreDirectSendChip1ToChip0) { +TEST_F(N300DeviceFixture, EthSingleCoreDirectSendChip1ToChip0) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); ASSERT_TRUE(this->num_devices_ == 2); @@ -200,7 +200,7 @@ TEST_F(N300DeviceFixture, SingleEthCoreDirectSendChip1ToChip0) { device_1, device_0, sender_core_1, receiver_core_1, WORD_SIZE * MAX_NUM_WORDS)); } -TEST_F(N300DeviceFixture, BidirectionalEthCoreDirectSend) { +TEST_F(N300DeviceFixture, EthBidirectionalCoreDirectSend) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); ASSERT_TRUE(this->num_devices_ == 2); @@ -246,7 +246,7 @@ TEST_F(N300DeviceFixture, BidirectionalEthCoreDirectSend) { device_1, device_0, receiver_core_1, sender_core_1, WORD_SIZE * MAX_NUM_WORDS)); } -TEST_F(N300DeviceFixture, RandomDirectSendTests) { +TEST_F(N300DeviceFixture, EthRandomDirectSendTests) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); srand(0); diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/galaxy_cluster_api.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/galaxy_cluster_api.cpp index 447758371e8..b4cca6e03ee 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/galaxy_cluster_api.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/galaxy_cluster_api.cpp @@ -51,7 +51,7 @@ std::unordered_set get_ethernet_connected_device_ids(const chip_id_t // shelves and 4 links between adjacent Galaxy chips that are on the same // shelf, and currently tt::Cluster does not expose a way of determining // which shelf a particular Galaxy chip is on. -TEST_F(TGFixture, ValidateNumLinksBetweenAdjacentGalaxyChips) { +TEST_F(TGFixture, ActiveEthValidateNumLinksBetweenAdjacentGalaxyChips) { for (Device* device : this->devices_) { const chip_id_t device_id = device->id(); @@ -85,7 +85,7 @@ TEST_F(TGFixture, ValidateNumLinksBetweenAdjacentGalaxyChips) { // Validate that each MMIO chip links to two separate Galaxy chips, // and that each Galaxy chip links to at most one MMIO chip -TEST_F(GalaxyFixture, ValidateLinksBetweenMMIOAndGalaxyChips) { +TEST_F(GalaxyFixture, ActiveEthValidateLinksBetweenMMIOAndGalaxyChips) { for (Device* device : this->devices_) { const chip_id_t device_id = device->id(); diff --git a/tests/tt_metal/tt_metal/unit_tests/fast_dispatch_kernels/test_write_host.cpp b/tests/tt_metal/tt_metal/unit_tests/fast_dispatch_kernels/test_write_host.cpp index f70039820a5..5c3c0b270ab 100644 --- a/tests/tt_metal/tt_metal/unit_tests/fast_dispatch_kernels/test_write_host.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/fast_dispatch_kernels/test_write_host.cpp @@ -237,7 +237,7 @@ bool test_write_host(Device *device, uint32_t data_size, std::pair Date: Tue, 29 Oct 2024 14:51:50 +0000 Subject: [PATCH 03/26] #0: Renamed test --- .../circular_buffer/test_CircularBuffer_non_blocking.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_non_blocking.cpp b/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_non_blocking.cpp index c10b6c6e0db..0a4b0849ca4 100644 --- a/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_non_blocking.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_non_blocking.cpp @@ -61,7 +61,7 @@ std::vector generate_rt_args(uint32_t master_semaphore, uint32_t slave return rt_args; } -TEST_F(DeviceFixture, TestCircularBufferNonBlockingAPIs) { +TEST_F(DeviceFixture, TensixTestCircularBufferNonBlockingAPIs) { Program program; Device *device = devices_.at(0); From 7e6619c9f31be217dd120a023fd3095da3d9683b Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Thu, 31 Oct 2024 20:57:43 +0000 Subject: [PATCH 04/26] #0: Reorganizing test structure --- CONTRIBUTING.md | 4 +- .../tensors/test_async_tensor_apis.cpp | 10 +- .../common/command_queue_fixtures.hpp | 51 ++++++++ .../tt_metal/common/trace_fixtures.hpp | 53 +++++++++ .../1_compute_mm/test_compute_mm.cpp | 2 +- .../test_create_kernel_from_string.cpp | 6 +- .../tt_metal/unit_tests/CMakeLists.txt | 2 + .../unit_tests/common/core_coord_fixture.hpp | 2 +- .../test_CoreRangeSet_construct.cpp | 4 +- .../core_coord/test_CoreRangeSet_merge.cpp | 6 +- .../core_coord/test_CoreRange_adjacent.cpp | 4 +- .../core_coord/test_CoreRange_contains.cpp | 4 +- .../core_coord/test_CoreRange_intersects.cpp | 4 +- .../core_coord/test_CoreRange_iterator.cpp | 2 +- .../core_coord/test_CoreRange_merge.cpp | 4 +- .../basic/test_kernel_creation.cpp | 8 +- ...r_fixture.hpp => debug_tools_fixtures.hpp} | 110 ++++++++++++++++-- ...ommon_fixture.hpp => dispatch_fixture.hpp} | 4 +- .../common/dprint_fixture.hpp | 95 --------------- .../common/test_dispatch.cpp | 16 +-- .../compute/matmul/test_matmul_X_tile.cpp | 14 +-- .../matmul/test_matmul_large_block.cpp | 6 +- .../matmul/test_matmul_multi_core_X_dram.cpp | 8 +- ...ti_core_multi_dram_in0_mcast_in1_mcast.cpp | 4 +- ...matmul_multi_core_multi_dram_inX_mcast.cpp | 6 +- .../matmul/test_matmul_single_core.cpp | 8 +- .../compute/test_flatten.cpp | 6 +- .../dprint/test_eth_cores.cpp | 2 +- .../dprint/test_mute_device.cpp | 2 +- .../dprint/test_mute_print_server.cpp | 2 +- .../dprint/test_print_all_harts.cpp | 2 +- .../dprint/test_print_before_finish.cpp | 2 +- .../dprint/test_print_hanging.cpp | 2 +- .../dprint/test_print_tensix_dest.cpp | 2 +- .../dprint/test_print_tiles.cpp | 2 +- .../dprint/test_raise_wait.cpp | 2 +- .../unit_tests_common/dram/test_dram.cpp | 10 +- .../dram/test_dram_to_l1_multicast.cpp | 8 +- .../unit_tests_common/watcher/test_assert.cpp | 2 +- .../watcher/test_link_training.cpp | 2 +- .../watcher/test_noc_sanitize.cpp | 2 +- .../watcher/test_noc_sanitize_delays.cpp | 2 +- .../unit_tests_common/watcher/test_pause.cpp | 2 +- .../watcher/test_ringbuf.cpp | 2 +- .../watcher/test_waypoint.cpp | 2 +- .../unit_tests_fast_dispatch/CMakeLists.txt | 1 + .../command_queue/test_EnqueueProgram.cpp | 2 +- .../command_queue/test_EnqueueTrace.cpp | 1 + ...queueWriteBuffer_and_EnqueueReadBuffer.cpp | 1 + .../common/command_queue_fixture.hpp | 88 -------------- .../compute/sfpu/sfpu_compute.cpp | 1 + .../multichip/test_eth_EnqueueProgram.cpp | 1 + .../CMakeLists.txt | 1 + .../command_queue/test_EnqueueTrace.cpp | 1 + .../common/command_queue_fixture.hpp | 33 ------ tests/ttnn/unit_tests/gtests/test_add.cpp | 2 +- .../ttnn/unit_tests/gtests/test_graph_add.cpp | 2 +- 57 files changed, 305 insertions(+), 322 deletions(-) create mode 100644 tests/tt_metal/tt_metal/common/command_queue_fixtures.hpp create mode 100644 tests/tt_metal/tt_metal/common/trace_fixtures.hpp rename tests/tt_metal/tt_metal/unit_tests_common/common/{watcher_fixture.hpp => debug_tools_fixtures.hpp} (55%) rename tests/tt_metal/tt_metal/unit_tests_common/common/{common_fixture.hpp => dispatch_fixture.hpp} (97%) delete mode 100644 tests/tt_metal/tt_metal/unit_tests_common/common/dprint_fixture.hpp diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1f33a46de1c..5d1fff5282f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -245,7 +245,7 @@ structure our tests with this framework is to bundle it into a single executable. You can use `--gtest_filter_test` to filter out the specific test you'd like. -For example, to build and run the `CommonFixture.DRAMLoopbackSingleCore` on +For example, to build and run the `DispatchFixture.DRAMLoopbackSingleCore` on fast dispatch, you can 1. Build the unit tests: @@ -254,7 +254,7 @@ fast dispatch, you can ``` 2. Run the test: ``` - ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="CommonFixture.DRAMLoopbackSingleCore" + ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="DispatchFixture.DRAMLoopbackSingleCore" ``` On slow dispatch, to run another specific test, the equivalent would be: diff --git a/tests/tt_eager/tensors/test_async_tensor_apis.cpp b/tests/tt_eager/tensors/test_async_tensor_apis.cpp index 488d4178edd..5edd0082dc9 100644 --- a/tests/tt_eager/tensors/test_async_tensor_apis.cpp +++ b/tests/tt_eager/tensors/test_async_tensor_apis.cpp @@ -14,7 +14,7 @@ #include "ttnn/tensor/tensor.hpp" #include "ttnn/tensor/tensor_impl.hpp" #include "ttnn/tensor/types.hpp" -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "ttnn/operations/numpy/functions.hpp" @@ -37,7 +37,7 @@ uint32_t get_device_buffer_address(const Tensor& tensor) { } } -TEST_F(CommonFixture, TestTensorOwnershipSanity) { +TEST_F(DispatchFixture, TestTensorOwnershipSanity) { // Sanity test tensor read, write and update paths with synchronous // Ensure that tensor data is copied and owned as expected Device* device = this->devices_[0]; @@ -114,7 +114,7 @@ TEST_F(CommonFixture, TestTensorOwnershipSanity) { EXPECT_EQ(readback_tensor.get_shape(), ttnn::Shape(tt::tt_metal::LegacyShape({1, 1, 32, 128}))); } -TEST_F(CommonFixture, TestAsyncEltwiseBinary) { +TEST_F(DispatchFixture, TestAsyncEltwiseBinary) { Device* device = this->devices_[0]; device->enable_async(true); // Populate these in first loop and verify that deallocation worked - addresses should be identical across loops @@ -171,7 +171,7 @@ TEST_F(CommonFixture, TestAsyncEltwiseBinary) { Tensor tensor_identity_copy_function(const Tensor& tensor) { return tensor; } -TEST_F(CommonFixture, TestAsyncRefCountManager) { +TEST_F(DispatchFixture, TestAsyncRefCountManager) { Device* device = this->devices_[0]; device->enable_async(true); @@ -229,7 +229,7 @@ TEST_F(CommonFixture, TestAsyncRefCountManager) { device->enable_async(false); } -TEST_F(CommonFixture, TestTensorAsyncDataMovement) { +TEST_F(DispatchFixture, TestTensorAsyncDataMovement) { // Test 2 data paths here (resembles async mode): // 1. Main -> Worker: Create a tensor in the main thread. Ensure that it is accessible in the worker thread even // after its destroyed diff --git a/tests/tt_metal/tt_metal/common/command_queue_fixtures.hpp b/tests/tt_metal/tt_metal/common/command_queue_fixtures.hpp new file mode 100644 index 00000000000..abaa4308ee5 --- /dev/null +++ b/tests/tt_metal/tt_metal/common/command_queue_fixtures.hpp @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include "gtest/gtest.h" +#include "tt_metal/host_api.hpp" +#include "detail/tt_metal.hpp" +#include "tt_metal/test_utils/env_vars.hpp" + +class CommandQueueSingleCardFixture : public ::testing::Test { + protected: + void SetUp() override { + this->validate_dispatch_mode(); + this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + this->create_devices(); + } + + void TearDown() override { tt::tt_metal::detail::CloseDevices(reserved_devices_); } + + void validate_dispatch_mode() { + auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); + if (slow_dispatch) { + TT_THROW("This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); + GTEST_SKIP(); + } + } + + void create_devices(const std::size_t trace_region_size = DEFAULT_TRACE_REGION_SIZE) { + const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); + const chip_id_t mmio_device_id = 0; + this->reserved_devices_ = tt::tt_metal::detail::CreateDevices( + {mmio_device_id}, 1, DEFAULT_L1_SMALL_SIZE, trace_region_size, dispatch_core_type); + auto enable_remote_chip = getenv("TT_METAL_ENABLE_REMOTE_CHIP"); + if (enable_remote_chip) { + for (const auto &[id, device] : this->reserved_devices_) { + this->devices_.push_back(device); + } + } else { + this->devices_.push_back(this->reserved_devices_.at(mmio_device_id)); + } + + this->num_devices_ = this->reserved_devices_.size(); + } + + std::vector devices_; + std::map reserved_devices_; + tt::ARCH arch_; + size_t num_devices_; +}; diff --git a/tests/tt_metal/tt_metal/common/trace_fixtures.hpp b/tests/tt_metal/tt_metal/common/trace_fixtures.hpp new file mode 100644 index 00000000000..b31c7de830f --- /dev/null +++ b/tests/tt_metal/tt_metal/common/trace_fixtures.hpp @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include "gtest/gtest.h" +#include "tt_metal/host_api.hpp" +#include "tt_metal/test_utils/env_vars.hpp" +#include "command_queue_fixtures.hpp" +#include "impl/kernels/kernel.hpp" + +class SingleDeviceTraceFixture : public ::testing::Test { + protected: + Device* device_; + tt::ARCH arch_; + + void Setup(const size_t buffer_size, const uint8_t num_hw_cqs = 1) { + auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); + if (slow_dispatch) { + tt::log_info( + tt::LogTest, "This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); + GTEST_SKIP(); + } + if (num_hw_cqs > 1) { + // Running multi-CQ test. User must set this explicitly. + auto num_cqs = getenv("TT_METAL_GTEST_NUM_HW_CQS"); + if (num_cqs == nullptr or strcmp(num_cqs, "2")) { + TT_THROW("This suite must be run with TT_METAL_GTEST_NUM_HW_CQS=2"); + GTEST_SKIP(); + } + } + this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + const int device_id = 0; + this->device_ = tt::tt_metal::CreateDevice(device_id, num_hw_cqs, 0, buffer_size); + ; + } + + void TearDown() override { + if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")) { + tt::tt_metal::CloseDevice(this->device_); + } + } +}; + +class CommandQueueSingleCardTraceFixture : virtual public CommandQueueSingleCardFixture { + protected: + void SetUp() override { + this->validate_dispatch_mode(); + this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + this->create_devices(90000000); + } +}; diff --git a/tests/tt_metal/tt_metal/perf_microbenchmark/1_compute_mm/test_compute_mm.cpp b/tests/tt_metal/tt_metal/perf_microbenchmark/1_compute_mm/test_compute_mm.cpp index ced445053f8..2ba054fd9c9 100644 --- a/tests/tt_metal/tt_metal/perf_microbenchmark/1_compute_mm/test_compute_mm.cpp +++ b/tests/tt_metal/tt_metal/perf_microbenchmark/1_compute_mm/test_compute_mm.cpp @@ -22,7 +22,7 @@ #include "tt_metal/common/constants.hpp" #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "tt_metal/test_utils/deprecated/tensor.hpp" #include "tests/tt_metal/test_utils/tilization.hpp" #include "tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/matmul_utils.hpp" diff --git a/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp b/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp index 5ddcd8f773d..88662259341 100644 --- a/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp +++ b/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp @@ -13,15 +13,15 @@ #include "impl/program/program.hpp" #include "tt_cluster_descriptor_types.h" -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" using namespace tt; using namespace tt::tt_metal; -class ProgramWithKernelCreatedFromStringFixture : public CommonFixture { +class ProgramWithKernelCreatedFromStringFixture : public DispatchFixture { protected: void SetUp() override { - CommonFixture::SetUp(); + DispatchFixture::SetUp(); for (Device *device : this->devices_) { const chip_id_t device_id = device->id(); diff --git a/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt index abd7f277144..38990ebe994 100644 --- a/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt @@ -75,6 +75,7 @@ target_include_directories( ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/tt_metal ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common ${CMAKE_CURRENT_SOURCE_DIR}/circular_buffer @@ -86,6 +87,7 @@ target_include_directories( ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/tt_metal ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common ) diff --git a/tests/tt_metal/tt_metal/unit_tests/common/core_coord_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests/common/core_coord_fixture.hpp index 596c5f44a73..f49f17e3de4 100644 --- a/tests/tt_metal/tt_metal/unit_tests/common/core_coord_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests/common/core_coord_fixture.hpp @@ -8,7 +8,7 @@ #include "tt_metal/host_api.hpp" #include "tt_metal/test_utils/env_vars.hpp" -class CoreCoordHarness : public ::testing::Test { +class CoreCoordFixture : public ::testing::Test { protected: CoreRange cr1 = CoreRange({0, 0}, {1, 1}); CoreRange cr2 = CoreRange({3, 3}, {5, 4}); diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_construct.cpp b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_construct.cpp index 04cdc9f15c2..a1aedf9403e 100644 --- a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_construct.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_construct.cpp @@ -8,7 +8,7 @@ namespace basic_tests::CoreRangeSet{ -TEST_F(CoreCoordHarness, TestCoreRangeSetValidConstruct) +TEST_F(CoreCoordFixture, TestCoreRangeSetValidConstruct) { EXPECT_NO_THROW(::CoreRangeSet(std::vector{this->sc1, this->cr2})); EXPECT_NO_THROW(::CoreRangeSet(std::vector{this->cr1, this->cr2})); @@ -17,7 +17,7 @@ TEST_F(CoreCoordHarness, TestCoreRangeSetValidConstruct) EXPECT_EQ(valid_ranges.ranges().size(), 2); } -TEST_F(CoreCoordHarness, TestCoreRangeSetInvalidConstruct) +TEST_F(CoreCoordFixture, TestCoreRangeSetInvalidConstruct) { ::CoreRange overlapping_range({1, 2}, {3, 3}); EXPECT_ANY_THROW(::CoreRangeSet(std::vector{this->cr1, this->cr2, overlapping_range})); diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_merge.cpp b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_merge.cpp index 778e5083538..7c3a28d3700 100644 --- a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_merge.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_merge.cpp @@ -11,14 +11,14 @@ namespace basic_tests::CoreRangeSet { -TEST_F(CoreCoordHarness, TestCoreRangeSetMergeNoSolution) { +TEST_F(CoreCoordFixture, TestCoreRangeSetMergeNoSolution) { EXPECT_EQ(::CoreRangeSet(sc1).merge(std::set{sc3}), ::CoreRangeSet(std::set{sc1, sc3})); EXPECT_EQ(::CoreRangeSet(cr1).merge(std::set{cr2}), ::CoreRangeSet(std::set{cr1, cr2})); EXPECT_EQ(::CoreRangeSet(cr1).merge(std::set{cr1, cr2}), ::CoreRangeSet(std::set{cr1, cr2})); EXPECT_EQ(::CoreRangeSet(cr1).merge(std::set{cr2}).merge(std::set{cr3}), ::CoreRangeSet(std::set{cr1, cr2, cr3})); } -TEST_F(CoreCoordHarness, TestCoreRangeSetMergeCoreCoord) { +TEST_F(CoreCoordFixture, TestCoreRangeSetMergeCoreCoord) { ::CoreRangeSet empty_crs; EXPECT_EQ(empty_crs.merge(std::set{this->sc1}).ranges().size(), 1); EXPECT_EQ(::CoreRangeSet(cr1).merge(std::set{sc3, sc4}), ::CoreRangeSet(std::set{cr16})); @@ -47,7 +47,7 @@ TEST_F(CoreCoordHarness, TestCoreRangeSetMergeCoreCoord) { CoreRange{{3, 4}, {4, 5}}})); } -TEST_F(CoreCoordHarness, TestCoreRangeSetMergeCoreRange) { +TEST_F(CoreCoordFixture, TestCoreRangeSetMergeCoreRange) { EXPECT_EQ(::CoreRangeSet(cr1).merge(std::set{cr1}), ::CoreRangeSet(std::set{cr1})); EXPECT_EQ(::CoreRangeSet(cr7).merge(std::set{cr6}).merge(std::set{cr4}), ::CoreRangeSet(std::set{cr8})); EXPECT_EQ( diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_adjacent.cpp b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_adjacent.cpp index f08976402d6..f9b386a71ea 100644 --- a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_adjacent.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_adjacent.cpp @@ -10,7 +10,7 @@ namespace basic_tests::CoreRange{ -TEST_F(CoreCoordHarness, TestCoreRangeAdjacent) +TEST_F(CoreCoordFixture, TestCoreRangeAdjacent) { EXPECT_TRUE ( this->cr1.adjacent(this->cr9) ); EXPECT_TRUE ( this->cr9.adjacent(this->cr1) ); @@ -23,7 +23,7 @@ TEST_F(CoreCoordHarness, TestCoreRangeAdjacent) } -TEST_F(CoreCoordHarness, TestCoreRangeNotAdjacent){ +TEST_F(CoreCoordFixture, TestCoreRangeNotAdjacent){ EXPECT_FALSE ( this->cr2.adjacent(this->cr3)); EXPECT_FALSE ( this->cr1.adjacent(this->cr6)); EXPECT_FALSE ( this->cr1.adjacent(this->cr11)); diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_contains.cpp b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_contains.cpp index a9369eb7445..905b59123fe 100644 --- a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_contains.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_contains.cpp @@ -10,7 +10,7 @@ namespace basic_tests::CoreRange { -TEST_F(CoreCoordHarness, TestCoreRangeContains) { +TEST_F(CoreCoordFixture, TestCoreRangeContains) { // Contains CoreCoord EXPECT_TRUE(this->cr1.contains(this->sc1.start_coord)); EXPECT_TRUE(this->cr1.contains(this->cr1.start_coord)); @@ -25,7 +25,7 @@ TEST_F(CoreCoordHarness, TestCoreRangeContains) { EXPECT_TRUE(this->cr4.contains(::CoreRangeSet(std::vector{this->cr1, this->cr2, this->cr3}))); } -TEST_F(CoreCoordHarness, TestCoreRangeNotContains) { +TEST_F(CoreCoordFixture, TestCoreRangeNotContains) { // Not Contains CoreCoord EXPECT_FALSE(this->sc1.contains(this->cr1.start_coord)); EXPECT_FALSE(this->sc1.contains(this->sc2.start_coord)); diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_intersects.cpp b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_intersects.cpp index 29eeeb591b8..409bf123f26 100644 --- a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_intersects.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_intersects.cpp @@ -8,7 +8,7 @@ namespace basic_tests::CoreRange { -TEST_F(CoreCoordHarness, TestCoreRangeIntersects) { +TEST_F(CoreCoordFixture, TestCoreRangeIntersects) { EXPECT_TRUE(this->cr1.intersects(this->cr5)); EXPECT_EQ(this->cr1.intersection(this->cr5).value(), ::CoreRange({1, 0}, {1, 1})); @@ -25,7 +25,7 @@ TEST_F(CoreCoordHarness, TestCoreRangeIntersects) { EXPECT_EQ(this->cr7.intersection(this->cr8).value(), this->cr7); } -TEST_F(CoreCoordHarness, TestCoreRangeNotIntersects) { +TEST_F(CoreCoordFixture, TestCoreRangeNotIntersects) { EXPECT_FALSE(this->cr1.intersects(this->cr2)); EXPECT_FALSE(this->sc1.intersects(this->cr2)); EXPECT_FALSE(this->cr1.intersects(this->cr7)); diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_iterator.cpp b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_iterator.cpp index 5729e1a6c4b..7b41528637c 100644 --- a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_iterator.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_iterator.cpp @@ -11,7 +11,7 @@ using std::vector; namespace basic_tests::CoreRange { -TEST_F(CoreCoordHarness, TestCoreRangeIterator) +TEST_F(CoreCoordFixture, TestCoreRangeIterator) { vector cores_in_core_range; diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_merge.cpp b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_merge.cpp index db8a1b2c7ad..a3da8c8b90d 100644 --- a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_merge.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_merge.cpp @@ -10,7 +10,7 @@ namespace basic_tests::CoreRange{ -TEST_F(CoreCoordHarness, TestCoreRangeMerge) +TEST_F(CoreCoordFixture, TestCoreRangeMerge) { EXPECT_EQ ( this->sc1.merge(this->sc1).value(), this->sc1 ); EXPECT_EQ ( this->cr4.merge(this->cr5).value(), this->cr6 ); @@ -25,7 +25,7 @@ TEST_F(CoreCoordHarness, TestCoreRangeMerge) } -TEST_F(CoreCoordHarness, TestCoreRangeNotMergeable){ +TEST_F(CoreCoordFixture, TestCoreRangeNotMergeable){ EXPECT_FALSE ( this->cr1.merge(this->cr3)); EXPECT_FALSE ( this->cr2.merge(this->cr3)); EXPECT_FALSE ( this->cr1.merge(this->cr6)); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp b/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp index 6b95ca30074..0ea595fd648 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" @@ -14,7 +14,7 @@ using namespace tt; // Ensures we can successfully create kernels on available compute grid -TEST_F(CommonFixture, TensixCreateKernelsOnComputeCores) { +TEST_F(DispatchFixture, TensixCreateKernelsOnComputeCores) { for (unsigned int id = 0; id < devices_.size(); id++) { tt_metal::Program program = CreateProgram(); CoreCoord compute_grid = devices_.at(id)->compute_with_storage_grid_size(); @@ -30,7 +30,7 @@ TEST_F(CommonFixture, TensixCreateKernelsOnComputeCores) { } // Ensure we cannot create kernels on storage cores -TEST_F(CommonFixture, TensixCreateKernelsOnStorageCores) { +TEST_F(DispatchFixture, TensixCreateKernelsOnStorageCores) { for (unsigned int id=0; id < devices_.size(); id++) { if (devices_.at(id)->storage_only_cores().empty()) { GTEST_SKIP() << "This test only runs on devices with storage only cores"; @@ -47,7 +47,7 @@ TEST_F(CommonFixture, TensixCreateKernelsOnStorageCores) { } } -TEST_F(CommonFixture, TensixIdleEthCreateKernelsOnDispatchCores) { +TEST_F(DispatchFixture, TensixIdleEthCreateKernelsOnDispatchCores) { if (getenv("TT_METAL_SLOW_DISPATCH_MODE")) { GTEST_SKIP() << "This test is only supported in fast dispatch mode"; } diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/watcher_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp similarity index 55% rename from tests/tt_metal/tt_metal/unit_tests_common/common/watcher_fixture.hpp rename to tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp index 9d74f94942d..d25ee6d596f 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/common/watcher_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp @@ -4,14 +4,100 @@ #pragma once -#include -#include -#include "common_fixture.hpp" -#include "impl/debug/watcher_server.hpp" -#include "llrt/rtoptions.hpp" - -// A version of CommonFixture with watcher enabled -class WatcherFixture: public CommonFixture { +#include "dispatch_fixture.hpp" + +class DebugToolsFixture : public DispatchFixture { + +}; + +// A version of DispatchFixture with DPrint enabled on all cores. +class DPrintFixture: public DebugToolsFixture { +public: + inline static const string dprint_file_name = "gtest_dprint_log.txt"; + + // A function to run a program, according to which dispatch mode is set. + void RunProgram(Device* device, Program& program) { + // Only difference is that we need to wait for the print server to catch + // up after running a test. + DebugToolsFixture::RunProgram(device, program); + tt::DprintServerAwait(); + } + +protected: + // Running with dprint + watcher enabled can make the code size blow up, so let's force watcher + // disabled for DPRINT tests. + bool watcher_previous_enabled; + void SetUp() override { + // The core range (physical) needs to be set >= the set of all cores + // used by all tests using this fixture, so set dprint enabled for + // all cores and all devices + tt::llrt::OptionsG.set_feature_enabled(tt::llrt::RunTimeDebugFeatureDprint, true); + tt::llrt::OptionsG.set_feature_all_cores( + tt::llrt::RunTimeDebugFeatureDprint, CoreType::WORKER, tt::llrt::RunTimeDebugClassWorker); + tt::llrt::OptionsG.set_feature_all_cores( + tt::llrt::RunTimeDebugFeatureDprint, CoreType::ETH, tt::llrt::RunTimeDebugClassWorker); + tt::llrt::OptionsG.set_feature_all_chips(tt::llrt::RunTimeDebugFeatureDprint, true); + // Send output to a file so the test can check after program is run. + tt::llrt::OptionsG.set_feature_file_name(tt::llrt::RunTimeDebugFeatureDprint, dprint_file_name); + tt::llrt::OptionsG.set_test_mode_enabled(true); + watcher_previous_enabled = tt::llrt::OptionsG.get_watcher_enabled(); + tt::llrt::OptionsG.set_watcher_enabled(false); + + ExtraSetUp(); + + // Parent class initializes devices and any necessary flags + DebugToolsFixture::SetUp(); + } + + void TearDown() override { + // Parent class tears down devices + DebugToolsFixture::TearDown(); + + // Remove the DPrint output file after the test is finished. + std::remove(dprint_file_name.c_str()); + + // Reset DPrint settings + tt::llrt::OptionsG.set_feature_cores(tt::llrt::RunTimeDebugFeatureDprint, {}); + tt::llrt::OptionsG.set_feature_enabled(tt::llrt::RunTimeDebugFeatureDprint, false); + tt::llrt::OptionsG.set_feature_all_cores( + tt::llrt::RunTimeDebugFeatureDprint, CoreType::WORKER, tt::llrt::RunTimeDebugClassNoneSpecified); + tt::llrt::OptionsG.set_feature_all_cores( + tt::llrt::RunTimeDebugFeatureDprint, CoreType::ETH, tt::llrt::RunTimeDebugClassNoneSpecified); + tt::llrt::OptionsG.set_feature_all_chips(tt::llrt::RunTimeDebugFeatureDprint, false); + tt::llrt::OptionsG.set_feature_file_name(tt::llrt::RunTimeDebugFeatureDprint, ""); + tt::llrt::OptionsG.set_test_mode_enabled(false); + tt::llrt::OptionsG.set_watcher_enabled(watcher_previous_enabled); + } + + void RunTestOnDevice( + const std::function& run_function, + Device* device + ) { + auto run_function_no_args = [=]() { + run_function(this, device); + }; + DebugToolsFixture::RunTestOnDevice(run_function_no_args, device); + tt::DPrintServerClearLogFile(); + tt::DPrintServerClearSignals(); + } + + // Override this function in child classes for additional setup commands between DPRINT setup + // and device creation. + virtual void ExtraSetUp() {} +}; + +// For usage by tests that need the dprint server devices disabled. +class DPrintFixtureDisableDevices: public DPrintFixture { +protected: + void ExtraSetUp() override { + // For this test, mute each devices using the environment variable + tt::llrt::OptionsG.set_feature_all_chips(tt::llrt::RunTimeDebugFeatureDprint, false); + tt::llrt::OptionsG.set_feature_chip_ids(tt::llrt::RunTimeDebugFeatureDprint, {}); + } +}; + +// A version of DispatchFixture with watcher enabled +class WatcherFixture: public DebugToolsFixture { public: inline static const string log_file_name = "generated/watcher/watcher.log"; inline static const int interval_ms = 250; @@ -20,7 +106,7 @@ class WatcherFixture: public CommonFixture { void RunProgram(Device* device, Program& program, bool wait_for_dump = false) { // Only difference is that we need to wait for the print server to catch // up after running a test. - CommonFixture::RunProgram(device, program); + DebugToolsFixture::RunProgram(device, program); // Wait for watcher to run a full dump before finishing, need to wait for dump count to // increase because we'll likely check in the middle of a dump. @@ -57,12 +143,12 @@ class WatcherFixture: public CommonFixture { tt::watcher_clear_log(); // Parent class initializes devices and any necessary flags - CommonFixture::SetUp(); + DebugToolsFixture::SetUp(); } void TearDown() override { // Parent class tears down devices - CommonFixture::TearDown(); + DebugToolsFixture::TearDown(); // Reset watcher settings to their previous values tt::llrt::OptionsG.set_watcher_enabled(watcher_previous_enabled); @@ -82,7 +168,7 @@ class WatcherFixture: public CommonFixture { auto run_function_no_args = [=]() { run_function(this, device); }; - CommonFixture::RunTestOnDevice(run_function_no_args, device); + DebugToolsFixture::RunTestOnDevice(run_function_no_args, device); // Wait for a final watcher poll and then clear the log. std::this_thread::sleep_for(std::chrono::milliseconds(interval_ms)); tt::watcher_clear_log(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp similarity index 97% rename from tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp rename to tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp index 1b1b4d6104f..28725cbccaf 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 @@ -14,7 +14,7 @@ #include "tt_metal/impl/device/device_pool.hpp" // A dispatch-agnostic test fixture -class CommonFixture: public ::testing::Test { +class DispatchFixture: public ::testing::Test { public: // A function to run a program, according to which dispatch mode is set. void RunProgram(tt::tt_metal::Device* device, tt::tt_metal::Program& program) { diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/dprint_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_common/common/dprint_fixture.hpp deleted file mode 100644 index 829a9feb140..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_common/common/dprint_fixture.hpp +++ /dev/null @@ -1,95 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include "common_fixture.hpp" -#include "impl/debug/dprint_server.hpp" -#include "tt_metal/common/core_descriptor.hpp" - -// A version of CommonFixture with DPrint enabled on all cores. -class DPrintFixture: public CommonFixture { -public: - inline static const string dprint_file_name = "gtest_dprint_log.txt"; - - // A function to run a program, according to which dispatch mode is set. - void RunProgram(Device* device, Program& program) { - // Only difference is that we need to wait for the print server to catch - // up after running a test. - CommonFixture::RunProgram(device, program); - tt::DprintServerAwait(); - } - -protected: - // Running with dprint + watcher enabled can make the code size blow up, so let's force watcher - // disabled for DPRINT tests. - bool watcher_previous_enabled; - void SetUp() override { - // The core range (physical) needs to be set >= the set of all cores - // used by all tests using this fixture, so set dprint enabled for - // all cores and all devices - tt::llrt::OptionsG.set_feature_enabled(tt::llrt::RunTimeDebugFeatureDprint, true); - tt::llrt::OptionsG.set_feature_all_cores( - tt::llrt::RunTimeDebugFeatureDprint, CoreType::WORKER, tt::llrt::RunTimeDebugClassWorker); - tt::llrt::OptionsG.set_feature_all_cores( - tt::llrt::RunTimeDebugFeatureDprint, CoreType::ETH, tt::llrt::RunTimeDebugClassWorker); - tt::llrt::OptionsG.set_feature_all_chips(tt::llrt::RunTimeDebugFeatureDprint, true); - // Send output to a file so the test can check after program is run. - tt::llrt::OptionsG.set_feature_file_name(tt::llrt::RunTimeDebugFeatureDprint, dprint_file_name); - tt::llrt::OptionsG.set_test_mode_enabled(true); - watcher_previous_enabled = tt::llrt::OptionsG.get_watcher_enabled(); - tt::llrt::OptionsG.set_watcher_enabled(false); - - ExtraSetUp(); - - // Parent class initializes devices and any necessary flags - CommonFixture::SetUp(); - } - - void TearDown() override { - // Parent class tears down devices - CommonFixture::TearDown(); - - // Remove the DPrint output file after the test is finished. - std::remove(dprint_file_name.c_str()); - - // Reset DPrint settings - tt::llrt::OptionsG.set_feature_cores(tt::llrt::RunTimeDebugFeatureDprint, {}); - tt::llrt::OptionsG.set_feature_enabled(tt::llrt::RunTimeDebugFeatureDprint, false); - tt::llrt::OptionsG.set_feature_all_cores( - tt::llrt::RunTimeDebugFeatureDprint, CoreType::WORKER, tt::llrt::RunTimeDebugClassNoneSpecified); - tt::llrt::OptionsG.set_feature_all_cores( - tt::llrt::RunTimeDebugFeatureDprint, CoreType::ETH, tt::llrt::RunTimeDebugClassNoneSpecified); - tt::llrt::OptionsG.set_feature_all_chips(tt::llrt::RunTimeDebugFeatureDprint, false); - tt::llrt::OptionsG.set_feature_file_name(tt::llrt::RunTimeDebugFeatureDprint, ""); - tt::llrt::OptionsG.set_test_mode_enabled(false); - tt::llrt::OptionsG.set_watcher_enabled(watcher_previous_enabled); - } - - void RunTestOnDevice( - const std::function& run_function, - Device* device - ) { - auto run_function_no_args = [=]() { - run_function(this, device); - }; - CommonFixture::RunTestOnDevice(run_function_no_args, device); - tt::DPrintServerClearLogFile(); - tt::DPrintServerClearSignals(); - } - - // Override this function in child classes for additional setup commands between DPRINT setup - // and device creation. - virtual void ExtraSetUp() {} -}; - -// For usage by tests that need the dprint server devices disabled. -class DPrintFixtureDisableDevices: public DPrintFixture { -protected: - void ExtraSetUp() override { - // For this test, mute each devices using the environment variable - tt::llrt::OptionsG.set_feature_all_chips(tt::llrt::RunTimeDebugFeatureDprint, false); - tt::llrt::OptionsG.set_feature_chip_ids(tt::llrt::RunTimeDebugFeatureDprint, {}); - } -}; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp b/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp index a5288527ff3..1dcb5c71997 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp @@ -4,13 +4,13 @@ // This file contains dispatch tests that are (generally) dispatch mode agnostic -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" using std::vector; // Test sync w/ semaphores betweeen eth/tensix cores // Test will hang in the kernel if the sync doesn't work properly -static void test_sems_across_core_types(CommonFixture *fixture, +static void test_sems_across_core_types(DispatchFixture *fixture, vector& devices, bool active_eth) { // just something unique... @@ -89,7 +89,7 @@ static void test_sems_across_core_types(CommonFixture *fixture, } } -TEST_F(CommonFixture, EthTestBlank) { +TEST_F(DispatchFixture, EthTestBlank) { Device *device = devices_[0]; Program program = CreateProgram(); @@ -113,7 +113,7 @@ TEST_F(CommonFixture, EthTestBlank) { } } -TEST_F(CommonFixture, TensixTestInitLocalMemory) { +TEST_F(DispatchFixture, TensixTestInitLocalMemory) { // This test will hang/assert if there is a failure @@ -136,7 +136,7 @@ TEST_F(CommonFixture, TensixTestInitLocalMemory) { this->RunProgram(device, program); } -TEST_F(CommonFixture, EthTestInitLocalMemory) { +TEST_F(DispatchFixture, EthTestInitLocalMemory) { // This test will hang/assert if there is a failure @@ -167,11 +167,11 @@ TEST_F(CommonFixture, EthTestInitLocalMemory) { } } -TEST_F(CommonFixture, TensixActiveEthTestSemaphores) { +TEST_F(DispatchFixture, TensixActiveEthTestSemaphores) { test_sems_across_core_types(this, this->devices_, true); } -TEST_F(CommonFixture, TensixIdleEthTestSemaphores) { +TEST_F(DispatchFixture, TensixIdleEthTestSemaphores) { if (not this->slow_dispatch_) { GTEST_SKIP(); } @@ -181,7 +181,7 @@ TEST_F(CommonFixture, TensixIdleEthTestSemaphores) { // This test was written to cover issue #12738 (CBs for workers showing up on // active eth cores) -TEST_F(CommonFixture, TensixActiveEthTestCBsAcrossDifferentCoreTypes) { +TEST_F(DispatchFixture, TensixActiveEthTestCBsAcrossDifferentCoreTypes) { uint32_t intermediate_cb = 24; uint32_t out_cb = 16; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp index 88849d33472..3890154ce4e 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" @@ -83,7 +83,7 @@ void set_math_fid_masks(uint16_t &math_fid_mask, MathFidelity math_fidelity = Ma } } -void matmul_tile(CommonFixture *fixture, tt_metal::Device *device, const MatmulTileConfig &cfg, vector activations, vector weights, vector tensor_vals){ +void matmul_tile(DispatchFixture *fixture, tt_metal::Device *device, const MatmulTileConfig &cfg, vector activations, vector weights, vector tensor_vals){ tt_metal::Program program = tt_metal::CreateProgram(); CoreCoord core = {0, 0}; @@ -351,7 +351,7 @@ using namespace unit_tests_common::matmul::test_matmul_X_tile; } */ -TEST_F(CommonFixture, TensixMatmulSingleTile){ +TEST_F(DispatchFixture, TensixMatmulSingleTile){ for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; for (bool fp32_dest_acc_en : {true, false}) { @@ -377,7 +377,7 @@ TEST_F(CommonFixture, TensixMatmulSingleTile){ } } -TEST_F(CommonFixture, TensixMatmulMultiTile){ +TEST_F(DispatchFixture, TensixMatmulMultiTile){ for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; for (bool fp32_dest_acc_en : {true, false}) { @@ -410,7 +410,7 @@ TEST_F(CommonFixture, TensixMatmulMultiTile){ } } -TEST_F(CommonFixture, TensixMatmulBlock){ +TEST_F(DispatchFixture, TensixMatmulBlock){ for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; for (bool fp32_dest_acc_en : {true, false}) { @@ -441,7 +441,7 @@ TEST_F(CommonFixture, TensixMatmulBlock){ } } -TEST_F(CommonFixture, TensixMatmulBlockInitShort){ +TEST_F(DispatchFixture, TensixMatmulBlockInitShort){ for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; for (bool fp32_dest_acc_en : {true, false}) { @@ -472,7 +472,7 @@ TEST_F(CommonFixture, TensixMatmulBlockInitShort){ } } -TEST_F(CommonFixture, TensixMatmulBlockInitShortWithDt){ +TEST_F(DispatchFixture, TensixMatmulBlockInitShortWithDt){ for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; for (bool fp32_dest_acc_en : {true, false}) { diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp index 2db444f66a7..a5b7fcc9dd0 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" @@ -137,7 +137,7 @@ void create_CBs_for_fused_matmul(tt_metal::Program &program, tt_metal::Device* d } } -bool matmul_large_block(CommonFixture *fixture, tt_metal::Device *device, bool activations_rm, bool output_rm, MathFidelity math_fidelity = MathFidelity::HiFi4) { +bool matmul_large_block(DispatchFixture *fixture, tt_metal::Device *device, bool activations_rm, bool output_rm, MathFidelity math_fidelity = MathFidelity::HiFi4) { bool pass = true; tt_metal::Program program = tt_metal::CreateProgram(); @@ -365,7 +365,7 @@ bool matmul_large_block(CommonFixture *fixture, tt_metal::Device *device, bool a } -TEST_F(CommonFixture, TensixMatmulLargeBlock) { +TEST_F(DispatchFixture, TensixMatmulLargeBlock) { for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue;; tt::log_info(tt::LogTest, "Math Fidelity = {}", i); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp index 1fa16fa1570..32b30ab4d34 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" @@ -368,7 +368,7 @@ bool assign_runtime_args_to_program( return pass; } -bool matmul_multi_core_multi_dram(CommonFixture *fixture, tt_metal::Device *device){ +bool matmul_multi_core_multi_dram(DispatchFixture *fixture, tt_metal::Device *device){ bool pass = true; int num_cores_r = device->compute_with_storage_grid_size().y; int num_cores_c = device->compute_with_storage_grid_size().x; @@ -498,7 +498,7 @@ bool matmul_multi_core_multi_dram(CommonFixture *fixture, tt_metal::Device *devi } -TEST_F(CommonFixture, TensixMatmulMultiCoreSingleDRAM){ +TEST_F(DispatchFixture, TensixMatmulMultiCoreSingleDRAM){ const char* arch = getenv("ARCH_NAME"); if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ log_info(LogTest, "This test is only supported in slow dispatch mode"); @@ -512,7 +512,7 @@ TEST_F(CommonFixture, TensixMatmulMultiCoreSingleDRAM){ } } -TEST_F(CommonFixture, TensixMatmulMultiCoreMultiDRAM){ +TEST_F(DispatchFixture, TensixMatmulMultiCoreMultiDRAM){ // need to update move_tiles_to_dram to support both slow and fast if (getenv("TT_METAL_SLOW_DISPATCH_MODE")){ log_info(LogTest, "This test is not supported in slow dispatch mode, need to update move_tiles_to_dram.."); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp index 69e743782ae..bd28c7d35a0 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" @@ -473,7 +473,7 @@ bool matmul_multi_core_multi_dram_in0_mcast_in1_mcast(tt_metal::Device *device){ } // namespace unit_tests_common::matmul::test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast -TEST_F(CommonFixture, TensixMatmulMultiCoreMultiDRAMIn0MCastIn1MCast) { +TEST_F(DispatchFixture, TensixMatmulMultiCoreMultiDRAMIn0MCastIn1MCast) { if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ tt::log_info(tt::LogTest, "This test is only supported in slow dispatch mode"); GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp index 611db2e65ca..6785c4394d6 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" @@ -390,7 +390,7 @@ bool matmul_multi_core_multi_dram_inX_mcast(tt_metal::Device *device, int in1_or } } // namespace unit_tests_common::matmul::test_matmul_multi_core -TEST_F(CommonFixture, TensixMatmulMultiCoreMultiDRAMIn0MCast) { +TEST_F(DispatchFixture, TensixMatmulMultiCoreMultiDRAMIn0MCast) { if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ tt::log_info(tt::LogTest, "This test is only supported in slow dispatch mode"); GTEST_SKIP(); @@ -400,7 +400,7 @@ TEST_F(CommonFixture, TensixMatmulMultiCoreMultiDRAMIn0MCast) { } } -TEST_F(CommonFixture, TensixMatmulMultiCoreMultiDRAMIn1MCast) { +TEST_F(DispatchFixture, TensixMatmulMultiCoreMultiDRAMIn1MCast) { if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ tt::log_info(tt::LogTest, "This test is only supported in slow dispatch mode"); GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp index 88c539367c3..7a67231bb06 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" @@ -22,7 +22,7 @@ using namespace tt; namespace unit_tests_common::matmul::test_matmul_single_core{ -bool matmul_single_core(CommonFixture *fixture, tt_metal::Device *device, int M, int N, int K, int out_subblock_h, int out_subblock_w){ +bool matmul_single_core(DispatchFixture *fixture, tt_metal::Device *device, int M, int N, int K, int out_subblock_h, int out_subblock_w){ bool pass = true; tt_metal::Program program = tt_metal::CreateProgram(); @@ -216,7 +216,7 @@ bool matmul_single_core(CommonFixture *fixture, tt_metal::Device *device, int M, } } // namespace unit_tests_common::matmul::test_matmul_single_core -TEST_F (CommonFixture, TensixMatmulSingleCoreSmall){ +TEST_F (DispatchFixture, TensixMatmulSingleCoreSmall){ uint32_t M = 4; uint32_t K = 4; uint32_t N = 4; @@ -227,7 +227,7 @@ TEST_F (CommonFixture, TensixMatmulSingleCoreSmall){ } } -TEST_F (CommonFixture, TensixMatmulSingleCore){ +TEST_F (DispatchFixture, TensixMatmulSingleCore){ if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ log_info(LogTest, "Fast dispatch buffer memory issue, skipping for now"); GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp index b84918d946a..db9a8452014 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" @@ -66,7 +66,7 @@ inline std::vector gold_standard_flatten(std::vector src_vec return expected_dst_vec; } -bool flatten(CommonFixture *fixture, tt_metal::Device *device, uint32_t num_tiles_r = 5, uint32_t num_tiles_c = 5) { +bool flatten(DispatchFixture *fixture, tt_metal::Device *device, uint32_t num_tiles_r = 5, uint32_t num_tiles_c = 5) { bool pass = true; tt_metal::Program program = tt_metal::CreateProgram(); @@ -191,7 +191,7 @@ bool flatten(CommonFixture *fixture, tt_metal::Device *device, uint32_t num_tile } -TEST_F(CommonFixture, TensixFlatten){ +TEST_F(DispatchFixture, TensixFlatten){ // TODO: Re-enable when #7264 is fixed GTEST_SKIP(); uint32_t num_tiles_r = 2; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp index 39f47d9b020..78824f98ea7 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "dprint_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "gtest/gtest.h" #include "test_utils.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp index 0b9e661ce16..faff93cf981 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "dprint_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "common/bfloat16.hpp" #include "test_utils.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp index 5cabeb1a3a4..c0b2ac3362d 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 -#include "dprint_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "gtest/gtest.h" #include "impl/debug/dprint_server.hpp" #include "test_utils.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp index e40c3fa4cfe..e6b00e9144d 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "dprint_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "common/bfloat16.hpp" #include "gtest/gtest.h" #include "test_utils.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp index c4781ce67aa..b599bed43eb 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 -#include "dprint_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "test_utils.hpp" ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp index b8be9466260..13a447d1eb9 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "dprint_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "common/bfloat16.hpp" #include "gtest/gtest.h" #include "test_utils.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp index a58737414bd..d763ef97ebe 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "common/bfloat16.hpp" -#include "dprint_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "gtest/gtest.h" #include "test_utils.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tiles.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tiles.cpp index 6a0210a9ef6..d5120c259e3 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tiles.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tiles.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "dprint_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "test_utils.hpp" #include "common/bfloat8.hpp" #include "common/bfloat4.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp index 96b59573269..3f844ccdc0e 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "dprint_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "gtest/gtest.h" #include "test_utils.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram.cpp index 2bdae62bc21..f94b0423f42 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" @@ -24,7 +24,7 @@ struct DRAMConfig{ tt_metal::DataMovementConfig data_movement_cfg; }; -bool dram_single_core_db (CommonFixture* fixture, tt_metal::Device *device){ +bool dram_single_core_db (DispatchFixture* fixture, tt_metal::Device *device){ tt_metal::Program program = tt_metal::CreateProgram(); CoreCoord core = {0, 0}; @@ -90,7 +90,7 @@ bool dram_single_core_db (CommonFixture* fixture, tt_metal::Device *device){ return input_vec == result_vec; } -bool dram_single_core (CommonFixture* fixture, tt_metal::Device *device, const DRAMConfig &cfg, std::vector src_vec){ +bool dram_single_core (DispatchFixture* fixture, tt_metal::Device *device, const DRAMConfig &cfg, std::vector src_vec){ // Create a program tt_metal::Program program = CreateProgram(); @@ -139,7 +139,7 @@ bool dram_single_core (CommonFixture* fixture, tt_metal::Device *device, const D } } -TEST_F(CommonFixture, TensixDRAMLoopbackSingleCore){ +TEST_F(DispatchFixture, TensixDRAMLoopbackSingleCore){ uint32_t buffer_size = 2 * 1024 * 25; std::vector src_vec = create_random_vector_of_bfloat16( buffer_size, 100, std::chrono::system_clock::now().time_since_epoch().count()); @@ -155,7 +155,7 @@ TEST_F(CommonFixture, TensixDRAMLoopbackSingleCore){ } } -TEST_F(CommonFixture, TensixDRAMLoopbackSingleCoreDB){ +TEST_F(DispatchFixture, TensixDRAMLoopbackSingleCoreDB){ if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ tt::log_info(tt::LogTest, "This test is only supported in slow dispatch mode"); GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp index 378a0f51629..4da1b98c956 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" @@ -23,7 +23,7 @@ struct DRAMtoL1MulticastConfig{ CoreCoord exclude_direction; }; -bool dram_to_l1_multicast(CommonFixture* fixture, tt_metal::Device *device, const DRAMtoL1MulticastConfig &cfg){ +bool dram_to_l1_multicast(DispatchFixture* fixture, tt_metal::Device *device, const DRAMtoL1MulticastConfig &cfg){ bool pass = true; tt_metal::Program program = tt_metal::CreateProgram(); @@ -123,7 +123,7 @@ bool dram_to_l1_multicast(CommonFixture* fixture, tt_metal::Device *device, cons } } -TEST_F(CommonFixture, TensixDRAMtoL1Multicast){ +TEST_F(DispatchFixture, TensixDRAMtoL1Multicast){ unit_tests_common::dram::test_dram_to_l1_multicast::DRAMtoL1MulticastConfig test_config = { .dest_buffer_addr = 200 * 1024, .target_grid_offset = 1, @@ -133,7 +133,7 @@ TEST_F(CommonFixture, TensixDRAMtoL1Multicast){ ASSERT_TRUE(unit_tests_common::dram::test_dram_to_l1_multicast::dram_to_l1_multicast(this, devices_.at(id), test_config)); } } -TEST_F(CommonFixture, TensixDRAMtoL1MulticastLoopbackSrc){ +TEST_F(DispatchFixture, TensixDRAMtoL1MulticastLoopbackSrc){ unit_tests_common::dram::test_dram_to_l1_multicast::DRAMtoL1MulticastConfig test_config = { .dest_buffer_addr = 500 * 1024, .target_grid_offset = 0, diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp index 2802d2d1401..d097db29542 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "watcher_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "test_utils.hpp" ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp index 07578ecc9c2..dd30679b880 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "watcher_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "test_utils.hpp" ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp index eeedaa9aa6d..b24754bdd50 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "watcher_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "test_utils.hpp" #include "llrt/llrt.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp index c8c6b6c154b..47ee26037e5 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "llrt/rtoptions.hpp" -#include "watcher_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "test_utils.hpp" #include "llrt/llrt.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp index a7c3d048712..e3d10780934 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "watcher_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "test_utils.hpp" ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp index 0bed2d67a86..5ea9193b83e 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "watcher_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "test_utils.hpp" ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_waypoint.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_waypoint.cpp index 8da13273c27..32f862b99cc 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_waypoint.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_waypoint.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "watcher_fixture.hpp" +#include "debug_tools_fixtures.hpp" #include "test_utils.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/CMakeLists.txt index 30a552af009..6c251c99a95 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/CMakeLists.txt @@ -30,6 +30,7 @@ target_include_directories( ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/tt_metal ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common ) diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp index 201e6bcc3c5..86f400222eb 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp @@ -4,8 +4,8 @@ #include #include -#include #include "command_queue_fixture.hpp" +#include "trace_fixtures.hpp" #include "command_queue_test_utils.hpp" #include "gtest/gtest.h" #include "impl/buffers/buffer.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp index da46c682e98..370e1b052f8 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp @@ -8,6 +8,7 @@ #include "command_queue_fixture.hpp" #include "command_queue_test_utils.hpp" +#include "trace_fixtures.hpp" #include "detail/tt_metal.hpp" #include "tt_metal/common/env_lib.hpp" #include "gtest/gtest.h" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp index e380c41d67c..4e03e9f8b5e 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp @@ -5,6 +5,7 @@ #include #include "command_queue_fixture.hpp" +#include "command_queue_fixtures.hpp" #include "command_queue_test_utils.hpp" #include "gtest/gtest.h" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp index b5efa2e0729..de6be0e64f0 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp @@ -4,10 +4,6 @@ #pragma once -#include -#include -#include -#include #include "common/core_coord.hpp" #include "common/env_lib.hpp" #include "gtest/gtest.h" @@ -88,90 +84,6 @@ class CommandQueueMultiDeviceFixture : public ::testing::Test { size_t num_devices_; }; -class CommandQueueSingleCardFixture : public ::testing::Test { - protected: - void SetUp() override { - this->validate_dispatch_mode(); - this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); - this->create_devices(); - } - - void TearDown() override { tt::tt_metal::detail::CloseDevices(reserved_devices_); } - - void validate_dispatch_mode() { - auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); - if (slow_dispatch) { - TT_THROW("This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); - GTEST_SKIP(); - } - } - - void create_devices(const std::size_t trace_region_size = DEFAULT_TRACE_REGION_SIZE) { - const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); - const chip_id_t mmio_device_id = 0; - this->reserved_devices_ = tt::tt_metal::detail::CreateDevices( - {mmio_device_id}, 1, DEFAULT_L1_SMALL_SIZE, trace_region_size, dispatch_core_type); - auto enable_remote_chip = getenv("TT_METAL_ENABLE_REMOTE_CHIP"); - if (enable_remote_chip) { - for (const auto &[id, device] : this->reserved_devices_) { - this->devices_.push_back(device); - } - } else { - this->devices_.push_back(this->reserved_devices_.at(mmio_device_id)); - } - - this->num_devices_ = this->reserved_devices_.size(); - } - - std::vector devices_; - std::map reserved_devices_; - tt::ARCH arch_; - size_t num_devices_; -}; - -class CommandQueueSingleCardTraceFixture : virtual public CommandQueueSingleCardFixture { - protected: - void SetUp() override { - this->validate_dispatch_mode(); - this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); - this->create_devices(90000000); - } -}; - -class SingleDeviceTraceFixture: public ::testing::Test { -protected: - tt::tt_metal::Device* device_; - tt::ARCH arch_; - - void Setup(const size_t buffer_size, const uint8_t num_hw_cqs = 1) { - auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); - if (slow_dispatch) { - tt::log_info(tt::LogTest, "This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); - GTEST_SKIP(); - } - if (num_hw_cqs > 1) { - // Running multi-CQ test. User must set this explicitly. - auto num_cqs = getenv("TT_METAL_GTEST_NUM_HW_CQS"); - if (num_cqs == nullptr or strcmp(num_cqs, "2")) { - TT_THROW("This suite must be run with TT_METAL_GTEST_NUM_HW_CQS=2"); - GTEST_SKIP(); - } - } - this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); - const int device_id = 0; - const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); - const chip_id_t mmio_device_id = 0; - this->device_ = tt::tt_metal::detail::CreateDevices({mmio_device_id}, 1, DEFAULT_L1_SMALL_SIZE, buffer_size, dispatch_core_type).at(mmio_device_id); - } - - void TearDown() override { - if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")) { - tt::tt_metal::CloseDevice(this->device_); - } - } - -}; - class RandomProgramFixture : virtual public CommandQueueSingleCardFixture { protected: static const uint32_t MIN_KERNEL_SIZE_BYTES = 20; diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp index 442428347b4..ae24f15bf06 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp @@ -10,6 +10,7 @@ #include #include "command_queue_fixture.hpp" +#include "command_queue_fixtures.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/dispatch/command_queue.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp index cf5d37e7a98..4537d504b05 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp @@ -9,6 +9,7 @@ #include #include "command_queue_fixture.hpp" +#include "command_queue_fixtures.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/kernels/kernel.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/CMakeLists.txt index 9cef200d2fa..49d29eddb8f 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/CMakeLists.txt @@ -16,6 +16,7 @@ target_include_directories( ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/tt_metal ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common ) diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp index ea960df1259..7428a8108b6 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "command_queue_fixture.hpp" +#include "trace_fixtures.hpp" #include "gtest/gtest.h" #include "tt_metal/common/scoped_timer.hpp" #include "tt_metal/host_api.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp index b3efb0e4f16..bf0796c64d0 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp @@ -85,36 +85,3 @@ class MultiCommandQueueMultiDeviceFixture : public ::testing::Test { size_t num_devices_; tt::ARCH arch_; }; - - -class SingleDeviceTraceFixture: public ::testing::Test { -protected: - Device* device_; - tt::ARCH arch_; - - void Setup(const size_t buffer_size, const uint8_t num_hw_cqs = 1) { - auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); - if (slow_dispatch) { - tt::log_info(tt::LogTest, "This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); - GTEST_SKIP(); - } - if (num_hw_cqs > 1) { - // Running multi-CQ test. User must set this explicitly. - auto num_cqs = getenv("TT_METAL_GTEST_NUM_HW_CQS"); - if (num_cqs == nullptr or strcmp(num_cqs, "2")) { - TT_THROW("This suite must be run with TT_METAL_GTEST_NUM_HW_CQS=2"); - GTEST_SKIP(); - } - } - this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); - const int device_id = 0; - this->device_ = tt::tt_metal::CreateDevice(device_id, num_hw_cqs, 0, buffer_size);; - } - - void TearDown() override { - if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")) { - tt::tt_metal::CloseDevice(this->device_); - } - } - -}; diff --git a/tests/ttnn/unit_tests/gtests/test_add.cpp b/tests/ttnn/unit_tests/gtests/test_add.cpp index c1be54118a6..cc386e6836b 100644 --- a/tests/ttnn/unit_tests/gtests/test_add.cpp +++ b/tests/ttnn/unit_tests/gtests/test_add.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "ttnn/device.hpp" #include "ttnn/operations/eltwise/binary/binary.hpp" #include "ttnn/operations/core/core.hpp" diff --git a/tests/ttnn/unit_tests/gtests/test_graph_add.cpp b/tests/ttnn/unit_tests/gtests/test_graph_add.cpp index 311639585bc..dec3a99af78 100644 --- a/tests/ttnn/unit_tests/gtests/test_graph_add.cpp +++ b/tests/ttnn/unit_tests/gtests/test_graph_add.cpp @@ -4,7 +4,7 @@ #include "gtest/gtest.h" #include "tt_metal/common/logger.hpp" -#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp" +#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" #include "ttnn/device.hpp" #include "ttnn/operations/eltwise/binary/binary.hpp" #include "ttnn/operations/core/core.hpp" From 3bcd2778cec9edd6516d963a2e67fd5ca1589d47 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Thu, 31 Oct 2024 23:30:55 +0000 Subject: [PATCH 05/26] #0: More changes to test structuring --- .../unit_tests/common/device_fixture.hpp | 85 ----------- .../common/multi_device_fixture.hpp | 138 ++++++++++++++++++ .../unit_tests/common/n300_device_fixture.hpp | 50 ------- .../unit_tests/ethernet/basic_eth_kernels.cpp | 2 +- .../ethernet/buffer_movement_kernels.cpp | 2 +- .../ethernet/device_cluster_api.cpp | 2 +- .../ethernet/erisc_app_direct_send.cpp | 2 +- .../ethernet/galaxy_cluster_api.cpp | 6 +- .../ethernet/ring_gather_kernels.cpp | 2 +- 9 files changed, 144 insertions(+), 145 deletions(-) create mode 100644 tests/tt_metal/tt_metal/unit_tests/common/multi_device_fixture.hpp delete mode 100644 tests/tt_metal/tt_metal/unit_tests/common/n300_device_fixture.hpp diff --git a/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp index 7e638470b1c..4d637d67db1 100644 --- a/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp @@ -99,88 +99,3 @@ class BlackholeSingleCardFixture : public DeviceSingleCardFixture { num_devices_ = reserved_devices_.size(); } }; - -class GalaxyFixture : public ::testing::Test { - protected: - void SkipTestSuiteIfNotGalaxyMotherboard() - { - const tt::ARCH arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); - const size_t num_devices = tt::tt_metal::GetNumAvailableDevices(); - if (!(arch == tt::ARCH::WORMHOLE_B0 && num_devices >= 32)) - { - GTEST_SKIP(); - } - } - - void InitializeDevices() - { - const size_t num_devices = tt::tt_metal::GetNumAvailableDevices(); - std::vector ids; - for (uint32_t id = 0; id < num_devices; id++) - { - ids.push_back(id); - } - this->device_ids_to_devices_ = tt::tt_metal::detail::CreateDevices(ids); - this->devices_ = tt::DevicePool::instance().get_all_active_devices(); - } - - void SetUp() override - { - this->SkipTestSuiteIfNotGalaxyMotherboard(); - this->InitializeDevices(); - } - - void TearDown() override - { - tt::tt_metal::detail::CloseDevices(this->device_ids_to_devices_); - this->device_ids_to_devices_.clear(); - this->devices_.clear(); - } - - std::vector devices_; - - private: - std::map device_ids_to_devices_; -}; - -class TGFixture : public GalaxyFixture -{ - protected: - void SkipTestSuiteIfNotTG() - { - this->SkipTestSuiteIfNotGalaxyMotherboard(); - const size_t num_devices = tt::tt_metal::GetNumAvailableDevices(); - const size_t num_pcie_devices = tt::tt_metal::GetNumPCIeDevices(); - if (!(num_devices == 32 && num_pcie_devices == 4)) - { - GTEST_SKIP(); - } - } - - void SetUp() override - { - this->SkipTestSuiteIfNotTG(); - this->InitializeDevices(); - } -}; - -class TGGFixture : public GalaxyFixture -{ - protected: - void SkipTestSuiteIfNotTGG() - { - this->SkipTestSuiteIfNotGalaxyMotherboard(); - const size_t num_devices = tt::tt_metal::GetNumAvailableDevices(); - const size_t num_pcie_devices = tt::tt_metal::GetNumPCIeDevices(); - if (!(num_devices == 64 && num_pcie_devices == 8)) - { - GTEST_SKIP(); - } - } - - void SetUp() override - { - this->SkipTestSuiteIfNotTGG(); - this->InitializeDevices(); - } -}; diff --git a/tests/tt_metal/tt_metal/unit_tests/common/multi_device_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests/common/multi_device_fixture.hpp new file mode 100644 index 00000000000..7ebc03147df --- /dev/null +++ b/tests/tt_metal/tt_metal/unit_tests/common/multi_device_fixture.hpp @@ -0,0 +1,138 @@ +// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include + +#include "tt_metal/host_api.hpp" +#include "tt_metal/detail/tt_metal.hpp" +#include "tt_metal/test_utils/env_vars.hpp" +#include "tt_metal/impl/device/device_pool.hpp" + +class MultiDeviceFixture : public ::testing::Test {}; + +class GalaxyFixture : public MultiDeviceFixture { + protected: + void SkipTestSuiteIfNotGalaxyMotherboard() + { + const tt::ARCH arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + const size_t num_devices = tt::tt_metal::GetNumAvailableDevices(); + if (!(arch == tt::ARCH::WORMHOLE_B0 && num_devices >= 32)) + { + GTEST_SKIP(); + } + } + + void InitializeDevices() + { + const size_t num_devices = tt::tt_metal::GetNumAvailableDevices(); + std::vector ids; + for (uint32_t id = 0; id < num_devices; id++) + { + ids.push_back(id); + } + this->device_ids_to_devices_ = tt::tt_metal::detail::CreateDevices(ids); + this->devices_ = tt::DevicePool::instance().get_all_active_devices(); + } + + void SetUp() override + { + this->SkipTestSuiteIfNotGalaxyMotherboard(); + this->InitializeDevices(); + } + + void TearDown() override + { + tt::tt_metal::detail::CloseDevices(this->device_ids_to_devices_); + this->device_ids_to_devices_.clear(); + this->devices_.clear(); + } + + std::vector devices_; + + private: + std::map device_ids_to_devices_; +}; + +class TGFixture : public GalaxyFixture +{ + protected: + void SkipTestSuiteIfNotTG() + { + this->SkipTestSuiteIfNotGalaxyMotherboard(); + const size_t num_devices = tt::tt_metal::GetNumAvailableDevices(); + const size_t num_pcie_devices = tt::tt_metal::GetNumPCIeDevices(); + if (!(num_devices == 32 && num_pcie_devices == 4)) + { + GTEST_SKIP(); + } + } + + void SetUp() override + { + this->SkipTestSuiteIfNotTG(); + this->InitializeDevices(); + } +}; + +class TGGFixture : public GalaxyFixture +{ + protected: + void SkipTestSuiteIfNotTGG() + { + this->SkipTestSuiteIfNotGalaxyMotherboard(); + const size_t num_devices = tt::tt_metal::GetNumAvailableDevices(); + const size_t num_pcie_devices = tt::tt_metal::GetNumPCIeDevices(); + if (!(num_devices == 64 && num_pcie_devices == 8)) + { + GTEST_SKIP(); + } + } + + void SetUp() override + { + this->SkipTestSuiteIfNotTGG(); + this->InitializeDevices(); + } +}; + +class N300DeviceFixture : public MultiDeviceFixture { + protected: + void SetUp() override { + auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); + if (not slow_dispatch) { + TT_THROW("This suite can only be run with TT_METAL_SLOW_DISPATCH_MODE set"); + GTEST_SKIP(); + } + arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + + num_devices_ = tt::tt_metal::GetNumAvailableDevices(); + if (arch_ == tt::ARCH::WORMHOLE_B0 and tt::tt_metal::GetNumAvailableDevices() == 2 and + tt::tt_metal::GetNumPCIeDevices() == 1) { + std::vector ids; + for (unsigned int id = 0; id < num_devices_; id++) { + ids.push_back(id); + } + + const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); + tt::DevicePool::initialize(ids, 1, DEFAULT_L1_SMALL_SIZE, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); + devices_ = tt::DevicePool::instance().get_all_active_devices(); + + } else { + GTEST_SKIP(); + } + } + + void TearDown() override { + tt::Cluster::instance().set_internal_routing_info_for_ethernet_cores(false); + for (unsigned int id = 0; id < devices_.size(); id++) { + tt::tt_metal::CloseDevice(devices_.at(id)); + } + } + + std::vector devices_; + tt::ARCH arch_; + size_t num_devices_; +}; diff --git a/tests/tt_metal/tt_metal/unit_tests/common/n300_device_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests/common/n300_device_fixture.hpp deleted file mode 100644 index 08e57a5cb2a..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests/common/n300_device_fixture.hpp +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include - -#include "tt_metal/host_api.hpp" -#include "tt_metal/test_utils/env_vars.hpp" -#include "tt_metal/impl/device/device_pool.hpp" - -class N300DeviceFixture : public ::testing::Test { - protected: - void SetUp() override { - auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); - if (not slow_dispatch) { - TT_THROW("This suite can only be run with TT_METAL_SLOW_DISPATCH_MODE set"); - GTEST_SKIP(); - } - arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); - - num_devices_ = tt::tt_metal::GetNumAvailableDevices(); - if (arch_ == tt::ARCH::WORMHOLE_B0 and tt::tt_metal::GetNumAvailableDevices() == 2 and - tt::tt_metal::GetNumPCIeDevices() == 1) { - std::vector ids; - for (unsigned int id = 0; id < num_devices_; id++) { - ids.push_back(id); - } - - const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); - tt::DevicePool::initialize(ids, 1, DEFAULT_L1_SMALL_SIZE, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); - devices_ = tt::DevicePool::instance().get_all_active_devices(); - - } else { - GTEST_SKIP(); - } - } - - void TearDown() override { - tt::Cluster::instance().set_internal_routing_info_for_ethernet_cores(false); - for (unsigned int id = 0; id < devices_.size(); id++) { - tt::tt_metal::CloseDevice(devices_.at(id)); - } - } - - std::vector devices_; - tt::ARCH arch_; - size_t num_devices_; -}; diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp index 78ba87d64dd..bec12773a2e 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp @@ -9,7 +9,7 @@ #include #include "device_fixture.hpp" -#include "n300_device_fixture.hpp" +#include "multi_device_fixture.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/kernels/kernel.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp index 6d0dd564a96..8aad97249f1 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp @@ -9,7 +9,7 @@ #include #include "device_fixture.hpp" -#include "n300_device_fixture.hpp" +#include "multi_device_fixture.hpp" #include "tt_metal/common/math.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/device_cluster_api.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/device_cluster_api.cpp index 0c6491dab32..033bed287dd 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/device_cluster_api.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/device_cluster_api.cpp @@ -8,7 +8,7 @@ #include #include -#include "n300_device_fixture.hpp" +#include "multi_device_fixture.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/test_utils/env_vars.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/erisc_app_direct_send.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/erisc_app_direct_send.cpp index 8009a5d7f82..0a6641104b8 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/erisc_app_direct_send.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/erisc_app_direct_send.cpp @@ -8,7 +8,7 @@ #include #include -#include "n300_device_fixture.hpp" +#include "multi_device_fixture.hpp" #include "tt_metal/common/logger.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/galaxy_cluster_api.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/galaxy_cluster_api.cpp index b4cca6e03ee..3d5158d9be5 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/galaxy_cluster_api.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/galaxy_cluster_api.cpp @@ -4,11 +4,7 @@ #include -#include -#include -#include - -#include "device_fixture.hpp" +#include "multi_device_fixture.hpp" #include "tt_metal/llrt/tt_cluster.hpp" #include "tt_metal/host_api.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/ring_gather_kernels.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/ring_gather_kernels.cpp index 56ed607e79d..721ef99e4c2 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/ring_gather_kernels.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/ring_gather_kernels.cpp @@ -9,7 +9,7 @@ #include #include "device_fixture.hpp" -#include "n300_device_fixture.hpp" +#include "multi_device_fixture.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/kernels/kernel.hpp" From a175cad41a058ccc1d93b172f4529ae420f32b63 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Fri, 1 Nov 2024 16:31:50 +0000 Subject: [PATCH 06/26] #0: Renaming --- .../unit_tests_common/dram/test_dram_to_l1_multicast.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp index 4da1b98c956..65d385ea13b 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp @@ -143,7 +143,7 @@ TEST_F(DispatchFixture, TensixDRAMtoL1MulticastLoopbackSrc){ ASSERT_TRUE(unit_tests_common::dram::test_dram_to_l1_multicast::dram_to_l1_multicast(this, devices_.at(id), test_config)); } } -TEST_F(CommonFixture, DRAMtoL1MulticastExcludeRegionUpLeft){ +TEST_F(DispatchFixture, TensixDRAMtoL1MulticastExcludeRegionUpLeft){ unit_tests_common::dram::test_dram_to_l1_multicast::DRAMtoL1MulticastConfig test_config = { .dest_buffer_addr = 200 * 1024, .target_grid_offset = 0, //source core is in exclusion zone, don't count twice @@ -160,7 +160,7 @@ TEST_F(CommonFixture, DRAMtoL1MulticastExcludeRegionUpLeft){ } } -TEST_F(CommonFixture, DRAMtoL1MulticastExcludeRegionUpRight){ +TEST_F(DispatchFixture, TensixDRAMtoL1MulticastExcludeRegionUpRight){ unit_tests_common::dram::test_dram_to_l1_multicast::DRAMtoL1MulticastConfig test_config = { .dest_buffer_addr = 200 * 1024, .target_grid_offset = 1, @@ -177,7 +177,7 @@ TEST_F(CommonFixture, DRAMtoL1MulticastExcludeRegionUpRight){ } } -TEST_F(CommonFixture, DRAMtoL1MulticastExcludeRegionDownLeft){ +TEST_F(DispatchFixture, TensixDRAMtoL1MulticastExcludeRegionDownLeft){ unit_tests_common::dram::test_dram_to_l1_multicast::DRAMtoL1MulticastConfig test_config = { .dest_buffer_addr = 200 * 1024, .target_grid_offset = 1, @@ -194,7 +194,7 @@ TEST_F(CommonFixture, DRAMtoL1MulticastExcludeRegionDownLeft){ } } -TEST_F(CommonFixture, DRAMtoL1MulticastExcludeRegionDownRight){ +TEST_F(DispatchFixture, TensixDRAMtoL1MulticastExcludeRegionDownRight){ unit_tests_common::dram::test_dram_to_l1_multicast::DRAMtoL1MulticastConfig test_config = { .dest_buffer_addr = 200 * 1024, .target_grid_offset = 1, From 9307a764711d2bd810424003ce341ecba6d04e42 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Fri, 1 Nov 2024 21:34:55 +0000 Subject: [PATCH 07/26] #0: More test restructuring --- .../tensors/test_async_tensor_apis.cpp | 2 +- .../tt_metal/common/command_queue_fixtures.hpp | 4 ++-- .../common/dispatch_fixture.hpp | 4 ++-- .../tt_metal/tt_metal/common/event_fixture.hpp | 9 +++++++++ .../tt_metal/tt_metal/common/host_fixture.hpp | 9 +++++++++ .../tt_metal/common/trace_fixtures.hpp | 12 +++++++----- .../1_compute_mm/test_compute_mm.cpp | 2 +- .../test_create_kernel_from_string.cpp | 2 +- .../unit_tests/common/core_coord_fixture.hpp | 5 +++-- .../unit_tests/common/multi_device_fixture.hpp | 15 +++++++-------- .../host_apis/test_tilize_untilize.cpp | 18 +++++++++--------- .../tt_metal/unit_tests_common/CMakeLists.txt | 1 + .../basic/test_kernel_creation.cpp | 2 +- .../common/debug_tools_fixtures.hpp | 2 +- .../common/test_bit_utils.cpp | 9 +++++---- .../unit_tests_common/common/test_dispatch.cpp | 2 +- .../compute/matmul/test_matmul_X_tile.cpp | 2 +- .../compute/matmul/test_matmul_large_block.cpp | 2 +- .../matmul/test_matmul_multi_core_X_dram.cpp | 2 +- ...lti_core_multi_dram_in0_mcast_in1_mcast.cpp | 2 +- ..._matmul_multi_core_multi_dram_inX_mcast.cpp | 4 +--- .../compute/matmul/test_matmul_single_core.cpp | 2 +- .../unit_tests_common/compute/test_flatten.cpp | 2 +- .../dprint/test_mute_device.cpp | 2 +- .../unit_tests_common/dram/test_dram.cpp | 2 +- .../dram/test_dram_to_l1_multicast.cpp | 2 +- .../command_queue/test_events.cpp | 16 ++++++++-------- .../common/command_queue_fixture.hpp | 5 +++-- .../command_queue/test_EnqueueWaitForEvent.cpp | 14 +++++++------- .../common/command_queue_fixture.hpp | 9 +++++++-- tests/ttnn/unit_tests/gtests/test_add.cpp | 2 +- .../ttnn/unit_tests/gtests/test_graph_add.cpp | 2 +- 32 files changed, 97 insertions(+), 71 deletions(-) rename tests/tt_metal/tt_metal/{unit_tests_common => }/common/dispatch_fixture.hpp (98%) create mode 100644 tests/tt_metal/tt_metal/common/event_fixture.hpp create mode 100644 tests/tt_metal/tt_metal/common/host_fixture.hpp diff --git a/tests/tt_eager/tensors/test_async_tensor_apis.cpp b/tests/tt_eager/tensors/test_async_tensor_apis.cpp index 5edd0082dc9..f9ca0f69435 100644 --- a/tests/tt_eager/tensors/test_async_tensor_apis.cpp +++ b/tests/tt_eager/tensors/test_async_tensor_apis.cpp @@ -14,7 +14,7 @@ #include "ttnn/tensor/tensor.hpp" #include "ttnn/tensor/tensor_impl.hpp" #include "ttnn/tensor/types.hpp" -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "tests/tt_metal/tt_metal/common/dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "ttnn/operations/numpy/functions.hpp" diff --git a/tests/tt_metal/tt_metal/common/command_queue_fixtures.hpp b/tests/tt_metal/tt_metal/common/command_queue_fixtures.hpp index abaa4308ee5..fc3defc6c58 100644 --- a/tests/tt_metal/tt_metal/common/command_queue_fixtures.hpp +++ b/tests/tt_metal/tt_metal/common/command_queue_fixtures.hpp @@ -4,12 +4,13 @@ #pragma once +#include "dispatch_fixture.hpp" #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" #include "detail/tt_metal.hpp" #include "tt_metal/test_utils/env_vars.hpp" -class CommandQueueSingleCardFixture : public ::testing::Test { +class CommandQueueSingleCardFixture : virtual public DispatchFixture { protected: void SetUp() override { this->validate_dispatch_mode(); @@ -46,6 +47,5 @@ class CommandQueueSingleCardFixture : public ::testing::Test { std::vector devices_; std::map reserved_devices_; - tt::ARCH arch_; size_t num_devices_; }; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp b/tests/tt_metal/tt_metal/common/dispatch_fixture.hpp similarity index 98% rename from tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp rename to tests/tt_metal/tt_metal/common/dispatch_fixture.hpp index 28725cbccaf..23a3c3380a9 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp +++ b/tests/tt_metal/tt_metal/common/dispatch_fixture.hpp @@ -14,8 +14,8 @@ #include "tt_metal/impl/device/device_pool.hpp" // A dispatch-agnostic test fixture -class DispatchFixture: public ::testing::Test { -public: +class DispatchFixture : virtual public ::testing::Test { + public: // A function to run a program, according to which dispatch mode is set. void RunProgram(tt::tt_metal::Device* device, tt::tt_metal::Program& program) { const uint64_t program_id = program.get_id(); diff --git a/tests/tt_metal/tt_metal/common/event_fixture.hpp b/tests/tt_metal/tt_metal/common/event_fixture.hpp new file mode 100644 index 00000000000..cb4f1ed44d6 --- /dev/null +++ b/tests/tt_metal/tt_metal/common/event_fixture.hpp @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include + +class EventFixture : virtual public ::testing::Test {}; diff --git a/tests/tt_metal/tt_metal/common/host_fixture.hpp b/tests/tt_metal/tt_metal/common/host_fixture.hpp new file mode 100644 index 00000000000..c8e83d2e87c --- /dev/null +++ b/tests/tt_metal/tt_metal/common/host_fixture.hpp @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include "gtest/gtest.h" + +class HostFixture : public ::testing::Test {}; diff --git a/tests/tt_metal/tt_metal/common/trace_fixtures.hpp b/tests/tt_metal/tt_metal/common/trace_fixtures.hpp index b31c7de830f..0c7dd166ba9 100644 --- a/tests/tt_metal/tt_metal/common/trace_fixtures.hpp +++ b/tests/tt_metal/tt_metal/common/trace_fixtures.hpp @@ -10,7 +10,9 @@ #include "command_queue_fixtures.hpp" #include "impl/kernels/kernel.hpp" -class SingleDeviceTraceFixture : public ::testing::Test { +class TraceFixture : virtual public ::testing::Test {}; + +class SingleDeviceTraceFixture : virtual public TraceFixture { protected: Device* device_; tt::ARCH arch_; @@ -43,11 +45,11 @@ class SingleDeviceTraceFixture : public ::testing::Test { } }; -class CommandQueueSingleCardTraceFixture : virtual public CommandQueueSingleCardFixture { - protected: - void SetUp() override { +class CommandQueueSingleCardTraceFixture : virtual public CommandQueueSingleCardFixture, virtual public TraceFixture { + protected: + void SetUp() override { this->validate_dispatch_mode(); this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); this->create_devices(90000000); - } + } }; diff --git a/tests/tt_metal/tt_metal/perf_microbenchmark/1_compute_mm/test_compute_mm.cpp b/tests/tt_metal/tt_metal/perf_microbenchmark/1_compute_mm/test_compute_mm.cpp index 2ba054fd9c9..6e96f5885e8 100644 --- a/tests/tt_metal/tt_metal/perf_microbenchmark/1_compute_mm/test_compute_mm.cpp +++ b/tests/tt_metal/tt_metal/perf_microbenchmark/1_compute_mm/test_compute_mm.cpp @@ -22,7 +22,7 @@ #include "tt_metal/common/constants.hpp" #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "tests/tt_metal/tt_metal/common/dispatch_fixture.hpp" #include "tt_metal/test_utils/deprecated/tensor.hpp" #include "tests/tt_metal/test_utils/tilization.hpp" #include "tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/matmul_utils.hpp" diff --git a/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp b/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp index 88662259341..0e7e8e5213f 100644 --- a/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp +++ b/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp @@ -13,7 +13,7 @@ #include "impl/program/program.hpp" #include "tt_cluster_descriptor_types.h" -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "tests/tt_metal/tt_metal/common/dispatch_fixture.hpp" using namespace tt; using namespace tt::tt_metal; diff --git a/tests/tt_metal/tt_metal/unit_tests/common/core_coord_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests/common/core_coord_fixture.hpp index f49f17e3de4..aa8dd03db03 100644 --- a/tests/tt_metal/tt_metal/unit_tests/common/core_coord_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests/common/core_coord_fixture.hpp @@ -1,14 +1,15 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 #pragma once #include "gtest/gtest.h" +#include "host_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/test_utils/env_vars.hpp" -class CoreCoordFixture : public ::testing::Test { +class CoreCoordFixture : public HostFixture { protected: CoreRange cr1 = CoreRange({0, 0}, {1, 1}); CoreRange cr2 = CoreRange({3, 3}, {5, 4}); diff --git a/tests/tt_metal/tt_metal/unit_tests/common/multi_device_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests/common/multi_device_fixture.hpp index 7ebc03147df..7ef53e098bd 100644 --- a/tests/tt_metal/tt_metal/unit_tests/common/multi_device_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests/common/multi_device_fixture.hpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 @@ -11,7 +11,10 @@ #include "tt_metal/test_utils/env_vars.hpp" #include "tt_metal/impl/device/device_pool.hpp" -class MultiDeviceFixture : public ::testing::Test {}; +class MultiDeviceFixture : public ::testing::Test { + protected: + std::vector devices_; +}; class GalaxyFixture : public MultiDeviceFixture { protected: @@ -50,8 +53,6 @@ class GalaxyFixture : public MultiDeviceFixture { this->devices_.clear(); } - std::vector devices_; - private: std::map device_ids_to_devices_; }; @@ -106,10 +107,10 @@ class N300DeviceFixture : public MultiDeviceFixture { TT_THROW("This suite can only be run with TT_METAL_SLOW_DISPATCH_MODE set"); GTEST_SKIP(); } - arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + const tt::ARCH arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); num_devices_ = tt::tt_metal::GetNumAvailableDevices(); - if (arch_ == tt::ARCH::WORMHOLE_B0 and tt::tt_metal::GetNumAvailableDevices() == 2 and + if (arch == tt::ARCH::WORMHOLE_B0 and tt::tt_metal::GetNumAvailableDevices() == 2 and tt::tt_metal::GetNumPCIeDevices() == 1) { std::vector ids; for (unsigned int id = 0; id < num_devices_; id++) { @@ -132,7 +133,5 @@ class N300DeviceFixture : public MultiDeviceFixture { } } - std::vector devices_; - tt::ARCH arch_; size_t num_devices_; }; diff --git a/tests/tt_metal/tt_metal/unit_tests/host_apis/test_tilize_untilize.cpp b/tests/tt_metal/tt_metal/unit_tests/host_apis/test_tilize_untilize.cpp index 0c2379b4e19..efdf7b62871 100644 --- a/tests/tt_metal/tt_metal/unit_tests/host_apis/test_tilize_untilize.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/host_apis/test_tilize_untilize.cpp @@ -4,7 +4,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests/common/basic_fixture.hpp" +#include "host_fixture.hpp" #include "tt_metal/common/tilize_untilize.hpp" template @@ -35,7 +35,7 @@ void tilize_untilize_helper(uint max_num_batches, uint max_num_row_tiles, uint m } // The following run the tilize/untilize APIs and their inverses -TEST_F(BasicFixture, TestTilizeAndThenUntilizeBfloat16) { +TEST_F(HostFixture, TestTilizeAndThenUntilizeBfloat16) { uint max_num_batches = 8; uint max_num_row_tiles = 8; uint max_num_col_tiles = 8; @@ -45,12 +45,12 @@ TEST_F(BasicFixture, TestTilizeAndThenUntilizeBfloat16) { tilize_untilize_helper(max_num_batches, max_num_row_tiles, max_num_col_tiles, TILE_HEIGHT, TILE_WIDTH); } -TEST_F(BasicFixture, TestTilizeThrowErrorForNonBfloat16DataType) { +TEST_F(HostFixture, TestTilizeThrowErrorForNonBfloat16DataType) { std::vector vec(1024, 0); EXPECT_ANY_THROW(tilize(vec, 32, 32)); } -TEST_F(BasicFixture, TestTilizeThrowErrorForInvalidTileMandN) { +TEST_F(HostFixture, TestTilizeThrowErrorForInvalidTileMandN) { // m and n are not divisible by tile size std::vector vec(16, 0); EXPECT_ANY_THROW(tilize(vec, 4, 4)); // m and n not divisible by 32 @@ -59,19 +59,19 @@ TEST_F(BasicFixture, TestTilizeThrowErrorForInvalidTileMandN) { EXPECT_ANY_THROW(tilize(vec, 0, 0)); } -TEST_F(BasicFixture, TestTilizeThrowErrorForInvalidVectorShape) { +TEST_F(HostFixture, TestTilizeThrowErrorForInvalidVectorShape) { std::vector vec(16, 0); // Size not divisible by 1024 EXPECT_ANY_THROW(tilize(vec, 32, 32)); // m and n not divisible by 32 vec = {}; // Cannot have a zero vector either EXPECT_ANY_THROW(tilize(vec, 32, 32)); // m and n not divisible by 32 } -TEST_F(BasicFixture, TestUntilizeThrowErrorForNonBfloat16DataType) { +TEST_F(HostFixture, TestUntilizeThrowErrorForNonBfloat16DataType) { std::vector vec(1024, 0); EXPECT_ANY_THROW(untilize(vec, 32, 32)); } -TEST_F(BasicFixture, TestUntilizeThrowErrorForInvalidTileMandN) { +TEST_F(HostFixture, TestUntilizeThrowErrorForInvalidTileMandN) { // m and n are not divisible by tile side lengths std::vector vec(16, 0); EXPECT_ANY_THROW(untilize(vec, 4, 4)); @@ -80,14 +80,14 @@ TEST_F(BasicFixture, TestUntilizeThrowErrorForInvalidTileMandN) { EXPECT_ANY_THROW(untilize(vec, 0, 0)); } -TEST_F(BasicFixture, TestUntilizeThrowErrorForInvalidVectorShape) { +TEST_F(HostFixture, TestUntilizeThrowErrorForInvalidVectorShape) { std::vector vec(16, 0); // Size not divisible by 1024 EXPECT_ANY_THROW(untilize(vec, 32, 32)); // m and n not divisible by 32 vec = {}; // Cannot have a zero vector either EXPECT_ANY_THROW(untilize(vec, 32, 32)); // m and n not divisible by 32 } -TEST_F(BasicFixture, TestUntilizeAndThenTilizeBfloat16) { +TEST_F(HostFixture, TestUntilizeAndThenTilizeBfloat16) { uint max_num_batches = 8; uint max_num_row_tiles = 8; uint max_num_col_tiles = 8; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt index 01e44f6ea47..8bf66065a7b 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt @@ -49,5 +49,6 @@ target_include_directories( ${PROJECT_SOURCE_DIR}/tt_metal ${PROJECT_SOURCE_DIR}/tt_metal/common ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR}/common ) diff --git a/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp b/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp index 0ea595fd648..14350f86741 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "dispatch_fixture.hpp" #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp b/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp index d25ee6d596f..408ca1d2124 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp @@ -87,7 +87,7 @@ class DPrintFixture: public DebugToolsFixture { }; // For usage by tests that need the dprint server devices disabled. -class DPrintFixtureDisableDevices: public DPrintFixture { +class DPrintDisableDevicesFixture: public DPrintFixture { protected: void ExtraSetUp() override { // For this test, mute each devices using the environment variable diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/test_bit_utils.cpp b/tests/tt_metal/tt_metal/unit_tests_common/common/test_bit_utils.cpp index 99f62def780..2135c826447 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/common/test_bit_utils.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/common/test_bit_utils.cpp @@ -3,10 +3,11 @@ // SPDX-License-Identifier: Apache-2.0 #include "bit_utils.h" +#include "host_fixture.hpp" #include #include -TEST(NoFixture, ExtractBitArray) { +TEST_F(HostFixture, ExtractBitArray) { uint32_t src[4] = {0x12345678, 0x9abcdef0, 0x13579bdf, 0x2468ace0}; // 1. Extract the 20-bit elements from the 32-bit source array. uint32_t dest[4]; @@ -25,7 +26,7 @@ TEST(NoFixture, ExtractBitArray) { EXPECT_EQ(dest[3], 0x9abc); } -TEST(NoFixture, PackBitArray) { +TEST_F(HostFixture, PackBitArray) { uint32_t src[8] = { 1, 2, 3, 4, 5, 6, 7, 7 }; uint32_t dest[8]; @@ -56,7 +57,7 @@ TEST(NoFixture, PackBitArray) { EXPECT_EQ(dest[0], expected); } -TEST(NoFixture, PackExtractBitArray) { +TEST_F(HostFixture, PackExtractBitArray) { uint32_t src[8] = { 1, 2, 3, 4, 5, 6, 7, 7 }; for (uint num_pack_bits = 3; num_pack_bits <= 31; num_pack_bits++) { @@ -70,7 +71,7 @@ TEST(NoFixture, PackExtractBitArray) { } } -TEST(NoFixture, ExtractPackBitArray) { +TEST_F(HostFixture, ExtractPackBitArray) { uint32_t src[4] = { 0x12345678, 0x9abcdef0, 0x13579bdf, 0x2468ace0 }; // Compute the number of 3-bit elements that can be packed into 4 x 32-bit elements diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp b/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp index 1dcb5c71997..1cd8a9a0d2d 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp @@ -4,7 +4,7 @@ // This file contains dispatch tests that are (generally) dispatch mode agnostic -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "dispatch_fixture.hpp" using std::vector; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp index 3890154ce4e..530071248e7 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp index a5b7fcc9dd0..dbb206b7501 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp index 32b30ab4d34..0aed1106ee9 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp index bd28c7d35a0..8fd6967f007 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp index 6785c4394d6..fa678cd94b4 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp @@ -3,10 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include -#include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp index 7a67231bb06..f8aca2715c4 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp b/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp index db9a8452014..90b0e589643 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp @@ -6,7 +6,7 @@ #include #include -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp index faff93cf981..fbe5b88ddab 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp @@ -77,7 +77,7 @@ static void RunTest(DPrintFixture* fixture, Device* device) { } } -TEST_F(DPrintFixtureDisableDevices, TensixTestPrintMuteDevice) { +TEST_F(DPrintDisableDevicesFixture, TensixTestPrintMuteDevice) { for (Device* device : this->devices_) { this->RunTestOnDevice(CMAKE_UNIQUE_NAMESPACE::RunTest, device); } diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram.cpp index f94b0423f42..e035b0adaf4 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "dispatch_fixture.hpp" #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp index 65d385ea13b..3f770ff57ca 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dram/test_dram_to_l1_multicast.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "dispatch_fixture.hpp" #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_events.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_events.cpp index 023462a6cd2..824b4e7edfd 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_events.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_events.cpp @@ -23,7 +23,7 @@ enum class DataMovementMode: uint8_t { constexpr uint32_t completion_queue_event_offset = sizeof(CQDispatchCmd); constexpr uint32_t completion_queue_page_size = dispatch_constants::TRANSFER_PAGE_SIZE; -TEST_F(CommandQueueFixture, TestEventsDataMovementWrittenToCompletionQueueInOrder) { +TEST_F(CommandQueueEventFixture, TestEventsDataMovementWrittenToCompletionQueueInOrder) { size_t num_buffers = 100; uint32_t page_size = 2048; vector page(page_size / sizeof(uint32_t)); @@ -75,7 +75,7 @@ TEST_F(CommandQueueFixture, TestEventsDataMovementWrittenToCompletionQueueInOrde } // Basic test, record events, check that Event struct was updated. Enough commands to trigger issue queue wrap. -TEST_F(CommandQueueFixture, TestEventsEnqueueRecordEventIssueQueueWrap) { +TEST_F(CommandQueueEventFixture, TestEventsEnqueueRecordEventIssueQueueWrap) { const size_t num_events = 100000; // Enough to wrap issue queue. 768MB and cmds are 22KB each, so 35k cmds. uint32_t cmds_issued_per_cq = 0; @@ -96,7 +96,7 @@ TEST_F(CommandQueueFixture, TestEventsEnqueueRecordEventIssueQueueWrap) { } // Test where Host synchronously waits for event to be completed. -TEST_F(CommandQueueFixture, TestEventsEnqueueRecordEventAndSynchronize) { +TEST_F(CommandQueueEventFixture, TestEventsEnqueueRecordEventAndSynchronize) { const size_t num_events = 100; const size_t num_events_between_sync = 10; @@ -128,7 +128,7 @@ TEST_F(CommandQueueFixture, TestEventsEnqueueRecordEventAndSynchronize) { // Negative test. Host syncing on a future event that isn't actually issued. // Ensure that expected hang is seen, which indicates event sync feature is working properly. -TEST_F(CommandQueueFixture, TestEventsEnqueueRecordEventAndSynchronizeHang) { +TEST_F(CommandQueueEventFixture, TestEventsEnqueueRecordEventAndSynchronizeHang) { tt::llrt::OptionsG.set_test_mode_enabled(true); // Required for finish hang breakout. auto future_event = std::make_shared(); @@ -155,7 +155,7 @@ TEST_F(CommandQueueFixture, TestEventsEnqueueRecordEventAndSynchronizeHang) { // Negative test. Device sync. Single CQ here syncing on a future event that isn't actually issued. // Ensure that expected hang is seen, which indicates event sync feature is working properly. -TEST_F(CommandQueueFixture, TestEventsQueueWaitForEventHang) { +TEST_F(CommandQueueEventFixture, TestEventsQueueWaitForEventHang) { // Skip this test until #7216 is implemented. GTEST_SKIP(); tt::llrt::OptionsG.set_test_mode_enabled(true); // Required for finish hang breakout. @@ -183,7 +183,7 @@ TEST_F(CommandQueueFixture, TestEventsQueueWaitForEventHang) { } // Device sync. Single CQ here, less interesting than 2CQ but still useful. Ensure no hangs. -TEST_F(CommandQueueFixture, TestEventsQueueWaitForEventBasic) { +TEST_F(CommandQueueEventFixture, TestEventsQueueWaitForEventBasic) { const size_t num_events = 50; const size_t num_events_between_sync = 5; @@ -214,7 +214,7 @@ TEST_F(CommandQueueFixture, TestEventsQueueWaitForEventBasic) { } // Device sync. Single CQ here, less interesting than 2CQ but still useful. Ensure no hangs. -TEST_F(CommandQueueFixture, TestEventsEventsQueryBasic) { +TEST_F(CommandQueueEventFixture, TestEventsEventsQueryBasic) { const size_t num_events = 50; const size_t num_events_between_query = 5; @@ -260,7 +260,7 @@ TEST_F(CommandQueueFixture, TestEventsEventsQueryBasic) { // Mix of WritesBuffers, RecordEvent, WaitForEvent, EventSynchronize with some checking. -TEST_F(CommandQueueFixture, TestEventsMixedWriteBufferRecordWaitSynchronize) { +TEST_F(CommandQueueEventFixture, TestEventsMixedWriteBufferRecordWaitSynchronize) { const size_t num_buffers = 2; const uint32_t page_size = 2048; vector page(page_size / sizeof(uint32_t)); diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp index de6be0e64f0..7ee8e3b54fc 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp @@ -24,7 +24,7 @@ #include "tt_metal/tt_metal/unit_tests_common/common/test_utils.hpp" #include "tt_soc_descriptor.h" -class CommandQueueFixture : public ::testing::Test { +class CommandQueueFixture : public DispatchFixture { protected: tt::ARCH arch_; tt::tt_metal::Device* device_; @@ -49,6 +49,7 @@ class CommandQueueFixture : public ::testing::Test { } }; +class CommandQueueEventFixture : virtual public CommandQueueFixture, virtual public EventFixture {}; class CommandQueueMultiDeviceFixture : public ::testing::Test { protected: @@ -422,7 +423,7 @@ class RandomProgramFixture : virtual public CommandQueueSingleCardFixture { } }; -class RandomProgramTraceFixture : public RandomProgramFixture, public CommandQueueSingleCardTraceFixture { +class RandomProgramTraceFixture : virtual public RandomProgramFixture, virtual public CommandQueueSingleCardTraceFixture { protected: static const uint32_t NUM_TRACE_ITERATIONS = 50; Program programs[NUM_PROGRAMS]; diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWaitForEvent.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWaitForEvent.cpp index 1c08c86fa15..28d95a7f531 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWaitForEvent.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWaitForEvent.cpp @@ -30,7 +30,7 @@ void FinishAllCqs(vector>& cqs) { namespace basic_tests { // Simplest test to record Event per CQ and wait from host, and verify populated Event struct is correct (many events, wrap issue queue) -TEST_F(MultiCommandQueueMultiDeviceFixture, TestEventsEventSynchronizeSanity) { +TEST_F(MultiCommandQueueMultiDeviceEventFixture, TestEventsEventSynchronizeSanity) { for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); vector> cqs = {device->command_queue(0), device->command_queue(1)}; @@ -70,7 +70,7 @@ TEST_F(MultiCommandQueueMultiDeviceFixture, TestEventsEventSynchronizeSanity) { } // Simplest test to record Event per CQ and wait from host, and verify populated Event struct is correct (many events, wrap issue queue) -TEST_F(MultiCommandQueueSingleDeviceFixture, TestEventsEventSynchronizeSanity) { +TEST_F(MultiCommandQueueSingleDeviceEventFixture, TestEventsEventSynchronizeSanity) { vector> cqs = {this->device_->command_queue(0), this->device_->command_queue(1)}; vector cmds_issued_per_cq = {0, 0}; @@ -108,7 +108,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, TestEventsEventSynchronizeSanity) { } // Simplest test to record and wait-for-events on same CQ. -TEST_F(MultiCommandQueueSingleDeviceFixture, TestEventsEnqueueWaitForEventSanity) { +TEST_F(MultiCommandQueueSingleDeviceEventFixture, TestEventsEnqueueWaitForEventSanity) { vector> cqs = {this->device_->command_queue(0), this->device_->command_queue(1)}; vector events_issued_per_cq = {0, 0}; size_t num_events = 10; @@ -136,7 +136,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, TestEventsEnqueueWaitForEventSanity // Record event on one CQ, wait-for-that-event on another CQ. Then do the flip. Occasionally insert // syncs from Host per CQ, and verify completion queues per CQ are correct. -TEST_F(MultiCommandQueueSingleDeviceFixture, TestEventsEnqueueWaitForEventCrossCQs) { +TEST_F(MultiCommandQueueSingleDeviceEventFixture, TestEventsEnqueueWaitForEventCrossCQs) { vector> cqs = {this->device_->command_queue(0), this->device_->command_queue(1)}; vector cmds_issued_per_cq = {0, 0}; const size_t num_events_per_cq = 10; @@ -200,7 +200,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, TestEventsEnqueueWaitForEventCrossC // Simple 2CQ test to mix reads, writes, record-event, wait-for-event in a basic way. It's simple because // the write, record-event, wait-event, read-event are all on the same CQ, but cover both CQ's. -TEST_F(MultiCommandQueueSingleDeviceFixture, TestEventsReadWriteWithWaitForEventSameCQ) { +TEST_F(MultiCommandQueueSingleDeviceEventFixture, TestEventsReadWriteWithWaitForEventSameCQ) { TestBufferConfig config = {.num_pages = 1, .page_size = 256, .buftype = BufferType::DRAM}; vector> cqs = {this->device_->command_queue(0), this->device_->command_queue(1)}; vector cmds_issued_per_cq = {0, 0}; @@ -247,7 +247,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, TestEventsReadWriteWithWaitForEvent // More interesting test where Blocking ReadBuffer, Non-Blocking WriteBuffer are on alternate CQs, // ordered via events. Do many loops, occasionally increasing size of buffers (page size, num pages). // Ensure read back data is correct, data is different for each write. -TEST_F(MultiCommandQueueSingleDeviceFixture, TestEventsReadWriteWithWaitForEventCrossCQs) { +TEST_F(MultiCommandQueueSingleDeviceEventFixture, TestEventsReadWriteWithWaitForEventCrossCQs) { if (tt::Cluster::instance().arch() == tt::ARCH::GRAYSKULL) { GTEST_SKIP() << "Skipping for GS due to readback mismatch under debug Github issue #6281 "; } @@ -307,7 +307,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, TestEventsReadWriteWithWaitForEvent // 2 CQs with single Buffer, and a loop where each iteration has non-blocking Write to Buffer via CQ0 and non-blocking Read // to Bufffer via CQ1. Ping-Pongs between Writes and Reads to same buffer. Use events to synchronze read after write and // write after read before checking correct data read at the end after all cmds finished on device. -TEST_F(MultiCommandQueueSingleDeviceFixture, TestEventsReadWriteWithWaitForEventCrossCQsPingPong) { +TEST_F(MultiCommandQueueSingleDeviceEventFixture, TestEventsReadWriteWithWaitForEventCrossCQsPingPong) { if (tt::Cluster::instance().arch() == tt::ARCH::GRAYSKULL) { GTEST_SKIP() << "Skipping for GS due to readback mismatch under debug Github issue #6281 "; } diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp index bf0796c64d0..cbcc631fb0d 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp @@ -5,6 +5,7 @@ #pragma once #include "gtest/gtest.h" +#include "event_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/test_utils/env_vars.hpp" @@ -13,7 +14,7 @@ using namespace tt::tt_metal; -class MultiCommandQueueSingleDeviceFixture : public ::testing::Test { +class MultiCommandQueueSingleDeviceFixture : virtual public ::testing::Test { protected: void SetUp() override { auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); @@ -45,7 +46,9 @@ class MultiCommandQueueSingleDeviceFixture : public ::testing::Test { tt::ARCH arch_; }; -class MultiCommandQueueMultiDeviceFixture : public ::testing::Test { +class MultiCommandQueueSingleDeviceEventFixture : public MultiCommandQueueSingleDeviceFixture, public EventFixture {}; + +class MultiCommandQueueMultiDeviceFixture : virtual public ::testing::Test { protected: void SetUp() override { auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); @@ -85,3 +88,5 @@ class MultiCommandQueueMultiDeviceFixture : public ::testing::Test { size_t num_devices_; tt::ARCH arch_; }; + +class MultiCommandQueueMultiDeviceEventFixture : public MultiCommandQueueMultiDeviceFixture, public EventFixture {}; diff --git a/tests/ttnn/unit_tests/gtests/test_add.cpp b/tests/ttnn/unit_tests/gtests/test_add.cpp index cc386e6836b..7b0be8728ac 100644 --- a/tests/ttnn/unit_tests/gtests/test_add.cpp +++ b/tests/ttnn/unit_tests/gtests/test_add.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "tests/tt_metal/tt_metal/common/dispatch_fixture.hpp" #include "ttnn/device.hpp" #include "ttnn/operations/eltwise/binary/binary.hpp" #include "ttnn/operations/core/core.hpp" diff --git a/tests/ttnn/unit_tests/gtests/test_graph_add.cpp b/tests/ttnn/unit_tests/gtests/test_graph_add.cpp index dec3a99af78..a03ed11549e 100644 --- a/tests/ttnn/unit_tests/gtests/test_graph_add.cpp +++ b/tests/ttnn/unit_tests/gtests/test_graph_add.cpp @@ -4,7 +4,7 @@ #include "gtest/gtest.h" #include "tt_metal/common/logger.hpp" -#include "tests/tt_metal/tt_metal/unit_tests_common/common/dispatch_fixture.hpp" +#include "tests/tt_metal/tt_metal/common/dispatch_fixture.hpp" #include "ttnn/device.hpp" #include "ttnn/operations/eltwise/binary/binary.hpp" #include "ttnn/operations/core/core.hpp" From 4f7e9efafad7a7a4a58c67991119d74c36035643 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Mon, 4 Nov 2024 18:39:00 +0000 Subject: [PATCH 08/26] #0: More test restructuring --- .../tt_metal/common/buffer_fixtures.hpp | 9 ++ .../common/command_queue_fixtures.hpp | 51 --------- .../tt_metal/common/program_fixtures.hpp | 9 ++ .../tt_metal/common/trace_fixtures.hpp | 11 -- .../common/debug_tools_fixtures.hpp | 2 +- .../command_queue/test_CommandQueue.cpp | 17 +-- .../command_queue/test_EnqueueProgram.cpp | 66 +++++------ .../command_queue/test_EnqueueTrace.cpp | 103 ++++++++++++++++-- ...queueWriteBuffer_and_EnqueueReadBuffer.cpp | 69 ++++++------ .../command_queue/test_HostAsyncCQ.cpp | 10 +- .../common/command_queue_fixture.hpp | 68 +++++++++++- .../compute/sfpu/sfpu_compute.cpp | 1 - .../multichip/test_eth_EnqueueProgram.cpp | 17 +-- .../test_eth_ring_gather_EnqueueProgram.cpp | 4 +- .../pipelining/basic_pipeline.cpp | 2 +- .../streams/test_autonomous_relay_streams.cpp | 12 +- .../command_queue/test_EnqueueProgram.cpp | 4 +- ...queueWriteBuffer_and_EnqueueReadBuffer.cpp | 46 ++++---- .../common/command_queue_fixture.hpp | 12 +- 19 files changed, 307 insertions(+), 206 deletions(-) create mode 100644 tests/tt_metal/tt_metal/common/buffer_fixtures.hpp delete mode 100644 tests/tt_metal/tt_metal/common/command_queue_fixtures.hpp create mode 100644 tests/tt_metal/tt_metal/common/program_fixtures.hpp diff --git a/tests/tt_metal/tt_metal/common/buffer_fixtures.hpp b/tests/tt_metal/tt_metal/common/buffer_fixtures.hpp new file mode 100644 index 00000000000..c11461c677e --- /dev/null +++ b/tests/tt_metal/tt_metal/common/buffer_fixtures.hpp @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include + +class BufferFixture : virtual public ::testing::Test {}; diff --git a/tests/tt_metal/tt_metal/common/command_queue_fixtures.hpp b/tests/tt_metal/tt_metal/common/command_queue_fixtures.hpp deleted file mode 100644 index fc3defc6c58..00000000000 --- a/tests/tt_metal/tt_metal/common/command_queue_fixtures.hpp +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include "dispatch_fixture.hpp" -#include "gtest/gtest.h" -#include "tt_metal/host_api.hpp" -#include "detail/tt_metal.hpp" -#include "tt_metal/test_utils/env_vars.hpp" - -class CommandQueueSingleCardFixture : virtual public DispatchFixture { - protected: - void SetUp() override { - this->validate_dispatch_mode(); - this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); - this->create_devices(); - } - - void TearDown() override { tt::tt_metal::detail::CloseDevices(reserved_devices_); } - - void validate_dispatch_mode() { - auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); - if (slow_dispatch) { - TT_THROW("This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); - GTEST_SKIP(); - } - } - - void create_devices(const std::size_t trace_region_size = DEFAULT_TRACE_REGION_SIZE) { - const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); - const chip_id_t mmio_device_id = 0; - this->reserved_devices_ = tt::tt_metal::detail::CreateDevices( - {mmio_device_id}, 1, DEFAULT_L1_SMALL_SIZE, trace_region_size, dispatch_core_type); - auto enable_remote_chip = getenv("TT_METAL_ENABLE_REMOTE_CHIP"); - if (enable_remote_chip) { - for (const auto &[id, device] : this->reserved_devices_) { - this->devices_.push_back(device); - } - } else { - this->devices_.push_back(this->reserved_devices_.at(mmio_device_id)); - } - - this->num_devices_ = this->reserved_devices_.size(); - } - - std::vector devices_; - std::map reserved_devices_; - size_t num_devices_; -}; diff --git a/tests/tt_metal/tt_metal/common/program_fixtures.hpp b/tests/tt_metal/tt_metal/common/program_fixtures.hpp new file mode 100644 index 00000000000..985309dea0d --- /dev/null +++ b/tests/tt_metal/tt_metal/common/program_fixtures.hpp @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include + +class ProgramFixture : virtual public ::testing::Test {}; diff --git a/tests/tt_metal/tt_metal/common/trace_fixtures.hpp b/tests/tt_metal/tt_metal/common/trace_fixtures.hpp index 0c7dd166ba9..36aae845707 100644 --- a/tests/tt_metal/tt_metal/common/trace_fixtures.hpp +++ b/tests/tt_metal/tt_metal/common/trace_fixtures.hpp @@ -7,7 +7,6 @@ #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" #include "tt_metal/test_utils/env_vars.hpp" -#include "command_queue_fixtures.hpp" #include "impl/kernels/kernel.hpp" class TraceFixture : virtual public ::testing::Test {}; @@ -35,7 +34,6 @@ class SingleDeviceTraceFixture : virtual public TraceFixture { this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); const int device_id = 0; this->device_ = tt::tt_metal::CreateDevice(device_id, num_hw_cqs, 0, buffer_size); - ; } void TearDown() override { @@ -44,12 +42,3 @@ class SingleDeviceTraceFixture : virtual public TraceFixture { } } }; - -class CommandQueueSingleCardTraceFixture : virtual public CommandQueueSingleCardFixture, virtual public TraceFixture { - protected: - void SetUp() override { - this->validate_dispatch_mode(); - this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); - this->create_devices(90000000); - } -}; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp b/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp index 408ca1d2124..bd9d3a1745e 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp @@ -6,7 +6,7 @@ #include "dispatch_fixture.hpp" -class DebugToolsFixture : public DispatchFixture { +class DebugToolsFixture : virtual public DispatchFixture { }; diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_CommandQueue.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_CommandQueue.cpp index 8017f70fb27..cd617d81ff9 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_CommandQueue.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_CommandQueue.cpp @@ -24,19 +24,10 @@ TEST_F(CommandQueueMultiDeviceFixture, DISABLED_TestAccessCommandQueue) { } } -TEST(FastDispatchHostSuite, TestCannotAccessCommandQueueForClosedDevice) { - auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); - if (slow_dispatch) { - TT_THROW("This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); - GTEST_SKIP(); - } - const unsigned int device_id = 0; - const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); - Device* device = tt::tt_metal::CreateDevice(device_id, tt::llrt::OptionsG.get_num_hw_cqs(), DEFAULT_L1_SMALL_SIZE, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); - - EXPECT_NO_THROW(device->command_queue()); - CloseDevice(device); - EXPECT_ANY_THROW(device->command_queue()); +TEST_F(CommandQueueFixture, TestCannotAccessCommandQueueForClosedDevice) { + EXPECT_NO_THROW(device_->command_queue()); + CloseDevice(device_); + EXPECT_ANY_THROW(device_->command_queue()); } TEST_F(CommandQueueMultiDeviceFixture, DISABLED_TestDirectedLoopbackToUniqueHugepage) { diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp index 86f400222eb..da035da0f74 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp @@ -651,7 +651,7 @@ namespace basic_tests { namespace compiler_workaround_hardware_bug_tests { -TEST_F(CommandQueueSingleCardFixture, TensixTestArbiterDoesNotHang) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestArbiterDoesNotHang) { for (Device *device : devices_) { Program program; @@ -669,7 +669,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestArbiterDoesNotHang) { } namespace single_core_tests { -TEST_F(CommandQueueSingleCardFixture, TensixTestSingleCbConfigCorrectlySentSingleCore) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestSingleCbConfigCorrectlySentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -682,7 +682,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestSingleCbConfigCorrectlySentSingl } } -TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCbSeqConfigCorrectlySentSingleCore) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestMultiCbSeqConfigCorrectlySentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -699,7 +699,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCbSeqConfigCorrectlySentSin } } -TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCbRandomConfigCorrectlySentSingleCore) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestMultiCbRandomConfigCorrectlySentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -716,7 +716,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCbRandomConfigCorrectlySent } } -TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCBSharedAddressSpaceSentSingleCore) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestMultiCBSharedAddressSpaceSentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -770,7 +770,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCBSharedAddressSpaceSentSin } } -TEST_F(CommandQueueSingleCardFixture, TensixTestSingleCbConfigCorrectlyUpdateSizeSentSingleCore) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestSingleCbConfigCorrectlyUpdateSizeSentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -783,7 +783,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestSingleCbConfigCorrectlyUpdateSiz } } -TEST_F(CommandQueueSingleCardFixture, TensixTestSingleSemaphoreConfigCorrectlySentSingleCore) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestSingleSemaphoreConfigCorrectlySentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -794,7 +794,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestSingleSemaphoreConfigCorrectlySe } } -TEST_F(CommandQueueSingleCardFixture, TensixTestAutoInsertedBlankBriscKernelInDeviceDispatchMode) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestAutoInsertedBlankBriscKernelInDeviceDispatchMode) { for (Device *device : devices_) { Program program; @@ -812,7 +812,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestAutoInsertedBlankBriscKernelInDe } // Sanity test for setting and verifying common and unique runtime args to a single core, the simplest case. -TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanitySingleCoreCompute) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixIncrementRuntimeArgsSanitySingleCoreCompute) { CoreRange cr0({0, 0}, {0, 0}); CoreRangeSet cr_set({cr0}); DummyProgramConfig dummy_program_config = {.cr_set = cr_set}; @@ -822,7 +822,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanitySingleCore } // Sanity test for setting and verifying common and unique runtime args to single cores via ERISC. Some arch may return 0 active eth cores, that's okay. -TEST_F(CommandQueueSingleCardFixture, ActiveEthIncrementRuntimeArgsSanitySingleCoreDataMovementErisc) { +TEST_F(CommandQueueSingleCardProgramFixture, ActiveEthIncrementRuntimeArgsSanitySingleCoreDataMovementErisc) { for (Device *device : devices_) { for (const auto ð_core : device->get_active_ethernet_cores(true)) { CoreRange cr0(eth_core); @@ -836,7 +836,7 @@ TEST_F(CommandQueueSingleCardFixture, ActiveEthIncrementRuntimeArgsSanitySingleC // Sanity test for setting and verifying common and unique runtime args to single cores via ERISC(IDLE). Some arch may return 0 active eth cores, that's okay. // FIXME - Re-enable when FD-on-idle-eth is supported -TEST_F(CommandQueueSingleCardFixture, DISABLED_ActiveEthIncrementRuntimeArgsSanitySingleCoreDataMovementEriscIdle) { +TEST_F(CommandQueueSingleCardProgramFixture, DISABLED_ActiveEthIncrementRuntimeArgsSanitySingleCoreDataMovementEriscIdle) { for (Device *device : devices_) { for (const auto ð_core : device->get_active_ethernet_cores(true)) { CoreRange cr0(eth_core); @@ -850,7 +850,7 @@ TEST_F(CommandQueueSingleCardFixture, DISABLED_ActiveEthIncrementRuntimeArgsSani // Sanity test for setting and verifying common and unique runtime args to single cores via inactive ERISC cores. Some arch may return 0 active eth cores, that's okay. // FIXME - Re-enable when FD-on-idle-eth is supported -TEST_F(CommandQueueSingleCardFixture, DISABLED_IdleEthIncrementRuntimeArgsSanitySingleCoreDataMovementEriscInactive) { +TEST_F(CommandQueueSingleCardProgramFixture, DISABLED_IdleEthIncrementRuntimeArgsSanitySingleCoreDataMovementEriscInactive) { for (Device *device : devices_) { for (const auto ð_core : device->get_inactive_ethernet_cores()) { CoreRange cr0(eth_core); @@ -862,7 +862,7 @@ TEST_F(CommandQueueSingleCardFixture, DISABLED_IdleEthIncrementRuntimeArgsSanity } } -TEST_F(CommandQueueSingleCardFixture, TensixTestRuntimeArgsCorrectlySentSingleCore) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestRuntimeArgsCorrectlySentSingleCore) { CoreRange cr({0, 0}, {0, 0}); CoreRangeSet cr_set({cr}); @@ -876,7 +876,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestRuntimeArgsCorrectlySentSingleCo } // end namespace single_core_tests namespace multicore_tests { -TEST_F(CommandQueueSingleCardFixture, TensixTestAllCbConfigsCorrectlySentMultiCore) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestAllCbConfigsCorrectlySentMultiCore) { CBConfig cb_config = {.num_pages = 1, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; std::vector cb_config_vector(NUM_CIRCULAR_BUFFERS, cb_config); @@ -896,7 +896,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestAllCbConfigsCorrectlySentMultiCo } } -TEST_F(CommandQueueSingleCardFixture, TensixTestAllCbConfigsCorrectlySentUpdateSizeMultiCore) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestAllCbConfigsCorrectlySentUpdateSizeMultiCore) { CBConfig cb_config = {.num_pages = 1, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; std::vector cb_config_vector(NUM_CIRCULAR_BUFFERS, cb_config); @@ -916,7 +916,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestAllCbConfigsCorrectlySentUpdateS } } -TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCbConfigsCorrectlySentUpdateSizeMultiCore) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestMultiCbConfigsCorrectlySentUpdateSizeMultiCore) { CBConfig cb_config_0 = {.cb_id = 0, .num_pages = 1, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; CBConfig cb_config_1 = {.cb_id = 1, .num_pages = 2, .page_size = 4096, .data_format = tt::DataFormat::Float16_b}; CBConfig cb_config_2 = {.cb_id = 2, .num_pages = 2, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; @@ -937,7 +937,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCbConfigsCorrectlySentUpdat } } -TEST_F(CommandQueueSingleCardFixture, TensixTestAllCbConfigsCorrectlySentMultipleCoreRanges) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestAllCbConfigsCorrectlySentMultipleCoreRanges) { CBConfig cb_config = {.num_pages = 1, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; std::vector cb_config_vector(NUM_CIRCULAR_BUFFERS, cb_config); @@ -958,7 +958,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestAllCbConfigsCorrectlySentMultipl } } -TEST_F(CommandQueueSingleCardFixture, TensixTestAllCbConfigsCorrectlySentUpdateSizeMultipleCoreRanges) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestAllCbConfigsCorrectlySentUpdateSizeMultipleCoreRanges) { CBConfig cb_config = {.num_pages = 1, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; std::vector cb_config_vector(NUM_CIRCULAR_BUFFERS, cb_config); @@ -979,7 +979,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestAllCbConfigsCorrectlySentUpdateS } } -TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCbConfigsCorrectlySentUpdateSizeMultipleCoreRanges) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestMultiCbConfigsCorrectlySentUpdateSizeMultipleCoreRanges) { CBConfig cb_config_0 = {.cb_id = 0, .num_pages = 1, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; CBConfig cb_config_1 = {.cb_id = 1, .num_pages = 2, .page_size = 4096, .data_format = tt::DataFormat::Float16_b}; CBConfig cb_config_2 = {.cb_id = 2, .num_pages = 2, .page_size = 2048, .data_format = tt::DataFormat::Float16_b}; @@ -1001,7 +1001,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestMultiCbConfigsCorrectlySentUpdat } } -TEST_F(CommandQueueSingleCardFixture, TensixTestAllSemConfigsCorrectlySentMultiCore) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestAllSemConfigsCorrectlySentMultiCore) { for (Device *device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1014,7 +1014,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestAllSemConfigsCorrectlySentMultiC } } -TEST_F(CommandQueueSingleCardFixture, TensixTestAllSemaphoreConfigsCorrectlySentMultipleCoreRanges) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestAllSemaphoreConfigsCorrectlySentMultipleCoreRanges) { for (Device *device : devices_) { CoreRange first_cr({0, 0}, {1, 1}); @@ -1054,7 +1054,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestAllSemaphoreConfigsCorrectlySent } } -TEST_F(CommandQueueSingleCardFixture, TensixTestAllRuntimeArgsCorrectlySentMultiCore) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestAllRuntimeArgsCorrectlySentMultiCore) { for (Device *device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1066,7 +1066,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestAllRuntimeArgsCorrectlySentMulti } } -TEST_F(CommandQueueSingleCardFixture, TensixTestAllRuntimeArgsCorrectlySentMultiCore_255_PerKernel) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestAllRuntimeArgsCorrectlySentMultiCore_255_PerKernel) { for (Device *device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1078,7 +1078,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestAllRuntimeArgsCorrectlySentMulti } } -TEST_F(CommandQueueSingleCardFixture, TensixTestSendRuntimeArgsMultiCoreRange) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestSendRuntimeArgsMultiCoreRange) { for (Device* device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1092,7 +1092,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestSendRuntimeArgsMultiCoreRange) { } } -TEST_F(CommandQueueSingleCardFixture, TensixTestSendRuntimeArgsMultiNonOverlappingCoreRange) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestSendRuntimeArgsMultiNonOverlappingCoreRange) { // Core ranges get merged in kernel groups, this one does not for (Device* device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1107,7 +1107,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestSendRuntimeArgsMultiNonOverlappi } } -TEST_F(CommandQueueSingleCardFixture, TensixTestUpdateRuntimeArgsMultiCoreRange) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixTestUpdateRuntimeArgsMultiCoreRange) { for (Device* device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1122,7 +1122,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixTestUpdateRuntimeArgsMultiCoreRange) } // Sanity test for setting and verifying common and unique runtime args to multiple cores. -TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreCompute) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixIncrementRuntimeArgsSanityMultiCoreCompute) { CoreRange cr0({1, 1}, {2, 2}); CoreRange cr1({3, 3}, {4, 4}); CoreRangeSet cr_set(std::vector{cr0, cr1}); @@ -1133,7 +1133,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreC } // Max number of 255 unique RT args. -TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreCompute_255_UniqueArgs) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixIncrementRuntimeArgsSanityMultiCoreCompute_255_UniqueArgs) { CoreRange cr0({1, 1}, {2, 2}); CoreRange cr1({3, 3}, {4, 4}); CoreRangeSet cr_set(std::vector{cr0, cr1}); @@ -1144,7 +1144,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreC } // Max number of 255 common RT args. -TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreCompute_255_CommonArgs) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixIncrementRuntimeArgsSanityMultiCoreCompute_255_CommonArgs) { CoreRange cr0({1, 1}, {2, 2}); CoreRange cr1({3, 3}, {4, 4}); CoreRangeSet cr_set(std::vector{cr0, cr1}); @@ -1155,7 +1155,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreC } // Sanity test for setting and verifying common and unique runtime args to multiple cores via BRISC. -TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreDataMovementBrisc) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixIncrementRuntimeArgsSanityMultiCoreDataMovementBrisc) { CoreRange cr0({1, 1}, {2, 2}); CoreRange cr1({3, 3}, {4, 4}); CoreRangeSet cr_set(std::vector{cr0, cr1}); @@ -1166,7 +1166,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreD } // Sanity test for setting and verifying common and unique runtime args to multiple cores via NCRISC. -TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreDataMovementNcrisc) { +TEST_F(CommandQueueSingleCardProgramFixture, TensixIncrementRuntimeArgsSanityMultiCoreDataMovementNcrisc) { CoreRange cr0({1, 1}, {2, 2}); CoreRange cr1({3, 3}, {4, 4}); CoreRangeSet cr_set(std::vector{cr0, cr1}); @@ -1183,7 +1183,7 @@ TEST_F(CommandQueueSingleCardFixture, TensixIncrementRuntimeArgsSanityMultiCoreD namespace stress_tests { -TEST_F(CommandQueueSingleCardFixture, DISABLED_TensixTestFillDispatchCoreBuffer) { +TEST_F(CommandQueueSingleCardProgramFixture, DISABLED_TensixTestFillDispatchCoreBuffer) { uint32_t NUM_ITER = 100000; for (Device *device : devices_) { CoreCoord worker_grid_size = device->compute_with_storage_grid_size(); @@ -1197,7 +1197,7 @@ TEST_F(CommandQueueSingleCardFixture, DISABLED_TensixTestFillDispatchCoreBuffer) } } -TEST_F(CommandQueueFixture, TensixTestRandomizedProgram) { +TEST_F(CommandQueueProgramFixture, TensixTestRandomizedProgram) { uint32_t NUM_PROGRAMS = 100; uint32_t MAX_LOOP = 100; uint32_t page_size = 1024; diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp index 370e1b052f8..e7357186e2f 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp @@ -8,7 +8,6 @@ #include "command_queue_fixture.hpp" #include "command_queue_test_utils.hpp" -#include "trace_fixtures.hpp" #include "detail/tt_metal.hpp" #include "tt_metal/common/env_lib.hpp" #include "gtest/gtest.h" @@ -92,7 +91,7 @@ constexpr bool kBlocking = true; constexpr bool kNonBlocking = false; vector blocking_flags = {kBlocking, kNonBlocking}; -TEST_F(SingleDeviceTraceFixture, TensixInstantiateTraceSanity) { +TEST_F(SingleDeviceTraceFixture, InstantiateTraceSanity) { Setup(2048); CommandQueue& command_queue = this->device_->command_queue(); @@ -124,7 +123,7 @@ TEST_F(SingleDeviceTraceFixture, TensixInstantiateTraceSanity) { ReleaseTrace(this->device_, tid); } -TEST_F(SingleDeviceTraceFixture, TensixEnqueueProgramTraceCapture) { +TEST_F(SingleDeviceTraceFixture, EnqueueProgramTraceCapture) { Setup(2048); auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); @@ -167,7 +166,7 @@ TEST_F(SingleDeviceTraceFixture, TensixEnqueueProgramTraceCapture) { ReleaseTrace(this->device_, tid); } -TEST_F(SingleDeviceTraceFixture, TensixEnqueueProgramDeviceCapture) { +TEST_F(SingleDeviceTraceFixture, EnqueueProgramDeviceCapture) { Setup(2048); auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); @@ -218,7 +217,7 @@ TEST_F(SingleDeviceTraceFixture, TensixEnqueueProgramDeviceCapture) { ReleaseTrace(this->device_, tid); } -TEST_F(SingleDeviceTraceFixture, TensixEnqueueTwoProgramTrace) { +TEST_F(SingleDeviceTraceFixture, EnqueueTwoProgramTrace) { Setup(6144); // Get command queue from device for this test, since its running in async mode CommandQueue& command_queue = this->device_->command_queue(); @@ -294,7 +293,7 @@ TEST_F(SingleDeviceTraceFixture, TensixEnqueueTwoProgramTrace) { } } -TEST_F(SingleDeviceTraceFixture, TensixEnqueueMultiProgramTraceBenchmark) { +TEST_F(SingleDeviceTraceFixture, EnqueueMultiProgramTraceBenchmark) { Setup(6144); CommandQueue& command_queue = this->device_->command_queue(); @@ -450,7 +449,10 @@ TEST_F(RandomProgramTraceFixture, TensixTestProgramsTrace) { EnqueueProgram(this->device_->command_queue(), program, false); } - Finish(device_->command_queue()); + const uint32_t trace_id = this->trace_programs(); + + Finish(this->device_->command_queue()); + ReleaseTrace(this->device_, trace_id); } TEST_F(RandomProgramTraceFixture, ActiveEthTestProgramsTrace) { @@ -591,3 +593,90 @@ TEST_F(RandomProgramTraceFixture, TensixTestLargeProgramInBetweenFiveSmallProgra Finish(this->device_->command_queue()); ReleaseTrace(this->device_, trace_id); } + +TEST_F(RandomProgramTraceFixture, TensixTestProgramsTraceAndNoTrace) { + for (uint32_t i = 0; i < NUM_PROGRAMS; i++) { + if (i % 10 == 0) { + log_info(tt::LogTest, "Creating Program {}", i); + } + this->programs[i] = CreateProgram(); + Program& program = this->programs[i]; + this->create_kernel(program, CoreType::WORKER); + } + + for (Program& program : this->programs) { + const bool use_trace = (rand() % 2) == 0; + if (use_trace) { + EnqueueProgram(this->device_->command_queue(), program, false); + + } else { + continue; + } + } + + Finish(this->device_->command_queue()); +} + +TEST_F(RandomProgramTraceFixture, ActiveEthTestProgramsTraceAndNoTrace) { + if (!does_device_have_active_eth_cores(this->device_)) { + GTEST_SKIP() << "Skipping test because device " << this->device_->id() << " does not have any active ethernet cores"; + } + + for (uint32_t i = 0; i < NUM_PROGRAMS; i++) { + if (i % 10 == 0) { + log_info(tt::LogTest, "Creating Program {}", i); + } + this->programs[i] = CreateProgram(); + Program& program = this->programs[i]; + // Large eth kernels currently don't fit in the ring buffer, so we're reducing the max number of RTAs + // and the max kernel size to ensure that the kernel can fit in the ring buffer + KernelProperties kernel_properties; + kernel_properties.max_kernel_size_bytes = MAX_KERNEL_SIZE_BYTES / 2; + kernel_properties.max_num_rt_args = MAX_NUM_RUNTIME_ARGS / 4; + this->create_kernel(program, CoreType::ETH, false, kernel_properties); + EnqueueProgram(this->device_->command_queue(), program, false); + } + + const uint32_t trace_id = this->trace_programs(); + + Finish(this->device_->command_queue()); + ReleaseTrace(this->device_, trace_id); +} + +TEST_F(RandomProgramTraceFixture, TensixActiveEthTestProgramsTraceAndNoTrace) { + if (!does_device_have_active_eth_cores(this->device_)) { + GTEST_SKIP() << "Skipping test because device " << this->device_->id() << " does not have any active ethernet cores"; + } + + for (uint32_t i = 0; i < NUM_PROGRAMS; i++) { + if (i % 10 == 0) { + log_info(tt::LogTest, "Creating Program {}", i); + } + this->programs[i] = CreateProgram(); + Program& program = this->programs[i]; + + bool eth_kernel_added_to_program = false; + if (rand() % 2 == 0) { + // Large eth kernels currently don't fit in the ring buffer, so we're reducing the max number of RTAs + // and the max kernel size to ensure that the kernel can fit in the ring buffer + KernelProperties kernel_properties; + kernel_properties.max_kernel_size_bytes = MAX_KERNEL_SIZE_BYTES / 2; + kernel_properties.max_num_rt_args = MAX_NUM_RUNTIME_ARGS / 4; + kernel_properties.max_num_sems = MAX_NUM_SEMS / 2; + this->create_kernel(program, CoreType::ETH, false, kernel_properties); + eth_kernel_added_to_program = true; + } + if (rand() % 2 == 0 || !eth_kernel_added_to_program) { + KernelProperties kernel_properties; + kernel_properties.max_num_sems = MAX_NUM_SEMS / 2; + this->create_kernel(program, CoreType::WORKER, false, kernel_properties); + } + + EnqueueProgram(this->device_->command_queue(), program, false); + } + + const uint32_t trace_id = this->trace_programs(); + + Finish(this->device_->command_queue()); + ReleaseTrace(this->device_, trace_id); +} diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp index 4e03e9f8b5e..a766ec98888 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp @@ -5,7 +5,6 @@ #include #include "command_queue_fixture.hpp" -#include "command_queue_fixtures.hpp" #include "command_queue_test_utils.hpp" #include "gtest/gtest.h" #include "tt_metal/detail/tt_metal.hpp" @@ -329,7 +328,7 @@ bool stress_test_EnqueueWriteBuffer_and_EnqueueReadBuffer_wrap( namespace basic_tests { namespace dram_tests { -TEST_F(CommandQueueSingleCardFixture, WriteOneTileToDramBank0) { +TEST_F(CommandQueueSingleCardBufferFixture, WriteOneTileToDramBank0) { TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::DRAM}; for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); @@ -337,7 +336,7 @@ TEST_F(CommandQueueSingleCardFixture, WriteOneTileToDramBank0) { } } -TEST_F(CommandQueueSingleCardFixture, WriteOneTileToAllDramBanks) { +TEST_F(CommandQueueSingleCardBufferFixture, WriteOneTileToAllDramBanks) { for (Device *device : devices_) { TestBufferConfig config = { .num_pages = uint32_t(device->num_banks(BufferType::DRAM)), .page_size = 2048, .buftype = BufferType::DRAM}; @@ -346,7 +345,7 @@ TEST_F(CommandQueueSingleCardFixture, WriteOneTileToAllDramBanks) { } } -TEST_F(CommandQueueSingleCardFixture, WriteOneTileAcrossAllDramBanksTwiceRoundRobin) { +TEST_F(CommandQueueSingleCardBufferFixture, WriteOneTileAcrossAllDramBanksTwiceRoundRobin) { constexpr uint32_t num_round_robins = 2; for (Device *device : devices_) { TestBufferConfig config = { @@ -357,7 +356,7 @@ TEST_F(CommandQueueSingleCardFixture, WriteOneTileAcrossAllDramBanksTwiceRoundRo } } -TEST_F(CommandQueueSingleCardFixture, Sending131072Pages) { +TEST_F(CommandQueueSingleCardBufferFixture, Sending131072Pages) { for (Device *device : devices_) { TestBufferConfig config = {.num_pages = 131072, .page_size = 128, .buftype = BufferType::DRAM}; tt::log_info("Running On Device {}", device->id()); @@ -365,7 +364,7 @@ TEST_F(CommandQueueSingleCardFixture, Sending131072Pages) { } } -TEST_F(CommandQueueSingleCardFixture, TestPageLargerThanAndUnalignedToTransferPage) { +TEST_F(CommandQueueSingleCardBufferFixture, TestPageLargerThanAndUnalignedToTransferPage) { constexpr uint32_t num_round_robins = 2; for (Device *device : devices_) { TestBufferConfig config = { @@ -377,7 +376,7 @@ TEST_F(CommandQueueSingleCardFixture, TestPageLargerThanAndUnalignedToTransferPa } } -TEST_F(CommandQueueSingleCardFixture, TestPageLargerThanMaxPrefetchCommandSize) { +TEST_F(CommandQueueSingleCardBufferFixture, TestPageLargerThanMaxPrefetchCommandSize) { constexpr uint32_t num_round_robins = 1; for (Device *device : devices_) { CoreType dispatch_core_type = dispatch_core_manager::instance().get_dispatch_core_type(device->id()); @@ -391,7 +390,7 @@ TEST_F(CommandQueueSingleCardFixture, TestPageLargerThanMaxPrefetchCommandSize) } } -TEST_F(CommandQueueSingleCardFixture, TestUnalignedPageLargerThanMaxPrefetchCommandSize) { +TEST_F(CommandQueueSingleCardBufferFixture, TestUnalignedPageLargerThanMaxPrefetchCommandSize) { constexpr uint32_t num_round_robins = 1; for (Device *device : devices_) { CoreType dispatch_core_type = dispatch_core_manager::instance().get_dispatch_core_type(device->id()); @@ -406,7 +405,7 @@ TEST_F(CommandQueueSingleCardFixture, TestUnalignedPageLargerThanMaxPrefetchComm } } -TEST_F(CommandQueueSingleCardFixture, TestNon32BAlignedPageSizeForDram) { +TEST_F(CommandQueueSingleCardBufferFixture, TestNon32BAlignedPageSizeForDram) { TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::DRAM}; for (Device *device : devices_) { @@ -414,7 +413,7 @@ TEST_F(CommandQueueSingleCardFixture, TestNon32BAlignedPageSizeForDram) { } } -TEST_F(CommandQueueSingleCardFixture, TestNon32BAlignedPageSizeForDram2) { +TEST_F(CommandQueueSingleCardBufferFixture, TestNon32BAlignedPageSizeForDram2) { // From stable diffusion read buffer TestBufferConfig config = {.num_pages = 8 * 1024, .page_size = 80, .buftype = BufferType::DRAM}; @@ -423,16 +422,18 @@ TEST_F(CommandQueueSingleCardFixture, TestNon32BAlignedPageSizeForDram2) { } } -TEST_F(CommandQueueFixture, TestPageSizeTooLarge) { +TEST_F(CommandQueueSingleCardBufferFixture, TestPageSizeTooLarge) { // Should throw a host error due to the page size not fitting in the consumer CB TestBufferConfig config = {.num_pages = 1024, .page_size = 250880 * 2, .buftype = BufferType::DRAM}; - EXPECT_ANY_THROW((local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer( - this->device_, this->device_->command_queue(), config))); + for (Device *device : devices_) { + EXPECT_ANY_THROW((local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer( + device, device->command_queue(), config))); + } } // Requires enqueue write buffer -TEST_F(CommandQueueSingleCardFixture, TestWrapHostHugepageOnEnqueueReadBuffer) { +TEST_F(CommandQueueSingleCardBufferFixture, TestWrapHostHugepageOnEnqueueReadBuffer) { for (Device *device : this->devices_) { tt::log_info("Running On Device {}", device->id()); uint32_t page_size = 2048; @@ -450,7 +451,7 @@ TEST_F(CommandQueueSingleCardFixture, TestWrapHostHugepageOnEnqueueReadBuffer) { } } -TEST_F(CommandQueueSingleCardFixture, TestIssueMultipleReadWriteCommandsForOneBuffer) { +TEST_F(CommandQueueSingleCardBufferFixture, TestIssueMultipleReadWriteCommandsForOneBuffer) { for (Device *device : this->devices_) { tt::log_info("Running On Device {}", device->id()); uint32_t page_size = 2048; @@ -465,7 +466,7 @@ TEST_F(CommandQueueSingleCardFixture, TestIssueMultipleReadWriteCommandsForOneBu } // Test that command queue wraps when buffer available space in completion region is less than a page -TEST_F(CommandQueueSingleCardFixture, TestWrapCompletionQOnInsufficientSpace) { +TEST_F(CommandQueueSingleCardBufferFixture, TestWrapCompletionQOnInsufficientSpace) { uint32_t large_page_size = 8192; // page size for first and third read uint32_t small_page_size = 2048; // page size for second read @@ -504,7 +505,7 @@ TEST_F(CommandQueueSingleCardFixture, TestWrapCompletionQOnInsufficientSpace) { // Test that command queue wraps when buffer read needs to be split into multiple enqueue_read_buffer commands and // available space in completion region is less than a page -TEST_F(CommandQueueSingleCardFixture, TestWrapCompletionQOnInsufficientSpace2) { +TEST_F(CommandQueueSingleCardBufferFixture, TestWrapCompletionQOnInsufficientSpace2) { // Using default 75-25 issue and completion queue split for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); @@ -541,14 +542,14 @@ TEST_F(CommandQueueSingleCardFixture, TestWrapCompletionQOnInsufficientSpace2) { namespace l1_tests { -TEST_F(CommandQueueSingleCardFixture, WriteOneTileToL1Bank0) { +TEST_F(CommandQueueSingleCardBufferFixture, WriteOneTileToL1Bank0) { TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::L1}; for (Device *device : devices_) { local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer(device, device->command_queue(), config); } } -TEST_F(CommandQueueSingleCardFixture, WriteOneTileToAllL1Banks) { +TEST_F(CommandQueueSingleCardBufferFixture, WriteOneTileToAllL1Banks) { for (Device *device : devices_) { auto compute_with_storage_grid = device->compute_with_storage_grid_size(); TestBufferConfig config = { @@ -560,7 +561,7 @@ TEST_F(CommandQueueSingleCardFixture, WriteOneTileToAllL1Banks) { } } -TEST_F(CommandQueueSingleCardFixture, WriteOneTileToAllL1BanksTwiceRoundRobin) { +TEST_F(CommandQueueSingleCardBufferFixture, WriteOneTileToAllL1BanksTwiceRoundRobin) { for (Device *device : devices_) { auto compute_with_storage_grid = device->compute_with_storage_grid_size(); TestBufferConfig config = { @@ -572,7 +573,7 @@ TEST_F(CommandQueueSingleCardFixture, WriteOneTileToAllL1BanksTwiceRoundRobin) { } } -TEST_F(CommandQueueSingleCardFixture, TestNon32BAlignedPageSizeForL1) { +TEST_F(CommandQueueSingleCardBufferFixture, TestNon32BAlignedPageSizeForL1) { TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::L1}; for (Device *device : devices_) { @@ -583,7 +584,7 @@ TEST_F(CommandQueueSingleCardFixture, TestNon32BAlignedPageSizeForL1) { } } -TEST_F(CommandQueueSingleCardFixture, TestBackToBackNon32BAlignedPageSize) { +TEST_F(CommandQueueSingleCardBufferFixture, TestBackToBackNon32BAlignedPageSize) { constexpr BufferType buff_type = BufferType::L1; for (Device *device : devices_) { @@ -607,7 +608,7 @@ TEST_F(CommandQueueSingleCardFixture, TestBackToBackNon32BAlignedPageSize) { } // This case was failing for FD v1.3 design -TEST_F(CommandQueueSingleCardFixture, TestLargeBuffer4096BPageSize) { +TEST_F(CommandQueueSingleCardBufferFixture, TestLargeBuffer4096BPageSize) { constexpr BufferType buff_type = BufferType::L1; for (Device *device : devices_) { @@ -619,7 +620,7 @@ TEST_F(CommandQueueSingleCardFixture, TestLargeBuffer4096BPageSize) { } // end namespace l1_tests -TEST_F(CommandQueueSingleCardFixture, TestNonblockingReads) { +TEST_F(CommandQueueSingleCardBufferFixture, TestNonblockingReads) { constexpr BufferType buff_type = BufferType::L1; for (auto device : devices_) { @@ -649,7 +650,7 @@ namespace stress_tests { // TODO: Add stress test that vary page size -TEST_F(CommandQueueSingleCardFixture, WritesToRandomBufferTypeAndThenReadsBlocking) { +TEST_F(CommandQueueSingleCardBufferFixture, WritesToRandomBufferTypeAndThenReadsBlocking) { BufferStressTestConfig config = { .seed = 0, .num_pages_total = 50000, .page_size = 2048, .max_num_pages_per_buffer = 16}; @@ -660,7 +661,7 @@ TEST_F(CommandQueueSingleCardFixture, WritesToRandomBufferTypeAndThenReadsBlocki } } -TEST_F(CommandQueueSingleCardFixture, WritesToRandomBufferTypeAndThenReadsNonblocking) { +TEST_F(CommandQueueSingleCardBufferFixture, WritesToRandomBufferTypeAndThenReadsNonblocking) { BufferStressTestConfig config = { .seed = 0, .num_pages_total = 50000, .page_size = 2048, .max_num_pages_per_buffer = 16}; @@ -673,7 +674,7 @@ TEST_F(CommandQueueSingleCardFixture, WritesToRandomBufferTypeAndThenReadsNonblo } // TODO: Split this into separate tests -TEST_F(CommandQueueSingleCardFixture, ShardedBufferL1ReadWrites) { +TEST_F(CommandQueueSingleCardBufferFixture, ShardedBufferL1ReadWrites) { std::map>> test_params; for (Device *device : devices_) { @@ -727,7 +728,7 @@ TEST_F(CommandQueueSingleCardFixture, ShardedBufferL1ReadWrites) { } } -TEST_F(CommandQueueSingleCardFixture, ShardedBufferDRAMReadWrites) { +TEST_F(CommandQueueSingleCardBufferFixture, ShardedBufferDRAMReadWrites) { for (Device *device : devices_) { for (const std::array cores : {std::array{1, 1}, @@ -785,7 +786,7 @@ TEST_F(CommandQueueSingleCardFixture, ShardedBufferDRAMReadWrites) { } } -TEST_F(CommandQueueSingleCardFixture, ShardedBufferLargeL1ReadWrites) { +TEST_F(CommandQueueSingleCardBufferFixture, ShardedBufferLargeL1ReadWrites) { for (Device *device : devices_) { for (const std::array cores : {std::array{1, 1}, @@ -827,7 +828,7 @@ TEST_F(CommandQueueSingleCardFixture, ShardedBufferLargeL1ReadWrites) { } } -TEST_F(CommandQueueSingleCardFixture, ShardedBufferLargeDRAMReadWrites) { +TEST_F(CommandQueueSingleCardBufferFixture, ShardedBufferLargeDRAMReadWrites) { for (Device *device : devices_) { for (const std::array cores : {std::array{1, 1}, @@ -881,7 +882,7 @@ TEST_F(CommandQueueSingleCardFixture, ShardedBufferLargeDRAMReadWrites) { } } -TEST_F(CommandQueueFixture, StressWrapTest) { +TEST_F(CommandQueueSingleCardBufferFixture, StressWrapTest) { const char *arch = getenv("ARCH_NAME"); if (strcasecmp(arch, "wormhole_b0") == 0) { tt::log_info("cannot run this test on WH B0"); @@ -891,8 +892,10 @@ TEST_F(CommandQueueFixture, StressWrapTest) { BufferStressTestConfig config = { .page_size = 4096, .max_num_pages_per_buffer = 2000, .num_iterations = 10000, .num_unique_vectors = 20}; - EXPECT_TRUE(local_test_functions::stress_test_EnqueueWriteBuffer_and_EnqueueReadBuffer_wrap( - this->device_, this->device_->command_queue(), config)); + for (Device *device : devices_) { + EXPECT_TRUE(local_test_functions::stress_test_EnqueueWriteBuffer_and_EnqueueReadBuffer_wrap( + device, device->command_queue(), config)); + } } } // end namespace stress_tests diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_HostAsyncCQ.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_HostAsyncCQ.cpp index 25f72bfa6ef..a9c0966f2af 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_HostAsyncCQ.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_HostAsyncCQ.cpp @@ -200,7 +200,7 @@ bool flatten(Device *device, uint32_t num_tiles_r = 5, uint32_t num_tiles_c = 5) namespace host_command_queue_tests { -TEST_F(CommandQueueFixture, TensixTestAsyncCommandQueueSanityAndProfile) { +TEST_F(CommandQueueProgramFixture, TensixTestAsyncCommandQueueSanityAndProfile) { auto& command_queue = this->device_->command_queue(); auto current_mode = CommandQueue::default_mode(); command_queue.set_mode(CommandQueue::CommandQueueMode::ASYNC); @@ -221,7 +221,7 @@ TEST_F(CommandQueueFixture, TensixTestAsyncCommandQueueSanityAndProfile) { command_queue.set_mode(current_mode); } -TEST_F(CommandQueueFixture, DISABLED_TestAsyncBufferRW) { +TEST_F(CommandQueueBufferFixture, DISABLED_TestAsyncBufferRW) { // Test Async Enqueue Read and Write + Get Addr + Buffer Allocation and Deallocation auto& command_queue = this->device_->command_queue(); auto current_mode = CommandQueue::default_mode(); @@ -263,7 +263,7 @@ TEST_F(CommandQueueFixture, DISABLED_TestAsyncBufferRW) { command_queue.set_mode(current_mode); } -TEST_F(CommandQueueFixture, DISABLED_TensixTestAsyncCBAllocation) { +TEST_F(CommandQueueBufferFixture, DISABLED_TensixTestAsyncCBAllocation) { // Test asynchronous allocation of buffers and their assignment to CBs auto& command_queue = this->device_->command_queue(); auto current_mode = CommandQueue::default_mode(); @@ -306,7 +306,7 @@ TEST_F(CommandQueueFixture, DISABLED_TensixTestAsyncCBAllocation) { command_queue.set_mode(current_mode); } -TEST_F(CommandQueueFixture, DISABLED_TensixTestAsyncAssertForDeprecatedAPI) { +TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAsyncAssertForDeprecatedAPI) { auto& command_queue = this->device_->command_queue(); auto current_mode = CommandQueue::default_mode(); command_queue.set_mode(CommandQueue::CommandQueueMode::ASYNC); @@ -332,7 +332,7 @@ TEST_F(CommandQueueFixture, DISABLED_TensixTestAsyncAssertForDeprecatedAPI) { command_queue.set_mode(current_mode); } -TEST_F(CommandQueueFixture, DISABLED_TensixTestAsyncFlattenStress){ +TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAsyncFlattenStress){ auto& command_queue = this->device_->command_queue(); auto current_mode = CommandQueue::default_mode(); command_queue.set_mode(CommandQueue::CommandQueueMode::ASYNC); diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp index 7ee8e3b54fc..687ff11cdbc 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp @@ -24,9 +24,8 @@ #include "tt_metal/tt_metal/unit_tests_common/common/test_utils.hpp" #include "tt_soc_descriptor.h" -class CommandQueueFixture : public DispatchFixture { +class CommandQueueFixture : virtual public DispatchFixture { protected: - tt::ARCH arch_; tt::tt_metal::Device* device_; void SetUp() override { auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); @@ -51,7 +50,66 @@ class CommandQueueFixture : public DispatchFixture { class CommandQueueEventFixture : virtual public CommandQueueFixture, virtual public EventFixture {}; -class CommandQueueMultiDeviceFixture : public ::testing::Test { +class CommandQueueBufferFixture : virtual public CommandQueueFixture, virtual public BufferFixture {}; + +class CommandQueueProgramFixture : virtual public CommandQueueFixture, virtual public ProgramFixture {}; + +class CommandQueueSingleCardFixture : virtual public DispatchFixture { + protected: + void SetUp() override { + this->validate_dispatch_mode(); + this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + this->create_devices(); + } + + void TearDown() override { tt::tt_metal::detail::CloseDevices(reserved_devices_); } + + void validate_dispatch_mode() { + auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); + if (slow_dispatch) { + TT_THROW("This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); + GTEST_SKIP(); + } + } + + void create_devices(const std::size_t trace_region_size = DEFAULT_TRACE_REGION_SIZE) { + const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); + const chip_id_t mmio_device_id = 0; + this->reserved_devices_ = tt::tt_metal::detail::CreateDevices( + {mmio_device_id}, 1, DEFAULT_L1_SMALL_SIZE, trace_region_size, dispatch_core_type); + auto enable_remote_chip = getenv("TT_METAL_ENABLE_REMOTE_CHIP"); + if (enable_remote_chip) { + for (const auto &[id, device] : this->reserved_devices_) { + this->devices_.push_back(device); + } + } else { + this->devices_.push_back(this->reserved_devices_.at(mmio_device_id)); + } + + this->num_devices_ = this->reserved_devices_.size(); + } + + std::vector devices_; + std::map reserved_devices_; + size_t num_devices_; +}; + +class CommandQueueSingleCardBufferFixture : virtual public CommandQueueSingleCardFixture, + virtual public BufferFixture {}; + +class CommandQueueSingleCardTraceFixture : virtual public CommandQueueSingleCardFixture, virtual public TraceFixture { + protected: + void SetUp() override { + this->validate_dispatch_mode(); + this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + this->create_devices(90000000); + } +}; + +class CommandQueueSingleCardProgramFixture : virtual public CommandQueueSingleCardFixture, + virtual public ProgramFixture {}; + +class CommandQueueMultiDeviceFixture : public DispatchFixture { protected: void SetUp() override { auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); @@ -81,10 +139,12 @@ class CommandQueueMultiDeviceFixture : public ::testing::Test { std::vector devices_; std::map reserved_devices_; - tt::ARCH arch_; size_t num_devices_; }; +class CommandQueueMultiDeviceProgramFixture : virtual public CommandQueueMultiDeviceFixture, + virtual public ProgramFixture {}; + class RandomProgramFixture : virtual public CommandQueueSingleCardFixture { protected: static const uint32_t MIN_KERNEL_SIZE_BYTES = 20; diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp index ae24f15bf06..442428347b4 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp @@ -10,7 +10,6 @@ #include #include "command_queue_fixture.hpp" -#include "command_queue_fixtures.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/dispatch/command_queue.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp index 4537d504b05..40c82285a97 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp @@ -4,12 +4,7 @@ #include -#include -#include -#include - #include "command_queue_fixture.hpp" -#include "command_queue_fixtures.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/kernels/kernel.hpp" @@ -556,7 +551,7 @@ bool chip_to_chip_interleaved_buffer_transfer( } } // namespace fd_unit_tests::erisc::kernels -TEST_F(CommandQueueSingleCardFixture, ActiveEthEnqueueDummyProgram) { +TEST_F(CommandQueueSingleCardProgramFixture, ActiveEthEnqueueDummyProgram) { for (const auto& device : devices_) { for (const auto& eth_core : device->get_active_ethernet_cores(true)) { ASSERT_TRUE(fd_unit_tests::erisc::kernels::test_dummy_EnqueueProgram_with_runtime_args(device, eth_core)); @@ -564,7 +559,7 @@ TEST_F(CommandQueueSingleCardFixture, ActiveEthEnqueueDummyProgram) { } } -TEST_F(CommandQueueSingleCardFixture, ActiveEthEthKernelsNocReadNoSend) { +TEST_F(CommandQueueSingleCardProgramFixture, ActiveEthEthKernelsNocReadNoSend) { using namespace CMAKE_UNIQUE_NAMESPACE; const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; @@ -580,7 +575,7 @@ TEST_F(CommandQueueSingleCardFixture, ActiveEthEthKernelsNocReadNoSend) { } } -TEST_F(CommandQueueSingleCardFixture, ActiveEthEthKernelsNocWriteNoReceive) { +TEST_F(CommandQueueSingleCardProgramFixture, ActiveEthEthKernelsNocWriteNoReceive) { using namespace CMAKE_UNIQUE_NAMESPACE; const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; @@ -596,7 +591,7 @@ TEST_F(CommandQueueSingleCardFixture, ActiveEthEthKernelsNocWriteNoReceive) { } } -TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsDirectSendAllConnectedChips) { +TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsDirectSendAllConnectedChips) { using namespace CMAKE_UNIQUE_NAMESPACE; const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; const size_t dst_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; @@ -647,7 +642,7 @@ TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsDirectSendAllConnected } } -TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsSendDramBufferAllConnectedChips) { +TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsSendDramBufferAllConnectedChips) { for (const auto& sender_device : devices_) { for (const auto& receiver_device : devices_) { if (sender_device->id() >= receiver_device->id()) { @@ -679,7 +674,7 @@ TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsSendDramBufferAllConne } } -TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsSendInterleavedBufferAllConnectedChips) { +TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsSendInterleavedBufferAllConnectedChips) { using namespace CMAKE_UNIQUE_NAMESPACE; for (const auto& sender_device : devices_) { for (const auto& receiver_device : devices_) { diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_ring_gather_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_ring_gather_EnqueueProgram.cpp index 1894fde0ef9..c4235b6a6c2 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_ring_gather_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_ring_gather_EnqueueProgram.cpp @@ -460,7 +460,7 @@ bool eth_interleaved_ring_gather_sender_receiver_kernels( } } // namespace fd_unit_tests::erisc::kernels -TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsDirectRingGatherAllChips) { +TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsDirectRingGatherAllChips) { using namespace CMAKE_UNIQUE_NAMESPACE; if (num_devices_ < 4) { GTEST_SKIP(); @@ -476,7 +476,7 @@ TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsDirectRingGatherAllChi device_ring, WORD_SIZE, src_eth_l1_byte_address, dst_eth_l1_byte_address, sem_l1_byte_address)); } -TEST_F(CommandQueueMultiDeviceFixture, ActiveEthEthKernelsInterleavedRingGatherAllChips) { +TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsInterleavedRingGatherAllChips) { using namespace CMAKE_UNIQUE_NAMESPACE; if (num_devices_ < 4) { GTEST_SKIP(); diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp index 26493c92af6..3be350496bf 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp @@ -245,7 +245,7 @@ void create_and_run_row_pipeline(tt_metal::Device* device, const PipelineRowConf } // namespace unit_tests::create_pipeline -TEST_F(CommandQueueFixture, TensixTestPipelineAcrossRows) { +TEST_F(CommandQueueProgramFixture, TensixTestPipelineAcrossRows) { if (this->arch_ != tt::ARCH::GRAYSKULL) { GTEST_SKIP(); } diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp index fdf9d5b19cc..b230a67e1cc 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp @@ -648,7 +648,7 @@ void build_and_run_autonomous_stream_test( } // namespace tt -TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreams) { +TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAutonomousRelayStreams) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); if (arch == tt::ARCH::GRAYSKULL) { @@ -691,7 +691,7 @@ TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreams) { return; } -TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsSmallPackets) { +TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAutonomousRelayStreamsSmallPackets) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); if (arch == tt::ARCH::GRAYSKULL) { @@ -734,7 +734,7 @@ TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsSmallPacket return; } -TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingShort) { +TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingShort) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); if (arch == tt::ARCH::GRAYSKULL) { @@ -780,7 +780,7 @@ TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingShor // Too long to run in post commit and these kernels are currently only live in these unit tests anyways // so we just enable a couple of the unit tests to ensure nobody accidentally introduces compile errors // or anything like that -TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingRandomShort) { +TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingRandomShort) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); // if (num_devices != 8) { @@ -835,7 +835,7 @@ TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingRand // Too long to run in post commit and these kernels are currently only live in these unit tests anyways // so we just enable a couple of the unit tests to ensure nobody accidentally introduces compile errors // or anything like that -TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingLong) { +TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingLong) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); // if (num_devices != 8) { @@ -885,7 +885,7 @@ TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingLong // Too long to run in post commit and these kernels are currently only live in these unit tests anyways // so we just enable a couple of the unit tests to ensure nobody accidentally introduces compile errors // or anything like that -TEST_F(CommandQueueFixture, DISABLED_TensixTestAutonomousRelayStreamsSweep) { +TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAutonomousRelayStreamsSweep) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); if (arch == tt::ARCH::GRAYSKULL) { diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp index 248b829ab13..f97c902bb9b 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp @@ -79,7 +79,7 @@ std::pair, std::vector> create_runtime_args(bool namespace stress_tests { -TEST_F(MultiCommandQueueSingleDeviceFixture, TensixTestRandomizedProgram) { +TEST_F(MultiCommandQueueSingleDeviceProgramFixture, TensixTestRandomizedProgram) { uint32_t NUM_PROGRAMS = 100; uint32_t MAX_LOOP = 100; uint32_t page_size = 1024; @@ -90,7 +90,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, TensixTestRandomizedProgram) { // Make random auto random_seed = 0; // (unsigned int)time(NULL); - uint32_t seed = tt::parse_env("SEED", random_seed); + uint32_t seed = tt::parse_env("TT_METAL_SEED", random_seed); log_info(tt::LogTest, "Using Test Seed: {}", seed); srand(seed); diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp index 6932ab11955..37a7d218b2d 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp @@ -55,7 +55,7 @@ bool test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(Device* device, v namespace basic_tests { namespace dram_tests { -TEST_F(MultiCommandQueueMultiDeviceFixture, WriteOneTileToDramBank0) { +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToDramBank0) { TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::DRAM}; for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); @@ -67,7 +67,7 @@ TEST_F(MultiCommandQueueMultiDeviceFixture, WriteOneTileToDramBank0) { } -TEST_F(MultiCommandQueueMultiDeviceFixture, WriteOneTileToAllDramBanks) { +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToAllDramBanks) { for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); TestBufferConfig config = { @@ -82,7 +82,7 @@ TEST_F(MultiCommandQueueMultiDeviceFixture, WriteOneTileToAllDramBanks) { } } -TEST_F(MultiCommandQueueMultiDeviceFixture, WriteOneTileAcrossAllDramBanksTwiceRoundRobin) { +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileAcrossAllDramBanksTwiceRoundRobin) { constexpr uint32_t num_round_robins = 2; for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); @@ -98,7 +98,7 @@ TEST_F(MultiCommandQueueMultiDeviceFixture, WriteOneTileAcrossAllDramBanksTwiceR } } -TEST_F(MultiCommandQueueMultiDeviceFixture, Sending131072Pages) { +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, Sending131072Pages) { // Was a failing case where we used to accidentally program cb num pages to be total // pages instead of cb num pages. TestBufferConfig config = { @@ -114,7 +114,7 @@ TEST_F(MultiCommandQueueMultiDeviceFixture, Sending131072Pages) { } } -TEST_F(MultiCommandQueueMultiDeviceFixture, TestNon32BAlignedPageSizeForDram) { +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, TestNon32BAlignedPageSizeForDram) { for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::DRAM}; @@ -126,7 +126,7 @@ TEST_F(MultiCommandQueueMultiDeviceFixture, TestNon32BAlignedPageSizeForDram) { } } -TEST_F(MultiCommandQueueMultiDeviceFixture, TestNon32BAlignedPageSizeForDram2) { +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, TestNon32BAlignedPageSizeForDram2) { for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); // From stable diffusion read buffer @@ -139,7 +139,7 @@ TEST_F(MultiCommandQueueMultiDeviceFixture, TestNon32BAlignedPageSizeForDram2) { } } -TEST_F(MultiCommandQueueMultiDeviceFixture, TestIssueMultipleReadWriteCommandsForOneBuffer) { +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, TestIssueMultipleReadWriteCommandsForOneBuffer) { for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); uint32_t page_size = 2048; @@ -155,7 +155,7 @@ TEST_F(MultiCommandQueueMultiDeviceFixture, TestIssueMultipleReadWriteCommandsFo } } -TEST_F(MultiCommandQueueSingleDeviceFixture, WriteOneTileToDramBank0) { +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToDramBank0) { TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::DRAM}; CommandQueue& a = this->device_->command_queue(0); CommandQueue& b = this->device_->command_queue(1); @@ -163,7 +163,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, WriteOneTileToDramBank0) { EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); } -TEST_F(MultiCommandQueueSingleDeviceFixture, WriteOneTileToAllDramBanks) { +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToAllDramBanks) { TestBufferConfig config = { .num_pages = uint32_t(this->device_->num_banks(BufferType::DRAM)), .page_size = 2048, @@ -175,7 +175,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, WriteOneTileToAllDramBanks) { EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); } -TEST_F(MultiCommandQueueSingleDeviceFixture, WriteOneTileAcrossAllDramBanksTwiceRoundRobin) { +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileAcrossAllDramBanksTwiceRoundRobin) { constexpr uint32_t num_round_robins = 2; TestBufferConfig config = { .num_pages = num_round_robins * (this->device_->num_banks(BufferType::DRAM)), @@ -188,7 +188,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, WriteOneTileAcrossAllDramBanksTwice EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); } -TEST_F(MultiCommandQueueSingleDeviceFixture, Sending131072Pages) { +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, Sending131072Pages) { // Was a failing case where we used to accidentally program cb num pages to be total // pages instead of cb num pages. TestBufferConfig config = { @@ -202,7 +202,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, Sending131072Pages) { EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); } -TEST_F(MultiCommandQueueSingleDeviceFixture, TestNon32BAlignedPageSizeForDram) { +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestNon32BAlignedPageSizeForDram) { TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::DRAM}; CommandQueue& a = this->device_->command_queue(0); @@ -211,7 +211,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, TestNon32BAlignedPageSizeForDram) { EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); } -TEST_F(MultiCommandQueueSingleDeviceFixture, TestNon32BAlignedPageSizeForDram2) { +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestNon32BAlignedPageSizeForDram2) { // From stable diffusion read buffer TestBufferConfig config = {.num_pages = 8 * 1024, .page_size = 80, .buftype = BufferType::DRAM}; @@ -221,7 +221,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, TestNon32BAlignedPageSizeForDram2) EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); } -TEST_F(MultiCommandQueueSingleDeviceFixture, TestPageSizeTooLarge) { +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestPageSizeTooLarge) { if (this->arch_ == tt::ARCH::WORMHOLE_B0) { GTEST_SKIP(); // This test hanging on wormhole b0 } @@ -234,7 +234,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, TestPageSizeTooLarge) { EXPECT_ANY_THROW(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); } -TEST_F(MultiCommandQueueSingleDeviceFixture, TestIssueMultipleReadWriteCommandsForOneBuffer) { +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestIssueMultipleReadWriteCommandsForOneBuffer) { uint32_t page_size = 2048; uint16_t channel = tt::Cluster::instance().get_assigned_channel_for_device(this->device_->id()); uint32_t command_queue_size = tt::Cluster::instance().get_host_channel_size(this->device_->id(), channel); @@ -253,7 +253,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, TestIssueMultipleReadWriteCommandsF namespace l1_tests { -TEST_F(MultiCommandQueueSingleDeviceFixture, WriteOneTileToL1Bank0) { +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToL1Bank0) { TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::L1}; CommandQueue& a = this->device_->command_queue(0); CommandQueue& b = this->device_->command_queue(1); @@ -261,7 +261,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, WriteOneTileToL1Bank0) { EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); } -TEST_F(MultiCommandQueueSingleDeviceFixture, WriteOneTileToAllL1Banks) { +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToAllL1Banks) { auto compute_with_storage_grid = this->device_->compute_with_storage_grid_size(); TestBufferConfig config = { .num_pages = uint32_t(compute_with_storage_grid.x * compute_with_storage_grid.y), @@ -274,7 +274,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, WriteOneTileToAllL1Banks) { EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); } -TEST_F(MultiCommandQueueSingleDeviceFixture, WriteOneTileToAllL1BanksTwiceRoundRobin) { +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToAllL1BanksTwiceRoundRobin) { auto compute_with_storage_grid = this->device_->compute_with_storage_grid_size(); TestBufferConfig config = { .num_pages = 2 * uint32_t(compute_with_storage_grid.x * compute_with_storage_grid.y), @@ -287,7 +287,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, WriteOneTileToAllL1BanksTwiceRoundR EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); } -TEST_F(MultiCommandQueueSingleDeviceFixture, TestNon32BAlignedPageSizeForL1) { +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestNon32BAlignedPageSizeForL1) { TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::L1}; CommandQueue& a = this->device_->command_queue(0); @@ -296,7 +296,7 @@ TEST_F(MultiCommandQueueSingleDeviceFixture, TestNon32BAlignedPageSizeForL1) { EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); } -TEST_F(MultiCommandQueueMultiDeviceFixture, WriteOneTileToL1Bank0) { +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToL1Bank0) { for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::L1}; @@ -307,7 +307,7 @@ TEST_F(MultiCommandQueueMultiDeviceFixture, WriteOneTileToL1Bank0) { } } -TEST_F(MultiCommandQueueMultiDeviceFixture, WriteOneTileToAllL1Banks) { +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToAllL1Banks) { for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); auto compute_with_storage_grid = device->compute_with_storage_grid_size(); @@ -323,7 +323,7 @@ TEST_F(MultiCommandQueueMultiDeviceFixture, WriteOneTileToAllL1Banks) { } } -TEST_F(MultiCommandQueueMultiDeviceFixture, WriteOneTileToAllL1BanksTwiceRoundRobin) { +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToAllL1BanksTwiceRoundRobin) { for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); auto compute_with_storage_grid = device->compute_with_storage_grid_size(); @@ -339,7 +339,7 @@ TEST_F(MultiCommandQueueMultiDeviceFixture, WriteOneTileToAllL1BanksTwiceRoundRo } } -TEST_F(MultiCommandQueueMultiDeviceFixture, TestNon32BAlignedPageSizeForL1) { +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, TestNon32BAlignedPageSizeForL1) { for (Device *device : devices_) { tt::log_info("Running On Device {}", device->id()); TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::L1}; diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp index cbcc631fb0d..cc0acde2394 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp @@ -6,15 +6,17 @@ #include "gtest/gtest.h" #include "event_fixture.hpp" +#include "buffer_fixtures.hpp" +#include "dispatch_fixture.hpp" +#include "program_fixtures.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/test_utils/env_vars.hpp" -#include "tt_metal/impl/dispatch/command_queue.hpp" #include "tt_metal/llrt/rtoptions.hpp" using namespace tt::tt_metal; -class MultiCommandQueueSingleDeviceFixture : virtual public ::testing::Test { +class MultiCommandQueueSingleDeviceFixture : virtual public DispatchFixture { protected: void SetUp() override { auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); @@ -48,6 +50,10 @@ class MultiCommandQueueSingleDeviceFixture : virtual public ::testing::Test { class MultiCommandQueueSingleDeviceEventFixture : public MultiCommandQueueSingleDeviceFixture, public EventFixture {}; +class MultiCommandQueueSingleDeviceBufferFixture : public MultiCommandQueueSingleDeviceFixture, public BufferFixture {}; + +class MultiCommandQueueSingleDeviceProgramFixture : public MultiCommandQueueSingleDeviceFixture, public ProgramFixture {}; + class MultiCommandQueueMultiDeviceFixture : virtual public ::testing::Test { protected: void SetUp() override { @@ -89,4 +95,6 @@ class MultiCommandQueueMultiDeviceFixture : virtual public ::testing::Test { tt::ARCH arch_; }; +class MultiCommandQueueMultiDeviceBufferFixture : public MultiCommandQueueMultiDeviceFixture, public BufferFixture {}; + class MultiCommandQueueMultiDeviceEventFixture : public MultiCommandQueueMultiDeviceFixture, public EventFixture {}; From 243ebd767df4c946fee0863d9315741165a12040 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Mon, 4 Nov 2024 21:43:25 +0000 Subject: [PATCH 09/26] #0: More test restructuring --- .../tt_metal/unit_tests/CMakeLists.txt | 1 + .../allocator/test_l1_banking_allocator.cpp | 4 +- .../unit_tests/common/basic_fixture.hpp | 16 +--- .../unit_tests/common/device_fixture.hpp | 40 ++++----- .../unit_tests/compute/test_broadcast.cpp | 6 +- .../unit_tests/ethernet/basic_eth_kernels.cpp | 6 +- .../fast_dispatch_kernels/test_write_host.cpp | 6 +- .../basic/test_device_init.cpp | 4 - .../dprint/test_invalid_print_core.cpp | 16 ++-- .../command_queue/test_EnqueueProgram.cpp | 18 ++-- .../multichip/test_device_pool.cpp | 87 +++++++++---------- 11 files changed, 89 insertions(+), 115 deletions(-) diff --git a/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt index 38990ebe994..80e3bbd8510 100644 --- a/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt @@ -37,6 +37,7 @@ set(UNIT_TESTS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRangeSet_merge.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dram/direct.cpp ${CMAKE_CURRENT_SOURCE_DIR}/host_apis/test_tilize_untilize.cpp + # ${CMAKE_CURRENT_SOURCE_DIR}/fast_dispatch_kernels/test_write_host.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ethernet/basic_eth_kernels.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ethernet/buffer_movement_kernels.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ethernet/device_cluster_api.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/allocator/test_l1_banking_allocator.cpp b/tests/tt_metal/tt_metal/unit_tests/allocator/test_l1_banking_allocator.cpp index 27134acd303..11ddd26ebe8 100644 --- a/tests/tt_metal/tt_metal/unit_tests/allocator/test_l1_banking_allocator.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/allocator/test_l1_banking_allocator.cpp @@ -26,7 +26,7 @@ uint64_t get_alloc_limit(const tt::tt_metal::Device *device) { } // namespace unit_tests::test_l1_banking_allocator -TEST_F(DeviceSingleCardFixture, TestL1BuffersAllocatedTopDown) { +TEST_F(DeviceSingleCardBufferFixture, TestL1BuffersAllocatedTopDown) { std::vector alloc_sizes = {32 * 1024, 64 * 1024, 128 * 1024}; size_t total_size_bytes = 0; @@ -50,7 +50,7 @@ TEST_F(DeviceSingleCardFixture, TestL1BuffersAllocatedTopDown) { buffers.clear(); } -TEST_F(DeviceSingleCardFixture, TestL1BuffersDoNotGrowBeyondBankSize) { +TEST_F(DeviceSingleCardBufferFixture, TestL1BuffersDoNotGrowBeyondBankSize) { uint64_t alloc_limit = unit_tests::test_l1_banking_allocator::get_alloc_limit(this->device_); tt::tt_metal::InterleavedBufferConfig l1_config{ diff --git a/tests/tt_metal/tt_metal/unit_tests/common/basic_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests/common/basic_fixture.hpp index f4603b7ec37..1b2faf22608 100644 --- a/tests/tt_metal/tt_metal/unit_tests/common/basic_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests/common/basic_fixture.hpp @@ -5,10 +5,10 @@ #pragma once #include +#include "device_fixture.hpp" #include "tt_metal/common/assert.hpp" -#include "tt_metal/test_utils/env_vars.hpp" -class BasicFixture : public ::testing::Test { +class BasicFixture : public ::testing::Test { protected: void SetUp() override { auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); @@ -17,17 +17,9 @@ class BasicFixture : public ::testing::Test { GTEST_SKIP(); } } - }; -class FDBasicFixture : public ::testing::Test { +class DevicePoolFixture : public DeviceFixture { protected: - void SetUp() override { - auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); - if (slow_dispatch) { - TT_THROW("This suite can only be run with FD runtime"); - GTEST_SKIP(); - } - } - + void SetUp() override {} }; diff --git a/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp index 4d637d67db1..df277004776 100644 --- a/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp @@ -6,6 +6,7 @@ #include +#include "buffer_fixtures.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/test_utils/env_vars.hpp" @@ -52,50 +53,47 @@ class DeviceFixture : public ::testing::Test { size_t num_devices_; }; - -class DeviceSingleCardFixture : public ::testing::Test { +class DeviceSingleCardFixture : virtual public ::testing::Test { protected: void SetUp() override { + this->validate_dispatch_mode(); + arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + this->create_devices(); + } + + void TearDown() override { tt::tt_metal::detail::CloseDevices(reserved_devices_); } + + void validate_dispatch_mode() { auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); - if (not slow_dispatch) { - TT_THROW("This suite can only be run with TT_METAL_SLOW_DISPATCH_MODE set"); + if (slow_dispatch) { + TT_THROW("This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); GTEST_SKIP(); } - arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + } + void create_devices(const std::size_t trace_region_size = DEFAULT_TRACE_REGION_SIZE) { const chip_id_t mmio_device_id = 0; reserved_devices_ = tt::tt_metal::detail::CreateDevices({mmio_device_id}); device_ = reserved_devices_.at(mmio_device_id); - - num_devices_ = reserved_devices_.size(); } - void TearDown() override { tt::tt_metal::detail::CloseDevices(reserved_devices_); } - - tt::tt_metal::Device* device_; + tt::tt_metal::Device *device_; std::map reserved_devices_; tt::ARCH arch_; size_t num_devices_; }; +class DeviceSingleCardBufferFixture : virtual public DeviceSingleCardFixture, virtual public BufferFixture {}; + class BlackholeSingleCardFixture : public DeviceSingleCardFixture { protected: void SetUp() override { - auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); - if (not slow_dispatch) { - TT_THROW("This suite can only be run with TT_METAL_SLOW_DISPATCH_MODE set"); - GTEST_SKIP(); - } + this->validate_dispatch_mode(); arch_ = tt::get_arch_from_string(tt::test_utils::get_env_arch_name()); if (arch_ != tt::ARCH::BLACKHOLE) { GTEST_SKIP(); } - - const chip_id_t mmio_device_id = 0; - reserved_devices_ = tt::tt_metal::detail::CreateDevices({mmio_device_id}); - device_ = reserved_devices_.at(mmio_device_id); - - num_devices_ = reserved_devices_.size(); + this->create_devices(); } }; diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_broadcast.cpp b/tests/tt_metal/tt_metal/unit_tests/compute/test_broadcast.cpp index c26fcf4c981..5642aa3dfed 100644 --- a/tests/tt_metal/tt_metal/unit_tests/compute/test_broadcast.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/compute/test_broadcast.cpp @@ -289,11 +289,11 @@ void run_single_core_broadcast(tt_metal::Device* device, const BroadcastConfig& } } -class BroadcastParametrizedDeviceFixture : public DeviceFixture, +class BroadcastParameterizedDeviceFixture : public DeviceFixture, public testing::WithParamInterface { }; -TEST_P(BroadcastParametrizedDeviceFixture, TensixComputeSingleTileBroadcast) { +TEST_P(BroadcastParameterizedDeviceFixture, TensixComputeSingleTileBroadcast) { unit_tests::compute::broadcast::BroadcastConfig test_config = GetParam(); for (uint8_t i = uint8_t(MathFidelity::LoFi); i <= uint8_t(MathFidelity::HiFi4); i++) { if (i == 1) continue; @@ -307,7 +307,7 @@ using namespace unit_tests::compute::broadcast; INSTANTIATE_TEST_SUITE_P( ComputeSingleTileBroadcast, - BroadcastParametrizedDeviceFixture, + BroadcastParameterizedDeviceFixture, ::testing::Values( (BroadcastConfig){ApiConvention::DEFAULT, EltwiseOp::ADD, BroadcastDim::ROW}, (BroadcastConfig){ApiConvention::DEFAULT, EltwiseOp::ADD, BroadcastDim::COL}, diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp index bec12773a2e..407809cef12 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp @@ -838,7 +838,7 @@ TEST_F(N300DeviceFixture, ActiveEthEthKernelsRandomEthPacketSizeDirectSendTests) } // TODO #14640: Run this on WH when i$ flush issue is addressed -TEST_F(BlackholeSingleCardFixture, EthKernelOnIdleErisc0) { +TEST_F(BlackholeSingleCardFixture, IdleEthKernelOnIdleErisc0) { using namespace CMAKE_UNIQUE_NAMESPACE; uint32_t eth_l1_address = hal.get_dev_addr(HalProgrammableCoreType::IDLE_ETH, HalL1MemAddrType::UNRESERVED); tt_metal::EthernetConfig noc0_ethernet_config{.eth_mode = Eth::IDLE, .noc = tt_metal::NOC::NOC_0, .processor = tt_metal::DataMovementProcessor::RISCV_0}; @@ -856,7 +856,7 @@ TEST_F(BlackholeSingleCardFixture, EthKernelOnIdleErisc0) { } } -TEST_F(BlackholeSingleCardFixture, EthKernelOnIdleErisc1) { +TEST_F(BlackholeSingleCardFixture, IdleEthKernelOnIdleErisc1) { using namespace CMAKE_UNIQUE_NAMESPACE; uint32_t eth_l1_address = hal.get_dev_addr(HalProgrammableCoreType::IDLE_ETH, HalL1MemAddrType::UNRESERVED); tt_metal::EthernetConfig noc0_ethernet_config{.eth_mode = Eth::IDLE, .noc = tt_metal::NOC::NOC_0, .processor = tt_metal::DataMovementProcessor::RISCV_1}; @@ -874,7 +874,7 @@ TEST_F(BlackholeSingleCardFixture, EthKernelOnIdleErisc1) { } } -TEST_F(BlackholeSingleCardFixture, EthKernelOnBothIdleEriscs) { +TEST_F(BlackholeSingleCardFixture, IdleEthKernelOnBothIdleEriscs) { using namespace CMAKE_UNIQUE_NAMESPACE; uint32_t read_write_size_bytes = WORD_SIZE * 2048; uint32_t reader_dst_address = hal.get_dev_addr(HalProgrammableCoreType::IDLE_ETH, HalL1MemAddrType::UNRESERVED); diff --git a/tests/tt_metal/tt_metal/unit_tests/fast_dispatch_kernels/test_write_host.cpp b/tests/tt_metal/tt_metal/unit_tests/fast_dispatch_kernels/test_write_host.cpp index 5c3c0b270ab..2d3e99cb382 100644 --- a/tests/tt_metal/tt_metal/unit_tests/fast_dispatch_kernels/test_write_host.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/fast_dispatch_kernels/test_write_host.cpp @@ -2,14 +2,10 @@ // // SPDX-License-Identifier: Apache-2.0 -#include - #include "gtest/gtest.h" -#include "tests/tt_metal/tt_metal/perf_microbenchmark/dispatch/common.h" #include "tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" -#include "tt_metal/test_utils/env_vars.hpp" #include "tt_metal/common/math.hpp" using std::vector; @@ -97,7 +93,7 @@ bool test_write_host(Device *device, uint32_t data_size, std::pairget_base_allocator_addr(HalMemType::L1); + uint32_t l1_unreserved_base = device->get_base_allocator_addr(HalMemType::L1); uint32_t l1_buf_base = align(l1_unreserved_base, dispatch_buffer_page_size_g); std::vector dispatch_cmds; 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 1db610062ce..d66dcb3774b 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 @@ -4,10 +4,6 @@ #include -#include -#include -#include - #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/dispatch/command_queue.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp index b3e7088b615..bdaf94db322 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp @@ -2,9 +2,8 @@ // // SPDX-License-Identifier: Apache-2.0 #include "gtest/gtest.h" +#include "debug_tools_fixtures.hpp" #include "tt_metal/host_api.hpp" -#include "tt_metal/test_utils/env_vars.hpp" -#include "tt_metal/impl/dispatch/command_queue.hpp" #include "tt_metal/llrt/rtoptions.hpp" ////////////////////////////////////////////////////////////////////////////////////////// @@ -12,22 +11,17 @@ ////////////////////////////////////////////////////////////////////////////////////////// using namespace tt::tt_metal; -TEST(DPrintErrorChecking, TensixTestPrintInvalidCore) { +TEST_F(DPrintFixture, TensixTestPrintInvalidCore) { // Set DPRINT enabled on a mix of invalid and valid cores. Previously this would hang during // device setup, but not the print server should simply ignore the invalid cores. std::map> dprint_cores; dprint_cores[CoreType::WORKER] = {{0, 0}, {1, 1}, {100, 100}}; tt::llrt::OptionsG.set_feature_cores(tt::llrt::RunTimeDebugFeatureDprint, dprint_cores); - tt::llrt::OptionsG.set_feature_enabled(tt::llrt::RunTimeDebugFeatureDprint, true); - - const int device_id = 0; - Device* device = nullptr; - const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); - device = tt::tt_metal::CreateDevice(device_id, tt::llrt::OptionsG.get_num_hw_cqs(), DEFAULT_L1_SMALL_SIZE, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); // We expect that even though illegal worker cores were requested, device setup did not hang. // So just make sure that device setup worked and then close the device. - EXPECT_TRUE(device != nullptr); + for (Device* device : this->devices_) { + EXPECT_TRUE(device != nullptr); + } tt::llrt::OptionsG.set_feature_enabled(tt::llrt::RunTimeDebugFeatureDprint, false); - tt::tt_metal::CloseDevice(device); } diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp index da035da0f74..0e3d9af36df 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp @@ -1386,7 +1386,7 @@ TEST_F(CommandQueueProgramFixture, TensixTestRandomizedProgram) { Finish(this->device_->command_queue()); } -TEST_F(RandomProgramFixture, TestSimpleProgramsOnTensix) { +TEST_F(RandomProgramFixture, TensixTestSimplePrograms) { for (uint32_t i = 0; i < NUM_PROGRAMS; i++) { if (i % 10 == 0) { log_info(tt::LogTest, "Creating Program {}", i); @@ -1399,7 +1399,7 @@ TEST_F(RandomProgramFixture, TestSimpleProgramsOnTensix) { Finish(device_->command_queue()); } -TEST_F(RandomProgramFixture, TestSimpleProgramsOnEth) { +TEST_F(RandomProgramFixture, ActiveEthTestSimplePrograms) { if (!does_device_have_active_eth_cores(device_)) { GTEST_SKIP() << "Skipping test because device " << device_->id() << " does not have any active ethernet cores"; } @@ -1416,7 +1416,7 @@ TEST_F(RandomProgramFixture, TestSimpleProgramsOnEth) { Finish(device_->command_queue()); } -TEST_F(RandomProgramFixture, TestSimpleProgramsOnTensixAndEth) { +TEST_F(RandomProgramFixture, TensixActiveEthTestSimplePrograms) { if (!does_device_have_active_eth_cores(device_)) { GTEST_SKIP() << "Skipping test because device " << device_->id() << " does not have any active ethernet cores"; } @@ -1442,7 +1442,7 @@ TEST_F(RandomProgramFixture, TestSimpleProgramsOnTensixAndEth) { Finish(device_->command_queue()); } -TEST_F(RandomProgramFixture, TestProgramsOnTensix) { +TEST_F(RandomProgramFixture, TensixTestPrograms) { for (uint32_t i = 0; i < NUM_PROGRAMS; i++) { if (i % 10 == 0) { log_info(tt::LogTest, "Creating Program {}", i); @@ -1455,7 +1455,7 @@ TEST_F(RandomProgramFixture, TestProgramsOnTensix) { Finish(device_->command_queue()); } -TEST_F(RandomProgramFixture, TestProgramsOnEth) { +TEST_F(RandomProgramFixture, ActiveEthTestPrograms) { if (!does_device_have_active_eth_cores(device_)) { GTEST_SKIP() << "Skipping test because device " << device_->id() << " does not have any active ethernet cores"; } @@ -1477,7 +1477,7 @@ TEST_F(RandomProgramFixture, TestProgramsOnEth) { Finish(device_->command_queue()); } -TEST_F(RandomProgramFixture, TestProgramsOnTensixAndEth) { +TEST_F(RandomProgramFixture, TensixActiveEthTestPrograms) { if (!does_device_have_active_eth_cores(device_)) { GTEST_SKIP() << "Skipping test because device " << device_->id() << " does not have any active ethernet cores"; } @@ -1511,7 +1511,7 @@ TEST_F(RandomProgramFixture, TestProgramsOnTensixAndEth) { Finish(device_->command_queue()); } -TEST_F(RandomProgramFixture, TestAlternatingLargeAndSmallProgramsOnTensix) { +TEST_F(RandomProgramFixture, TensixTestAlternatingLargeAndSmallPrograms) { for (uint32_t i = 0; i < NUM_PROGRAMS; i++) { if (i % 10 == 0) { log_info(tt::LogTest, "Creating Program {}", i); @@ -1532,7 +1532,7 @@ TEST_F(RandomProgramFixture, TestAlternatingLargeAndSmallProgramsOnTensix) { Finish(device_->command_queue()); } -TEST_F(RandomProgramFixture, TestLargeProgramFollowedBySmallProgramsOnTensix) { +TEST_F(RandomProgramFixture, TensixTestLargeProgramFollowedBySmallPrograms) { for (uint32_t i = 0; i < NUM_PROGRAMS; i++) { if (i % 10 == 0) { log_info(tt::LogTest, "Creating Program {}", i); @@ -1553,7 +1553,7 @@ TEST_F(RandomProgramFixture, TestLargeProgramFollowedBySmallProgramsOnTensix) { Finish(device_->command_queue()); } -TEST_F(RandomProgramFixture, TestLargeProgramInBetweenFiveSmallProgramsOnTensix) { +TEST_F(RandomProgramFixture, TensixTestLargeProgramInBetweenFiveSmallPrograms) { for (uint32_t i = 0; i < NUM_PROGRAMS; i++) { if (i % 10 == 0) { log_info(tt::LogTest, "Creating Program {}", i); diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_device_pool.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_device_pool.cpp index 85af4f9396f..a07c909ddd9 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_device_pool.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_device_pool.cpp @@ -6,123 +6,120 @@ #include "tests/tt_metal/tt_metal/unit_tests/common/basic_fixture.hpp" #include "tt_metal/host_api.hpp" -#include "tt_metal/test_utils/env_vars.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" -#include "tt_metal/test_utils/stimulus.hpp" #include "tt_metal/impl/device/device_pool.hpp" using namespace tt; using namespace tt::test_utils; -TEST_F(FDBasicFixture, DevicePoolOpenClose) { +TEST_F(DevicePoolFixture, DevicePoolOpenClose) { std::vector device_ids{0}; int num_hw_cqs = 1; int l1_small_size = 1024; - const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); + const auto& dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); tt::DevicePool::initialize(device_ids, num_hw_cqs, l1_small_size, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); auto devices = tt::DevicePool::instance().get_all_active_devices(); - for (const auto& dev: devices) { - ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); - ASSERT_TRUE((int)(dev->num_hw_cqs()) == num_hw_cqs); - ASSERT_TRUE(dev->is_initialized()); + for (const auto& dev : devices) { + ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); + ASSERT_TRUE((int)(dev->num_hw_cqs()) == num_hw_cqs); + ASSERT_TRUE(dev->is_initialized()); } // Close then get devices again - for (const auto& dev: devices) { + for (const auto& dev : devices) { dev->close(); } devices = tt::DevicePool::instance().get_all_active_devices(); - for (const auto& dev: devices) { - ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); - ASSERT_TRUE((int)(dev->num_hw_cqs()) == num_hw_cqs); - ASSERT_TRUE(dev->is_initialized()); + for (const auto& dev : devices) { + ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); + ASSERT_TRUE((int)(dev->num_hw_cqs()) == num_hw_cqs); + ASSERT_TRUE(dev->is_initialized()); } - for (const auto& dev: devices) { + for (const auto& dev : devices) { dev->close(); } } -TEST_F(FDBasicFixture, DevicePoolReconfigDevices) { +TEST_F(DevicePoolFixture, DevicePoolReconfigDevices) { std::vector device_ids{0}; int num_hw_cqs = 1; int l1_small_size = 1024; - const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); + const auto& dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); tt::DevicePool::initialize(device_ids, num_hw_cqs, l1_small_size, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); auto devices = tt::DevicePool::instance().get_all_active_devices(); - for (const auto& dev: devices) { - ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); - ASSERT_TRUE((int)(dev->num_hw_cqs()) == num_hw_cqs); - ASSERT_TRUE(dev->is_initialized()); + for (const auto& dev : devices) { + ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); + ASSERT_TRUE((int)(dev->num_hw_cqs()) == num_hw_cqs); + ASSERT_TRUE(dev->is_initialized()); } // Close then get devices with different configs - for (const auto& dev: devices) { + for (const auto& dev : devices) { dev->close(); } l1_small_size = 2048; tt::DevicePool::initialize(device_ids, num_hw_cqs, l1_small_size, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); devices = tt::DevicePool::instance().get_all_active_devices(); - for (const auto& dev: devices) { - ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); - ASSERT_TRUE(dev->is_initialized()); + for (const auto& dev : devices) { + ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); + ASSERT_TRUE(dev->is_initialized()); } - for (const auto& dev: devices) { + for (const auto& dev : devices) { dev->close(); } } -TEST_F(FDBasicFixture, DevicePoolAddDevices) { +TEST_F(DevicePoolFixture, DevicePoolAddDevices) { if (tt::tt_metal::GetNumAvailableDevices() != 8) { GTEST_SKIP(); } std::vector device_ids{0}; int num_hw_cqs = 1; int l1_small_size = 1024; - const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); + const auto& dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); tt::DevicePool::initialize(device_ids, num_hw_cqs, l1_small_size, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); auto devices = tt::DevicePool::instance().get_all_active_devices(); - for (const auto& dev: devices) { - ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); - ASSERT_TRUE((int)(dev->num_hw_cqs()) == num_hw_cqs); - ASSERT_TRUE(dev->is_initialized()); + for (const auto& dev : devices) { + ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); + ASSERT_TRUE((int)(dev->num_hw_cqs()) == num_hw_cqs); + ASSERT_TRUE(dev->is_initialized()); } // Close then get more devices - for (const auto& dev: devices) { + for (const auto& dev : devices) { dev->close(); } device_ids = {0, 1, 2, 3}; tt::DevicePool::initialize(device_ids, num_hw_cqs, l1_small_size, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); devices = tt::DevicePool::instance().get_all_active_devices(); ASSERT_TRUE(devices.size() >= 4); - for (const auto& dev: devices) { - ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); - ASSERT_TRUE((int)(dev->num_hw_cqs()) == num_hw_cqs); - ASSERT_TRUE(dev->is_initialized()); + for (const auto& dev : devices) { + ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); + ASSERT_TRUE((int)(dev->num_hw_cqs()) == num_hw_cqs); + ASSERT_TRUE(dev->is_initialized()); } - for (const auto& dev: devices) { + for (const auto& dev : devices) { dev->close(); } } -TEST_F(FDBasicFixture, DevicePoolReduceDevices) { +TEST_F(DevicePoolFixture, DevicePoolReduceDevices) { if (tt::tt_metal::GetNumAvailableDevices() != 8) { GTEST_SKIP(); } std::vector device_ids{0, 1, 2, 3}; int num_hw_cqs = 1; int l1_small_size = 1024; - const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); + const auto& dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); tt::DevicePool::initialize(device_ids, num_hw_cqs, l1_small_size, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); const auto devices = tt::DevicePool::instance().get_all_active_devices(); - for (const auto& dev: devices) { - ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); - ASSERT_TRUE((int)(dev->num_hw_cqs()) == num_hw_cqs); - ASSERT_TRUE(dev->is_initialized()); + for (const auto& dev : devices) { + ASSERT_TRUE((int)(dev->get_l1_small_size()) == l1_small_size); + ASSERT_TRUE((int)(dev->num_hw_cqs()) == num_hw_cqs); + ASSERT_TRUE(dev->is_initialized()); } // Close then get less devices - for (const auto& dev: devices) { + for (const auto& dev : devices) { dev->close(); } device_ids = {0}; From 0e357ea725ab7c7e190b1f2e0492ef73b1dfc70c Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Tue, 5 Nov 2024 01:34:50 +0000 Subject: [PATCH 10/26] #0: More work --- CONTRIBUTING.md | 6 +++--- .../unit_tests/ethernet/basic_eth_kernels.cpp | 18 +++++++++--------- .../ethernet/buffer_movement_kernels.cpp | 8 ++++---- .../common/command_queue_fixture.hpp | 4 ++-- .../multichip/test_eth_EnqueueProgram.cpp | 10 +++++----- .../test_eth_ring_gather_EnqueueProgram.cpp | 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d1fff5282f..b34119280b6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -245,7 +245,7 @@ structure our tests with this framework is to bundle it into a single executable. You can use `--gtest_filter_test` to filter out the specific test you'd like. -For example, to build and run the `DispatchFixture.DRAMLoopbackSingleCore` on +For example, to build and run the `DispatchFixture.TensixDRAMLoopbackSingleCore` on fast dispatch, you can 1. Build the unit tests: @@ -254,7 +254,7 @@ fast dispatch, you can ``` 2. Run the test: ``` - ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="DispatchFixture.DRAMLoopbackSingleCore" + ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="DispatchFixture.TensixDRAMLoopbackSingleCore" ``` On slow dispatch, to run another specific test, the equivalent would be: @@ -263,7 +263,7 @@ On slow dispatch, to run another specific test, the equivalent would be: 2. Run with the slow dispatch mode: ``` export TT_METAL_SLOW_DISPATCH_MODE=1 - ./build/test/tt_metal/unit_tests/fast_dispatch --gtest_filter_test="BasicFixture.TestL1BuffersAllocatedTopDown" + ./build/test/tt_metal/unit_tests/fast_dispatch --gtest_filter="DeviceSingleCardBufferFixture.TestL1BuffersAllocatedTopDown" ``` We have split our tests into the two dispatch modes for less pollution of state diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp index 407809cef12..d5db485111e 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp @@ -301,7 +301,7 @@ bool noc_reader_and_writer_kernels( return pass; } -TEST_F(N300DeviceFixture, ActiveEthEthKernelsNocReadNoSend) { +TEST_F(N300DeviceFixture, ActiveEthKernelsNocReadNoSend) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); const auto& device_0 = devices_.at(0); @@ -328,7 +328,7 @@ TEST_F(N300DeviceFixture, ActiveEthEthKernelsNocReadNoSend) { } } -TEST_F(N300DeviceFixture, ActiveEthEthKernelsNocWriteNoReceive) { +TEST_F(N300DeviceFixture, ActiveEthKernelsNocWriteNoReceive) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); const auto& device_0 = devices_.at(0); @@ -473,7 +473,7 @@ bool eth_direct_sender_receiver_kernels( } // namespace unit_tests::erisc::kernels -TEST_F(N300DeviceFixture, ActiveEthEthKernelsDirectSendChip0ToChip1) { +TEST_F(N300DeviceFixture, ActiveEthKernelsDirectSendChip0ToChip1) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); const auto& device_0 = devices_.at(0); @@ -522,7 +522,7 @@ TEST_F(N300DeviceFixture, ActiveEthEthKernelsDirectSendChip0ToChip1) { } } -TEST_F(N300DeviceFixture, ActiveEthEthKernelsDirectSendChip1ToChip0) { +TEST_F(N300DeviceFixture, ActiveEthKernelsDirectSendChip1ToChip0) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); const auto& device_0 = devices_.at(0); @@ -571,7 +571,7 @@ TEST_F(N300DeviceFixture, ActiveEthEthKernelsDirectSendChip1ToChip0) { } } -TEST_F(DeviceFixture, ActiveEthEthKernelsDirectSendAllConnectedChips) { +TEST_F(DeviceFixture, ActiveEthKernelsDirectSendAllConnectedChips) { using namespace CMAKE_UNIQUE_NAMESPACE; const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; const size_t dst_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; @@ -622,7 +622,7 @@ TEST_F(DeviceFixture, ActiveEthEthKernelsDirectSendAllConnectedChips) { } } -TEST_F(N300DeviceFixture, ActiveEthEthKernelsBidirectionalDirectSend) { +TEST_F(N300DeviceFixture, ActiveEthKernelsBidirectionalDirectSend) { using namespace CMAKE_UNIQUE_NAMESPACE; const auto& device_0 = devices_.at(0); const auto& device_1 = devices_.at(1); @@ -708,7 +708,7 @@ TEST_F(N300DeviceFixture, ActiveEthEthKernelsBidirectionalDirectSend) { } } -TEST_F(N300DeviceFixture, ActiveEthEthKernelsRepeatedDirectSends) { +TEST_F(N300DeviceFixture, ActiveEthKernelsRepeatedDirectSends) { using namespace CMAKE_UNIQUE_NAMESPACE; const auto& device_0 = devices_.at(0); const auto& device_1 = devices_.at(1); @@ -741,7 +741,7 @@ TEST_F(N300DeviceFixture, ActiveEthEthKernelsRepeatedDirectSends) { } } -TEST_F(N300DeviceFixture, ActiveEthEthKernelsRandomDirectSendTests) { +TEST_F(N300DeviceFixture, ActiveEthKernelsRandomDirectSendTests) { using namespace CMAKE_UNIQUE_NAMESPACE; srand(0); const auto& device_0 = devices_.at(0); @@ -785,7 +785,7 @@ TEST_F(N300DeviceFixture, ActiveEthEthKernelsRandomDirectSendTests) { receiver_core)); } } -TEST_F(N300DeviceFixture, ActiveEthEthKernelsRandomEthPacketSizeDirectSendTests) { +TEST_F(N300DeviceFixture, ActiveEthKernelsRandomEthPacketSizeDirectSendTests) { srand(0); const auto& device_0 = devices_.at(0); const auto& device_1 = devices_.at(1); diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp index 8aad97249f1..339eb87d063 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp @@ -280,7 +280,7 @@ bool chip_to_chip_interleaved_buffer_transfer( } // namespace unit_tests::erisc::kernels -TEST_F(N300DeviceFixture, ActiveEthEthKernelsSendDramBufferChip0ToChip1) { +TEST_F(N300DeviceFixture, ActiveEthKernelsSendDramBufferChip0ToChip1) { const auto& sender_device = devices_.at(0); const auto& receiver_device = devices_.at(1); @@ -298,7 +298,7 @@ TEST_F(N300DeviceFixture, ActiveEthEthKernelsSendDramBufferChip0ToChip1) { } } -TEST_F(N300DeviceFixture, ActiveEthEthKernelsSendDramBufferChip1ToChip0) { +TEST_F(N300DeviceFixture, ActiveEthKernelsSendDramBufferChip1ToChip0) { const auto& sender_device = devices_.at(1); const auto& receiver_device = devices_.at(0); @@ -316,7 +316,7 @@ TEST_F(N300DeviceFixture, ActiveEthEthKernelsSendDramBufferChip1ToChip0) { } } -TEST_F(N300DeviceFixture, ActiveEthEthKernelsSendInterleavedBufferChip0ToChip1) { +TEST_F(N300DeviceFixture, ActiveEthKernelsSendInterleavedBufferChip0ToChip1) { GTEST_SKIP(); const auto& sender_device = devices_.at(0); const auto& receiver_device = devices_.at(1); @@ -368,7 +368,7 @@ TEST_F(N300DeviceFixture, ActiveEthEthKernelsSendInterleavedBufferChip0ToChip1) } } -TEST_F(DeviceFixture, ActiveEthEthKernelsSendInterleavedBufferAllConnectedChips) { +TEST_F(DeviceFixture, ActiveEthKernelsSendInterleavedBufferAllConnectedChips) { for (const auto& sender_device : devices_) { for (const auto& receiver_device : devices_) { if (sender_device->id() == receiver_device->id()) { diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp index 687ff11cdbc..89d2012d50a 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp @@ -145,7 +145,7 @@ class CommandQueueMultiDeviceFixture : public DispatchFixture { class CommandQueueMultiDeviceProgramFixture : virtual public CommandQueueMultiDeviceFixture, virtual public ProgramFixture {}; -class RandomProgramFixture : virtual public CommandQueueSingleCardFixture { +class RandomProgramFixture : virtual public CommandQueueSingleCardProgramFixture { protected: static const uint32_t MIN_KERNEL_SIZE_BYTES = 20; static const uint32_t MAX_KERNEL_SIZE_BYTES = 4096; @@ -198,7 +198,7 @@ class RandomProgramFixture : virtual public CommandQueueSingleCardFixture { Device *device_; void SetUp() override { - CommandQueueSingleCardFixture::SetUp(); + CommandQueueSingleCardProgramFixture::SetUp(); this->device_ = this->devices_[0]; this->initialize_seed(); } diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp index 40c82285a97..c985e117a18 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp @@ -559,7 +559,7 @@ TEST_F(CommandQueueSingleCardProgramFixture, ActiveEthEnqueueDummyProgram) { } } -TEST_F(CommandQueueSingleCardProgramFixture, ActiveEthEthKernelsNocReadNoSend) { +TEST_F(CommandQueueSingleCardProgramFixture, ActiveEthKernelsNocReadNoSend) { using namespace CMAKE_UNIQUE_NAMESPACE; const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; @@ -575,7 +575,7 @@ TEST_F(CommandQueueSingleCardProgramFixture, ActiveEthEthKernelsNocReadNoSend) { } } -TEST_F(CommandQueueSingleCardProgramFixture, ActiveEthEthKernelsNocWriteNoReceive) { +TEST_F(CommandQueueSingleCardProgramFixture, ActiveEthKernelsNocWriteNoReceive) { using namespace CMAKE_UNIQUE_NAMESPACE; const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; @@ -591,7 +591,7 @@ TEST_F(CommandQueueSingleCardProgramFixture, ActiveEthEthKernelsNocWriteNoReceiv } } -TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsDirectSendAllConnectedChips) { +TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthKernelsDirectSendAllConnectedChips) { using namespace CMAKE_UNIQUE_NAMESPACE; const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; const size_t dst_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; @@ -642,7 +642,7 @@ TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsDirectSendAllCo } } -TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsSendDramBufferAllConnectedChips) { +TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthKernelsSendDramBufferAllConnectedChips) { for (const auto& sender_device : devices_) { for (const auto& receiver_device : devices_) { if (sender_device->id() >= receiver_device->id()) { @@ -674,7 +674,7 @@ TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsSendDramBufferA } } -TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsSendInterleavedBufferAllConnectedChips) { +TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthKernelsSendInterleavedBufferAllConnectedChips) { using namespace CMAKE_UNIQUE_NAMESPACE; for (const auto& sender_device : devices_) { for (const auto& receiver_device : devices_) { diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_ring_gather_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_ring_gather_EnqueueProgram.cpp index c4235b6a6c2..2cbaa40e82e 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_ring_gather_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_ring_gather_EnqueueProgram.cpp @@ -460,7 +460,7 @@ bool eth_interleaved_ring_gather_sender_receiver_kernels( } } // namespace fd_unit_tests::erisc::kernels -TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsDirectRingGatherAllChips) { +TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthKernelsDirectRingGatherAllChips) { using namespace CMAKE_UNIQUE_NAMESPACE; if (num_devices_ < 4) { GTEST_SKIP(); @@ -476,7 +476,7 @@ TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsDirectRingGathe device_ring, WORD_SIZE, src_eth_l1_byte_address, dst_eth_l1_byte_address, sem_l1_byte_address)); } -TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthEthKernelsInterleavedRingGatherAllChips) { +TEST_F(CommandQueueMultiDeviceProgramFixture, ActiveEthKernelsInterleavedRingGatherAllChips) { using namespace CMAKE_UNIQUE_NAMESPACE; if (num_devices_ < 4) { GTEST_SKIP(); From a91cb81d0460849cf437a1092eb9586a17cca593 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Tue, 5 Nov 2024 17:32:51 +0000 Subject: [PATCH 11/26] #0: More work --- .../{buffer_fixtures.hpp => buffer_fixture.hpp} | 0 .../{program_fixtures.hpp => program_fixture.hpp} | 0 .../{trace_fixtures.hpp => trace_fixture.hpp} | 0 .../tt_metal/unit_tests/common/device_fixture.hpp | 2 +- ..._tools_fixtures.hpp => debug_tools_fixture.hpp} | 0 .../unit_tests_common/dprint/test_eth_cores.cpp | 2 +- .../dprint/test_invalid_print_core.cpp | 2 +- .../unit_tests_common/dprint/test_mute_device.cpp | 2 +- .../dprint/test_mute_print_server.cpp | 2 +- .../dprint/test_print_all_harts.cpp | 2 +- .../dprint/test_print_before_finish.cpp | 2 +- .../dprint/test_print_hanging.cpp | 2 +- .../dprint/test_print_tensix_dest.cpp | 2 +- .../unit_tests_common/dprint/test_print_tiles.cpp | 2 +- .../unit_tests_common/dprint/test_raise_wait.cpp | 2 +- .../unit_tests_common/watcher/test_assert.cpp | 2 +- .../watcher/test_link_training.cpp | 2 +- .../watcher/test_noc_sanitize.cpp | 2 +- .../watcher/test_noc_sanitize_delays.cpp | 2 +- .../unit_tests_common/watcher/test_pause.cpp | 2 +- .../unit_tests_common/watcher/test_ringbuf.cpp | 2 +- .../unit_tests_common/watcher/test_waypoint.cpp | 2 +- .../command_queue/test_EnqueueProgram.cpp | 2 +- .../common/command_queue_fixture.hpp | 6 +----- .../command_queue/test_EnqueueTrace.cpp | 2 +- .../common/command_queue_fixture.hpp | 14 +++++--------- 26 files changed, 26 insertions(+), 34 deletions(-) rename tests/tt_metal/tt_metal/common/{buffer_fixtures.hpp => buffer_fixture.hpp} (100%) rename tests/tt_metal/tt_metal/common/{program_fixtures.hpp => program_fixture.hpp} (100%) rename tests/tt_metal/tt_metal/common/{trace_fixtures.hpp => trace_fixture.hpp} (100%) rename tests/tt_metal/tt_metal/unit_tests_common/common/{debug_tools_fixtures.hpp => debug_tools_fixture.hpp} (100%) diff --git a/tests/tt_metal/tt_metal/common/buffer_fixtures.hpp b/tests/tt_metal/tt_metal/common/buffer_fixture.hpp similarity index 100% rename from tests/tt_metal/tt_metal/common/buffer_fixtures.hpp rename to tests/tt_metal/tt_metal/common/buffer_fixture.hpp diff --git a/tests/tt_metal/tt_metal/common/program_fixtures.hpp b/tests/tt_metal/tt_metal/common/program_fixture.hpp similarity index 100% rename from tests/tt_metal/tt_metal/common/program_fixtures.hpp rename to tests/tt_metal/tt_metal/common/program_fixture.hpp diff --git a/tests/tt_metal/tt_metal/common/trace_fixtures.hpp b/tests/tt_metal/tt_metal/common/trace_fixture.hpp similarity index 100% rename from tests/tt_metal/tt_metal/common/trace_fixtures.hpp rename to tests/tt_metal/tt_metal/common/trace_fixture.hpp diff --git a/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp index df277004776..938df53a0f6 100644 --- a/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp @@ -6,7 +6,7 @@ #include -#include "buffer_fixtures.hpp" +#include "buffer_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/test_utils/env_vars.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp b/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixture.hpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixtures.hpp rename to tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixture.hpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp index 78824f98ea7..5428061e46e 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "gtest/gtest.h" #include "test_utils.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp index bdaf94db322..47ba5193765 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 #include "gtest/gtest.h" -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/llrt/rtoptions.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp index fbe5b88ddab..89a322d2892 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "common/bfloat16.hpp" #include "test_utils.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp index c0b2ac3362d..08c05d5228c 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "gtest/gtest.h" #include "impl/debug/dprint_server.hpp" #include "test_utils.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp index e6b00e9144d..6a6041650cc 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "common/bfloat16.hpp" #include "gtest/gtest.h" #include "test_utils.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp index b599bed43eb..200b7ce6264 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "test_utils.hpp" ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp index 13a447d1eb9..6bd805b8f1e 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "common/bfloat16.hpp" #include "gtest/gtest.h" #include "test_utils.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp index d763ef97ebe..6feeb9ccde5 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "common/bfloat16.hpp" -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "gtest/gtest.h" #include "test_utils.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tiles.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tiles.cpp index d5120c259e3..863ebcccbb8 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tiles.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tiles.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "test_utils.hpp" #include "common/bfloat8.hpp" #include "common/bfloat4.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp index 3f844ccdc0e..6e2443422c8 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "gtest/gtest.h" #include "test_utils.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp index d097db29542..2a14b6cea38 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "test_utils.hpp" ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp index dd30679b880..ab490a99373 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "test_utils.hpp" ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp index b24754bdd50..45a068071f3 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "test_utils.hpp" #include "llrt/llrt.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp index 47ee26037e5..4529dfc2b79 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "llrt/rtoptions.hpp" -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "test_utils.hpp" #include "llrt/llrt.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp index e3d10780934..fb1ab1d3442 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "test_utils.hpp" ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp index 5ea9193b83e..1c229fe4b7b 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "test_utils.hpp" ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_waypoint.cpp b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_waypoint.cpp index 32f862b99cc..3a5b9e1454d 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_waypoint.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_waypoint.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "debug_tools_fixtures.hpp" +#include "debug_tools_fixture.hpp" #include "test_utils.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp index 0e3d9af36df..d9b3d504477 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp @@ -5,7 +5,7 @@ #include #include #include "command_queue_fixture.hpp" -#include "trace_fixtures.hpp" +#include "trace_fixture.hpp" #include "command_queue_test_utils.hpp" #include "gtest/gtest.h" #include "impl/buffers/buffer.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp index 89d2012d50a..aa71c7f10b9 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp @@ -35,8 +35,7 @@ class CommandQueueFixture : virtual public DispatchFixture { } this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); - const int device_id = 0; - + const chip_id_t device_id = 0; const auto &dispatch_core_type = tt::llrt::OptionsG.get_dispatch_core_type(); this->device_ = tt::tt_metal::CreateDevice(device_id, 1, DEFAULT_L1_SMALL_SIZE, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); } @@ -85,13 +84,10 @@ class CommandQueueSingleCardFixture : virtual public DispatchFixture { } else { this->devices_.push_back(this->reserved_devices_.at(mmio_device_id)); } - - this->num_devices_ = this->reserved_devices_.size(); } std::vector devices_; std::map reserved_devices_; - size_t num_devices_; }; class CommandQueueSingleCardBufferFixture : virtual public CommandQueueSingleCardFixture, diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp index 7428a8108b6..103f690d786 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "command_queue_fixture.hpp" -#include "trace_fixtures.hpp" +#include "trace_fixture.hpp" #include "gtest/gtest.h" #include "tt_metal/common/scoped_timer.hpp" #include "tt_metal/host_api.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp index cc0acde2394..79794d25748 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp @@ -6,9 +6,9 @@ #include "gtest/gtest.h" #include "event_fixture.hpp" -#include "buffer_fixtures.hpp" +#include "buffer_fixture.hpp" #include "dispatch_fixture.hpp" -#include "program_fixtures.hpp" +#include "program_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/test_utils/env_vars.hpp" @@ -54,7 +54,7 @@ class MultiCommandQueueSingleDeviceBufferFixture : public MultiCommandQueueSingl class MultiCommandQueueSingleDeviceProgramFixture : public MultiCommandQueueSingleDeviceFixture, public ProgramFixture {}; -class MultiCommandQueueMultiDeviceFixture : virtual public ::testing::Test { +class MultiCommandQueueMultiDeviceFixture : virtual public DispatchFixture { protected: void SetUp() override { auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); @@ -67,11 +67,11 @@ class MultiCommandQueueMultiDeviceFixture : virtual public ::testing::Test { TT_THROW("This suite must be run with TT_METAL_GTEST_NUM_HW_CQS=2"); GTEST_SKIP(); } - arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + const tt::ARCH arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); DispatchCoreType dispatch_core_type = DispatchCoreType::WORKER; - if (arch_ == tt::ARCH::WORMHOLE_B0 and tt::tt_metal::GetNumAvailableDevices() != 1) { + if (arch == tt::ARCH::WORMHOLE_B0 and tt::tt_metal::GetNumAvailableDevices() != 1) { if (!tt::tt_metal::IsGalaxyCluster()) { tt::log_warning(tt::LogTest, "Ethernet Dispatch not being explicitly used. Set this configuration in Setup()"); dispatch_core_type = DispatchCoreType::ETH; @@ -83,16 +83,12 @@ class MultiCommandQueueMultiDeviceFixture : virtual public ::testing::Test { for (const auto &[id, device] : reserved_devices_) { devices_.push_back(device); } - - num_devices_ = reserved_devices_.size(); } void TearDown() override { tt::tt_metal::detail::CloseDevices(reserved_devices_); } std::vector devices_; std::map reserved_devices_; - size_t num_devices_; - tt::ARCH arch_; }; class MultiCommandQueueMultiDeviceBufferFixture : public MultiCommandQueueMultiDeviceFixture, public BufferFixture {}; From a1f673ead907cd95a285a994264d56c3c4ded0c2 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Wed, 6 Nov 2024 18:19:21 +0000 Subject: [PATCH 12/26] #0: Moving tests to new dirs --- .../allocator/test_free_list_allocator.cpp | 0 .../allocator/test_l1_banking_allocator.cpp | 1 - .../core_coord}/core_coord_fixture.hpp | 0 .../test_CoreRangeSet_construct.cpp | 0 .../core_coord/test_CoreRangeSet_merge.cpp | 0 .../core_coord/test_CoreRange_adjacent.cpp | 0 .../core_coord/test_CoreRange_contains.cpp | 0 .../core_coord/test_CoreRange_intersects.cpp | 0 .../core_coord/test_CoreRange_iterator.cpp | 0 .../core_coord/test_CoreRange_merge.cpp | 0 .../test_CommandQueue.cpp | 30 +- .../common => api}/test_bit_utils.cpp | 0 .../{unit_tests/basic => api}/test_noc.cpp | 45 ++- .../test_runtime_args.cpp} | 8 - .../test_semaphores.cpp} | 4 - .../basic => api}/test_soc_descriptor.cpp | 2 - .../test_tilize_untilize.cpp | 0 .../test_worker_config_buffer.cpp | 8 +- .../debug_tools_fixture.hpp | 28 +- .../dprint/test_eth_cores.cpp | 0 .../dprint/test_invalid_print_core.cpp | 0 .../dprint/test_mute_device.cpp | 0 .../dprint/test_mute_print_server.cpp | 0 .../dprint/test_print_all_harts.cpp | 0 .../dprint/test_print_before_finish.cpp | 0 .../dprint/test_print_hanging.cpp | 0 .../dprint/test_print_tensix_dest.cpp | 0 .../dprint/test_print_tiles.cpp | 0 .../dprint/test_raise_wait.cpp | 0 .../watcher/test_assert.cpp | 0 .../watcher/test_link_training.cpp | 0 .../watcher/test_noc_sanitize.cpp | 0 .../watcher/test_noc_sanitize_delays.cpp | 0 .../watcher/test_pause.cpp | 0 .../watcher/test_ringbuf.cpp | 0 .../watcher/test_waypoint.cpp | 0 .../device_cluster_api.cpp | 0 .../galaxy_cluster_api.cpp | 0 .../device.cpp => device/test_device.cpp} | 47 --- .../multichip => device}/test_device_pool.cpp | 0 ...queueWriteBuffer_and_EnqueueReadBuffer.cpp | 372 +++++++++++++++++- .../test_EnqueueWaitForEvent.cpp | 1 - .../tt_metal/dispatch_event/test_events.cpp | 249 ++++++++++++ .../test_EnqueueProgram.cpp | 191 ++++++++- .../test_dispatch.cpp | 0 .../test_EnqueueTrace.cpp | 178 ++++++++- .../gtest_smoke/test_basic_pipeline.cpp | 1 - .../tt_metal/gtest_smoke/test_device.cpp | 1 - .../tt_metal/gtest_smoke/test_flatten.cpp | 1 - .../gtest_smoke/test_matmul_large_block.cpp | 1 - .../test_matmul_multi_core_X_dram.cpp | 1 - .../tt_metal/gtest_smoke/tests_main.cpp | 9 - .../tt_stl => stl}/test_any_range.cpp | 0 .../slotmap.cpp => stl/test_slotmap.cpp} | 0 .../basic/test_device_init.cpp | 3 - .../command_queue/test_HostAsyncCQ.cpp | 68 +--- .../command_queue/test_events.cpp | 233 ----------- .../multichip/test_eth_EnqueueProgram.cpp | 4 - .../pipelining/basic_pipeline.cpp | 7 - .../streams/test_autonomous_relay_streams.cpp | 5 - .../command_queue/test_EnqueueProgram.cpp | 189 --------- .../command_queue/test_EnqueueTrace.cpp | 242 ------------ ...queueWriteBuffer_and_EnqueueReadBuffer.cpp | 355 ----------------- .../tests/run_many_times.cpp | 1 - 64 files changed, 1065 insertions(+), 1220 deletions(-) rename tests/tt_metal/tt_metal/{unit_tests => api}/allocator/test_free_list_allocator.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => api}/allocator/test_l1_banking_allocator.cpp (99%) rename tests/tt_metal/tt_metal/{unit_tests/common => api/core_coord}/core_coord_fixture.hpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => api}/core_coord/test_CoreRangeSet_construct.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => api}/core_coord/test_CoreRangeSet_merge.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => api}/core_coord/test_CoreRange_adjacent.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => api}/core_coord/test_CoreRange_contains.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => api}/core_coord/test_CoreRange_intersects.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => api}/core_coord/test_CoreRange_iterator.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => api}/core_coord/test_CoreRange_merge.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch/command_queue => api}/test_CommandQueue.cpp (64%) rename tests/tt_metal/tt_metal/{unit_tests_common/common => api}/test_bit_utils.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/basic => api}/test_noc.cpp (80%) rename tests/tt_metal/tt_metal/{unit_tests/basic/runtime_args.cpp => api/test_runtime_args.cpp} (99%) rename tests/tt_metal/tt_metal/{unit_tests/basic/initialize_semaphores.cpp => api/test_semaphores.cpp} (99%) rename tests/tt_metal/tt_metal/{unit_tests/basic => api}/test_soc_descriptor.cpp (98%) rename tests/tt_metal/tt_metal/{unit_tests/host_apis => api}/test_tilize_untilize.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch/command_queue => api}/test_worker_config_buffer.cpp (90%) rename tests/tt_metal/tt_metal/{unit_tests_common/common => debug_tools}/debug_tools_fixture.hpp (92%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/dprint/test_eth_cores.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/dprint/test_invalid_print_core.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/dprint/test_mute_device.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/dprint/test_mute_print_server.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/dprint/test_print_all_harts.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/dprint/test_print_before_finish.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/dprint/test_print_hanging.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/dprint/test_print_tensix_dest.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/dprint/test_print_tiles.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/dprint/test_raise_wait.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/watcher/test_assert.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/watcher/test_link_training.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/watcher/test_noc_sanitize.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/watcher/test_noc_sanitize_delays.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/watcher/test_pause.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/watcher/test_ringbuf.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => debug_tools}/watcher/test_waypoint.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/ethernet => device}/device_cluster_api.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/ethernet => device}/galaxy_cluster_api.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/basic/device.cpp => device/test_device.cpp} (87%) rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch/multichip => device}/test_device_pool.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch/command_queue => dispatch_buffer}/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp (68%) rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch_single_chip_multi_queue/command_queue => dispatch_event}/test_EnqueueWaitForEvent.cpp (99%) create mode 100644 tests/tt_metal/tt_metal/dispatch_event/test_events.cpp rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch/command_queue => dispatch_program}/test_EnqueueProgram.cpp (87%) rename tests/tt_metal/tt_metal/{unit_tests_common/common => dispatch_program}/test_dispatch.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch/command_queue => dispatch_trace}/test_EnqueueTrace.cpp (79%) delete mode 120000 tests/tt_metal/tt_metal/gtest_smoke/test_basic_pipeline.cpp delete mode 120000 tests/tt_metal/tt_metal/gtest_smoke/test_device.cpp delete mode 120000 tests/tt_metal/tt_metal/gtest_smoke/test_flatten.cpp delete mode 120000 tests/tt_metal/tt_metal/gtest_smoke/test_matmul_large_block.cpp delete mode 120000 tests/tt_metal/tt_metal/gtest_smoke/test_matmul_multi_core_X_dram.cpp delete mode 100644 tests/tt_metal/tt_metal/gtest_smoke/tests_main.cpp rename tests/tt_metal/tt_metal/{unit_tests/tt_stl => stl}/test_any_range.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/tt_stl/slotmap.cpp => stl/test_slotmap.cpp} (100%) delete mode 100644 tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp delete mode 100644 tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/allocator/test_free_list_allocator.cpp b/tests/tt_metal/tt_metal/api/allocator/test_free_list_allocator.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/allocator/test_free_list_allocator.cpp rename to tests/tt_metal/tt_metal/api/allocator/test_free_list_allocator.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/allocator/test_l1_banking_allocator.cpp b/tests/tt_metal/tt_metal/api/allocator/test_l1_banking_allocator.cpp similarity index 99% rename from tests/tt_metal/tt_metal/unit_tests/allocator/test_l1_banking_allocator.cpp rename to tests/tt_metal/tt_metal/api/allocator/test_l1_banking_allocator.cpp index 11ddd26ebe8..d1b20a992a2 100644 --- a/tests/tt_metal/tt_metal/unit_tests/allocator/test_l1_banking_allocator.cpp +++ b/tests/tt_metal/tt_metal/api/allocator/test_l1_banking_allocator.cpp @@ -4,7 +4,6 @@ #include -#include "basic_fixture.hpp" #include "device_fixture.hpp" #include "tt_metal/common/core_descriptor.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests/common/core_coord_fixture.hpp b/tests/tt_metal/tt_metal/api/core_coord/core_coord_fixture.hpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/common/core_coord_fixture.hpp rename to tests/tt_metal/tt_metal/api/core_coord/core_coord_fixture.hpp diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_construct.cpp b/tests/tt_metal/tt_metal/api/core_coord/test_CoreRangeSet_construct.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_construct.cpp rename to tests/tt_metal/tt_metal/api/core_coord/test_CoreRangeSet_construct.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_merge.cpp b/tests/tt_metal/tt_metal/api/core_coord/test_CoreRangeSet_merge.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_merge.cpp rename to tests/tt_metal/tt_metal/api/core_coord/test_CoreRangeSet_merge.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_adjacent.cpp b/tests/tt_metal/tt_metal/api/core_coord/test_CoreRange_adjacent.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_adjacent.cpp rename to tests/tt_metal/tt_metal/api/core_coord/test_CoreRange_adjacent.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_contains.cpp b/tests/tt_metal/tt_metal/api/core_coord/test_CoreRange_contains.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_contains.cpp rename to tests/tt_metal/tt_metal/api/core_coord/test_CoreRange_contains.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_intersects.cpp b/tests/tt_metal/tt_metal/api/core_coord/test_CoreRange_intersects.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_intersects.cpp rename to tests/tt_metal/tt_metal/api/core_coord/test_CoreRange_intersects.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_iterator.cpp b/tests/tt_metal/tt_metal/api/core_coord/test_CoreRange_iterator.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_iterator.cpp rename to tests/tt_metal/tt_metal/api/core_coord/test_CoreRange_iterator.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_merge.cpp b/tests/tt_metal/tt_metal/api/core_coord/test_CoreRange_merge.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRange_merge.cpp rename to tests/tt_metal/tt_metal/api/core_coord/test_CoreRange_merge.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_CommandQueue.cpp b/tests/tt_metal/tt_metal/api/test_CommandQueue.cpp similarity index 64% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_CommandQueue.cpp rename to tests/tt_metal/tt_metal/api/test_CommandQueue.cpp index cd617d81ff9..a1c4719c4e8 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_CommandQueue.cpp +++ b/tests/tt_metal/tt_metal/api/test_CommandQueue.cpp @@ -5,13 +5,10 @@ #include #include "command_queue_fixture.hpp" -#include "command_queue_test_utils.hpp" #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/device/device.hpp" -#include "tt_metal/test_utils/env_vars.hpp" #include "tt_metal/test_utils/stimulus.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" using namespace tt::tt_metal; @@ -30,6 +27,33 @@ TEST_F(CommandQueueFixture, TestCannotAccessCommandQueueForClosedDevice) { EXPECT_ANY_THROW(device_->command_queue()); } +TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAsyncAssertForDeprecatedAPI) { + auto &command_queue = this->device_->command_queue(); + auto current_mode = CommandQueue::default_mode(); + command_queue.set_mode(CommandQueue::CommandQueueMode::ASYNC); + Program program; + CoreCoord core = {0, 0}; + uint32_t buf_size = 4096; + uint32_t page_size = 4096; + auto dummy_kernel = CreateKernel( + program, + "tt_metal/kernels/dataflow/reader_binary_diff_lengths.cpp", + core, + DataMovementConfig{.processor = DataMovementProcessor::RISCV_0, .noc = NOC::RISCV_0_default}); + auto src0 = Buffer::create(this->device_, buf_size, page_size, BufferType::DRAM); + std::vector runtime_args = {src0->address()}; + try { + SetRuntimeArgs(program, dummy_kernel, core, runtime_args); + } catch (std::runtime_error &e) { + std::string expected = + "This variant of SetRuntimeArgs can only be called when Asynchronous SW Command Queues are disabled for " + "Fast Dispatch."; + const string error = string(e.what()); + EXPECT_TRUE(error.find(expected) != std::string::npos); + } + command_queue.set_mode(current_mode); +} + TEST_F(CommandQueueMultiDeviceFixture, DISABLED_TestDirectedLoopbackToUniqueHugepage) { std::unordered_map> golden_data; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/test_bit_utils.cpp b/tests/tt_metal/tt_metal/api/test_bit_utils.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/common/test_bit_utils.cpp rename to tests/tt_metal/tt_metal/api/test_bit_utils.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/basic/test_noc.cpp b/tests/tt_metal/tt_metal/api/test_noc.cpp similarity index 80% rename from tests/tt_metal/tt_metal/unit_tests/basic/test_noc.cpp rename to tests/tt_metal/tt_metal/api/test_noc.cpp index 18a243f6f4a..e1ef7d4370e 100644 --- a/tests/tt_metal/tt_metal/unit_tests/basic/test_noc.cpp +++ b/tests/tt_metal/tt_metal/api/test_noc.cpp @@ -4,17 +4,11 @@ #include -#include -#include -#include - #include "basic_fixture.hpp" #include "device_fixture.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.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; @@ -70,7 +64,44 @@ void read_translation_table (Device* device, CoreCoord logical_node, std::vector } // namespace unit_tests::basic::device +TEST_F(BasicFixture, TensixSingleDeviceHarvestingPrints) { + auto arch = tt::get_arch_from_string(get_umd_arch_name()); + tt::tt_metal::Device* device; + const unsigned int device_id = 0; + device = tt::tt_metal::CreateDevice(device_id); + CoreCoord unharvested_logical_grid_size; + switch (arch) { + case tt::ARCH::GRAYSKULL: unharvested_logical_grid_size = CoreCoord(12, 10); break; + case tt::ARCH::WORMHOLE_B0: unharvested_logical_grid_size = CoreCoord(8, 10); break; + case tt::ARCH::BLACKHOLE: unharvested_logical_grid_size = CoreCoord(14, 10); break; + default: + TT_THROW("Unsupported arch {}", get_umd_arch_name()); + } + auto logical_grid_size = device->logical_grid_size(); + if (logical_grid_size == unharvested_logical_grid_size) { + tt::log_info("Harvesting Disabled in SW"); + } else { + tt::log_info("Harvesting Enabled in SW"); + tt::log_info("Number of Harvested Rows={}", unharvested_logical_grid_size.y - logical_grid_size.y); + } + tt::log_info("Logical -- Noc Coordinates Mapping"); + tt::log_info("[Logical <-> NOC0] Coordinates"); + for (int r = 0; r < logical_grid_size.y; r++) { + string output_row = ""; + for (int c = 0; c < logical_grid_size.x; c++) { + const CoreCoord logical_coord(c, r); + const auto noc_coord = device->worker_core_from_logical_core(logical_coord); + output_row += "{L[x" + std::to_string(c); + output_row += "-y" + std::to_string(r); + output_row += "]:N[x" + std::to_string(noc_coord.x); + output_row += "-y" + std::to_string(noc_coord.y); + output_row += "]}, "; + } + tt::log_info("{}", output_row); + } + ASSERT_TRUE(tt::tt_metal::CloseDevice(device)); +} TEST_F(BasicFixture, TensixVerifyNocNodeIDs) { auto arch = tt::get_arch_from_string(get_umd_arch_name()); @@ -139,8 +170,6 @@ TEST_F(DeviceFixture, TensixDirectedStreamRegWriteRead) { const uint32_t stream_reg = 4; for (tt_metal::Device *device : this->devices_) { - std::set storage_only_cores = device->storage_only_cores(); - tt_metal::Program program = tt_metal::CreateProgram(); CoreCoord logical_grid_size = device->compute_with_storage_grid_size(); CoreCoord end_core{logical_grid_size.x - 1, logical_grid_size.y - 1}; diff --git a/tests/tt_metal/tt_metal/unit_tests/basic/runtime_args.cpp b/tests/tt_metal/tt_metal/api/test_runtime_args.cpp similarity index 99% rename from tests/tt_metal/tt_metal/unit_tests/basic/runtime_args.cpp rename to tests/tt_metal/tt_metal/api/test_runtime_args.cpp index 1d524f4c502..404222e3246 100644 --- a/tests/tt_metal/tt_metal/unit_tests/basic/runtime_args.cpp +++ b/tests/tt_metal/tt_metal/api/test_runtime_args.cpp @@ -4,16 +4,9 @@ #include -#include -#include -#include - #include "device_fixture.hpp" - #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" -#include "tt_metal/impl/kernels/kernel.hpp" - using namespace tt; using namespace tt::tt_metal; @@ -408,7 +401,6 @@ TEST_F(DeviceFixture, TensixIllegallyModifyRTArgs) { SetCommonRuntimeArgs(program, 0, common_runtime_args); std::vector illegal_common_runtime_args = {0, 1, 2, 3, 4, 5}; EXPECT_ANY_THROW(SetCommonRuntimeArgs(program, 0, illegal_common_runtime_args)); - } } diff --git a/tests/tt_metal/tt_metal/unit_tests/basic/initialize_semaphores.cpp b/tests/tt_metal/tt_metal/api/test_semaphores.cpp similarity index 99% rename from tests/tt_metal/tt_metal/unit_tests/basic/initialize_semaphores.cpp rename to tests/tt_metal/tt_metal/api/test_semaphores.cpp index 5ddaea5c543..3cd83770dfa 100644 --- a/tests/tt_metal/tt_metal/unit_tests/basic/initialize_semaphores.cpp +++ b/tests/tt_metal/tt_metal/api/test_semaphores.cpp @@ -4,10 +4,6 @@ #include -#include -#include -#include - #include "device_fixture.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/detail/util.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests/basic/test_soc_descriptor.cpp b/tests/tt_metal/tt_metal/api/test_soc_descriptor.cpp similarity index 98% rename from tests/tt_metal/tt_metal/unit_tests/basic/test_soc_descriptor.cpp rename to tests/tt_metal/tt_metal/api/test_soc_descriptor.cpp index a9806ec5bda..b3fcf980d75 100644 --- a/tests/tt_metal/tt_metal/unit_tests/basic/test_soc_descriptor.cpp +++ b/tests/tt_metal/tt_metal/api/test_soc_descriptor.cpp @@ -13,8 +13,6 @@ #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.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; diff --git a/tests/tt_metal/tt_metal/unit_tests/host_apis/test_tilize_untilize.cpp b/tests/tt_metal/tt_metal/api/test_tilize_untilize.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/host_apis/test_tilize_untilize.cpp rename to tests/tt_metal/tt_metal/api/test_tilize_untilize.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_worker_config_buffer.cpp b/tests/tt_metal/tt_metal/api/test_worker_config_buffer.cpp similarity index 90% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_worker_config_buffer.cpp rename to tests/tt_metal/tt_metal/api/test_worker_config_buffer.cpp index e0c4083eced..285286a67b9 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_worker_config_buffer.cpp +++ b/tests/tt_metal/tt_metal/api/test_worker_config_buffer.cpp @@ -1,18 +1,16 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 -#include - #include "gtest/gtest.h" #include "tt_metal/impl/dispatch/worker_config_buffer.hpp" using std::vector; using namespace tt::tt_metal; -namespace working_config_buffer_tests { +namespace worker_config_buffer_tests { -TEST(WorkingConfigBuffer, MarkCompletelyFull) { +TEST(WorkerConfigBuffer, MarkCompletelyFull) { WorkerConfigBufferMgr mgr; mgr.init_add_buffer(1024, 1024); mgr.init_add_buffer(2, 1024); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixture.hpp b/tests/tt_metal/tt_metal/debug_tools/debug_tools_fixture.hpp similarity index 92% rename from tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixture.hpp rename to tests/tt_metal/tt_metal/debug_tools/debug_tools_fixture.hpp index bd9d3a1745e..a5709ce219c 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/common/debug_tools_fixture.hpp +++ b/tests/tt_metal/tt_metal/debug_tools/debug_tools_fixture.hpp @@ -4,14 +4,14 @@ #pragma once +#include #include "dispatch_fixture.hpp" +#include "tt_metal/tt_metal/common/dispatch_fixture.hpp" -class DebugToolsFixture : virtual public DispatchFixture { - -}; +class DebugToolsFixture : virtual public ::testing::Test {}; // A version of DispatchFixture with DPrint enabled on all cores. -class DPrintFixture: public DebugToolsFixture { +class DPrintFixture : virtual public DispatchFixture, virtual public DebugToolsFixture { public: inline static const string dprint_file_name = "gtest_dprint_log.txt"; @@ -19,7 +19,7 @@ class DPrintFixture: public DebugToolsFixture { void RunProgram(Device* device, Program& program) { // Only difference is that we need to wait for the print server to catch // up after running a test. - DebugToolsFixture::RunProgram(device, program); + DispatchFixture::RunProgram(device, program); tt::DprintServerAwait(); } @@ -46,12 +46,12 @@ class DPrintFixture: public DebugToolsFixture { ExtraSetUp(); // Parent class initializes devices and any necessary flags - DebugToolsFixture::SetUp(); + DispatchFixture::SetUp(); } void TearDown() override { // Parent class tears down devices - DebugToolsFixture::TearDown(); + DispatchFixture::TearDown(); // Remove the DPrint output file after the test is finished. std::remove(dprint_file_name.c_str()); @@ -76,7 +76,7 @@ class DPrintFixture: public DebugToolsFixture { auto run_function_no_args = [=]() { run_function(this, device); }; - DebugToolsFixture::RunTestOnDevice(run_function_no_args, device); + DispatchFixture::RunTestOnDevice(run_function_no_args, device); tt::DPrintServerClearLogFile(); tt::DPrintServerClearSignals(); } @@ -87,7 +87,7 @@ class DPrintFixture: public DebugToolsFixture { }; // For usage by tests that need the dprint server devices disabled. -class DPrintDisableDevicesFixture: public DPrintFixture { +class DPrintDisableDevicesFixture : public DPrintFixture { protected: void ExtraSetUp() override { // For this test, mute each devices using the environment variable @@ -97,7 +97,7 @@ class DPrintDisableDevicesFixture: public DPrintFixture { }; // A version of DispatchFixture with watcher enabled -class WatcherFixture: public DebugToolsFixture { +class WatcherFixture : virtual public DispatchFixture, virtual public DebugToolsFixture { public: inline static const string log_file_name = "generated/watcher/watcher.log"; inline static const int interval_ms = 250; @@ -106,7 +106,7 @@ class WatcherFixture: public DebugToolsFixture { void RunProgram(Device* device, Program& program, bool wait_for_dump = false) { // Only difference is that we need to wait for the print server to catch // up after running a test. - DebugToolsFixture::RunProgram(device, program); + DispatchFixture::RunProgram(device, program); // Wait for watcher to run a full dump before finishing, need to wait for dump count to // increase because we'll likely check in the middle of a dump. @@ -143,12 +143,12 @@ class WatcherFixture: public DebugToolsFixture { tt::watcher_clear_log(); // Parent class initializes devices and any necessary flags - DebugToolsFixture::SetUp(); + DispatchFixture::SetUp(); } void TearDown() override { // Parent class tears down devices - DebugToolsFixture::TearDown(); + DispatchFixture::TearDown(); // Reset watcher settings to their previous values tt::llrt::OptionsG.set_watcher_enabled(watcher_previous_enabled); @@ -168,7 +168,7 @@ class WatcherFixture: public DebugToolsFixture { auto run_function_no_args = [=]() { run_function(this, device); }; - DebugToolsFixture::RunTestOnDevice(run_function_no_args, device); + DispatchFixture::RunTestOnDevice(run_function_no_args, device); // Wait for a final watcher poll and then clear the log. std::this_thread::sleep_for(std::chrono::milliseconds(interval_ms)); tt::watcher_clear_log(); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp b/tests/tt_metal/tt_metal/debug_tools/dprint/test_eth_cores.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/dprint/test_eth_cores.cpp rename to tests/tt_metal/tt_metal/debug_tools/dprint/test_eth_cores.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp b/tests/tt_metal/tt_metal/debug_tools/dprint/test_invalid_print_core.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/dprint/test_invalid_print_core.cpp rename to tests/tt_metal/tt_metal/debug_tools/dprint/test_invalid_print_core.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp b/tests/tt_metal/tt_metal/debug_tools/dprint/test_mute_device.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_device.cpp rename to tests/tt_metal/tt_metal/debug_tools/dprint/test_mute_device.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp b/tests/tt_metal/tt_metal/debug_tools/dprint/test_mute_print_server.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/dprint/test_mute_print_server.cpp rename to tests/tt_metal/tt_metal/debug_tools/dprint/test_mute_print_server.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp b/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_all_harts.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_all_harts.cpp rename to tests/tt_metal/tt_metal/debug_tools/dprint/test_print_all_harts.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp b/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_before_finish.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_before_finish.cpp rename to tests/tt_metal/tt_metal/debug_tools/dprint/test_print_before_finish.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp b/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_hanging.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_hanging.cpp rename to tests/tt_metal/tt_metal/debug_tools/dprint/test_print_hanging.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp b/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_tensix_dest.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tensix_dest.cpp rename to tests/tt_metal/tt_metal/debug_tools/dprint/test_print_tensix_dest.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tiles.cpp b/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_tiles.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/dprint/test_print_tiles.cpp rename to tests/tt_metal/tt_metal/debug_tools/dprint/test_print_tiles.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp b/tests/tt_metal/tt_metal/debug_tools/dprint/test_raise_wait.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/dprint/test_raise_wait.cpp rename to tests/tt_metal/tt_metal/debug_tools/dprint/test_raise_wait.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp b/tests/tt_metal/tt_metal/debug_tools/watcher/test_assert.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/watcher/test_assert.cpp rename to tests/tt_metal/tt_metal/debug_tools/watcher/test_assert.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp b/tests/tt_metal/tt_metal/debug_tools/watcher/test_link_training.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/watcher/test_link_training.cpp rename to tests/tt_metal/tt_metal/debug_tools/watcher/test_link_training.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp b/tests/tt_metal/tt_metal/debug_tools/watcher/test_noc_sanitize.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize.cpp rename to tests/tt_metal/tt_metal/debug_tools/watcher/test_noc_sanitize.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp b/tests/tt_metal/tt_metal/debug_tools/watcher/test_noc_sanitize_delays.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/watcher/test_noc_sanitize_delays.cpp rename to tests/tt_metal/tt_metal/debug_tools/watcher/test_noc_sanitize_delays.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp b/tests/tt_metal/tt_metal/debug_tools/watcher/test_pause.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/watcher/test_pause.cpp rename to tests/tt_metal/tt_metal/debug_tools/watcher/test_pause.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp b/tests/tt_metal/tt_metal/debug_tools/watcher/test_ringbuf.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/watcher/test_ringbuf.cpp rename to tests/tt_metal/tt_metal/debug_tools/watcher/test_ringbuf.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/watcher/test_waypoint.cpp b/tests/tt_metal/tt_metal/debug_tools/watcher/test_waypoint.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/watcher/test_waypoint.cpp rename to tests/tt_metal/tt_metal/debug_tools/watcher/test_waypoint.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/device_cluster_api.cpp b/tests/tt_metal/tt_metal/device/device_cluster_api.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/ethernet/device_cluster_api.cpp rename to tests/tt_metal/tt_metal/device/device_cluster_api.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/galaxy_cluster_api.cpp b/tests/tt_metal/tt_metal/device/galaxy_cluster_api.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/ethernet/galaxy_cluster_api.cpp rename to tests/tt_metal/tt_metal/device/galaxy_cluster_api.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/basic/device.cpp b/tests/tt_metal/tt_metal/device/test_device.cpp similarity index 87% rename from tests/tt_metal/tt_metal/unit_tests/basic/device.cpp rename to tests/tt_metal/tt_metal/device/test_device.cpp index b42547eb32b..71b85cc1a6b 100644 --- a/tests/tt_metal/tt_metal/unit_tests/basic/device.cpp +++ b/tests/tt_metal/tt_metal/device/test_device.cpp @@ -4,16 +4,9 @@ #include -#include -#include -#include - -#include "tests/tt_metal/tt_metal/unit_tests/common/basic_fixture.hpp" #include "tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.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; @@ -81,46 +74,6 @@ bool dram_ping( } } // namespace unit_tests::basic::device -TEST_F(BasicFixture, TensixSingleDeviceHarvestingPrints) { - auto arch = tt::get_arch_from_string(get_umd_arch_name()); - tt::tt_metal::Device* device; - const unsigned int device_id = 0; - device = tt::tt_metal::CreateDevice(device_id); - CoreCoord unharvested_logical_grid_size; - switch (arch) { - case tt::ARCH::GRAYSKULL: unharvested_logical_grid_size = CoreCoord(12, 10); break; - case tt::ARCH::WORMHOLE_B0: unharvested_logical_grid_size = CoreCoord(8, 10); break; - case tt::ARCH::BLACKHOLE: unharvested_logical_grid_size = CoreCoord(14, 10); break; - default: - TT_THROW("Unsupported arch {}", get_umd_arch_name()); - } - auto logical_grid_size = device->logical_grid_size(); - if (logical_grid_size == unharvested_logical_grid_size) { - tt::log_info("Harvesting Disabled in SW"); - } else { - tt::log_info("Harvesting Enabled in SW"); - tt::log_info("Number of Harvested Rows={}", unharvested_logical_grid_size.y - logical_grid_size.y); - } - - tt::log_info("Logical -- Noc Coordinates Mapping"); - tt::log_info("[Logical <-> NOC0] Coordinates"); - for (int r = 0; r < logical_grid_size.y; r++) { - string output_row = ""; - for (int c = 0; c < logical_grid_size.x; c++) { - const CoreCoord logical_coord(c, r); - const auto noc_coord = device->worker_core_from_logical_core(logical_coord); - output_row += "{L[x" + std::to_string(c); - output_row += "-y" + std::to_string(r); - output_row += "]:N[x" + std::to_string(noc_coord.x); - output_row += "-y" + std::to_string(noc_coord.y); - output_row += "]}, "; - } - tt::log_info("{}", output_row); - } - ASSERT_TRUE(tt::tt_metal::CloseDevice(device)); -} - - TEST_F(DeviceFixture, PingAllLegalDramChannels) { for (unsigned int id = 0; id < num_devices_; id++) { { diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_device_pool.cpp b/tests/tt_metal/tt_metal/device/test_device_pool.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_device_pool.cpp rename to tests/tt_metal/tt_metal/device/test_device_pool.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp b/tests/tt_metal/tt_metal/dispatch_buffer/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp similarity index 68% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp rename to tests/tt_metal/tt_metal/dispatch_buffer/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp index a766ec98888..d55ece84598 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp +++ b/tests/tt_metal/tt_metal/dispatch_buffer/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp @@ -9,8 +9,6 @@ #include "gtest/gtest.h" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" -#include "tt_metal/test_utils/env_vars.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" #include "tt_metal/impl/device/device.hpp" using std::vector; @@ -323,11 +321,90 @@ bool stress_test_EnqueueWriteBuffer_and_EnqueueReadBuffer_wrap( return pass; } +bool test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(Device* device, vector>& cqs, const TestBufferConfig& config) { + bool pass = true; + for (const bool use_void_star_api: {true, false}) { + + size_t buf_size = config.num_pages * config.page_size; + std::vector> buffers; + std::vector> srcs; + for (uint i = 0; i < cqs.size(); i++) { + buffers.push_back(Buffer::create(device, buf_size, config.page_size, config.buftype)); + srcs.push_back(generate_arange_vector(buffers[i]->size())); + if (use_void_star_api) { + EnqueueWriteBuffer(cqs[i], *buffers[i], srcs[i].data(), false); + } else { + EnqueueWriteBuffer(cqs[i], *buffers[i], srcs[i], false); + } + } + + for (uint i = 0; i < cqs.size(); i++) { + std::vector result; + if (use_void_star_api) { + result.resize(buf_size / sizeof(uint32_t)); + EnqueueReadBuffer(cqs[i], *buffers[i], result.data(), true); + } else { + EnqueueReadBuffer(cqs[i], *buffers[i], result, true); + } + bool local_pass = (srcs[i] == result); + pass &= local_pass; + } + } + + return pass; +} + } // end namespace local_test_functions namespace basic_tests { namespace dram_tests { +TEST_F(CommandQueueBufferFixture, DISABLED_TestAsyncBufferRW) { + // Test Async Enqueue Read and Write + Get Addr + Buffer Allocation and Deallocation + auto &command_queue = this->device_->command_queue(); + auto current_mode = CommandQueue::default_mode(); + command_queue.set_mode(CommandQueue::CommandQueueMode::ASYNC); + Program program; + for (int j = 0; j < 10; j++) { + // Asynchronously initialize a buffer on device + uint32_t first_buf_value = j + 1; + uint32_t second_buf_value = j + 2; + uint32_t first_buf_size = 4096; + uint32_t second_buf_size = 2048; + // Asynchronously allocate buffer on device + std::shared_ptr buffer = + Buffer::create(this->device_, first_buf_size, first_buf_size, BufferType::DRAM); + std::shared_ptr allocated_buffer_address = std::make_shared(); + EnqueueGetBufferAddr(this->device_->command_queue(), allocated_buffer_address.get(), buffer.get(), true); + // Ensure returned addr is correct + EXPECT_EQ((*allocated_buffer_address), buffer->address()); + + std::shared_ptr> vec = + std::make_shared>(first_buf_size / 4, first_buf_value); + std::vector readback_vec = {}; + // Write first vector to existing on device buffer. + EnqueueWriteBuffer(this->device_->command_queue(), buffer, vec, false); + // Reallocate the vector in the main thread after asynchronously pushing it (ensure that worker still has access + // to this data) + vec = std::make_shared>(second_buf_size / 4, second_buf_value); + // Simulate what tt-eager does: Share buffer ownership with program + AssignGlobalBufferToProgram(buffer, program); + // Reallocate buffer (this is safe, since the program also owns the existing buffer, which will not be + // deallocated) + buffer = Buffer::create(this->device_, second_buf_size, second_buf_size, BufferType::DRAM); + // Write second vector to second buffer + EnqueueWriteBuffer(this->device_->command_queue(), buffer, vec, false); + // Have main thread give up ownership immediately after writing + vec.reset(); + // Read both buffer and ensure data is correct + EnqueueReadBuffer(this->device_->command_queue(), buffer, readback_vec, true); + for (int i = 0; i < readback_vec.size(); i++) { + EXPECT_EQ(readback_vec[i], second_buf_value); + } + } + command_queue.set_mode(current_mode); +} + TEST_F(CommandQueueSingleCardBufferFixture, WriteOneTileToDramBank0) { TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::DRAM}; for (Device *device : devices_) { @@ -538,6 +615,199 @@ TEST_F(CommandQueueSingleCardBufferFixture, TestWrapCompletionQOnInsufficientSpa // TODO: add test for wrapping with non aligned page sizes +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToDramBank0) { + TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::DRAM}; + for (Device *device : devices_) { + tt::log_info("Running On Device {}", device->id()); + CommandQueue& a = device->command_queue(0); + CommandQueue& b = device->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); + } + +} + +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToAllDramBanks) { + for (Device *device : devices_) { + tt::log_info("Running On Device {}", device->id()); + TestBufferConfig config = { + .num_pages = uint32_t(device->num_banks(BufferType::DRAM)), + .page_size = 2048, + .buftype = BufferType::DRAM}; + + CommandQueue& a = device->command_queue(0); + CommandQueue& b = device->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); + } +} + +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileAcrossAllDramBanksTwiceRoundRobin) { + constexpr uint32_t num_round_robins = 2; + for (Device *device : devices_) { + tt::log_info("Running On Device {}", device->id()); + TestBufferConfig config = { + .num_pages = num_round_robins * (device->num_banks(BufferType::DRAM)), + .page_size = 2048, + .buftype = BufferType::DRAM}; + + CommandQueue& a = device->command_queue(0); + CommandQueue& b = device->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); + } +} + +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, Sending131072Pages) { + // Was a failing case where we used to accidentally program cb num pages to be total + // pages instead of cb num pages. + TestBufferConfig config = { + .num_pages = 131072, + .page_size = 128, + .buftype = BufferType::DRAM}; + for (Device *device : devices_) { + tt::log_info("Running On Device {}", device->id()); + CommandQueue& a = device->command_queue(0); + CommandQueue& b = device->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); + } +} + +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, TestNon32BAlignedPageSizeForDram) { + for (Device *device : devices_) { + tt::log_info("Running On Device {}", device->id()); + TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::DRAM}; + + CommandQueue& a = device->command_queue(0); + CommandQueue& b = device->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); + } +} + +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, TestNon32BAlignedPageSizeForDram2) { + for (Device *device : devices_) { + tt::log_info("Running On Device {}", device->id()); + // From stable diffusion read buffer + TestBufferConfig config = {.num_pages = 8 * 1024, .page_size = 80, .buftype = BufferType::DRAM}; + + CommandQueue& a = device->command_queue(0); + CommandQueue& b = device->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); + } +} + +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, TestIssueMultipleReadWriteCommandsForOneBuffer) { + for (Device *device : devices_) { + tt::log_info("Running On Device {}", device->id()); + uint32_t page_size = 2048; + uint32_t command_queue_size = device->sysmem_manager().get_cq_size(); + uint32_t num_pages = command_queue_size / page_size; + + TestBufferConfig config = {.num_pages = num_pages, .page_size = page_size, .buftype = BufferType::DRAM}; + + CommandQueue& a = device->command_queue(0); + CommandQueue& b = device->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); + } +} + +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToDramBank0) { + TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::DRAM}; + CommandQueue& a = this->device_->command_queue(0); + CommandQueue& b = this->device_->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); +} + +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToAllDramBanks) { + TestBufferConfig config = { + .num_pages = uint32_t(this->device_->num_banks(BufferType::DRAM)), + .page_size = 2048, + .buftype = BufferType::DRAM}; + + CommandQueue& a = this->device_->command_queue(0); + CommandQueue& b = this->device_->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); +} + +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileAcrossAllDramBanksTwiceRoundRobin) { + constexpr uint32_t num_round_robins = 2; + TestBufferConfig config = { + .num_pages = num_round_robins * (this->device_->num_banks(BufferType::DRAM)), + .page_size = 2048, + .buftype = BufferType::DRAM}; + + CommandQueue& a = this->device_->command_queue(0); + CommandQueue& b = this->device_->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); +} + +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, Sending131072Pages) { + // Was a failing case where we used to accidentally program cb num pages to be total + // pages instead of cb num pages. + TestBufferConfig config = { + .num_pages = 131072, + .page_size = 128, + .buftype = BufferType::DRAM}; + + CommandQueue& a = this->device_->command_queue(0); + CommandQueue& b = this->device_->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); +} + +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestNon32BAlignedPageSizeForDram) { + TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::DRAM}; + + CommandQueue& a = this->device_->command_queue(0); + CommandQueue& b = this->device_->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); +} + +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestNon32BAlignedPageSizeForDram2) { + // From stable diffusion read buffer + TestBufferConfig config = {.num_pages = 8 * 1024, .page_size = 80, .buftype = BufferType::DRAM}; + + CommandQueue& a = this->device_->command_queue(0); + CommandQueue& b = this->device_->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); +} + +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestPageSizeTooLarge) { + if (this->arch_ == tt::ARCH::WORMHOLE_B0) { + GTEST_SKIP(); // This test hanging on wormhole b0 + } + // Should throw a host error due to the page size not fitting in the consumer CB + TestBufferConfig config = {.num_pages = 1024, .page_size = 250880 * 2, .buftype = BufferType::DRAM}; + + CommandQueue& a = this->device_->command_queue(0); + CommandQueue& b = this->device_->command_queue(1); + vector> cqs = {a, b}; + EXPECT_ANY_THROW(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); +} + +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestIssueMultipleReadWriteCommandsForOneBuffer) { + uint32_t page_size = 2048; + uint16_t channel = tt::Cluster::instance().get_assigned_channel_for_device(this->device_->id()); + uint32_t command_queue_size = tt::Cluster::instance().get_host_channel_size(this->device_->id(), channel); + uint32_t num_pages = command_queue_size / page_size; + + TestBufferConfig config = {.num_pages = num_pages, .page_size = page_size, .buftype = BufferType::DRAM}; + + CommandQueue& a = this->device_->command_queue(0); + CommandQueue& b = this->device_->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); +} + } // end namespace dram_tests namespace l1_tests { @@ -618,6 +888,104 @@ TEST_F(CommandQueueSingleCardBufferFixture, TestLargeBuffer4096BPageSize) { } } +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToL1Bank0) { + TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::L1}; + CommandQueue& a = this->device_->command_queue(0); + CommandQueue& b = this->device_->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); +} + +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToAllL1Banks) { + auto compute_with_storage_grid = this->device_->compute_with_storage_grid_size(); + TestBufferConfig config = { + .num_pages = uint32_t(compute_with_storage_grid.x * compute_with_storage_grid.y), + .page_size = 2048, + .buftype = BufferType::L1}; + + CommandQueue& a = this->device_->command_queue(0); + CommandQueue& b = this->device_->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); +} + +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToAllL1BanksTwiceRoundRobin) { + auto compute_with_storage_grid = this->device_->compute_with_storage_grid_size(); + TestBufferConfig config = { + .num_pages = 2 * uint32_t(compute_with_storage_grid.x * compute_with_storage_grid.y), + .page_size = 2048, + .buftype = BufferType::L1}; + + CommandQueue& a = this->device_->command_queue(0); + CommandQueue& b = this->device_->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); +} + +TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestNon32BAlignedPageSizeForL1) { + TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::L1}; + + CommandQueue& a = this->device_->command_queue(0); + CommandQueue& b = this->device_->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); +} + +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToL1Bank0) { + for (Device *device : devices_) { + tt::log_info("Running On Device {}", device->id()); + TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::L1}; + CommandQueue& a = device->command_queue(0); + CommandQueue& b = device->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); + } +} + +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToAllL1Banks) { + for (Device *device : devices_) { + tt::log_info("Running On Device {}", device->id()); + auto compute_with_storage_grid = device->compute_with_storage_grid_size(); + TestBufferConfig config = { + .num_pages = uint32_t(compute_with_storage_grid.x * compute_with_storage_grid.y), + .page_size = 2048, + .buftype = BufferType::L1}; + + CommandQueue& a = device->command_queue(0); + CommandQueue& b = device->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); + } +} + +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToAllL1BanksTwiceRoundRobin) { + for (Device *device : devices_) { + tt::log_info("Running On Device {}", device->id()); + auto compute_with_storage_grid = device->compute_with_storage_grid_size(); + TestBufferConfig config = { + .num_pages = 2 * uint32_t(compute_with_storage_grid.x * compute_with_storage_grid.y), + .page_size = 2048, + .buftype = BufferType::L1}; + + CommandQueue& a = device->command_queue(0); + CommandQueue& b = device->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); + } +} + +TEST_F(MultiCommandQueueMultiDeviceBufferFixture, TestNon32BAlignedPageSizeForL1) { + for (Device *device : devices_) { + tt::log_info("Running On Device {}", device->id()); + TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::L1}; + + CommandQueue& a = device->command_queue(0); + CommandQueue& b = device->command_queue(1); + vector> cqs = {a, b}; + EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); + } +} + } // end namespace l1_tests TEST_F(CommandQueueSingleCardBufferFixture, TestNonblockingReads) { diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWaitForEvent.cpp b/tests/tt_metal/tt_metal/dispatch_event/test_EnqueueWaitForEvent.cpp similarity index 99% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWaitForEvent.cpp rename to tests/tt_metal/tt_metal/dispatch_event/test_EnqueueWaitForEvent.cpp index 28d95a7f531..bf71ca75e9a 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWaitForEvent.cpp +++ b/tests/tt_metal/tt_metal/dispatch_event/test_EnqueueWaitForEvent.cpp @@ -8,7 +8,6 @@ #include "tt_metal/common/logger.hpp" #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" -#include "tt_metal/test_utils/env_vars.hpp" #include "command_queue_test_utils.hpp" #include "tt_metal/impl/event/event.hpp" #include "tt_metal/impl/device/device.hpp" diff --git a/tests/tt_metal/tt_metal/dispatch_event/test_events.cpp b/tests/tt_metal/tt_metal/dispatch_event/test_events.cpp new file mode 100644 index 00000000000..28f125d1bf2 --- /dev/null +++ b/tests/tt_metal/tt_metal/dispatch_event/test_events.cpp @@ -0,0 +1,249 @@ +// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#include "command_queue_fixture.hpp" +#include "command_queue_test_utils.hpp" +#include "gtest/gtest.h" +#include "tt_metal/host_api.hpp" +#include "tt_metal/detail/tt_metal.hpp" +#include "impl/debug/watcher_server.hpp" +#include "tt_metal/impl/event/event.hpp" +#include "tt_metal/impl/dispatch/command_queue.hpp" + +using std::vector; +using namespace tt::tt_metal; + +constexpr uint32_t completion_queue_event_offset = sizeof(CQDispatchCmd); +constexpr uint32_t completion_queue_page_size = dispatch_constants::TRANSFER_PAGE_SIZE; + +// Basic test, record events, check that Event struct was updated. Enough commands to trigger issue queue wrap. +TEST_F(CommandQueueEventFixture, TestEventsEnqueueRecordEventIssueQueueWrap) { + + const size_t num_events = 100000; // Enough to wrap issue queue. 768MB and cmds are 22KB each, so 35k cmds. + uint32_t cmds_issued_per_cq = 0; + + auto start = std::chrono::system_clock::now(); + + for (size_t i = 0; i < num_events; i++) { + auto event = std::make_shared(); // type is std::shared_ptr + EnqueueRecordEvent(this->device_->command_queue(), event); + EXPECT_EQ(event->event_id, cmds_issued_per_cq + 1); // Event ids start at 1 + EXPECT_EQ(event->cq_id, this->device_->command_queue().id()); + cmds_issued_per_cq++; + } + Finish(this->device_->command_queue()); + + std::chrono::duration elapsed_seconds = (std::chrono::system_clock::now() - start); + tt::log_info(tt::LogTest, "Test Finished in {:.2f} us", elapsed_seconds.count() * 1000 * 1000); +} + +// Test where Host synchronously waits for event to be completed. +TEST_F(CommandQueueEventFixture, TestEventsEnqueueRecordEventAndSynchronize) { + const size_t num_events = 100; + const size_t num_events_between_sync = 10; + + auto start = std::chrono::system_clock::now(); + + std::vector> sync_events; + + // A bunch of events recorded, occasionally will sync from host. + for (size_t i = 0; i < num_events; i++) { + auto event = sync_events.emplace_back(std::make_shared()); + EnqueueRecordEvent(this->device_->command_queue(), event); + + // Host synchronize every N number of events. + if (i > 0 && ((i % num_events_between_sync) == 0)) { + EventSynchronize(event); + } + } + + // A bunch of bonus syncs where event_id is mod on earlier ID's. + EventSynchronize(sync_events.at(2)); + EventSynchronize(sync_events.at(sync_events.size() - 2)); + EventSynchronize(sync_events.at(5)); + + Finish(this->device_->command_queue()); + + std::chrono::duration elapsed_seconds = (std::chrono::system_clock::now() - start); + tt::log_info(tt::LogTest, "Test Finished in {:.2f} us", elapsed_seconds.count() * 1000 * 1000); +} + +// Negative test. Host syncing on a future event that isn't actually issued. +// Ensure that expected hang is seen, which indicates event sync feature is working properly. +TEST_F(CommandQueueEventFixture, TestEventsEnqueueRecordEventAndSynchronizeHang) { + tt::llrt::OptionsG.set_test_mode_enabled(true); // Required for finish hang breakout. + + auto future_event = std::make_shared(); + EnqueueRecordEvent(this->device_->command_queue(), future_event); + future_event->wait_until_ready(); // in case async used, must block until async cq populated event. + future_event->event_id = 0xFFFF; // Modify event_id to be a future event that isn't issued yet. + + // Launch Host Sync in an async thread, expected to hang, with timeout and kill signal. + auto future = std::async(std::launch::async, [this, future_event]() { + return EventSynchronize(future_event); + }); + + bool seen_expected_hang = future.wait_for(std::chrono::seconds(1)) == std::future_status::timeout; + tt::watcher_server_set_error_flag(seen_expected_hang); // Signal to terminate thread. Don't care about it's exception. + + // Briefly wait before clearing error flag, and wrapping up via finish. + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + tt::watcher_server_set_error_flag(false); + Finish(this->device_->command_queue()); + + log_info(tt::LogTest, "Note: Test expects to see a hang if events feature is working. seen_expected_hang: {}", seen_expected_hang); + EXPECT_TRUE(seen_expected_hang); +} + +// Negative test. Device sync. Single CQ here syncing on a future event that isn't actually issued. +// Ensure that expected hang is seen, which indicates event sync feature is working properly. +TEST_F(CommandQueueEventFixture, TestEventsQueueWaitForEventHang) { + // Skip this test until #7216 is implemented. + GTEST_SKIP(); + tt::llrt::OptionsG.set_test_mode_enabled(true); // Required for finish hang breakout. + + auto future_event = std::make_shared(); + EnqueueRecordEvent(this->device_->command_queue(), future_event); + future_event->wait_until_ready(); // in case async used, must block until async cq populated event. + future_event->event_id = 0xFFFF; // Modify event_id to be a future event that isn't issued yet. + EnqueueWaitForEvent(this->device_->command_queue(), future_event); + + // Launch Finish in an async thread, expected to hang, with timeout and kill signal. + auto future = std::async(std::launch::async, [this]() { + return Finish(this->device_->command_queue()); + }); + + bool seen_expected_hang = future.wait_for(std::chrono::seconds(1)) == std::future_status::timeout; + tt::watcher_server_set_error_flag(seen_expected_hang); // Signal to terminate thread. Don't care about it's exception. + + // Clear error flag before exiting to restore state for next test. + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + tt::watcher_server_set_error_flag(false); + + log_info(tt::LogTest, "Note: Test expects to see a hang if events feature is working. seen_expected_hang: {}", seen_expected_hang); + EXPECT_TRUE(seen_expected_hang); +} + +// Device sync. Single CQ here, less interesting than 2CQ but still useful. Ensure no hangs. +TEST_F(CommandQueueEventFixture, TestEventsQueueWaitForEventBasic) { + + const size_t num_events = 50; + const size_t num_events_between_sync = 5; + + auto start = std::chrono::system_clock::now(); + std::vector> sync_events; + + // A bunch of events recorded, occasionally will sync from device. + for (size_t i = 0; i < num_events; i++) { + auto event = sync_events.emplace_back(std::make_shared()); + EnqueueRecordEvent(this->device_->command_queue(), event); + + // Device synchronize every N number of events. + if (i > 0 && ((i % num_events_between_sync) == 0)) { + log_debug(tt::LogTest, "Going to WaitForEvent for i: {}", i); + EnqueueWaitForEvent(this->device_->command_queue(), event); + } + } + + // A bunch of bonus syncs where event_id is mod on earlier ID's. + EnqueueWaitForEvent(this->device_->command_queue(), sync_events.at(0)); + EnqueueWaitForEvent(this->device_->command_queue(), sync_events.at(sync_events.size() - 5)); + EnqueueWaitForEvent(this->device_->command_queue(), sync_events.at(4)); + Finish(this->device_->command_queue()); + + std::chrono::duration elapsed_seconds = (std::chrono::system_clock::now() - start); + tt::log_info(tt::LogTest, "Test Finished in {:.2f} us", elapsed_seconds.count() * 1000 * 1000); +} + +// Device sync. Single CQ here, less interesting than 2CQ but still useful. Ensure no hangs. +TEST_F(CommandQueueEventFixture, TestEventsEventsQueryBasic) { + + const size_t num_events = 50; + const size_t num_events_between_query = 5; + bool event_status; + + auto start = std::chrono::system_clock::now(); + std::vector> sync_events; + + // Record many events, occasionally query from host, but cannot guarantee completion status. + for (size_t i = 0; i < num_events; i++) { + auto event = sync_events.emplace_back(std::make_shared()); + EnqueueRecordEvent(this->device_->command_queue(), event); + + if (i > 0 && ((i % num_events_between_query) == 0)) { + auto status = EventQuery(event); + log_trace(tt::LogTest, "EventQuery for i: {} - status: {}", i, status); + } + } + + // Wait until earlier events are finished, then ensure query says they are finished. + auto &early_event_1 = sync_events.at(num_events - 10); + EventSynchronize(early_event_1); // Block until this event is finished. + event_status = EventQuery(early_event_1); + EXPECT_EQ(event_status, true); + + auto &early_event_2 = sync_events.at(num_events - 5); + Finish(this->device_->command_queue()); // Block until all events finished. + event_status = EventQuery(early_event_2); + EXPECT_EQ(event_status, true); + + // Query a future event that hasn't completed and ensure it's not finished. + auto future_event = std::make_shared(); + EnqueueRecordEvent(this->device_->command_queue(), future_event); + future_event->wait_until_ready(); // in case async used, must block until async cq populated event. + future_event->event_id = 0xFFFF; // Modify event_id to be a future event that isn't issued yet. + event_status = EventQuery(future_event); + EXPECT_EQ(event_status, false); + + Finish(this->device_->command_queue()); + std::chrono::duration elapsed_seconds = (std::chrono::system_clock::now() - start); + tt::log_info(tt::LogTest, "Test Finished in {:.2f} us", elapsed_seconds.count() * 1000 * 1000); +} + + +// Mix of WritesBuffers, RecordEvent, WaitForEvent, EventSynchronize with some checking. +TEST_F(CommandQueueEventFixture, TestEventsMixedWriteBufferRecordWaitSynchronize) { + const size_t num_buffers = 2; + const uint32_t page_size = 2048; + vector page(page_size / sizeof(uint32_t)); + uint32_t events_issued_per_cq = 0; + const uint32_t num_events_per_cq = 2; // Record and blocking write + uint32_t expected_event_id = 0; + + auto start = std::chrono::system_clock::now(); + + uint32_t completion_queue_base = this->device_->sysmem_manager().get_completion_queue_read_ptr(0); + chip_id_t mmio_device_id = tt::Cluster::instance().get_associated_mmio_device(this->device_->id()); + uint16_t channel = tt::Cluster::instance().get_assigned_channel_for_device(this->device_->id()); + constexpr uint32_t completion_queue_event_alignment = 32; + for (size_t i = 0; i < num_buffers; i++) { + + log_debug(tt::LogTest, "i: {} - Going to record event, write, wait, synchronize.", i); + auto event = std::make_shared(); // type is std::shared_ptr + EnqueueRecordEvent(this->device_->command_queue(), event); + EXPECT_EQ(event->cq_id, this->device_->command_queue().id()); + EXPECT_EQ(event->event_id, events_issued_per_cq + 1); // Event ids start at 1 + + std::shared_ptr buf = Buffer::create(this->device_, page_size, page_size, BufferType::DRAM); + EnqueueWriteBuffer(this->device_->command_queue(), buf, page, true); + EnqueueWaitForEvent(this->device_->command_queue(), event); + + if (i % 10 == 0) { + EventSynchronize(event); + } + events_issued_per_cq += num_events_per_cq; + } + Finish(this->device_->command_queue()); + + // Read completion queue and ensure we see expected event IDs + uint32_t event_id; + for (size_t i = 0; i < num_buffers * num_events_per_cq; i++) { + uint32_t host_addr = completion_queue_base + i * completion_queue_page_size + completion_queue_event_offset; + tt::Cluster::instance().read_sysmem(&event_id, 4, host_addr, mmio_device_id, channel); + EXPECT_EQ(event_id, ++expected_event_id); + } + + std::chrono::duration elapsed_seconds = (std::chrono::system_clock::now() - start); + tt::log_info(tt::LogTest, "Test Finished in {:.2f} us", elapsed_seconds.count() * 1000 * 1000); +} diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/dispatch_program/test_EnqueueProgram.cpp similarity index 87% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp rename to tests/tt_metal/tt_metal/dispatch_program/test_EnqueueProgram.cpp index d9b3d504477..83a856fa284 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/dispatch_program/test_EnqueueProgram.cpp @@ -41,7 +41,6 @@ struct DummyProgramMultiCBConfig { uint32_t num_sems; }; - namespace local_test_functions { void initialize_dummy_kernels(Program& program, const CoreRangeSet& cr_set) { @@ -1182,6 +1181,196 @@ TEST_F(CommandQueueSingleCardProgramFixture, TensixIncrementRuntimeArgsSanityMul namespace stress_tests { +TEST_F(MultiCommandQueueSingleDeviceProgramFixture, TensixTestRandomizedProgram) { + uint32_t NUM_PROGRAMS = 100; + uint32_t MAX_LOOP = 100; + uint32_t page_size = 1024; + + if (this->arch_ == tt::ARCH::BLACKHOLE) { + GTEST_SKIP(); // Running on second CQ is hanging on CI + } + + // Make random + auto random_seed = 0; // (unsigned int)time(NULL); + uint32_t seed = tt::parse_env("TT_METAL_SEED", random_seed); + log_info(tt::LogTest, "Using Test Seed: {}", seed); + srand(seed); + + CoreCoord worker_grid_size = this->device_->compute_with_storage_grid_size(); + CoreRange cr({0, 0}, {worker_grid_size.x - 1, worker_grid_size.y - 1}); + CoreRangeSet cr_set({cr}); + + log_info(tt::LogTest, "Starting compile of {} programs now.", NUM_PROGRAMS); + + vector programs; + for (uint32_t i = 0; i < NUM_PROGRAMS; i++) { + programs.push_back(Program()); + Program& program = programs.back(); + + std::map data_movement_defines = {{"DATA_MOVEMENT", "1"}}; + std::map compute_defines = {{"COMPUTE", "1"}}; + + // brisc + uint32_t BRISC_OUTER_LOOP, BRISC_MIDDLE_LOOP, BRISC_INNER_LOOP, NUM_CBS, NUM_SEMS; + bool USE_MAX_RT_ARGS; + + if (i == 0) { + // Ensures that we get at least one compilation with the max amount to + // ensure it compiles and runs + BRISC_OUTER_LOOP = MAX_LOOP; + BRISC_MIDDLE_LOOP = MAX_LOOP; + BRISC_INNER_LOOP = MAX_LOOP; + NUM_CBS = NUM_CIRCULAR_BUFFERS; + NUM_SEMS = NUM_SEMAPHORES; + USE_MAX_RT_ARGS = true; + } else { + BRISC_OUTER_LOOP = rand() % (MAX_LOOP) + 1; + BRISC_MIDDLE_LOOP = rand() % (MAX_LOOP) + 1; + BRISC_INNER_LOOP = rand() % (MAX_LOOP) + 1; + NUM_CBS = rand() % (NUM_CIRCULAR_BUFFERS) + 1; + NUM_SEMS = rand() % (NUM_SEMAPHORES) + 1; + USE_MAX_RT_ARGS = false; + } + + log_debug(tt::LogTest, "Compiling program {}/{} w/ BRISC_OUTER_LOOP: {} BRISC_MIDDLE_LOOP: {} BRISC_INNER_LOOP: {} NUM_CBS: {} NUM_SEMS: {} USE_MAX_RT_ARGS: {}", + i+1, NUM_PROGRAMS, BRISC_OUTER_LOOP, BRISC_MIDDLE_LOOP, BRISC_INNER_LOOP, NUM_CBS, NUM_SEMS, USE_MAX_RT_ARGS); + + for (uint32_t j = 0; j < NUM_CBS; j++) { + CircularBufferConfig cb_config = CircularBufferConfig(page_size * (j + 1), {{j, tt::DataFormat::Float16_b}}).set_page_size(j, page_size * (j + 1)); + auto cb = CreateCircularBuffer(program, cr_set, cb_config); + } + + for (uint32_t j = 0; j < NUM_SEMS; j++) { + CreateSemaphore(program, cr_set, j + 1); + } + + auto [brisc_unique_rtargs, brisc_common_rtargs] = local_test_functions::create_runtime_args(USE_MAX_RT_ARGS); + uint32_t num_brisc_unique_rtargs = brisc_unique_rtargs.size(); + uint32_t num_brisc_common_rtargs = brisc_common_rtargs.size(); + vector brisc_compile_args = {BRISC_OUTER_LOOP, BRISC_MIDDLE_LOOP, BRISC_INNER_LOOP, NUM_CBS, NUM_SEMS, num_brisc_unique_rtargs, num_brisc_common_rtargs, page_size}; + + // ncrisc + uint32_t NCRISC_OUTER_LOOP, NCRISC_MIDDLE_LOOP, NCRISC_INNER_LOOP; + if (i == 0) { + NCRISC_OUTER_LOOP = MAX_LOOP; + NCRISC_MIDDLE_LOOP = MAX_LOOP; + NCRISC_INNER_LOOP = MAX_LOOP; + } else { + NCRISC_OUTER_LOOP = rand() % (MAX_LOOP) + 1; + NCRISC_MIDDLE_LOOP = rand() % (MAX_LOOP) + 1; + NCRISC_INNER_LOOP = rand() % (MAX_LOOP) + 1; + } + + auto [ncrisc_unique_rtargs, ncrisc_common_rtargs] = local_test_functions::create_runtime_args(USE_MAX_RT_ARGS); + uint32_t num_ncrisc_unique_rtargs = ncrisc_unique_rtargs.size(); + uint32_t num_ncrisc_common_rtargs = ncrisc_common_rtargs.size(); + vector ncrisc_compile_args = {NCRISC_OUTER_LOOP, NCRISC_MIDDLE_LOOP, NCRISC_INNER_LOOP, NUM_CBS, NUM_SEMS, num_ncrisc_unique_rtargs, num_ncrisc_common_rtargs, page_size}; + + // trisc + uint32_t TRISC_OUTER_LOOP, TRISC_MIDDLE_LOOP, TRISC_INNER_LOOP; + if (i == 0) { + TRISC_OUTER_LOOP = MAX_LOOP; + TRISC_MIDDLE_LOOP = MAX_LOOP; + TRISC_INNER_LOOP = MAX_LOOP; + } else { + TRISC_OUTER_LOOP = rand() % (MAX_LOOP) + 1; + TRISC_MIDDLE_LOOP = rand() % (MAX_LOOP) + 1; + TRISC_INNER_LOOP = rand() % (MAX_LOOP) + 1; + } + + auto [trisc_unique_rtargs, trisc_common_rtargs] = local_test_functions::create_runtime_args(USE_MAX_RT_ARGS); + uint32_t num_trisc_unique_rtargs = trisc_unique_rtargs.size(); + uint32_t num_trisc_common_rtargs = trisc_common_rtargs.size(); + vector trisc_compile_args = {TRISC_OUTER_LOOP, TRISC_MIDDLE_LOOP, TRISC_INNER_LOOP, NUM_CBS, NUM_SEMS, num_trisc_unique_rtargs, num_trisc_common_rtargs, page_size}; + + bool at_least_one_kernel = false; + if (i == 0 or ((rand() % 2) == 0)) { + auto dummy_brisc_kernel = CreateKernel( + program, "tests/tt_metal/tt_metal/test_kernels/dataflow/unit_tests/command_queue/random_program.cpp", cr_set, DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, .noc = NOC::RISCV_0_default, .compile_args = brisc_compile_args, .defines = data_movement_defines}); + SetRuntimeArgs(program, dummy_brisc_kernel, cr_set, brisc_unique_rtargs); + SetCommonRuntimeArgs(program, dummy_brisc_kernel, brisc_common_rtargs); + at_least_one_kernel = true; + } + + if (i == 0 or ((rand() % 2) == 0)) { + auto dummy_ncrisc_kernel = CreateKernel( + program, "tests/tt_metal/tt_metal/test_kernels/dataflow/unit_tests/command_queue/random_program.cpp", cr_set, DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_1, .noc = NOC::RISCV_1_default, .compile_args = ncrisc_compile_args, .defines = data_movement_defines}); + SetRuntimeArgs(program, dummy_ncrisc_kernel, cr_set, ncrisc_unique_rtargs); + SetCommonRuntimeArgs(program, dummy_ncrisc_kernel, ncrisc_common_rtargs); + at_least_one_kernel = true; + } + + if (i == 0 or ((rand() % 2) == 0)) { + auto dummy_trisc_kernel = CreateKernel( + program, "tests/tt_metal/tt_metal/test_kernels/dataflow/unit_tests/command_queue/random_program.cpp", cr_set, ComputeConfig{ + .math_approx_mode = false, + .compile_args = trisc_compile_args, + .defines = compute_defines + }); + SetRuntimeArgs(program, dummy_trisc_kernel, cr_set, trisc_unique_rtargs); + SetCommonRuntimeArgs(program, dummy_trisc_kernel, trisc_common_rtargs); + at_least_one_kernel = true; + } + + if (not at_least_one_kernel) { + uint32_t random_risc = rand() % 3 + 1; + if (random_risc == 1) { + auto dummy_brisc_kernel = CreateKernel( + program, "tests/tt_metal/tt_metal/test_kernels/dataflow/unit_tests/command_queue/random_program.cpp", cr_set, DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, .noc = NOC::RISCV_0_default, .compile_args = brisc_compile_args, .defines = data_movement_defines}); + SetRuntimeArgs(program, dummy_brisc_kernel, cr_set, brisc_unique_rtargs); + SetCommonRuntimeArgs(program, dummy_brisc_kernel, brisc_common_rtargs); + } else if (random_risc == 2) { + auto dummy_ncrisc_kernel = CreateKernel( + program, "tests/tt_metal/tt_metal/test_kernels/dataflow/unit_tests/command_queue/random_program.cpp", cr_set, DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_1, .noc = NOC::RISCV_1_default, .compile_args = ncrisc_compile_args, .defines = data_movement_defines}); + SetRuntimeArgs(program, dummy_ncrisc_kernel, cr_set, ncrisc_unique_rtargs); + SetCommonRuntimeArgs(program, dummy_ncrisc_kernel, ncrisc_common_rtargs); + } else if (random_risc == 3) { + auto dummy_trisc_kernel = CreateKernel( + program, "tests/tt_metal/tt_metal/test_kernels/dataflow/unit_tests/command_queue/random_program.cpp", cr_set, ComputeConfig{ + .math_approx_mode = false, + .compile_args = trisc_compile_args, + .defines = compute_defines + }); + SetRuntimeArgs(program, dummy_trisc_kernel, cr_set, trisc_unique_rtargs); + SetCommonRuntimeArgs(program, dummy_trisc_kernel, trisc_common_rtargs); + } else { + TT_THROW("Invalid"); + } + } + + tt::tt_metal::detail::CompileProgram(this->device_, program); + } + + for (uint8_t cq_id = 0; cq_id < this->device_->num_hw_cqs(); ++cq_id) { + log_info(tt::LogTest, "Running {} programs on cq {} for cache warmup.", programs.size(), (uint32_t)cq_id); + // This loop caches program and runs + for (Program& program: programs) { + EnqueueProgram(this->device_->command_queue(cq_id), program, false); + } + + // This loops assumes already cached + uint32_t NUM_ITERATIONS = 500; // TODO(agrebenisan): Bump this to 5000, saw hangs for very large number of iterations, need to come back to that + + log_info(tt::LogTest, "Running {} programs on cq {} for {} iterations now.", programs.size(), (uint32_t)cq_id, NUM_ITERATIONS); + for (uint32_t i = 0; i < NUM_ITERATIONS; i++) { + auto rng = std::default_random_engine {}; + std::shuffle(std::begin(programs), std::end(programs), rng); + if (i % 10 == 0) { + log_debug(tt::LogTest, "Enqueueing {} programs on cq {} for iter: {}/{} now.", programs.size(), (uint32_t)cq_id, i+1, NUM_ITERATIONS); + } + for (Program& program: programs) { + EnqueueProgram(this->device_->command_queue(cq_id), program, false); + } + } + + log_info(tt::LogTest, "Calling Finish."); + Finish(this->device_->command_queue(cq_id)); + } +} TEST_F(CommandQueueSingleCardProgramFixture, DISABLED_TensixTestFillDispatchCoreBuffer) { uint32_t NUM_ITER = 100000; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp b/tests/tt_metal/tt_metal/dispatch_program/test_dispatch.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/common/test_dispatch.cpp rename to tests/tt_metal/tt_metal/dispatch_program/test_dispatch.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp b/tests/tt_metal/tt_metal/dispatch_trace/test_EnqueueTrace.cpp similarity index 79% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp rename to tests/tt_metal/tt_metal/dispatch_trace/test_EnqueueTrace.cpp index e7357186e2f..48238799d7b 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_EnqueueTrace.cpp +++ b/tests/tt_metal/tt_metal/dispatch_trace/test_EnqueueTrace.cpp @@ -91,7 +91,175 @@ constexpr bool kBlocking = true; constexpr bool kNonBlocking = false; vector blocking_flags = {kBlocking, kNonBlocking}; -TEST_F(SingleDeviceTraceFixture, InstantiateTraceSanity) { +TEST_F(SingleDeviceTraceFixture, TensixEnqueueOneProgramTrace) { + Setup(2048, 2); + auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); + auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); + + CommandQueue& command_queue = this->device_->command_queue(0); + CommandQueue& data_movement_queue = this->device_->command_queue(1); + + Program simple_program = create_simple_unary_program(*input, *output); + vector input_data(input->size() / sizeof(uint32_t), 0); + for (uint32_t i = 0; i < input_data.size(); i++) { + input_data[i] = i; + } + + // Eager mode + vector eager_output_data; + eager_output_data.resize(input_data.size()); + + EnqueueWriteBuffer(data_movement_queue, *input, input_data.data(), true); + EnqueueProgram(command_queue, simple_program, true); + EnqueueReadBuffer(data_movement_queue, output, eager_output_data.data(), true); + + // Trace mode + vector trace_output_data; + trace_output_data.resize(input_data.size()); + + EnqueueWriteBuffer(data_movement_queue, *input, input_data.data(), true); + + uint32_t tid = BeginTraceCapture(this->device_, command_queue.id()); + EnqueueProgram(command_queue, simple_program, false); + EndTraceCapture(this->device_, command_queue.id(), tid); + + EnqueueTrace(command_queue, tid, true); + EnqueueReadBuffer(data_movement_queue, *output, trace_output_data.data(), true); + EXPECT_TRUE(eager_output_data == trace_output_data); + + // Done + Finish(command_queue); + ReleaseTrace(this->device_, tid); +} + +TEST_F(SingleDeviceTraceFixture, TensixEnqueueOneProgramTraceLoops) { + Setup(4096, 2); + auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); + auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); + + CommandQueue& command_queue = this->device_->command_queue(0); + CommandQueue& data_movement_queue = this->device_->command_queue(1); + + Program simple_program = create_simple_unary_program(*input, *output); + vector input_data(input->size() / sizeof(uint32_t), 0); + for (uint32_t i = 0; i < input_data.size(); i++) { + input_data[i] = i; + } + + // Trace mode output + uint32_t num_loops = 10; + vector> trace_outputs; + + for (auto i = 0; i < num_loops; i++) { + trace_outputs.push_back({}); + trace_outputs[i].resize(input_data.size()); + } + + // Compile + EnqueueProgram(command_queue, simple_program, true); + + // Trace mode execution + uint32_t trace_id = 0; + bool trace_captured = false; + for (auto i = 0; i < num_loops; i++) { + EnqueueWriteBuffer(data_movement_queue, *input, input_data.data(), true); + + if (not trace_captured) { + trace_id = BeginTraceCapture(this->device_, command_queue.id()); + EnqueueProgram(command_queue, simple_program, false); + EndTraceCapture(this->device_, command_queue.id(), trace_id); + trace_captured = true; + } + + EnqueueTrace(command_queue, trace_id, false); + EnqueueReadBuffer(data_movement_queue, *output, trace_outputs[i].data(), true); + + // Expect same output across all loops + EXPECT_TRUE(trace_outputs[i] == trace_outputs[0]); + } + + // Done + Finish(command_queue); + ReleaseTrace(this->device_, trace_id); +} + +TEST_F(SingleDeviceTraceFixture, TensixEnqueueOneProgramTraceBenchmark) { + Setup(6144, 2); + auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); + auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); + + constexpr bool kBlocking = true; + constexpr bool kNonBlocking = false; + vector blocking_flags = {kBlocking, kNonBlocking}; + + // Single Q for data and commands + // Keep this queue in passthrough mode for now + CommandQueue& command_queue = this->device_->command_queue(0); + + auto simple_program = create_simple_unary_program(*input, *output); + vector input_data(input->size() / sizeof(uint32_t), 0); + for (uint32_t i = 0; i < input_data.size(); i++) { + input_data[i] = i; + } + + // Trace mode output + uint32_t num_loops = 10; + vector> trace_outputs; + + for (auto i = 0; i < num_loops; i++) { + trace_outputs.push_back({}); + trace_outputs[i].resize(input_data.size()); + } + + // Eager mode + vector expected_output_data; + vector eager_output_data; + expected_output_data.resize(input_data.size()); + eager_output_data.resize(input_data.size()); + + // Warm up and use the eager blocking run as the expected output + EnqueueWriteBuffer(command_queue, *input, input_data.data(), kBlocking); + EnqueueProgram(command_queue, simple_program, kBlocking); + EnqueueReadBuffer(command_queue, *output, expected_output_data.data(), kBlocking); + Finish(command_queue); + + for (bool blocking : blocking_flags) { + std::string mode = blocking ? "Eager-B" : "Eager-NB"; + for (auto i = 0; i < num_loops; i++) { + tt::ScopedTimer timer(mode + " loop " + std::to_string(i)); + EnqueueWriteBuffer(command_queue, *input, input_data.data(), blocking); + EnqueueProgram(command_queue, simple_program, blocking); + EnqueueReadBuffer(command_queue, *output, eager_output_data.data(), blocking); + } + if (not blocking) { + // (Optional) wait for the last non-blocking command to finish + Finish(command_queue); + } + EXPECT_TRUE(eager_output_data == expected_output_data); + } + + // Capture trace on a trace queue + uint32_t tid = BeginTraceCapture(this->device_, command_queue.id()); + EnqueueProgram(command_queue, simple_program, false); + EndTraceCapture(this->device_, command_queue.id(), tid); + + // Trace mode execution + for (auto i = 0; i < num_loops; i++) { + tt::ScopedTimer timer("Trace loop " + std::to_string(i)); + EnqueueWriteBuffer(command_queue, *input, input_data.data(), kNonBlocking); + EnqueueTrace(command_queue, tid, kNonBlocking); + EnqueueReadBuffer(command_queue, *output, trace_outputs[i].data(), kNonBlocking); + } + Finish(command_queue); + + // Expect same output across all loops + for (auto i = 0; i < num_loops; i++) { + EXPECT_TRUE(trace_outputs[i] == trace_outputs[0]); + } + ReleaseTrace(this->device_, tid); +} + +TEST_F(SingleDeviceTraceFixture, TensixInstantiateTraceSanity) { Setup(2048); CommandQueue& command_queue = this->device_->command_queue(); @@ -123,7 +291,7 @@ TEST_F(SingleDeviceTraceFixture, InstantiateTraceSanity) { ReleaseTrace(this->device_, tid); } -TEST_F(SingleDeviceTraceFixture, EnqueueProgramTraceCapture) { +TEST_F(SingleDeviceTraceFixture, TensixEnqueueProgramTraceCapture) { Setup(2048); auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); @@ -166,7 +334,7 @@ TEST_F(SingleDeviceTraceFixture, EnqueueProgramTraceCapture) { ReleaseTrace(this->device_, tid); } -TEST_F(SingleDeviceTraceFixture, EnqueueProgramDeviceCapture) { +TEST_F(SingleDeviceTraceFixture, TensixEnqueueProgramDeviceCapture) { Setup(2048); auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); @@ -217,7 +385,7 @@ TEST_F(SingleDeviceTraceFixture, EnqueueProgramDeviceCapture) { ReleaseTrace(this->device_, tid); } -TEST_F(SingleDeviceTraceFixture, EnqueueTwoProgramTrace) { +TEST_F(SingleDeviceTraceFixture, TensixEnqueueTwoProgramTrace) { Setup(6144); // Get command queue from device for this test, since its running in async mode CommandQueue& command_queue = this->device_->command_queue(); @@ -293,7 +461,7 @@ TEST_F(SingleDeviceTraceFixture, EnqueueTwoProgramTrace) { } } -TEST_F(SingleDeviceTraceFixture, EnqueueMultiProgramTraceBenchmark) { +TEST_F(SingleDeviceTraceFixture, TensixEnqueueMultiProgramTraceBenchmark) { Setup(6144); CommandQueue& command_queue = this->device_->command_queue(); diff --git a/tests/tt_metal/tt_metal/gtest_smoke/test_basic_pipeline.cpp b/tests/tt_metal/tt_metal/gtest_smoke/test_basic_pipeline.cpp deleted file mode 120000 index 3584a28b68e..00000000000 --- a/tests/tt_metal/tt_metal/gtest_smoke/test_basic_pipeline.cpp +++ /dev/null @@ -1 +0,0 @@ -../unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp \ No newline at end of file diff --git a/tests/tt_metal/tt_metal/gtest_smoke/test_device.cpp b/tests/tt_metal/tt_metal/gtest_smoke/test_device.cpp deleted file mode 120000 index 9ae4e0133cd..00000000000 --- a/tests/tt_metal/tt_metal/gtest_smoke/test_device.cpp +++ /dev/null @@ -1 +0,0 @@ -../unit_tests_common/basic/test_device_init.cpp \ No newline at end of file diff --git a/tests/tt_metal/tt_metal/gtest_smoke/test_flatten.cpp b/tests/tt_metal/tt_metal/gtest_smoke/test_flatten.cpp deleted file mode 120000 index dae6734bc34..00000000000 --- a/tests/tt_metal/tt_metal/gtest_smoke/test_flatten.cpp +++ /dev/null @@ -1 +0,0 @@ -../unit_tests_common/compute/test_flatten.cpp \ No newline at end of file diff --git a/tests/tt_metal/tt_metal/gtest_smoke/test_matmul_large_block.cpp b/tests/tt_metal/tt_metal/gtest_smoke/test_matmul_large_block.cpp deleted file mode 120000 index c649d4ab585..00000000000 --- a/tests/tt_metal/tt_metal/gtest_smoke/test_matmul_large_block.cpp +++ /dev/null @@ -1 +0,0 @@ -../unit_tests_common/compute/matmul/test_matmul_large_block.cpp \ No newline at end of file diff --git a/tests/tt_metal/tt_metal/gtest_smoke/test_matmul_multi_core_X_dram.cpp b/tests/tt_metal/tt_metal/gtest_smoke/test_matmul_multi_core_X_dram.cpp deleted file mode 120000 index 066de75928e..00000000000 --- a/tests/tt_metal/tt_metal/gtest_smoke/test_matmul_multi_core_X_dram.cpp +++ /dev/null @@ -1 +0,0 @@ -../unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp \ No newline at end of file diff --git a/tests/tt_metal/tt_metal/gtest_smoke/tests_main.cpp b/tests/tt_metal/tt_metal/gtest_smoke/tests_main.cpp deleted file mode 100644 index 660438fe72c..00000000000 --- a/tests/tt_metal/tt_metal/gtest_smoke/tests_main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "gtest/gtest.h" - -/* -All the tests in gtest_smoke are symlinks. This test suite is meant to be used for sanity checks. -*/ diff --git a/tests/tt_metal/tt_metal/unit_tests/tt_stl/test_any_range.cpp b/tests/tt_metal/tt_metal/stl/test_any_range.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/tt_stl/test_any_range.cpp rename to tests/tt_metal/tt_metal/stl/test_any_range.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/tt_stl/slotmap.cpp b/tests/tt_metal/tt_metal/stl/test_slotmap.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/tt_stl/slotmap.cpp rename to tests/tt_metal/tt_metal/stl/test_slotmap.cpp 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 d66dcb3774b..44974e34b10 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 @@ -8,8 +8,6 @@ #include "tt_metal/host_api.hpp" #include "tt_metal/impl/dispatch/command_queue.hpp" #include "tt_metal/test_utils/env_vars.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" -#include "tt_metal/test_utils/stimulus.hpp" #include "tt_metal/impl/device/device.hpp" #include "tt_metal/impl/device/device_pool.hpp" @@ -57,7 +55,6 @@ bool load_all_blank_kernels(tt_metal::Device *device) { CreateKernel(program, "tt_metal/kernels/compute/blank.cpp", all_cores, ComputeConfig{}); unit_tests_common::basic::test_device_init::launch_program(device, program); - // tt_metal::detail::LaunchProgram(device, program); return pass; } } // namespace unit_tests_common::basic::test_device_init diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_HostAsyncCQ.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_HostAsyncCQ.cpp index a9c0966f2af..7bb3b73b073 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_HostAsyncCQ.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_HostAsyncCQ.cpp @@ -221,47 +221,7 @@ TEST_F(CommandQueueProgramFixture, TensixTestAsyncCommandQueueSanityAndProfile) command_queue.set_mode(current_mode); } -TEST_F(CommandQueueBufferFixture, DISABLED_TestAsyncBufferRW) { - // Test Async Enqueue Read and Write + Get Addr + Buffer Allocation and Deallocation - auto& command_queue = this->device_->command_queue(); - auto current_mode = CommandQueue::default_mode(); - command_queue.set_mode(CommandQueue::CommandQueueMode::ASYNC); - Program program; - for (int j = 0; j < 10; j++) { - // Asynchronously initialize a buffer on device - uint32_t first_buf_value = j + 1; - uint32_t second_buf_value = j + 2; - uint32_t first_buf_size = 4096; - uint32_t second_buf_size = 2048; - // Asynchronously allocate buffer on device - std::shared_ptr buffer = Buffer::create(this->device_, first_buf_size, first_buf_size, BufferType::DRAM); - std::shared_ptr allocated_buffer_address = std::make_shared(); - EnqueueGetBufferAddr(this->device_->command_queue(), allocated_buffer_address.get(), buffer.get(), true); - // Ensure returned addr is correct - EXPECT_EQ((*allocated_buffer_address), buffer->address()); - - std::shared_ptr> vec = std::make_shared>(first_buf_size / 4, first_buf_value); - std::vector readback_vec = {}; - // Write first vector to existing on device buffer. - EnqueueWriteBuffer(this->device_->command_queue(), buffer, vec, false); - // Reallocate the vector in the main thread after asynchronously pushing it (ensure that worker still has access to this data) - vec = std::make_shared>(second_buf_size / 4, second_buf_value); - // Simulate what tt-eager does: Share buffer ownership with program - AssignGlobalBufferToProgram(buffer, program); - // Reallocate buffer (this is safe, since the program also owns the existing buffer, which will not be deallocated) - buffer = Buffer::create(this->device_, second_buf_size, second_buf_size, BufferType::DRAM); - // Write second vector to second buffer - EnqueueWriteBuffer(this->device_->command_queue(), buffer, vec, false); - // Have main thread give up ownership immediately after writing - vec.reset(); - // Read both buffer and ensure data is correct - EnqueueReadBuffer(this->device_->command_queue(), buffer, readback_vec, true); - for (int i = 0; i < readback_vec.size(); i++) { - EXPECT_EQ(readback_vec[i], second_buf_value); - } - } - command_queue.set_mode(current_mode); -} + TEST_F(CommandQueueBufferFixture, DISABLED_TensixTestAsyncCBAllocation) { // Test asynchronous allocation of buffers and their assignment to CBs @@ -306,31 +266,7 @@ TEST_F(CommandQueueBufferFixture, DISABLED_TensixTestAsyncCBAllocation) { command_queue.set_mode(current_mode); } -TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAsyncAssertForDeprecatedAPI) { - auto& command_queue = this->device_->command_queue(); - auto current_mode = CommandQueue::default_mode(); - command_queue.set_mode(CommandQueue::CommandQueueMode::ASYNC); - Program program; - CoreCoord core = {0, 0}; - uint32_t buf_size = 4096; - uint32_t page_size = 4096; - auto dummy_kernel = CreateKernel( - program, - "tt_metal/kernels/dataflow/reader_binary_diff_lengths.cpp", - core, - DataMovementConfig{.processor = DataMovementProcessor::RISCV_0, .noc = NOC::RISCV_0_default}); - auto src0 = Buffer::create(this->device_, buf_size, page_size, BufferType::DRAM); - std::vector runtime_args = {src0->address()}; - try { - SetRuntimeArgs(program, dummy_kernel, core, runtime_args); - } - catch (std::runtime_error &e) { - std::string expected = "This variant of SetRuntimeArgs can only be called when Asynchronous SW Command Queues are disabled for Fast Dispatch."; - const string error = string(e.what()); - EXPECT_TRUE(error.find(expected) != std::string::npos); - } - command_queue.set_mode(current_mode); -} + TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAsyncFlattenStress){ auto& command_queue = this->device_->command_queue(); diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_events.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_events.cpp index 824b4e7edfd..ffb53173d91 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_events.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/test_events.cpp @@ -20,8 +20,6 @@ enum class DataMovementMode: uint8_t { READ = 1 }; -constexpr uint32_t completion_queue_event_offset = sizeof(CQDispatchCmd); -constexpr uint32_t completion_queue_page_size = dispatch_constants::TRANSFER_PAGE_SIZE; TEST_F(CommandQueueEventFixture, TestEventsDataMovementWrittenToCompletionQueueInOrder) { size_t num_buffers = 100; @@ -73,234 +71,3 @@ TEST_F(CommandQueueEventFixture, TestEventsDataMovementWrittenToCompletionQueueI } } - -// Basic test, record events, check that Event struct was updated. Enough commands to trigger issue queue wrap. -TEST_F(CommandQueueEventFixture, TestEventsEnqueueRecordEventIssueQueueWrap) { - - const size_t num_events = 100000; // Enough to wrap issue queue. 768MB and cmds are 22KB each, so 35k cmds. - uint32_t cmds_issued_per_cq = 0; - - auto start = std::chrono::system_clock::now(); - - for (size_t i = 0; i < num_events; i++) { - auto event = std::make_shared(); // type is std::shared_ptr - EnqueueRecordEvent(this->device_->command_queue(), event); - EXPECT_EQ(event->event_id, cmds_issued_per_cq + 1); // Event ids start at 1 - EXPECT_EQ(event->cq_id, this->device_->command_queue().id()); - cmds_issued_per_cq++; - } - Finish(this->device_->command_queue()); - - std::chrono::duration elapsed_seconds = (std::chrono::system_clock::now() - start); - tt::log_info(tt::LogTest, "Test Finished in {:.2f} us", elapsed_seconds.count() * 1000 * 1000); -} - -// Test where Host synchronously waits for event to be completed. -TEST_F(CommandQueueEventFixture, TestEventsEnqueueRecordEventAndSynchronize) { - const size_t num_events = 100; - const size_t num_events_between_sync = 10; - - auto start = std::chrono::system_clock::now(); - - std::vector> sync_events; - - // A bunch of events recorded, occasionally will sync from host. - for (size_t i = 0; i < num_events; i++) { - auto event = sync_events.emplace_back(std::make_shared()); - EnqueueRecordEvent(this->device_->command_queue(), event); - - // Host synchronize every N number of events. - if (i > 0 && ((i % num_events_between_sync) == 0)) { - EventSynchronize(event); - } - } - - // A bunch of bonus syncs where event_id is mod on earlier ID's. - EventSynchronize(sync_events.at(2)); - EventSynchronize(sync_events.at(sync_events.size() - 2)); - EventSynchronize(sync_events.at(5)); - - Finish(this->device_->command_queue()); - - std::chrono::duration elapsed_seconds = (std::chrono::system_clock::now() - start); - tt::log_info(tt::LogTest, "Test Finished in {:.2f} us", elapsed_seconds.count() * 1000 * 1000); -} - -// Negative test. Host syncing on a future event that isn't actually issued. -// Ensure that expected hang is seen, which indicates event sync feature is working properly. -TEST_F(CommandQueueEventFixture, TestEventsEnqueueRecordEventAndSynchronizeHang) { - tt::llrt::OptionsG.set_test_mode_enabled(true); // Required for finish hang breakout. - - auto future_event = std::make_shared(); - EnqueueRecordEvent(this->device_->command_queue(), future_event); - future_event->wait_until_ready(); // in case async used, must block until async cq populated event. - future_event->event_id = 0xFFFF; // Modify event_id to be a future event that isn't issued yet. - - // Launch Host Sync in an async thread, expected to hang, with timeout and kill signal. - auto future = std::async(std::launch::async, [this, future_event]() { - return EventSynchronize(future_event); - }); - - bool seen_expected_hang = future.wait_for(std::chrono::seconds(1)) == std::future_status::timeout; - tt::watcher_server_set_error_flag(seen_expected_hang); // Signal to terminate thread. Don't care about it's exception. - - // Briefly wait before clearing error flag, and wrapping up via finish. - std::this_thread::sleep_for(std::chrono::milliseconds(200)); - tt::watcher_server_set_error_flag(false); - Finish(this->device_->command_queue()); - - log_info(tt::LogTest, "Note: Test expects to see a hang if events feature is working. seen_expected_hang: {}", seen_expected_hang); - EXPECT_TRUE(seen_expected_hang); -} - -// Negative test. Device sync. Single CQ here syncing on a future event that isn't actually issued. -// Ensure that expected hang is seen, which indicates event sync feature is working properly. -TEST_F(CommandQueueEventFixture, TestEventsQueueWaitForEventHang) { - // Skip this test until #7216 is implemented. - GTEST_SKIP(); - tt::llrt::OptionsG.set_test_mode_enabled(true); // Required for finish hang breakout. - - auto future_event = std::make_shared(); - EnqueueRecordEvent(this->device_->command_queue(), future_event); - future_event->wait_until_ready(); // in case async used, must block until async cq populated event. - future_event->event_id = 0xFFFF; // Modify event_id to be a future event that isn't issued yet. - EnqueueWaitForEvent(this->device_->command_queue(), future_event); - - // Launch Finish in an async thread, expected to hang, with timeout and kill signal. - auto future = std::async(std::launch::async, [this]() { - return Finish(this->device_->command_queue()); - }); - - bool seen_expected_hang = future.wait_for(std::chrono::seconds(1)) == std::future_status::timeout; - tt::watcher_server_set_error_flag(seen_expected_hang); // Signal to terminate thread. Don't care about it's exception. - - // Clear error flag before exiting to restore state for next test. - std::this_thread::sleep_for(std::chrono::milliseconds(200)); - tt::watcher_server_set_error_flag(false); - - log_info(tt::LogTest, "Note: Test expects to see a hang if events feature is working. seen_expected_hang: {}", seen_expected_hang); - EXPECT_TRUE(seen_expected_hang); -} - -// Device sync. Single CQ here, less interesting than 2CQ but still useful. Ensure no hangs. -TEST_F(CommandQueueEventFixture, TestEventsQueueWaitForEventBasic) { - - const size_t num_events = 50; - const size_t num_events_between_sync = 5; - - auto start = std::chrono::system_clock::now(); - std::vector> sync_events; - - // A bunch of events recorded, occasionally will sync from device. - for (size_t i = 0; i < num_events; i++) { - auto event = sync_events.emplace_back(std::make_shared()); - EnqueueRecordEvent(this->device_->command_queue(), event); - - // Device synchronize every N number of events. - if (i > 0 && ((i % num_events_between_sync) == 0)) { - log_debug(tt::LogTest, "Going to WaitForEvent for i: {}", i); - EnqueueWaitForEvent(this->device_->command_queue(), event); - } - } - - // A bunch of bonus syncs where event_id is mod on earlier ID's. - EnqueueWaitForEvent(this->device_->command_queue(), sync_events.at(0)); - EnqueueWaitForEvent(this->device_->command_queue(), sync_events.at(sync_events.size() - 5)); - EnqueueWaitForEvent(this->device_->command_queue(), sync_events.at(4)); - Finish(this->device_->command_queue()); - - std::chrono::duration elapsed_seconds = (std::chrono::system_clock::now() - start); - tt::log_info(tt::LogTest, "Test Finished in {:.2f} us", elapsed_seconds.count() * 1000 * 1000); -} - -// Device sync. Single CQ here, less interesting than 2CQ but still useful. Ensure no hangs. -TEST_F(CommandQueueEventFixture, TestEventsEventsQueryBasic) { - - const size_t num_events = 50; - const size_t num_events_between_query = 5; - bool event_status; - - auto start = std::chrono::system_clock::now(); - std::vector> sync_events; - - // Record many events, occasionally query from host, but cannot guarantee completion status. - for (size_t i = 0; i < num_events; i++) { - auto event = sync_events.emplace_back(std::make_shared()); - EnqueueRecordEvent(this->device_->command_queue(), event); - - if (i > 0 && ((i % num_events_between_query) == 0)) { - auto status = EventQuery(event); - log_trace(tt::LogTest, "EventQuery for i: {} - status: {}", i, status); - } - } - - // Wait until earlier events are finished, then ensure query says they are finished. - auto &early_event_1 = sync_events.at(num_events - 10); - EventSynchronize(early_event_1); // Block until this event is finished. - event_status = EventQuery(early_event_1); - EXPECT_EQ(event_status, true); - - auto &early_event_2 = sync_events.at(num_events - 5); - Finish(this->device_->command_queue()); // Block until all events finished. - event_status = EventQuery(early_event_2); - EXPECT_EQ(event_status, true); - - // Query a future event that hasn't completed and ensure it's not finished. - auto future_event = std::make_shared(); - EnqueueRecordEvent(this->device_->command_queue(), future_event); - future_event->wait_until_ready(); // in case async used, must block until async cq populated event. - future_event->event_id = 0xFFFF; // Modify event_id to be a future event that isn't issued yet. - event_status = EventQuery(future_event); - EXPECT_EQ(event_status, false); - - Finish(this->device_->command_queue()); - std::chrono::duration elapsed_seconds = (std::chrono::system_clock::now() - start); - tt::log_info(tt::LogTest, "Test Finished in {:.2f} us", elapsed_seconds.count() * 1000 * 1000); -} - - -// Mix of WritesBuffers, RecordEvent, WaitForEvent, EventSynchronize with some checking. -TEST_F(CommandQueueEventFixture, TestEventsMixedWriteBufferRecordWaitSynchronize) { - const size_t num_buffers = 2; - const uint32_t page_size = 2048; - vector page(page_size / sizeof(uint32_t)); - uint32_t events_issued_per_cq = 0; - const uint32_t num_events_per_cq = 2; // Record and blocking write - uint32_t expected_event_id = 0; - - auto start = std::chrono::system_clock::now(); - - uint32_t completion_queue_base = this->device_->sysmem_manager().get_completion_queue_read_ptr(0); - chip_id_t mmio_device_id = tt::Cluster::instance().get_associated_mmio_device(this->device_->id()); - uint16_t channel = tt::Cluster::instance().get_assigned_channel_for_device(this->device_->id()); - constexpr uint32_t completion_queue_event_alignment = 32; - for (size_t i = 0; i < num_buffers; i++) { - - log_debug(tt::LogTest, "i: {} - Going to record event, write, wait, synchronize.", i); - auto event = std::make_shared(); // type is std::shared_ptr - EnqueueRecordEvent(this->device_->command_queue(), event); - EXPECT_EQ(event->cq_id, this->device_->command_queue().id()); - EXPECT_EQ(event->event_id, events_issued_per_cq + 1); // Event ids start at 1 - - std::shared_ptr buf = Buffer::create(this->device_, page_size, page_size, BufferType::DRAM); - EnqueueWriteBuffer(this->device_->command_queue(), buf, page, true); - EnqueueWaitForEvent(this->device_->command_queue(), event); - - if (i % 10 == 0) { - EventSynchronize(event); - } - events_issued_per_cq += num_events_per_cq; - } - Finish(this->device_->command_queue()); - - // Read completion queue and ensure we see expected event IDs - uint32_t event_id; - for (size_t i = 0; i < num_buffers * num_events_per_cq; i++) { - uint32_t host_addr = completion_queue_base + i * completion_queue_page_size + completion_queue_event_offset; - tt::Cluster::instance().read_sysmem(&event_id, 4, host_addr, mmio_device_id, channel); - EXPECT_EQ(event_id, ++expected_event_id); - } - - std::chrono::duration elapsed_seconds = (std::chrono::system_clock::now() - start); - tt::log_info(tt::LogTest, "Test Finished in {:.2f} us", elapsed_seconds.count() * 1000 * 1000); -} diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp index c985e117a18..9e89f7fbcfb 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/multichip/test_eth_EnqueueProgram.cpp @@ -10,10 +10,6 @@ #include "tt_metal/impl/kernels/kernel.hpp" #include "tt_metal/impl/buffers/buffer.hpp" #include "tt_metal/impl/device/device.hpp" - -#include "tt_metal/test_utils/comparison.hpp" -#include "tt_metal/test_utils/df/df.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" #include "tt_metal/test_utils/stimulus.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp index 3be350496bf..dea334cb1ad 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/pipelining/basic_pipeline.cpp @@ -17,9 +17,6 @@ #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/dispatch/command_queue.hpp" -#include "tt_metal/test_utils/env_vars.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" -#include "tt_metal/test_utils/stimulus.hpp" #include "tt_metal/impl/device/device.hpp" using std::map; @@ -44,10 +41,6 @@ void create_and_run_row_pipeline(tt_metal::Device* device, const PipelineRowConf tt_metal::Program program = tt_metal::CreateProgram(); - // uint32_t num_tiles = 32; - // uint32_t block_size_tiles = 16; - // uint32_t num_blocks_in_CB = 2; - // uint32_t num_repetitions = 1; uint32_t num_cores = (uint32_t)test_config.num_cores; uint32_t num_tiles = (uint32_t)test_config.num_tiles; uint32_t block_size_tiles = (uint32_t)test_config.block_size_tiles; diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp index b230a67e1cc..532a439bc4a 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp @@ -26,7 +26,6 @@ #include "tt_metal/test_utils/comparison.hpp" #include "tt_metal/test_utils/df/df.hpp" #include "tt_metal/test_utils/env_vars.hpp" -// #include "tt_metal/test_utils/print_helpers.hpp" #include "tt_metal/detail/persistent_kernel_cache.hpp" #include "tt_metal/test_utils/stimulus.hpp" @@ -838,10 +837,6 @@ TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAutonomousRelayStreamsLoop TEST_F(CommandQueueProgramFixture, DISABLED_TensixTestAutonomousRelayStreamsLoopingLong) { auto arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); auto num_devices = tt::tt_metal::GetNumAvailableDevices(); - // if (num_devices != 8) { - // log_info(tt::LogTest, "Need at least 2 devices to run this test"); - // return; - // } if (arch == tt::ARCH::GRAYSKULL) { log_info(tt::LogTest, "Test must be run on WH"); return; diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp index f97c902bb9b..5aff132e1f3 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp @@ -79,195 +79,6 @@ std::pair, std::vector> create_runtime_args(bool namespace stress_tests { -TEST_F(MultiCommandQueueSingleDeviceProgramFixture, TensixTestRandomizedProgram) { - uint32_t NUM_PROGRAMS = 100; - uint32_t MAX_LOOP = 100; - uint32_t page_size = 1024; - if (this->arch_ == tt::ARCH::BLACKHOLE) { - GTEST_SKIP(); // Running on second CQ is hanging on CI - } - - // Make random - auto random_seed = 0; // (unsigned int)time(NULL); - uint32_t seed = tt::parse_env("TT_METAL_SEED", random_seed); - log_info(tt::LogTest, "Using Test Seed: {}", seed); - srand(seed); - - CoreCoord worker_grid_size = this->device_->compute_with_storage_grid_size(); - CoreRange cr({0, 0}, {worker_grid_size.x - 1, worker_grid_size.y - 1}); - CoreRangeSet cr_set({cr}); - - log_info(tt::LogTest, "Starting compile of {} programs now.", NUM_PROGRAMS); - - vector programs; - for (uint32_t i = 0; i < NUM_PROGRAMS; i++) { - programs.push_back(Program()); - Program& program = programs.back(); - - std::map data_movement_defines = {{"DATA_MOVEMENT", "1"}}; - std::map compute_defines = {{"COMPUTE", "1"}}; - - // brisc - uint32_t BRISC_OUTER_LOOP, BRISC_MIDDLE_LOOP, BRISC_INNER_LOOP, NUM_CBS, NUM_SEMS; - bool USE_MAX_RT_ARGS; - - if (i == 0) { - // Ensures that we get at least one compilation with the max amount to - // ensure it compiles and runs - BRISC_OUTER_LOOP = MAX_LOOP; - BRISC_MIDDLE_LOOP = MAX_LOOP; - BRISC_INNER_LOOP = MAX_LOOP; - NUM_CBS = NUM_CIRCULAR_BUFFERS; - NUM_SEMS = NUM_SEMAPHORES; - USE_MAX_RT_ARGS = true; - } else { - BRISC_OUTER_LOOP = rand() % (MAX_LOOP) + 1; - BRISC_MIDDLE_LOOP = rand() % (MAX_LOOP) + 1; - BRISC_INNER_LOOP = rand() % (MAX_LOOP) + 1; - NUM_CBS = rand() % (NUM_CIRCULAR_BUFFERS) + 1; - NUM_SEMS = rand() % (NUM_SEMAPHORES) + 1; - USE_MAX_RT_ARGS = false; - } - - log_debug(tt::LogTest, "Compiling program {}/{} w/ BRISC_OUTER_LOOP: {} BRISC_MIDDLE_LOOP: {} BRISC_INNER_LOOP: {} NUM_CBS: {} NUM_SEMS: {} USE_MAX_RT_ARGS: {}", - i+1, NUM_PROGRAMS, BRISC_OUTER_LOOP, BRISC_MIDDLE_LOOP, BRISC_INNER_LOOP, NUM_CBS, NUM_SEMS, USE_MAX_RT_ARGS); - - for (uint32_t j = 0; j < NUM_CBS; j++) { - CircularBufferConfig cb_config = CircularBufferConfig(page_size * (j + 1), {{j, tt::DataFormat::Float16_b}}).set_page_size(j, page_size * (j + 1)); - auto cb = CreateCircularBuffer(program, cr_set, cb_config); - } - - for (uint32_t j = 0; j < NUM_SEMS; j++) { - CreateSemaphore(program, cr_set, j + 1); - } - - auto [brisc_unique_rtargs, brisc_common_rtargs] = local_test_functions::create_runtime_args(USE_MAX_RT_ARGS); - uint32_t num_brisc_unique_rtargs = brisc_unique_rtargs.size(); - uint32_t num_brisc_common_rtargs = brisc_common_rtargs.size(); - vector brisc_compile_args = {BRISC_OUTER_LOOP, BRISC_MIDDLE_LOOP, BRISC_INNER_LOOP, NUM_CBS, NUM_SEMS, num_brisc_unique_rtargs, num_brisc_common_rtargs, page_size}; - - // ncrisc - uint32_t NCRISC_OUTER_LOOP, NCRISC_MIDDLE_LOOP, NCRISC_INNER_LOOP; - if (i == 0) { - NCRISC_OUTER_LOOP = MAX_LOOP; - NCRISC_MIDDLE_LOOP = MAX_LOOP; - NCRISC_INNER_LOOP = MAX_LOOP; - } else { - NCRISC_OUTER_LOOP = rand() % (MAX_LOOP) + 1; - NCRISC_MIDDLE_LOOP = rand() % (MAX_LOOP) + 1; - NCRISC_INNER_LOOP = rand() % (MAX_LOOP) + 1; - } - - auto [ncrisc_unique_rtargs, ncrisc_common_rtargs] = local_test_functions::create_runtime_args(USE_MAX_RT_ARGS); - uint32_t num_ncrisc_unique_rtargs = ncrisc_unique_rtargs.size(); - uint32_t num_ncrisc_common_rtargs = ncrisc_common_rtargs.size(); - vector ncrisc_compile_args = {NCRISC_OUTER_LOOP, NCRISC_MIDDLE_LOOP, NCRISC_INNER_LOOP, NUM_CBS, NUM_SEMS, num_ncrisc_unique_rtargs, num_ncrisc_common_rtargs, page_size}; - - // trisc - uint32_t TRISC_OUTER_LOOP, TRISC_MIDDLE_LOOP, TRISC_INNER_LOOP; - if (i == 0) { - TRISC_OUTER_LOOP = MAX_LOOP; - TRISC_MIDDLE_LOOP = MAX_LOOP; - TRISC_INNER_LOOP = MAX_LOOP; - } else { - TRISC_OUTER_LOOP = rand() % (MAX_LOOP) + 1; - TRISC_MIDDLE_LOOP = rand() % (MAX_LOOP) + 1; - TRISC_INNER_LOOP = rand() % (MAX_LOOP) + 1; - } - - auto [trisc_unique_rtargs, trisc_common_rtargs] = local_test_functions::create_runtime_args(USE_MAX_RT_ARGS); - uint32_t num_trisc_unique_rtargs = trisc_unique_rtargs.size(); - uint32_t num_trisc_common_rtargs = trisc_common_rtargs.size(); - vector trisc_compile_args = {TRISC_OUTER_LOOP, TRISC_MIDDLE_LOOP, TRISC_INNER_LOOP, NUM_CBS, NUM_SEMS, num_trisc_unique_rtargs, num_trisc_common_rtargs, page_size}; - - bool at_least_one_kernel = false; - if (i == 0 or ((rand() % 2) == 0)) { - auto dummy_brisc_kernel = CreateKernel( - program, "tests/tt_metal/tt_metal/test_kernels/dataflow/unit_tests/command_queue/random_program.cpp", cr_set, DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, .noc = NOC::RISCV_0_default, .compile_args = brisc_compile_args, .defines = data_movement_defines}); - SetRuntimeArgs(program, dummy_brisc_kernel, cr_set, brisc_unique_rtargs); - SetCommonRuntimeArgs(program, dummy_brisc_kernel, brisc_common_rtargs); - at_least_one_kernel = true; - } - - if (i == 0 or ((rand() % 2) == 0)) { - auto dummy_ncrisc_kernel = CreateKernel( - program, "tests/tt_metal/tt_metal/test_kernels/dataflow/unit_tests/command_queue/random_program.cpp", cr_set, DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_1, .noc = NOC::RISCV_1_default, .compile_args = ncrisc_compile_args, .defines = data_movement_defines}); - SetRuntimeArgs(program, dummy_ncrisc_kernel, cr_set, ncrisc_unique_rtargs); - SetCommonRuntimeArgs(program, dummy_ncrisc_kernel, ncrisc_common_rtargs); - at_least_one_kernel = true; - } - - if (i == 0 or ((rand() % 2) == 0)) { - auto dummy_trisc_kernel = CreateKernel( - program, "tests/tt_metal/tt_metal/test_kernels/dataflow/unit_tests/command_queue/random_program.cpp", cr_set, ComputeConfig{ - .math_approx_mode = false, - .compile_args = trisc_compile_args, - .defines = compute_defines - }); - SetRuntimeArgs(program, dummy_trisc_kernel, cr_set, trisc_unique_rtargs); - SetCommonRuntimeArgs(program, dummy_trisc_kernel, trisc_common_rtargs); - at_least_one_kernel = true; - } - - if (not at_least_one_kernel) { - uint32_t random_risc = rand() % 3 + 1; - if (random_risc == 1) { - auto dummy_brisc_kernel = CreateKernel( - program, "tests/tt_metal/tt_metal/test_kernels/dataflow/unit_tests/command_queue/random_program.cpp", cr_set, DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, .noc = NOC::RISCV_0_default, .compile_args = brisc_compile_args, .defines = data_movement_defines}); - SetRuntimeArgs(program, dummy_brisc_kernel, cr_set, brisc_unique_rtargs); - SetCommonRuntimeArgs(program, dummy_brisc_kernel, brisc_common_rtargs); - } else if (random_risc == 2) { - auto dummy_ncrisc_kernel = CreateKernel( - program, "tests/tt_metal/tt_metal/test_kernels/dataflow/unit_tests/command_queue/random_program.cpp", cr_set, DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_1, .noc = NOC::RISCV_1_default, .compile_args = ncrisc_compile_args, .defines = data_movement_defines}); - SetRuntimeArgs(program, dummy_ncrisc_kernel, cr_set, ncrisc_unique_rtargs); - SetCommonRuntimeArgs(program, dummy_ncrisc_kernel, ncrisc_common_rtargs); - } else if (random_risc == 3) { - auto dummy_trisc_kernel = CreateKernel( - program, "tests/tt_metal/tt_metal/test_kernels/dataflow/unit_tests/command_queue/random_program.cpp", cr_set, ComputeConfig{ - .math_approx_mode = false, - .compile_args = trisc_compile_args, - .defines = compute_defines - }); - SetRuntimeArgs(program, dummy_trisc_kernel, cr_set, trisc_unique_rtargs); - SetCommonRuntimeArgs(program, dummy_trisc_kernel, trisc_common_rtargs); - } else { - TT_THROW("Invalid"); - } - } - - tt::tt_metal::detail::CompileProgram(this->device_, program); - } - - for (uint8_t cq_id = 0; cq_id < this->device_->num_hw_cqs(); ++cq_id) { - log_info(tt::LogTest, "Running {} programs on cq {} for cache warmup.", programs.size(), (uint32_t)cq_id); - // This loop caches program and runs - for (Program& program: programs) { - EnqueueProgram(this->device_->command_queue(cq_id), program, false); - } - - // This loops assumes already cached - uint32_t NUM_ITERATIONS = 500; // TODO(agrebenisan): Bump this to 5000, saw hangs for very large number of iterations, need to come back to that - - log_info(tt::LogTest, "Running {} programs on cq {} for {} iterations now.", programs.size(), (uint32_t)cq_id, NUM_ITERATIONS); - for (uint32_t i = 0; i < NUM_ITERATIONS; i++) { - auto rng = std::default_random_engine {}; - std::shuffle(std::begin(programs), std::end(programs), rng); - if (i % 10 == 0) { - log_debug(tt::LogTest, "Enqueueing {} programs on cq {} for iter: {}/{} now.", programs.size(), (uint32_t)cq_id, i+1, NUM_ITERATIONS); - } - for (Program& program: programs) { - EnqueueProgram(this->device_->command_queue(cq_id), program, false); - } - } - - log_info(tt::LogTest, "Calling Finish."); - Finish(this->device_->command_queue(cq_id)); - } -} } // namespace stress_tests diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp deleted file mode 100644 index 103f690d786..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueTrace.cpp +++ /dev/null @@ -1,242 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "command_queue_fixture.hpp" -#include "trace_fixture.hpp" -#include "gtest/gtest.h" -#include "tt_metal/common/scoped_timer.hpp" -#include "tt_metal/host_api.hpp" -#include "tt_metal/impl/device/device.hpp" - -using std::vector; -using namespace tt::tt_metal; - -Program create_simple_unary_program(const Buffer& input, const Buffer& output) { - Program program = CreateProgram(); - - CoreCoord worker = {0, 0}; - auto reader_kernel = CreateKernel( - program, - "tt_metal/kernels/dataflow/reader_unary.cpp", - worker, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_1, .noc = NOC::RISCV_1_default}); - - auto writer_kernel = CreateKernel( - program, - "tt_metal/kernels/dataflow/writer_unary.cpp", - worker, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, .noc = NOC::RISCV_0_default}); - - auto sfpu_kernel = CreateKernel( - program, - "tt_metal/kernels/compute/eltwise_sfpu.cpp", - worker, - ComputeConfig{ - .math_approx_mode = true, - .compile_args = {1, 1}, - .defines = {{"SFPU_OP_EXP_INCLUDE", "1"}, {"SFPU_OP_CHAIN_0", "exp_tile_init(); exp_tile(0);"}}}); - - CircularBufferConfig input_cb_config = CircularBufferConfig(2048, {{0, tt::DataFormat::Float16_b}}) - .set_page_size(0, 2048); - - CoreRange core_range({0, 0}); - CreateCircularBuffer(program, core_range, input_cb_config); - vector writer_rt_args = { - output.address(), - (uint32_t)output.noc_coordinates().x, - (uint32_t)output.noc_coordinates().y, - output.num_pages() - }; - SetRuntimeArgs(program, writer_kernel, worker, writer_rt_args); - - CircularBufferConfig output_cb_config = CircularBufferConfig(2048, {{16, tt::DataFormat::Float16_b}}) - .set_page_size(16, 2048); - - CreateCircularBuffer(program, core_range, output_cb_config); - vector reader_rt_args = { - input.address(), - (uint32_t)input.noc_coordinates().x, - (uint32_t)input.noc_coordinates().y, - input.num_pages() - }; - SetRuntimeArgs(program, reader_kernel, worker, reader_rt_args); - - return program; -} - -// All basic trace tests just assert that the replayed result exactly matches -// the eager mode results -namespace basic_tests { - -TEST_F(SingleDeviceTraceFixture, TensixEnqueueOneProgramTrace) { - Setup(2048, 2); - auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); - auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); - - CommandQueue& command_queue = this->device_->command_queue(0); - CommandQueue& data_movement_queue = this->device_->command_queue(1); - - Program simple_program = create_simple_unary_program(*input, *output); - vector input_data(input->size() / sizeof(uint32_t), 0); - for (uint32_t i = 0; i < input_data.size(); i++) { - input_data[i] = i; - } - - // Eager mode - vector eager_output_data; - eager_output_data.resize(input_data.size()); - - EnqueueWriteBuffer(data_movement_queue, *input, input_data.data(), true); - EnqueueProgram(command_queue, simple_program, true); - EnqueueReadBuffer(data_movement_queue, output, eager_output_data.data(), true); - - // Trace mode - vector trace_output_data; - trace_output_data.resize(input_data.size()); - - EnqueueWriteBuffer(data_movement_queue, *input, input_data.data(), true); - - uint32_t tid = BeginTraceCapture(this->device_, command_queue.id()); - EnqueueProgram(command_queue, simple_program, false); - EndTraceCapture(this->device_, command_queue.id(), tid); - - EnqueueTrace(command_queue, tid, true); - EnqueueReadBuffer(data_movement_queue, *output, trace_output_data.data(), true); - EXPECT_TRUE(eager_output_data == trace_output_data); - - // Done - Finish(command_queue); - ReleaseTrace(this->device_, tid); -} - -TEST_F(SingleDeviceTraceFixture, TensixEnqueueOneProgramTraceLoops) { - Setup(4096, 2); - auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); - auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); - - CommandQueue& command_queue = this->device_->command_queue(0); - CommandQueue& data_movement_queue = this->device_->command_queue(1); - - Program simple_program = create_simple_unary_program(*input, *output); - vector input_data(input->size() / sizeof(uint32_t), 0); - for (uint32_t i = 0; i < input_data.size(); i++) { - input_data[i] = i; - } - - // Trace mode output - uint32_t num_loops = 10; - vector> trace_outputs; - - for (auto i = 0; i < num_loops; i++) { - trace_outputs.push_back({}); - trace_outputs[i].resize(input_data.size()); - } - - // Compile - EnqueueProgram(command_queue, simple_program, true); - - // Trace mode execution - uint32_t trace_id = 0; - bool trace_captured = false; - for (auto i = 0; i < num_loops; i++) { - EnqueueWriteBuffer(data_movement_queue, *input, input_data.data(), true); - - if (not trace_captured) { - trace_id = BeginTraceCapture(this->device_, command_queue.id()); - EnqueueProgram(command_queue, simple_program, false); - EndTraceCapture(this->device_, command_queue.id(), trace_id); - trace_captured = true; - } - - EnqueueTrace(command_queue, trace_id, false); - EnqueueReadBuffer(data_movement_queue, *output, trace_outputs[i].data(), true); - - // Expect same output across all loops - EXPECT_TRUE(trace_outputs[i] == trace_outputs[0]); - } - - // Done - Finish(command_queue); - ReleaseTrace(this->device_, trace_id); -} - -TEST_F(SingleDeviceTraceFixture, TensixEnqueueOneProgramTraceBenchmark) { - Setup(6144, 2); - auto input = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); - auto output = Buffer::create(this->device_, 2048, 2048, BufferType::DRAM); - - constexpr bool kBlocking = true; - constexpr bool kNonBlocking = false; - vector blocking_flags = {kBlocking, kNonBlocking}; - - // Single Q for data and commands - // Keep this queue in passthrough mode for now - CommandQueue& command_queue = this->device_->command_queue(0); - - auto simple_program = create_simple_unary_program(*input, *output); - vector input_data(input->size() / sizeof(uint32_t), 0); - for (uint32_t i = 0; i < input_data.size(); i++) { - input_data[i] = i; - } - - // Trace mode output - uint32_t num_loops = 10; - vector> trace_outputs; - - for (auto i = 0; i < num_loops; i++) { - trace_outputs.push_back({}); - trace_outputs[i].resize(input_data.size()); - } - - // Eager mode - vector expected_output_data; - vector eager_output_data; - expected_output_data.resize(input_data.size()); - eager_output_data.resize(input_data.size()); - - // Warm up and use the eager blocking run as the expected output - EnqueueWriteBuffer(command_queue, *input, input_data.data(), kBlocking); - EnqueueProgram(command_queue, simple_program, kBlocking); - EnqueueReadBuffer(command_queue, *output, expected_output_data.data(), kBlocking); - Finish(command_queue); - - for (bool blocking : blocking_flags) { - std::string mode = blocking ? "Eager-B" : "Eager-NB"; - for (auto i = 0; i < num_loops; i++) { - tt::ScopedTimer timer(mode + " loop " + std::to_string(i)); - EnqueueWriteBuffer(command_queue, *input, input_data.data(), blocking); - EnqueueProgram(command_queue, simple_program, blocking); - EnqueueReadBuffer(command_queue, *output, eager_output_data.data(), blocking); - } - if (not blocking) { - // (Optional) wait for the last non-blocking command to finish - Finish(command_queue); - } - EXPECT_TRUE(eager_output_data == expected_output_data); - } - - // Capture trace on a trace queue - uint32_t tid = BeginTraceCapture(this->device_, command_queue.id()); - EnqueueProgram(command_queue, simple_program, false); - EndTraceCapture(this->device_, command_queue.id(), tid); - - // Trace mode execution - for (auto i = 0; i < num_loops; i++) { - tt::ScopedTimer timer("Trace loop " + std::to_string(i)); - EnqueueWriteBuffer(command_queue, *input, input_data.data(), kNonBlocking); - EnqueueTrace(command_queue, tid, kNonBlocking); - EnqueueReadBuffer(command_queue, *output, trace_outputs[i].data(), kNonBlocking); - } - Finish(command_queue); - - // Expect same output across all loops - for (auto i = 0; i < num_loops; i++) { - EXPECT_TRUE(trace_outputs[i] == trace_outputs[0]); - } - ReleaseTrace(this->device_, tid); -} - -} // end namespace basic_tests diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp deleted file mode 100644 index 37a7d218b2d..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp +++ /dev/null @@ -1,355 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include - -#include "command_queue_fixture.hpp" -#include "command_queue_test_utils.hpp" -#include "gtest/gtest.h" -#include "tt_metal/host_api.hpp" -#include "tt_metal/test_utils/env_vars.hpp" -#include "tt_metal/impl/device/device.hpp" - -using std::vector; -using namespace tt::tt_metal; - - -namespace local_test_functions { - -bool test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(Device* device, vector>& cqs, const TestBufferConfig& config) { - bool pass = true; - for (const bool use_void_star_api: {true, false}) { - - size_t buf_size = config.num_pages * config.page_size; - std::vector> buffers; - std::vector> srcs; - for (uint i = 0; i < cqs.size(); i++) { - buffers.push_back(Buffer::create(device, buf_size, config.page_size, config.buftype)); - srcs.push_back(generate_arange_vector(buffers[i]->size())); - if (use_void_star_api) { - EnqueueWriteBuffer(cqs[i], *buffers[i], srcs[i].data(), false); - } else { - EnqueueWriteBuffer(cqs[i], *buffers[i], srcs[i], false); - } - } - - for (uint i = 0; i < cqs.size(); i++) { - std::vector result; - if (use_void_star_api) { - result.resize(buf_size / sizeof(uint32_t)); - EnqueueReadBuffer(cqs[i], *buffers[i], result.data(), true); - } else { - EnqueueReadBuffer(cqs[i], *buffers[i], result, true); - } - bool local_pass = (srcs[i] == result); - pass &= local_pass; - } - } - - return pass; -} -} - - -namespace basic_tests { -namespace dram_tests { - -TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToDramBank0) { - TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::DRAM}; - for (Device *device : devices_) { - tt::log_info("Running On Device {}", device->id()); - CommandQueue& a = device->command_queue(0); - CommandQueue& b = device->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); - } - -} - -TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToAllDramBanks) { - for (Device *device : devices_) { - tt::log_info("Running On Device {}", device->id()); - TestBufferConfig config = { - .num_pages = uint32_t(device->num_banks(BufferType::DRAM)), - .page_size = 2048, - .buftype = BufferType::DRAM}; - - CommandQueue& a = device->command_queue(0); - CommandQueue& b = device->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); - } -} - -TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileAcrossAllDramBanksTwiceRoundRobin) { - constexpr uint32_t num_round_robins = 2; - for (Device *device : devices_) { - tt::log_info("Running On Device {}", device->id()); - TestBufferConfig config = { - .num_pages = num_round_robins * (device->num_banks(BufferType::DRAM)), - .page_size = 2048, - .buftype = BufferType::DRAM}; - - CommandQueue& a = device->command_queue(0); - CommandQueue& b = device->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); - } -} - -TEST_F(MultiCommandQueueMultiDeviceBufferFixture, Sending131072Pages) { - // Was a failing case where we used to accidentally program cb num pages to be total - // pages instead of cb num pages. - TestBufferConfig config = { - .num_pages = 131072, - .page_size = 128, - .buftype = BufferType::DRAM}; - for (Device *device : devices_) { - tt::log_info("Running On Device {}", device->id()); - CommandQueue& a = device->command_queue(0); - CommandQueue& b = device->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); - } -} - -TEST_F(MultiCommandQueueMultiDeviceBufferFixture, TestNon32BAlignedPageSizeForDram) { - for (Device *device : devices_) { - tt::log_info("Running On Device {}", device->id()); - TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::DRAM}; - - CommandQueue& a = device->command_queue(0); - CommandQueue& b = device->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); - } -} - -TEST_F(MultiCommandQueueMultiDeviceBufferFixture, TestNon32BAlignedPageSizeForDram2) { - for (Device *device : devices_) { - tt::log_info("Running On Device {}", device->id()); - // From stable diffusion read buffer - TestBufferConfig config = {.num_pages = 8 * 1024, .page_size = 80, .buftype = BufferType::DRAM}; - - CommandQueue& a = device->command_queue(0); - CommandQueue& b = device->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); - } -} - -TEST_F(MultiCommandQueueMultiDeviceBufferFixture, TestIssueMultipleReadWriteCommandsForOneBuffer) { - for (Device *device : devices_) { - tt::log_info("Running On Device {}", device->id()); - uint32_t page_size = 2048; - uint32_t command_queue_size = device->sysmem_manager().get_cq_size(); - uint32_t num_pages = command_queue_size / page_size; - - TestBufferConfig config = {.num_pages = num_pages, .page_size = page_size, .buftype = BufferType::DRAM}; - - CommandQueue& a = device->command_queue(0); - CommandQueue& b = device->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); - } -} - -TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToDramBank0) { - TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::DRAM}; - CommandQueue& a = this->device_->command_queue(0); - CommandQueue& b = this->device_->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); -} - -TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToAllDramBanks) { - TestBufferConfig config = { - .num_pages = uint32_t(this->device_->num_banks(BufferType::DRAM)), - .page_size = 2048, - .buftype = BufferType::DRAM}; - - CommandQueue& a = this->device_->command_queue(0); - CommandQueue& b = this->device_->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); -} - -TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileAcrossAllDramBanksTwiceRoundRobin) { - constexpr uint32_t num_round_robins = 2; - TestBufferConfig config = { - .num_pages = num_round_robins * (this->device_->num_banks(BufferType::DRAM)), - .page_size = 2048, - .buftype = BufferType::DRAM}; - - CommandQueue& a = this->device_->command_queue(0); - CommandQueue& b = this->device_->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); -} - -TEST_F(MultiCommandQueueSingleDeviceBufferFixture, Sending131072Pages) { - // Was a failing case where we used to accidentally program cb num pages to be total - // pages instead of cb num pages. - TestBufferConfig config = { - .num_pages = 131072, - .page_size = 128, - .buftype = BufferType::DRAM}; - - CommandQueue& a = this->device_->command_queue(0); - CommandQueue& b = this->device_->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); -} - -TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestNon32BAlignedPageSizeForDram) { - TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::DRAM}; - - CommandQueue& a = this->device_->command_queue(0); - CommandQueue& b = this->device_->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); -} - -TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestNon32BAlignedPageSizeForDram2) { - // From stable diffusion read buffer - TestBufferConfig config = {.num_pages = 8 * 1024, .page_size = 80, .buftype = BufferType::DRAM}; - - CommandQueue& a = this->device_->command_queue(0); - CommandQueue& b = this->device_->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); -} - -TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestPageSizeTooLarge) { - if (this->arch_ == tt::ARCH::WORMHOLE_B0) { - GTEST_SKIP(); // This test hanging on wormhole b0 - } - // Should throw a host error due to the page size not fitting in the consumer CB - TestBufferConfig config = {.num_pages = 1024, .page_size = 250880 * 2, .buftype = BufferType::DRAM}; - - CommandQueue& a = this->device_->command_queue(0); - CommandQueue& b = this->device_->command_queue(1); - vector> cqs = {a, b}; - EXPECT_ANY_THROW(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); -} - -TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestIssueMultipleReadWriteCommandsForOneBuffer) { - uint32_t page_size = 2048; - uint16_t channel = tt::Cluster::instance().get_assigned_channel_for_device(this->device_->id()); - uint32_t command_queue_size = tt::Cluster::instance().get_host_channel_size(this->device_->id(), channel); - uint32_t num_pages = command_queue_size / page_size; - - TestBufferConfig config = {.num_pages = num_pages, .page_size = page_size, .buftype = BufferType::DRAM}; - - CommandQueue& a = this->device_->command_queue(0); - CommandQueue& b = this->device_->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); -} - - -} // end namespace dram_tests - -namespace l1_tests { - -TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToL1Bank0) { - TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::L1}; - CommandQueue& a = this->device_->command_queue(0); - CommandQueue& b = this->device_->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); -} - -TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToAllL1Banks) { - auto compute_with_storage_grid = this->device_->compute_with_storage_grid_size(); - TestBufferConfig config = { - .num_pages = uint32_t(compute_with_storage_grid.x * compute_with_storage_grid.y), - .page_size = 2048, - .buftype = BufferType::L1}; - - CommandQueue& a = this->device_->command_queue(0); - CommandQueue& b = this->device_->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); -} - -TEST_F(MultiCommandQueueSingleDeviceBufferFixture, WriteOneTileToAllL1BanksTwiceRoundRobin) { - auto compute_with_storage_grid = this->device_->compute_with_storage_grid_size(); - TestBufferConfig config = { - .num_pages = 2 * uint32_t(compute_with_storage_grid.x * compute_with_storage_grid.y), - .page_size = 2048, - .buftype = BufferType::L1}; - - CommandQueue& a = this->device_->command_queue(0); - CommandQueue& b = this->device_->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); -} - -TEST_F(MultiCommandQueueSingleDeviceBufferFixture, TestNon32BAlignedPageSizeForL1) { - TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::L1}; - - CommandQueue& a = this->device_->command_queue(0); - CommandQueue& b = this->device_->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(this->device_, cqs, config)); -} - -TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToL1Bank0) { - for (Device *device : devices_) { - tt::log_info("Running On Device {}", device->id()); - TestBufferConfig config = {.num_pages = 1, .page_size = 2048, .buftype = BufferType::L1}; - CommandQueue& a = device->command_queue(0); - CommandQueue& b = device->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); - } -} - -TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToAllL1Banks) { - for (Device *device : devices_) { - tt::log_info("Running On Device {}", device->id()); - auto compute_with_storage_grid = device->compute_with_storage_grid_size(); - TestBufferConfig config = { - .num_pages = uint32_t(compute_with_storage_grid.x * compute_with_storage_grid.y), - .page_size = 2048, - .buftype = BufferType::L1}; - - CommandQueue& a = device->command_queue(0); - CommandQueue& b = device->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); - } -} - -TEST_F(MultiCommandQueueMultiDeviceBufferFixture, WriteOneTileToAllL1BanksTwiceRoundRobin) { - for (Device *device : devices_) { - tt::log_info("Running On Device {}", device->id()); - auto compute_with_storage_grid = device->compute_with_storage_grid_size(); - TestBufferConfig config = { - .num_pages = 2 * uint32_t(compute_with_storage_grid.x * compute_with_storage_grid.y), - .page_size = 2048, - .buftype = BufferType::L1}; - - CommandQueue& a = device->command_queue(0); - CommandQueue& b = device->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); - } -} - -TEST_F(MultiCommandQueueMultiDeviceBufferFixture, TestNon32BAlignedPageSizeForL1) { - for (Device *device : devices_) { - tt::log_info("Running On Device {}", device->id()); - TestBufferConfig config = {.num_pages = 1250, .page_size = 200, .buftype = BufferType::L1}; - - CommandQueue& a = device->command_queue(0); - CommandQueue& b = device->command_queue(1); - vector> cqs = {a, b}; - EXPECT_TRUE(local_test_functions::test_EnqueueWriteBuffer_and_EnqueueReadBuffer_multi_queue(device, cqs, config)); - } -} - -} // end namespace l1_tests -} // end namespace basic_tests diff --git a/tests/tt_metal/tt_metal/unit_tests_frequent/tests/run_many_times.cpp b/tests/tt_metal/tt_metal/unit_tests_frequent/tests/run_many_times.cpp index 61b161f7530..7832c916472 100644 --- a/tests/tt_metal/tt_metal/unit_tests_frequent/tests/run_many_times.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_frequent/tests/run_many_times.cpp @@ -16,7 +16,6 @@ void RunTest(Device *device) { Program program = Program(); std::set core_ranges; - //CoreCoord grid_size = device->logical_grid_size(); CoreCoord grid_size = {5, 5}; for (uint32_t y = 0; y < grid_size.y; y++) { for (uint32_t x = 0; x < grid_size.x; x++) { From 509318ebf8e46f35d8fb5473226eb64a0f318699 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Wed, 6 Nov 2024 20:25:06 +0000 Subject: [PATCH 13/26] #0: Deleted files --- .../core_coord/test_CoreRangeSet_contains.cpp | 53 ------------------- .../test_CoreRangeSet_intersects.cpp | 52 ------------------ 2 files changed, 105 deletions(-) delete mode 100644 tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_contains.cpp delete mode 100644 tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_intersects.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_contains.cpp b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_contains.cpp deleted file mode 100644 index a76802a2e35..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_contains.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include - -#include "core_coord_fixture.hpp" -#include "gtest/gtest.h" -#include "tt_metal/common/core_coord.hpp" - -namespace basic_tests::CoreRangeSet { - -TEST_F(CoreCoordHarness, TestCoreRangeSetContains) { - // Contains CoreCoord - EXPECT_TRUE(::CoreRangeSet(this->cr1).contains(this->cr5.start_coord)); - EXPECT_TRUE(::CoreRangeSet(this->cr5).contains(this->cr1.end_coord)); - EXPECT_TRUE(::CoreRangeSet(std::vector{this->sc1, this->sc4}).contains(this->cr3.start_coord)); - EXPECT_TRUE(::CoreRangeSet(std::vector{this->cr17, this->cr16}).contains(this->sc2.start_coord)); - EXPECT_TRUE(::CoreRangeSet(this->cr11).contains(this->cr12.end_coord)); - // Contains CoreRange - EXPECT_TRUE(::CoreRangeSet(this->cr1).contains(this->sc1)); - EXPECT_TRUE(::CoreRangeSet(this->cr8).contains(this->cr1)); - EXPECT_TRUE(::CoreRangeSet(this->cr13).contains(this->cr16)); - EXPECT_TRUE(::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc5, this->sc6}).contains(this->cr1)); - EXPECT_TRUE(::CoreRangeSet(std::vector{this->cr17, this->cr16}).contains(this->cr1)); - // Contains CoreRangeSet - EXPECT_TRUE( - ::CoreRangeSet(this->cr1).contains(::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc5, this->sc6}))); - EXPECT_TRUE(::CoreRangeSet(this->cr5).contains(::CoreRangeSet())); - EXPECT_TRUE(::CoreRangeSet().contains(::CoreRangeSet())); - EXPECT_TRUE(::CoreRangeSet(std::vector{this->sc6, cr5, sc2}) - .contains(::CoreRangeSet(std::vector{this->cr1, this->cr2, this->cr3}))); - EXPECT_TRUE(::CoreRangeSet(this->cr12).contains(::CoreRangeSet(std::vector{this->sc6, this->cr11}))); -} - -TEST_F(CoreCoordHarness, TestCoreRangeSetNotContains) { - // Not Contains CoreCoord - EXPECT_FALSE(::CoreRangeSet(this->cr1).contains(this->cr2.start_coord)); - EXPECT_FALSE( - ::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc3, this->sc4}).contains(this->cr17.start_coord)); - EXPECT_FALSE(::CoreRangeSet(std::vector{this->cr1, this->sc4}).contains(this->cr7.start_coord)); - // No Contains CoreRange - EXPECT_FALSE(::CoreRangeSet(this->cr1).contains(this->sc3)); - EXPECT_FALSE(::CoreRangeSet(std::vector{this->sc1, this->sc5, this->sc6}).contains(this->cr1)); - EXPECT_FALSE(::CoreRangeSet(std::vector{this->cr7, this->cr1}).contains(this->cr16)); - // Not Contains CoreRangeSet - EXPECT_FALSE(::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc5}).contains(::CoreRangeSet(this->cr1))); - EXPECT_FALSE(::CoreRangeSet().contains(::CoreRangeSet(this->cr5))); - EXPECT_FALSE(::CoreRangeSet(std::vector{this->sc6, cr5}) - .contains(::CoreRangeSet(std::vector{this->cr1, this->cr2, this->cr3}))); -} - -} // namespace basic_tests::CoreRangeSet diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_intersects.cpp b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_intersects.cpp deleted file mode 100644 index 3815de620e2..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_intersects.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include - -#include "core_coord_fixture.hpp" -#include "gtest/gtest.h" -#include "tt_metal/common/core_coord.hpp" - -namespace basic_tests::CoreRangeSet { - -TEST_F(CoreCoordHarness, TestCoreRangeSetIntersects) { - // Intersects CoreCoord - EXPECT_TRUE(::CoreRangeSet(this->cr1).intersects(this->cr5.start_coord)); - EXPECT_TRUE(::CoreRangeSet(this->cr5).intersects(this->cr1.end_coord)); - EXPECT_TRUE(::CoreRangeSet(std::vector{this->sc1, this->sc4}).intersects(this->cr3.start_coord)); - EXPECT_TRUE(::CoreRangeSet(std::vector{this->cr17, this->cr16}).intersects(this->sc4.start_coord)); - EXPECT_TRUE(::CoreRangeSet(this->cr11).intersects(this->cr12.end_coord)); - // Intersects CoreRange - EXPECT_TRUE(::CoreRangeSet(this->cr1).intersects(this->cr5)); - EXPECT_TRUE(::CoreRangeSet(this->cr5).intersects(this->cr1)); - EXPECT_TRUE(::CoreRangeSet(std::vector{this->sc1, this->sc4}).intersects(this->cr3)); - EXPECT_TRUE(::CoreRangeSet(std::vector{this->cr17, this->cr16}).intersects(this->sc4)); - EXPECT_TRUE(::CoreRangeSet(this->cr11).intersects(this->cr12)); - // Intersects CoreRangeSet - EXPECT_TRUE(::CoreRangeSet(this->cr1).intersects(::CoreRangeSet(this->cr5))); - EXPECT_TRUE(::CoreRangeSet(this->cr5).intersects(::CoreRangeSet(this->cr1))); - EXPECT_TRUE(::CoreRangeSet(std::vector{this->sc1, this->sc4}).intersects(::CoreRangeSet(this->cr3))); - EXPECT_TRUE(::CoreRangeSet(std::vector{this->cr17, this->cr16}) - .intersects(::CoreRangeSet(std::vector{this->sc2, this->sc4}))); - EXPECT_TRUE(::CoreRangeSet(this->sc2).intersects(::CoreRangeSet(std::vector{this->cr7, this->cr1}))); -} - -TEST_F(CoreCoordHarness, TestCoreRangeSetNotIntersects) { - // Not Intersects CoreCoord - EXPECT_FALSE(::CoreRangeSet(this->cr1).intersects(this->cr2.start_coord)); - EXPECT_FALSE( - ::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc3, this->sc4}).intersects(this->cr17.start_coord)); - EXPECT_FALSE(::CoreRangeSet(std::vector{this->cr1, this->sc4}).intersects(this->cr7.start_coord)); - // Not Intersects CoreRange - EXPECT_FALSE(::CoreRangeSet(this->cr1).intersects(this->cr2)); - EXPECT_FALSE(::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc3, this->sc4}).intersects(this->cr17)); - EXPECT_FALSE(::CoreRangeSet(std::vector{this->cr1, this->sc4}).intersects(this->cr7)); - // Not Intersects CoreRangeSet - EXPECT_FALSE(::CoreRangeSet(this->cr1).intersects(::CoreRangeSet(std::vector{this->cr2, this->cr3}))); - EXPECT_FALSE(::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc3, this->sc4}) - .intersects(::CoreRangeSet(std::vector{this->cr17, this->cr18}))); - EXPECT_FALSE(::CoreRangeSet(std::vector{this->cr1, this->sc4}).intersects(::CoreRangeSet(this->cr7))); -} - -} // namespace basic_tests::CoreRangeSet From cad287c53bd0194c40d2fbcda668dc43db5a4cfc Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Wed, 6 Nov 2024 20:31:27 +0000 Subject: [PATCH 14/26] #0: More test restructuring --- .../basic => api}/test_kernel_creation.cpp | 0 .../streams/test_autonomous_relay_streams.cpp | 5 ----- 2 files changed, 5 deletions(-) rename tests/tt_metal/tt_metal/{unit_tests_common/basic => api}/test_kernel_creation.cpp (100%) diff --git a/tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp b/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/basic/test_kernel_creation.cpp rename to tests/tt_metal/tt_metal/api/test_kernel_creation.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp index 532a439bc4a..8ab6acf9442 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/streams/test_autonomous_relay_streams.cpp @@ -266,11 +266,6 @@ void build_and_run_autonomous_stream_test( uint32_t buffer_size_bytes = num_messages * page_size; auto inputs = test_utils::generate_uniform_random_vector(0, 100, buffer_size_bytes / sizeof(uint32_t)); std::iota(inputs.begin(), inputs.end(), 1); - // for (auto i = 0; i < inputs.size(); i += page_size) { - // for (auto ii = 0; ii < std::min(page_size, inputs.size() - i); ii++) { - // inputs.at(i + ii) = i + 1; - // } - // } auto zeroes_buffer = std::vector(buffer_size_bytes / sizeof(uint32_t), 0); std::vector outputs(buffer_size_bytes / sizeof(uint32_t), 0); From a0894c4b3c3d47c691b2e793648369bb2ba4a0e6 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Thu, 7 Nov 2024 15:09:23 +0000 Subject: [PATCH 15/26] #0: More test restructuring --- tests/tt_metal/tt_metal/CMakeLists.txt | 39 ++++++++++++----- tests/tt_metal/tt_metal/api/CMakeLists.txt | 43 +++++++++++++++++++ .../test_global_semaphores.cpp | 0 .../tt_metal/debug_tools/CMakeLists.txt | 41 ++++++++++++++++++ tests/tt_metal/tt_metal/device/CMakeLists.txt | 28 ++++++++++++ ...er_api.cpp => test_device_cluster_api.cpp} | 0 ...er_api.cpp => test_galaxy_cluster_api.cpp} | 0 .../tt_metal/dispatch_buffer/CMakeLists.txt | 23 ++++++++++ .../tt_metal/dispatch_event/CMakeLists.txt | 23 ++++++++++ .../tt_metal/dispatch_program/CMakeLists.txt | 26 +++++++++++ .../tt_metal/dispatch_trace/CMakeLists.txt | 23 ++++++++++ tests/tt_metal/tt_metal/llk/CMakeLists.txt | 36 ++++++++++++++++ .../compute => llk}/test_broadcast.cpp | 0 .../test_copy_block_matmul_partials.cpp | 0 .../compute => llk}/test_cumsum.cpp | 0 .../test_dropout_sfpu_compute.cpp | 0 .../compute => llk}/test_golden_impls.cpp | 0 .../compute => llk}/test_golden_impls.hpp | 0 .../compute => llk}/test_reconfig.cpp | 0 .../compute => llk}/test_reduce.cpp | 0 .../compute => llk}/test_sfpu_compute.cpp | 0 .../test_single_core_binary_compute.cpp | 0 .../test_single_core_matmul_compute.cpp | 0 .../compute => llk}/test_transpose.cpp | 0 .../compute => llk}/test_untilize_tilize.cpp | 0 25 files changed, 271 insertions(+), 11 deletions(-) create mode 100644 tests/tt_metal/tt_metal/api/CMakeLists.txt rename tests/tt_metal/tt_metal/{unit_tests/global_semaphore => api}/test_global_semaphores.cpp (100%) create mode 100644 tests/tt_metal/tt_metal/debug_tools/CMakeLists.txt create mode 100644 tests/tt_metal/tt_metal/device/CMakeLists.txt rename tests/tt_metal/tt_metal/device/{device_cluster_api.cpp => test_device_cluster_api.cpp} (100%) rename tests/tt_metal/tt_metal/device/{galaxy_cluster_api.cpp => test_galaxy_cluster_api.cpp} (100%) create mode 100644 tests/tt_metal/tt_metal/dispatch_buffer/CMakeLists.txt create mode 100644 tests/tt_metal/tt_metal/dispatch_event/CMakeLists.txt create mode 100644 tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt create mode 100644 tests/tt_metal/tt_metal/dispatch_trace/CMakeLists.txt create mode 100644 tests/tt_metal/tt_metal/llk/CMakeLists.txt rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_broadcast.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_copy_block_matmul_partials.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_cumsum.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_dropout_sfpu_compute.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_golden_impls.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_golden_impls.hpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_reconfig.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_reduce.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_sfpu_compute.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_single_core_binary_compute.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_single_core_matmul_compute.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_transpose.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests/compute => llk}/test_untilize_tilize.cpp (100%) diff --git a/tests/tt_metal/tt_metal/CMakeLists.txt b/tests/tt_metal/tt_metal/CMakeLists.txt index 2fda533488a..565294b163c 100644 --- a/tests/tt_metal/tt_metal/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/CMakeLists.txt @@ -63,21 +63,38 @@ foreach(TEST_SRC ${TT_METAL_TESTS_SRCS}) list(APPEND METAL_TEST_TARGETS ${TEST}) endforeach() -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests_common) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests_fast_dispatch) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests_fast_dispatch_single_chip_multi_queue) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests_frequent) +#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests_common) +#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests) +#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests_fast_dispatch) +#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests_fast_dispatch_single_chip_multi_queue) +#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests_frequent) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/api) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/debug_tools) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/device) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_buffer) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_event) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_program) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_trace) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/perf_microbenchmark) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stl) add_custom_target( metal_tests DEPENDS ${METAL_TEST_TARGETS} - unit_tests - unit_tests_fast_dispatch - unit_tests_fast_dispatch_single_chip_multi_queue - unit_tests_frequent - metal_perf_microbenchmark_tests - unit_tests_galaxy + #unit_tests + #unit_tests_fast_dispatch + #unit_tests_fast_dispatch_single_chip_multi_queue + #unit_tests_frequent + #metal_perf_microbenchmark_tests + #unit_tests_galaxy + unit_tests_api + unit_tests_debug_tools + unit_tests_device + unit_tests_dispatch_buffer + unit_tests_dispatch_event + unit_tests_dispatch_program + unit_tests_dispatch_trace + unit_tests_stl ) diff --git a/tests/tt_metal/tt_metal/api/CMakeLists.txt b/tests/tt_metal/tt_metal/api/CMakeLists.txt new file mode 100644 index 00000000000..ffe48a66887 --- /dev/null +++ b/tests/tt_metal/tt_metal/api/CMakeLists.txt @@ -0,0 +1,43 @@ +set(UNIT_TESTS_API_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/allocator/test_free_list_allocator.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/allocator/test_l1_banking_allocator.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRange_adjacent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRange_contains.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRange_intersects.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRange_iterator.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRange_merge.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRangeSet_construct.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRangeSet_merge.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_bit_utils.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_CommandQueue.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_global_semaphores.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_kernel_creation.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_noc.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_runtime_args.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_semaphores.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_soc_descriptor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_tilize_untilize.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_worker_config_buffer.cpp +) + +add_executable(unit_tests_api ${UNIT_TESTS_API_SRC}) +TT_ENABLE_UNITY_BUILD(unit_tests_api) + +target_link_libraries(unit_tests_api PUBLIC test_metal_common_libs) +target_include_directories( + unit_tests_api + PRIVATE + ${UMD_HOME} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/common +) +set_target_properties( + unit_tests_api + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/test/tt_metal +) diff --git a/tests/tt_metal/tt_metal/unit_tests/global_semaphore/test_global_semaphores.cpp b/tests/tt_metal/tt_metal/api/test_global_semaphores.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/global_semaphore/test_global_semaphores.cpp rename to tests/tt_metal/tt_metal/api/test_global_semaphores.cpp diff --git a/tests/tt_metal/tt_metal/debug_tools/CMakeLists.txt b/tests/tt_metal/tt_metal/debug_tools/CMakeLists.txt new file mode 100644 index 00000000000..4bf92a2f68d --- /dev/null +++ b/tests/tt_metal/tt_metal/debug_tools/CMakeLists.txt @@ -0,0 +1,41 @@ +set(UNIT_TESTS_DEBUG_TOOLS_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_eth_cores.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_invalid_print_core.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_mute_device.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_mute_print_server.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_print_all_harts.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_print_before_finish.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_print_hanging.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_print_tensix_dest.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_print_tiles.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_raise_wait.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_assert.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_link_training.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_noc_sanitize_delays.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_noc_sanitize.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_pause.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_ringbuf.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_waypoint.cpp +) + +add_executable(unit_tests_debug_tools ${UNIT_TESTS_DEBUG_TOOLS_SRC}) +TT_ENABLE_UNITY_BUILD(unit_tests_debug_tools) + +target_link_libraries(unit_tests_debug_tools PUBLIC test_metal_common_libs) +target_include_directories( + unit_tests_debug_tools + PRIVATE + ${UMD_HOME} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/common +) +set_target_properties( + unit_tests_debug_tools + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/test/tt_metal +) diff --git a/tests/tt_metal/tt_metal/device/CMakeLists.txt b/tests/tt_metal/tt_metal/device/CMakeLists.txt new file mode 100644 index 00000000000..7cd8a512e35 --- /dev/null +++ b/tests/tt_metal/tt_metal/device/CMakeLists.txt @@ -0,0 +1,28 @@ +set(UNIT_TESTS_DEVICE_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/test_device_cluster_api.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_device_pool.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_device.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_galaxy_cluster_api.cpp +) + +add_executable(unit_tests_device ${UNIT_TESTS_DEVICE_SRC}) +TT_ENABLE_UNITY_BUILD(unit_tests_device) + +target_link_libraries(unit_tests_device PUBLIC test_metal_common_libs) +target_include_directories( + unit_tests_device + PRIVATE + ${UMD_HOME} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/common +) +set_target_properties( + unit_tests_device + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/test/tt_metal +) diff --git a/tests/tt_metal/tt_metal/device/device_cluster_api.cpp b/tests/tt_metal/tt_metal/device/test_device_cluster_api.cpp similarity index 100% rename from tests/tt_metal/tt_metal/device/device_cluster_api.cpp rename to tests/tt_metal/tt_metal/device/test_device_cluster_api.cpp diff --git a/tests/tt_metal/tt_metal/device/galaxy_cluster_api.cpp b/tests/tt_metal/tt_metal/device/test_galaxy_cluster_api.cpp similarity index 100% rename from tests/tt_metal/tt_metal/device/galaxy_cluster_api.cpp rename to tests/tt_metal/tt_metal/device/test_galaxy_cluster_api.cpp diff --git a/tests/tt_metal/tt_metal/dispatch_buffer/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch_buffer/CMakeLists.txt new file mode 100644 index 00000000000..46436a5c86d --- /dev/null +++ b/tests/tt_metal/tt_metal/dispatch_buffer/CMakeLists.txt @@ -0,0 +1,23 @@ +set(UNIT_TESTS_DISPATCH_BUFFER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp) + +add_executable(unit_tests_dispatch_buffer ${UNIT_TESTS_DISPATCH_BUFFER_SRC}) +TT_ENABLE_UNITY_BUILD(unit_tests_dispatch_buffer) + +target_link_libraries(unit_tests_dispatch_buffer PUBLIC test_metal_common_libs) +target_include_directories( + unit_tests_dispatch_buffer + PRIVATE + ${UMD_HOME} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/common +) +set_target_properties( + unit_tests_dispatch_buffer + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/test/tt_metal +) diff --git a/tests/tt_metal/tt_metal/dispatch_event/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch_event/CMakeLists.txt new file mode 100644 index 00000000000..6c0f162c6bd --- /dev/null +++ b/tests/tt_metal/tt_metal/dispatch_event/CMakeLists.txt @@ -0,0 +1,23 @@ +set(UNIT_TESTS_DISPATCH_EVENT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueWaitForEvent.cpp) + +add_executable(unit_tests_dispatch_event ${UNIT_TESTS_DISPATCH_EVENT_SRC}) +TT_ENABLE_UNITY_BUILD(unit_tests_dispatch_event) + +target_link_libraries(unit_tests_dispatch_event PUBLIC test_metal_common_libs) +target_include_directories( + unit_tests_dispatch_event + PRIVATE + ${UMD_HOME} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/common +) +set_target_properties( + unit_tests_dispatch_event + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/test/tt_metal +) diff --git a/tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt new file mode 100644 index 00000000000..1efcfe6f72e --- /dev/null +++ b/tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt @@ -0,0 +1,26 @@ +set(UNIT_TESTS_DISPATCH_PROGRAM_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/test_dispatch.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueProgram.cpp +) + +add_executable(unit_tests_dispatch_program ${UNIT_TESTS_DISPATCH_PROGRAM_SRC}) +TT_ENABLE_UNITY_BUILD(unit_tests_dispatch_program) + +target_link_libraries(unit_tests_dispatch_program PUBLIC test_metal_common_libs) +target_include_directories( + unit_tests_dispatch_program + PRIVATE + ${UMD_HOME} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/common +) +set_target_properties( + unit_tests_dispatch_program + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/test/tt_metal +) diff --git a/tests/tt_metal/tt_metal/dispatch_trace/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch_trace/CMakeLists.txt new file mode 100644 index 00000000000..d33ff80f029 --- /dev/null +++ b/tests/tt_metal/tt_metal/dispatch_trace/CMakeLists.txt @@ -0,0 +1,23 @@ +set(UNIT_TESTS_DISPATCH_TRACE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueTrace.cpp) + +add_executable(unit_tests_dispatch_trace ${UNIT_TESTS_DISPATCH_TRACE_SRC}) +TT_ENABLE_UNITY_BUILD(unit_tests_dispatch_trace) + +target_link_libraries(unit_tests_dispatch_trace PUBLIC test_metal_common_libs) +target_include_directories( + unit_tests_dispatch_trace + PRIVATE + ${UMD_HOME} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/common +) +set_target_properties( + unit_tests_dispatch_trace + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/test/tt_metal +) diff --git a/tests/tt_metal/tt_metal/llk/CMakeLists.txt b/tests/tt_metal/tt_metal/llk/CMakeLists.txt new file mode 100644 index 00000000000..a7800aaf352 --- /dev/null +++ b/tests/tt_metal/tt_metal/llk/CMakeLists.txt @@ -0,0 +1,36 @@ +set(UNIT_TESTS_LLK_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/test_broadcast.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_copy_block_matmul_partials.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_cumsum.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_dropout_sfpu_compute.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_golden_impl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_reconfig.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_reduce.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_sfpu_compute.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_single_core_binary_compute.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_single_core_matmul_compute.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_transpose.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_untilize_tilize.cpp +) + +add_executable(unit_tests_llk ${UNIT_TESTS_LLK_SRC}) +TT_ENABLE_UNITY_BUILD(unit_tests_llk) + +target_link_libraries(unit_tests_llk PUBLIC test_metal_common_libs) +target_include_directories( + unit_tests_llk + PRIVATE + ${UMD_HOME} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/common +) +set_target_properties( + unit_tests_llk + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/test/tt_metal +) diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_broadcast.cpp b/tests/tt_metal/tt_metal/llk/test_broadcast.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_broadcast.cpp rename to tests/tt_metal/tt_metal/llk/test_broadcast.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_copy_block_matmul_partials.cpp b/tests/tt_metal/tt_metal/llk/test_copy_block_matmul_partials.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_copy_block_matmul_partials.cpp rename to tests/tt_metal/tt_metal/llk/test_copy_block_matmul_partials.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_cumsum.cpp b/tests/tt_metal/tt_metal/llk/test_cumsum.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_cumsum.cpp rename to tests/tt_metal/tt_metal/llk/test_cumsum.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_dropout_sfpu_compute.cpp b/tests/tt_metal/tt_metal/llk/test_dropout_sfpu_compute.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_dropout_sfpu_compute.cpp rename to tests/tt_metal/tt_metal/llk/test_dropout_sfpu_compute.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_golden_impls.cpp b/tests/tt_metal/tt_metal/llk/test_golden_impls.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_golden_impls.cpp rename to tests/tt_metal/tt_metal/llk/test_golden_impls.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_golden_impls.hpp b/tests/tt_metal/tt_metal/llk/test_golden_impls.hpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_golden_impls.hpp rename to tests/tt_metal/tt_metal/llk/test_golden_impls.hpp diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_reconfig.cpp b/tests/tt_metal/tt_metal/llk/test_reconfig.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_reconfig.cpp rename to tests/tt_metal/tt_metal/llk/test_reconfig.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_reduce.cpp b/tests/tt_metal/tt_metal/llk/test_reduce.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_reduce.cpp rename to tests/tt_metal/tt_metal/llk/test_reduce.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_sfpu_compute.cpp b/tests/tt_metal/tt_metal/llk/test_sfpu_compute.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_sfpu_compute.cpp rename to tests/tt_metal/tt_metal/llk/test_sfpu_compute.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_single_core_binary_compute.cpp b/tests/tt_metal/tt_metal/llk/test_single_core_binary_compute.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_single_core_binary_compute.cpp rename to tests/tt_metal/tt_metal/llk/test_single_core_binary_compute.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_single_core_matmul_compute.cpp b/tests/tt_metal/tt_metal/llk/test_single_core_matmul_compute.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_single_core_matmul_compute.cpp rename to tests/tt_metal/tt_metal/llk/test_single_core_matmul_compute.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_transpose.cpp b/tests/tt_metal/tt_metal/llk/test_transpose.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_transpose.cpp rename to tests/tt_metal/tt_metal/llk/test_transpose.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/compute/test_untilize_tilize.cpp b/tests/tt_metal/tt_metal/llk/test_untilize_tilize.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/compute/test_untilize_tilize.cpp rename to tests/tt_metal/tt_metal/llk/test_untilize_tilize.cpp From 4f6076f436ff94e5df30d10d8ec0527ece0bf18c Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Thu, 7 Nov 2024 15:49:29 +0000 Subject: [PATCH 16/26] #0: Restored deleted files --- .../core_coord/test_CoreRangeSet_contains.cpp | 53 +++++++++++++++++++ .../test_CoreRangeSet_intersects.cpp | 52 ++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_contains.cpp create mode 100644 tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_intersects.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_contains.cpp b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_contains.cpp new file mode 100644 index 00000000000..a76802a2e35 --- /dev/null +++ b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_contains.cpp @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "core_coord_fixture.hpp" +#include "gtest/gtest.h" +#include "tt_metal/common/core_coord.hpp" + +namespace basic_tests::CoreRangeSet { + +TEST_F(CoreCoordHarness, TestCoreRangeSetContains) { + // Contains CoreCoord + EXPECT_TRUE(::CoreRangeSet(this->cr1).contains(this->cr5.start_coord)); + EXPECT_TRUE(::CoreRangeSet(this->cr5).contains(this->cr1.end_coord)); + EXPECT_TRUE(::CoreRangeSet(std::vector{this->sc1, this->sc4}).contains(this->cr3.start_coord)); + EXPECT_TRUE(::CoreRangeSet(std::vector{this->cr17, this->cr16}).contains(this->sc2.start_coord)); + EXPECT_TRUE(::CoreRangeSet(this->cr11).contains(this->cr12.end_coord)); + // Contains CoreRange + EXPECT_TRUE(::CoreRangeSet(this->cr1).contains(this->sc1)); + EXPECT_TRUE(::CoreRangeSet(this->cr8).contains(this->cr1)); + EXPECT_TRUE(::CoreRangeSet(this->cr13).contains(this->cr16)); + EXPECT_TRUE(::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc5, this->sc6}).contains(this->cr1)); + EXPECT_TRUE(::CoreRangeSet(std::vector{this->cr17, this->cr16}).contains(this->cr1)); + // Contains CoreRangeSet + EXPECT_TRUE( + ::CoreRangeSet(this->cr1).contains(::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc5, this->sc6}))); + EXPECT_TRUE(::CoreRangeSet(this->cr5).contains(::CoreRangeSet())); + EXPECT_TRUE(::CoreRangeSet().contains(::CoreRangeSet())); + EXPECT_TRUE(::CoreRangeSet(std::vector{this->sc6, cr5, sc2}) + .contains(::CoreRangeSet(std::vector{this->cr1, this->cr2, this->cr3}))); + EXPECT_TRUE(::CoreRangeSet(this->cr12).contains(::CoreRangeSet(std::vector{this->sc6, this->cr11}))); +} + +TEST_F(CoreCoordHarness, TestCoreRangeSetNotContains) { + // Not Contains CoreCoord + EXPECT_FALSE(::CoreRangeSet(this->cr1).contains(this->cr2.start_coord)); + EXPECT_FALSE( + ::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc3, this->sc4}).contains(this->cr17.start_coord)); + EXPECT_FALSE(::CoreRangeSet(std::vector{this->cr1, this->sc4}).contains(this->cr7.start_coord)); + // No Contains CoreRange + EXPECT_FALSE(::CoreRangeSet(this->cr1).contains(this->sc3)); + EXPECT_FALSE(::CoreRangeSet(std::vector{this->sc1, this->sc5, this->sc6}).contains(this->cr1)); + EXPECT_FALSE(::CoreRangeSet(std::vector{this->cr7, this->cr1}).contains(this->cr16)); + // Not Contains CoreRangeSet + EXPECT_FALSE(::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc5}).contains(::CoreRangeSet(this->cr1))); + EXPECT_FALSE(::CoreRangeSet().contains(::CoreRangeSet(this->cr5))); + EXPECT_FALSE(::CoreRangeSet(std::vector{this->sc6, cr5}) + .contains(::CoreRangeSet(std::vector{this->cr1, this->cr2, this->cr3}))); +} + +} // namespace basic_tests::CoreRangeSet diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_intersects.cpp b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_intersects.cpp new file mode 100644 index 00000000000..3815de620e2 --- /dev/null +++ b/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_intersects.cpp @@ -0,0 +1,52 @@ +// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "core_coord_fixture.hpp" +#include "gtest/gtest.h" +#include "tt_metal/common/core_coord.hpp" + +namespace basic_tests::CoreRangeSet { + +TEST_F(CoreCoordHarness, TestCoreRangeSetIntersects) { + // Intersects CoreCoord + EXPECT_TRUE(::CoreRangeSet(this->cr1).intersects(this->cr5.start_coord)); + EXPECT_TRUE(::CoreRangeSet(this->cr5).intersects(this->cr1.end_coord)); + EXPECT_TRUE(::CoreRangeSet(std::vector{this->sc1, this->sc4}).intersects(this->cr3.start_coord)); + EXPECT_TRUE(::CoreRangeSet(std::vector{this->cr17, this->cr16}).intersects(this->sc4.start_coord)); + EXPECT_TRUE(::CoreRangeSet(this->cr11).intersects(this->cr12.end_coord)); + // Intersects CoreRange + EXPECT_TRUE(::CoreRangeSet(this->cr1).intersects(this->cr5)); + EXPECT_TRUE(::CoreRangeSet(this->cr5).intersects(this->cr1)); + EXPECT_TRUE(::CoreRangeSet(std::vector{this->sc1, this->sc4}).intersects(this->cr3)); + EXPECT_TRUE(::CoreRangeSet(std::vector{this->cr17, this->cr16}).intersects(this->sc4)); + EXPECT_TRUE(::CoreRangeSet(this->cr11).intersects(this->cr12)); + // Intersects CoreRangeSet + EXPECT_TRUE(::CoreRangeSet(this->cr1).intersects(::CoreRangeSet(this->cr5))); + EXPECT_TRUE(::CoreRangeSet(this->cr5).intersects(::CoreRangeSet(this->cr1))); + EXPECT_TRUE(::CoreRangeSet(std::vector{this->sc1, this->sc4}).intersects(::CoreRangeSet(this->cr3))); + EXPECT_TRUE(::CoreRangeSet(std::vector{this->cr17, this->cr16}) + .intersects(::CoreRangeSet(std::vector{this->sc2, this->sc4}))); + EXPECT_TRUE(::CoreRangeSet(this->sc2).intersects(::CoreRangeSet(std::vector{this->cr7, this->cr1}))); +} + +TEST_F(CoreCoordHarness, TestCoreRangeSetNotIntersects) { + // Not Intersects CoreCoord + EXPECT_FALSE(::CoreRangeSet(this->cr1).intersects(this->cr2.start_coord)); + EXPECT_FALSE( + ::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc3, this->sc4}).intersects(this->cr17.start_coord)); + EXPECT_FALSE(::CoreRangeSet(std::vector{this->cr1, this->sc4}).intersects(this->cr7.start_coord)); + // Not Intersects CoreRange + EXPECT_FALSE(::CoreRangeSet(this->cr1).intersects(this->cr2)); + EXPECT_FALSE(::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc3, this->sc4}).intersects(this->cr17)); + EXPECT_FALSE(::CoreRangeSet(std::vector{this->cr1, this->sc4}).intersects(this->cr7)); + // Not Intersects CoreRangeSet + EXPECT_FALSE(::CoreRangeSet(this->cr1).intersects(::CoreRangeSet(std::vector{this->cr2, this->cr3}))); + EXPECT_FALSE(::CoreRangeSet(std::vector{this->sc1, this->sc2, this->sc3, this->sc4}) + .intersects(::CoreRangeSet(std::vector{this->cr17, this->cr18}))); + EXPECT_FALSE(::CoreRangeSet(std::vector{this->cr1, this->sc4}).intersects(::CoreRangeSet(this->cr7))); +} + +} // namespace basic_tests::CoreRangeSet From 925dd5b769f42cf0aa1fbd3e809d32062623a72c Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Fri, 8 Nov 2024 03:45:52 +0000 Subject: [PATCH 17/26] #0: More file restructuring --- tests/tt_metal/tt_metal/api/CMakeLists.txt | 2 + .../allocator/test_l1_banking_allocator.cpp | 1 - .../circular_buffer_test_utils.hpp | 0 .../test_CircularBuffer_allocation.cpp | 0 .../test_CircularBuffer_creation.cpp | 0 .../test_CircularBuffer_non_blocking.cpp | 0 .../core_coord/test_CoreRangeSet_contains.cpp | 4 +- .../test_CoreRangeSet_intersects.cpp | 4 +- .../tt_metal/api/test_CommandQueue.cpp | 14 +-- .../test_sharded_l1_buffer.cpp} | 0 .../test_simple_dram_buffer.cpp | 3 - .../buffer => api}/test_simple_l1_buffer.cpp | 3 - .../common/command_queue_fixture.hpp | 81 +++++++++++++++- .../common/device_fixture.hpp | 0 .../common/multi_device_fixture.hpp | 0 .../common/test_utils.hpp | 0 .../dprint/test_print_tensix_dest.cpp | 3 - tests/tt_metal/tt_metal/device/CMakeLists.txt | 1 + .../tt_metal/tt_metal/device/test_device.cpp | 2 +- .../device/test_device_cluster_api.cpp | 5 - .../test_device_init_and_teardown.cpp} | 0 .../tt_metal/device/test_device_pool.cpp | 1 - .../dispatch_program/test_EnqueueProgram.cpp | 4 +- .../buffer_movement_kernels.cpp | 7 -- .../erisc_app_direct_send.cpp | 11 +-- .../matmul/matmul_utils.hpp | 0 .../matmul/test_matmul_X_tile.cpp | 0 .../matmul/test_matmul_large_block.cpp | 0 .../matmul/test_matmul_multi_core_X_dram.cpp | 0 ...ti_core_multi_dram_in0_mcast_in1_mcast.cpp | 0 ...matmul_multi_core_multi_dram_inX_mcast.cpp | 0 .../matmul/test_matmul_single_core.cpp | 0 .../compute => integration}/test_flatten.cpp | 15 +-- .../test_sfpu_compute.cpp} | 4 - tests/tt_metal/tt_metal/stl/CMakeLists.txt | 26 +++++ .../unit_tests/buffer/test_buffer_utils.cpp | 27 ------ .../unit_tests/buffer/test_buffer_utils.hpp | 21 +++- .../unit_tests/ethernet/basic_eth_kernels.cpp | 5 - .../ethernet/ring_gather_kernels.cpp | 4 +- .../tt_metal/unit_tests/tests_main.cpp | 5 - .../command_queue/test_EnqueueProgram.cpp | 84 ---------------- .../common/command_queue_fixture.hpp | 96 ------------------- 42 files changed, 146 insertions(+), 287 deletions(-) rename tests/tt_metal/tt_metal/{unit_tests => api}/circular_buffer/circular_buffer_test_utils.hpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => api}/circular_buffer/test_CircularBuffer_allocation.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => api}/circular_buffer/test_CircularBuffer_creation.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => api}/circular_buffer/test_CircularBuffer_non_blocking.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => api}/core_coord/test_CoreRangeSet_contains.cpp (96%) rename tests/tt_metal/tt_metal/{unit_tests => api}/core_coord/test_CoreRangeSet_intersects.cpp (96%) rename tests/tt_metal/tt_metal/{unit_tests/buffer/test_sharded_l1.cpp => api/test_sharded_l1_buffer.cpp} (100%) rename tests/tt_metal/tt_metal/{unit_tests/buffer => api}/test_simple_dram_buffer.cpp (97%) rename tests/tt_metal/tt_metal/{unit_tests/buffer => api}/test_simple_l1_buffer.cpp (98%) rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch => }/common/command_queue_fixture.hpp (86%) rename tests/tt_metal/tt_metal/{unit_tests => }/common/device_fixture.hpp (100%) rename tests/tt_metal/tt_metal/{unit_tests => }/common/multi_device_fixture.hpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common => }/common/test_utils.hpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common/basic/test_device_init.cpp => device/test_device_init_and_teardown.cpp} (100%) rename tests/tt_metal/tt_metal/{unit_tests/ethernet => eth}/buffer_movement_kernels.cpp (98%) rename tests/tt_metal/tt_metal/{unit_tests/ethernet => eth}/erisc_app_direct_send.cpp (97%) rename tests/tt_metal/tt_metal/{unit_tests_common/compute => integration}/matmul/matmul_utils.hpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common/compute => integration}/matmul/test_matmul_X_tile.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common/compute => integration}/matmul/test_matmul_large_block.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common/compute => integration}/matmul/test_matmul_multi_core_X_dram.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common/compute => integration}/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common/compute => integration}/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common/compute => integration}/matmul/test_matmul_single_core.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_common/compute => integration}/test_flatten.cpp (95%) rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp => integration/test_sfpu_compute.cpp} (99%) create mode 100644 tests/tt_metal/tt_metal/stl/CMakeLists.txt delete mode 100644 tests/tt_metal/tt_metal/unit_tests/buffer/test_buffer_utils.cpp delete mode 100644 tests/tt_metal/tt_metal/unit_tests/tests_main.cpp delete mode 100644 tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp delete mode 100644 tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp diff --git a/tests/tt_metal/tt_metal/api/CMakeLists.txt b/tests/tt_metal/tt_metal/api/CMakeLists.txt index ffe48a66887..6ed40b1572d 100644 --- a/tests/tt_metal/tt_metal/api/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/api/CMakeLists.txt @@ -7,6 +7,8 @@ set(UNIT_TESTS_API_SRC ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRange_iterator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRange_merge.cpp ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRangeSet_construct.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRangeSet_contains.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRangeSet_intersects.cpp ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRangeSet_merge.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_bit_utils.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_CommandQueue.cpp diff --git a/tests/tt_metal/tt_metal/api/allocator/test_l1_banking_allocator.cpp b/tests/tt_metal/tt_metal/api/allocator/test_l1_banking_allocator.cpp index d1b20a992a2..738e79c3fd4 100644 --- a/tests/tt_metal/tt_metal/api/allocator/test_l1_banking_allocator.cpp +++ b/tests/tt_metal/tt_metal/api/allocator/test_l1_banking_allocator.cpp @@ -5,7 +5,6 @@ #include #include "device_fixture.hpp" -#include "tt_metal/common/core_descriptor.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests/circular_buffer/circular_buffer_test_utils.hpp b/tests/tt_metal/tt_metal/api/circular_buffer/circular_buffer_test_utils.hpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/circular_buffer/circular_buffer_test_utils.hpp rename to tests/tt_metal/tt_metal/api/circular_buffer/circular_buffer_test_utils.hpp diff --git a/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_allocation.cpp b/tests/tt_metal/tt_metal/api/circular_buffer/test_CircularBuffer_allocation.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_allocation.cpp rename to tests/tt_metal/tt_metal/api/circular_buffer/test_CircularBuffer_allocation.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_creation.cpp b/tests/tt_metal/tt_metal/api/circular_buffer/test_CircularBuffer_creation.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_creation.cpp rename to tests/tt_metal/tt_metal/api/circular_buffer/test_CircularBuffer_creation.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_non_blocking.cpp b/tests/tt_metal/tt_metal/api/circular_buffer/test_CircularBuffer_non_blocking.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/circular_buffer/test_CircularBuffer_non_blocking.cpp rename to tests/tt_metal/tt_metal/api/circular_buffer/test_CircularBuffer_non_blocking.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_contains.cpp b/tests/tt_metal/tt_metal/api/core_coord/test_CoreRangeSet_contains.cpp similarity index 96% rename from tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_contains.cpp rename to tests/tt_metal/tt_metal/api/core_coord/test_CoreRangeSet_contains.cpp index a76802a2e35..6a3eefbf03f 100644 --- a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_contains.cpp +++ b/tests/tt_metal/tt_metal/api/core_coord/test_CoreRangeSet_contains.cpp @@ -10,7 +10,7 @@ namespace basic_tests::CoreRangeSet { -TEST_F(CoreCoordHarness, TestCoreRangeSetContains) { +TEST_F(CoreCoordFixture, TestCoreRangeSetContains) { // Contains CoreCoord EXPECT_TRUE(::CoreRangeSet(this->cr1).contains(this->cr5.start_coord)); EXPECT_TRUE(::CoreRangeSet(this->cr5).contains(this->cr1.end_coord)); @@ -33,7 +33,7 @@ TEST_F(CoreCoordHarness, TestCoreRangeSetContains) { EXPECT_TRUE(::CoreRangeSet(this->cr12).contains(::CoreRangeSet(std::vector{this->sc6, this->cr11}))); } -TEST_F(CoreCoordHarness, TestCoreRangeSetNotContains) { +TEST_F(CoreCoordFixture, TestCoreRangeSetNotContains) { // Not Contains CoreCoord EXPECT_FALSE(::CoreRangeSet(this->cr1).contains(this->cr2.start_coord)); EXPECT_FALSE( diff --git a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_intersects.cpp b/tests/tt_metal/tt_metal/api/core_coord/test_CoreRangeSet_intersects.cpp similarity index 96% rename from tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_intersects.cpp rename to tests/tt_metal/tt_metal/api/core_coord/test_CoreRangeSet_intersects.cpp index 3815de620e2..fb1f406412f 100644 --- a/tests/tt_metal/tt_metal/unit_tests/core_coord/test_CoreRangeSet_intersects.cpp +++ b/tests/tt_metal/tt_metal/api/core_coord/test_CoreRangeSet_intersects.cpp @@ -10,7 +10,7 @@ namespace basic_tests::CoreRangeSet { -TEST_F(CoreCoordHarness, TestCoreRangeSetIntersects) { +TEST_F(CoreCoordFixture, TestCoreRangeSetIntersects) { // Intersects CoreCoord EXPECT_TRUE(::CoreRangeSet(this->cr1).intersects(this->cr5.start_coord)); EXPECT_TRUE(::CoreRangeSet(this->cr5).intersects(this->cr1.end_coord)); @@ -32,7 +32,7 @@ TEST_F(CoreCoordHarness, TestCoreRangeSetIntersects) { EXPECT_TRUE(::CoreRangeSet(this->sc2).intersects(::CoreRangeSet(std::vector{this->cr7, this->cr1}))); } -TEST_F(CoreCoordHarness, TestCoreRangeSetNotIntersects) { +TEST_F(CoreCoordFixture, TestCoreRangeSetNotIntersects) { // Not Intersects CoreCoord EXPECT_FALSE(::CoreRangeSet(this->cr1).intersects(this->cr2.start_coord)); EXPECT_FALSE( diff --git a/tests/tt_metal/tt_metal/api/test_CommandQueue.cpp b/tests/tt_metal/tt_metal/api/test_CommandQueue.cpp index a1c4719c4e8..72967150fc5 100644 --- a/tests/tt_metal/tt_metal/api/test_CommandQueue.cpp +++ b/tests/tt_metal/tt_metal/api/test_CommandQueue.cpp @@ -2,10 +2,9 @@ // // SPDX-License-Identifier: Apache-2.0 -#include +#include "gtest/gtest.h" #include "command_queue_fixture.hpp" -#include "gtest/gtest.h" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/device/device.hpp" #include "tt_metal/test_utils/stimulus.hpp" @@ -14,7 +13,6 @@ using namespace tt::tt_metal; namespace host_tests { -namespace multi_device_tests { TEST_F(CommandQueueMultiDeviceFixture, DISABLED_TestAccessCommandQueue) { for (unsigned int device_id = 0; device_id < num_devices_; device_id++) { EXPECT_NO_THROW(devices_[device_id]->command_queue()); @@ -66,7 +64,8 @@ TEST_F(CommandQueueMultiDeviceFixture, DISABLED_TestDirectedLoopbackToUniqueHuge chip_id_t mmio_device_id = tt::Cluster::instance().get_associated_mmio_device(device_id); uint16_t channel = tt::Cluster::instance().get_assigned_channel_for_device(device_id); - tt::Cluster::instance().write_sysmem(data.data(), data.size() * sizeof(uint32_t), address, mmio_device_id, channel); + tt::Cluster::instance().write_sysmem( + data.data(), data.size() * sizeof(uint32_t), address, mmio_device_id, channel); golden_data[device_id] = data; } @@ -80,9 +79,4 @@ TEST_F(CommandQueueMultiDeviceFixture, DISABLED_TestDirectedLoopbackToUniqueHuge EXPECT_EQ(readback_data, golden_data.at(device_id)); } } -} - - - - -} // namespace host_tests +} // namespace host_tests diff --git a/tests/tt_metal/tt_metal/unit_tests/buffer/test_sharded_l1.cpp b/tests/tt_metal/tt_metal/api/test_sharded_l1_buffer.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/buffer/test_sharded_l1.cpp rename to tests/tt_metal/tt_metal/api/test_sharded_l1_buffer.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/buffer/test_simple_dram_buffer.cpp b/tests/tt_metal/tt_metal/api/test_simple_dram_buffer.cpp similarity index 97% rename from tests/tt_metal/tt_metal/unit_tests/buffer/test_simple_dram_buffer.cpp rename to tests/tt_metal/tt_metal/api/test_simple_dram_buffer.cpp index 27eadb2448e..55d4216cef9 100644 --- a/tests/tt_metal/tt_metal/unit_tests/buffer/test_simple_dram_buffer.cpp +++ b/tests/tt_metal/tt_metal/api/test_simple_dram_buffer.cpp @@ -6,9 +6,6 @@ #include "gtest/gtest.h" #include "test_buffer_utils.hpp" #include "tt_metal/host_api.hpp" -#include "tt_metal/test_utils/comparison.hpp" -#include "tt_metal/test_utils/df/df.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" #include "tt_metal/test_utils/stimulus.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests/buffer/test_simple_l1_buffer.cpp b/tests/tt_metal/tt_metal/api/test_simple_l1_buffer.cpp similarity index 98% rename from tests/tt_metal/tt_metal/unit_tests/buffer/test_simple_l1_buffer.cpp rename to tests/tt_metal/tt_metal/api/test_simple_l1_buffer.cpp index 2ad3095e2e1..91048c7390b 100644 --- a/tests/tt_metal/tt_metal/unit_tests/buffer/test_simple_l1_buffer.cpp +++ b/tests/tt_metal/tt_metal/api/test_simple_l1_buffer.cpp @@ -7,9 +7,6 @@ #include "test_buffer_utils.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" -#include "tt_metal/test_utils/comparison.hpp" -#include "tt_metal/test_utils/df/df.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" #include "tt_metal/test_utils/stimulus.hpp" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/common/command_queue_fixture.hpp similarity index 86% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp rename to tests/tt_metal/tt_metal/common/command_queue_fixture.hpp index aa71c7f10b9..172cbb4b62b 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/common/command_queue_fixture.hpp +++ b/tests/tt_metal/tt_metal/common/command_queue_fixture.hpp @@ -21,7 +21,7 @@ #include "tt_metal/impl/kernels/kernel.hpp" #include "tt_metal/common/tt_backend_api_types.hpp" #include "tt_metal/llrt/rtoptions.hpp" -#include "tt_metal/tt_metal/unit_tests_common/common/test_utils.hpp" +#include "test_utils.hpp" #include "tt_soc_descriptor.h" class CommandQueueFixture : virtual public DispatchFixture { @@ -512,3 +512,82 @@ class RandomProgramTraceFixture : virtual public RandomProgramFixture, virtual p } } }; + +class MultiCommandQueueSingleDeviceFixture : virtual public DispatchFixture { + protected: + void SetUp() override { + auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); + if (slow_dispatch) { + TT_THROW("This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); + GTEST_SKIP(); + } + auto num_cqs = tt::llrt::OptionsG.get_num_hw_cqs(); + if (num_cqs != 2) { + TT_THROW("This suite must be run with TT_METAL_GTEST_NUM_HW_CQS=2"); + GTEST_SKIP(); + } + arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + DispatchCoreType dispatch_core_type = DispatchCoreType::WORKER; + if (arch_ == tt::ARCH::WORMHOLE_B0 and tt::tt_metal::GetNumAvailableDevices() != 1) { + if (!tt::tt_metal::IsGalaxyCluster()) { + tt::log_warning(tt::LogTest, "Ethernet Dispatch not being explicitly used. Set this configuration in Setup()"); + dispatch_core_type = DispatchCoreType::ETH; + } + } + device_ = tt::tt_metal::CreateDevice(0, num_cqs, DEFAULT_L1_SMALL_SIZE, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); + } + + void TearDown() override { + tt::tt_metal::CloseDevice(device_); + } + + tt::tt_metal::Device* device_; + tt::ARCH arch_; +}; + +class MultiCommandQueueSingleDeviceEventFixture : public MultiCommandQueueSingleDeviceFixture, public EventFixture {}; + +class MultiCommandQueueSingleDeviceBufferFixture : public MultiCommandQueueSingleDeviceFixture, public BufferFixture {}; + +class MultiCommandQueueSingleDeviceProgramFixture : public MultiCommandQueueSingleDeviceFixture, public ProgramFixture {}; + +class MultiCommandQueueMultiDeviceFixture : virtual public DispatchFixture { + protected: + void SetUp() override { + auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); + if (slow_dispatch) { + TT_THROW("This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); + GTEST_SKIP(); + } + auto num_cqs = tt::llrt::OptionsG.get_num_hw_cqs(); + if (num_cqs != 2) { + TT_THROW("This suite must be run with TT_METAL_GTEST_NUM_HW_CQS=2"); + GTEST_SKIP(); + } + const tt::ARCH arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + + + DispatchCoreType dispatch_core_type = DispatchCoreType::WORKER; + if (arch == tt::ARCH::WORMHOLE_B0 and tt::tt_metal::GetNumAvailableDevices() != 1) { + if (!tt::tt_metal::IsGalaxyCluster()) { + tt::log_warning(tt::LogTest, "Ethernet Dispatch not being explicitly used. Set this configuration in Setup()"); + dispatch_core_type = DispatchCoreType::ETH; + } + } + + const chip_id_t mmio_device_id = 0; + reserved_devices_ = tt::tt_metal::detail::CreateDevices({mmio_device_id}, num_cqs, DEFAULT_L1_SMALL_SIZE, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); + for (const auto &[id, device] : reserved_devices_) { + devices_.push_back(device); + } + } + + void TearDown() override { tt::tt_metal::detail::CloseDevices(reserved_devices_); } + + std::vector devices_; + std::map reserved_devices_; +}; + +class MultiCommandQueueMultiDeviceBufferFixture : public MultiCommandQueueMultiDeviceFixture, public BufferFixture {}; + +class MultiCommandQueueMultiDeviceEventFixture : public MultiCommandQueueMultiDeviceFixture, public EventFixture {}; diff --git a/tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp b/tests/tt_metal/tt_metal/common/device_fixture.hpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp rename to tests/tt_metal/tt_metal/common/device_fixture.hpp diff --git a/tests/tt_metal/tt_metal/unit_tests/common/multi_device_fixture.hpp b/tests/tt_metal/tt_metal/common/multi_device_fixture.hpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/common/multi_device_fixture.hpp rename to tests/tt_metal/tt_metal/common/multi_device_fixture.hpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/common/test_utils.hpp b/tests/tt_metal/tt_metal/common/test_utils.hpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/common/test_utils.hpp rename to tests/tt_metal/tt_metal/common/test_utils.hpp diff --git a/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_tensix_dest.cpp b/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_tensix_dest.cpp index 6feeb9ccde5..d195e56e030 100644 --- a/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_tensix_dest.cpp +++ b/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_tensix_dest.cpp @@ -8,9 +8,6 @@ #include "test_utils.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" -#include "tt_metal/test_utils/comparison.hpp" -#include "tt_metal/test_utils/df/df.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" #include "tt_metal/test_utils/stimulus.hpp" ////////////////////////////////////////////////////////////////////////////////////////// // A test for checking dprint diff --git a/tests/tt_metal/tt_metal/device/CMakeLists.txt b/tests/tt_metal/tt_metal/device/CMakeLists.txt index 7cd8a512e35..206411187aa 100644 --- a/tests/tt_metal/tt_metal/device/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/device/CMakeLists.txt @@ -1,5 +1,6 @@ set(UNIT_TESTS_DEVICE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_device_cluster_api.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_device_init_and_teardown.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_device_pool.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_device.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_galaxy_cluster_api.cpp diff --git a/tests/tt_metal/tt_metal/device/test_device.cpp b/tests/tt_metal/tt_metal/device/test_device.cpp index 71b85cc1a6b..1137a2edeb3 100644 --- a/tests/tt_metal/tt_metal/device/test_device.cpp +++ b/tests/tt_metal/tt_metal/device/test_device.cpp @@ -4,7 +4,7 @@ #include -#include "tests/tt_metal/tt_metal/unit_tests/common/device_fixture.hpp" +#include "device_fixture.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/test_utils/stimulus.hpp" diff --git a/tests/tt_metal/tt_metal/device/test_device_cluster_api.cpp b/tests/tt_metal/tt_metal/device/test_device_cluster_api.cpp index 033bed287dd..b846ead88e3 100644 --- a/tests/tt_metal/tt_metal/device/test_device_cluster_api.cpp +++ b/tests/tt_metal/tt_metal/device/test_device_cluster_api.cpp @@ -5,15 +5,10 @@ #include #include -#include -#include #include "multi_device_fixture.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.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; diff --git a/tests/tt_metal/tt_metal/unit_tests_common/basic/test_device_init.cpp b/tests/tt_metal/tt_metal/device/test_device_init_and_teardown.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/basic/test_device_init.cpp rename to tests/tt_metal/tt_metal/device/test_device_init_and_teardown.cpp diff --git a/tests/tt_metal/tt_metal/device/test_device_pool.cpp b/tests/tt_metal/tt_metal/device/test_device_pool.cpp index a07c909ddd9..4e52c9d0f60 100644 --- a/tests/tt_metal/tt_metal/device/test_device_pool.cpp +++ b/tests/tt_metal/tt_metal/device/test_device_pool.cpp @@ -4,7 +4,6 @@ #include -#include "tests/tt_metal/tt_metal/unit_tests/common/basic_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/device/device_pool.hpp" diff --git a/tests/tt_metal/tt_metal/dispatch_program/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/dispatch_program/test_EnqueueProgram.cpp index 83a856fa284..3fcb44acb1d 100644 --- a/tests/tt_metal/tt_metal/dispatch_program/test_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/dispatch_program/test_EnqueueProgram.cpp @@ -5,17 +5,15 @@ #include #include #include "command_queue_fixture.hpp" -#include "trace_fixture.hpp" #include "command_queue_test_utils.hpp" #include "gtest/gtest.h" #include "impl/buffers/buffer.hpp" #include "impl/device/device.hpp" #include "impl/kernels/kernel_types.hpp" -#include "tt_metal/common/bfloat16.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/impl/kernels/kernel.hpp" -#include "tests/tt_metal/tt_metal/unit_tests_common/common/test_utils.hpp" +#include "test_utils.hpp" #include "tt_soc_descriptor.h" using std::vector; diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp b/tests/tt_metal/tt_metal/eth/buffer_movement_kernels.cpp similarity index 98% rename from tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp rename to tests/tt_metal/tt_metal/eth/buffer_movement_kernels.cpp index 339eb87d063..4eb5956609a 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/buffer_movement_kernels.cpp +++ b/tests/tt_metal/tt_metal/eth/buffer_movement_kernels.cpp @@ -4,19 +4,12 @@ #include -#include -#include -#include - #include "device_fixture.hpp" #include "multi_device_fixture.hpp" #include "tt_metal/common/math.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/kernels/kernel.hpp" -#include "tt_metal/test_utils/comparison.hpp" -#include "tt_metal/test_utils/df/df.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" #include "tt_metal/test_utils/stimulus.hpp" using namespace tt; diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/erisc_app_direct_send.cpp b/tests/tt_metal/tt_metal/eth/erisc_app_direct_send.cpp similarity index 97% rename from tests/tt_metal/tt_metal/unit_tests/ethernet/erisc_app_direct_send.cpp rename to tests/tt_metal/tt_metal/eth/erisc_app_direct_send.cpp index 0a6641104b8..d771fd50ce4 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/erisc_app_direct_send.cpp +++ b/tests/tt_metal/tt_metal/eth/erisc_app_direct_send.cpp @@ -12,9 +12,6 @@ #include "tt_metal/common/logger.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" -#include "tt_metal/test_utils/comparison.hpp" -#include "tt_metal/test_utils/df/df.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" #include "tt_metal/test_utils/stimulus.hpp" namespace { @@ -140,7 +137,7 @@ bool send_over_eth( } // namespace unit_tests::erisc::direct_send -TEST_F(N300DeviceFixture, EthSingleCoreDirectSendChip0ToChip1) { +TEST_F(N300DeviceFixture, ActiveEthSingleCoreDirectSendChip0ToChip1) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); ASSERT_TRUE(this->num_devices_ == 2); @@ -170,7 +167,7 @@ TEST_F(N300DeviceFixture, EthSingleCoreDirectSendChip0ToChip1) { device_0, device_1, sender_core_1, receiver_core_1, WORD_SIZE * MAX_NUM_WORDS)); } -TEST_F(N300DeviceFixture, EthSingleCoreDirectSendChip1ToChip0) { +TEST_F(N300DeviceFixture, ActiveEthSingleCoreDirectSendChip1ToChip0) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); ASSERT_TRUE(this->num_devices_ == 2); @@ -200,7 +197,7 @@ TEST_F(N300DeviceFixture, EthSingleCoreDirectSendChip1ToChip0) { device_1, device_0, sender_core_1, receiver_core_1, WORD_SIZE * MAX_NUM_WORDS)); } -TEST_F(N300DeviceFixture, EthBidirectionalCoreDirectSend) { +TEST_F(N300DeviceFixture, ActiveEthBidirectionalCoreDirectSend) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); ASSERT_TRUE(this->num_devices_ == 2); @@ -246,7 +243,7 @@ TEST_F(N300DeviceFixture, EthBidirectionalCoreDirectSend) { device_1, device_0, receiver_core_1, sender_core_1, WORD_SIZE * MAX_NUM_WORDS)); } -TEST_F(N300DeviceFixture, EthRandomDirectSendTests) { +TEST_F(N300DeviceFixture, ActiveEthRandomDirectSendTests) { using namespace CMAKE_UNIQUE_NAMESPACE; GTEST_SKIP(); srand(0); diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/matmul_utils.hpp b/tests/tt_metal/tt_metal/integration/matmul/matmul_utils.hpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/matmul_utils.hpp rename to tests/tt_metal/tt_metal/integration/matmul/matmul_utils.hpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_X_tile.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_X_tile.cpp rename to tests/tt_metal/tt_metal/integration/matmul/test_matmul_X_tile.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_large_block.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_large_block.cpp rename to tests/tt_metal/tt_metal/integration/matmul/test_matmul_large_block.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_X_dram.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_X_dram.cpp rename to tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_X_dram.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp rename to tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp rename to tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_single_core.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/test_matmul_single_core.cpp rename to tests/tt_metal/tt_metal/integration/matmul/test_matmul_single_core.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp b/tests/tt_metal/tt_metal/integration/test_flatten.cpp similarity index 95% rename from tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp rename to tests/tt_metal/tt_metal/integration/test_flatten.cpp index 90b0e589643..f9ebfe24790 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/compute/test_flatten.cpp +++ b/tests/tt_metal/tt_metal/integration/test_flatten.cpp @@ -2,22 +2,15 @@ // // SPDX-License-Identifier: Apache-2.0 -#include -#include -#include - #include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" -#include "llrt/llrt.hpp" - - using std::vector; using namespace tt; -namespace gtest_smoke::test_flatten{ +namespace test_flatten { uint32_t prod(vector &shape) { uint32_t shape_prod = 1; @@ -196,15 +189,15 @@ TEST_F(DispatchFixture, TensixFlatten){ GTEST_SKIP(); uint32_t num_tiles_r = 2; uint32_t num_tiles_c = 2; - if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")){ + if (!this->IsSlowDispatch()){ log_info(LogTest, "Flatten running with num_tiles_r=1, num_tiles_c=1"); num_tiles_r = 1; num_tiles_c = 1; } for (unsigned int id=0; id < devices_.size(); id++){ // TODO: #6097, fix this for fast dispatch remote device. - if (!this->slow_dispatch_ && id > 0) + if (!this->IsSlowDispatch() && id > 0) continue; - ASSERT_TRUE(gtest_smoke::test_flatten::flatten(this, devices_.at(id), num_tiles_r, num_tiles_c)); + ASSERT_TRUE(test_flatten::flatten(this, this->devices_.at(id), num_tiles_r, num_tiles_c)); } } diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp b/tests/tt_metal/tt_metal/integration/test_sfpu_compute.cpp similarity index 99% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp rename to tests/tt_metal/tt_metal/integration/test_sfpu_compute.cpp index 442428347b4..b1b8a212566 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/compute/sfpu/sfpu_compute.cpp +++ b/tests/tt_metal/tt_metal/integration/test_sfpu_compute.cpp @@ -6,16 +6,12 @@ #include #include -#include -#include #include "command_queue_fixture.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/dispatch/command_queue.hpp" #include "tt_metal/test_utils/comparison.hpp" -#include "tt_metal/test_utils/df/df.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" #include "tt_metal/test_utils/stimulus.hpp" #include "tt_metal/impl/device/device.hpp" diff --git a/tests/tt_metal/tt_metal/stl/CMakeLists.txt b/tests/tt_metal/tt_metal/stl/CMakeLists.txt new file mode 100644 index 00000000000..0a7362b1a9f --- /dev/null +++ b/tests/tt_metal/tt_metal/stl/CMakeLists.txt @@ -0,0 +1,26 @@ +set(UNIT_TESTS_STL_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/test_any_range.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_slotmap.cpp +) + +add_executable(unit_tests_stl ${UNIT_TESTS_STL_SRC}) +TT_ENABLE_UNITY_BUILD(unit_tests_stl) + +target_link_libraries(unit_tests_stl PUBLIC test_metal_common_libs) +target_include_directories( + unit_tests_stl + PRIVATE + ${UMD_HOME} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/common +) +set_target_properties( + unit_tests_stl + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/test/tt_metal +) diff --git a/tests/tt_metal/tt_metal/unit_tests/buffer/test_buffer_utils.cpp b/tests/tt_metal/tt_metal/unit_tests/buffer/test_buffer_utils.cpp deleted file mode 100644 index 0ffef3f73dc..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests/buffer/test_buffer_utils.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "test_buffer_utils.hpp" -#include "tt_metal/detail/tt_metal.hpp" - -namespace tt::test::buffer::detail { -void writeL1Backdoor(tt::tt_metal::Device* device, CoreCoord coord, uint32_t address, std::vector& data) { - tt::log_info("{} -- coord={} address={}", __FUNCTION__, coord.str(), address); - tt_metal::detail::WriteToDeviceL1(device, coord, address, data); -} -void readL1Backdoor( - tt::tt_metal::Device* device, CoreCoord coord, uint32_t address, uint32_t byte_size, std::vector& data) { - tt::log_info("{} -- coord={} address={} byte_size={}", __FUNCTION__, coord.str(), address, byte_size); - tt_metal::detail::ReadFromDeviceL1(device, coord, address, byte_size, data); -} -void writeDramBackdoor(tt::tt_metal::Device* device, uint32_t channel, uint32_t address, std::vector& data) { - tt::log_info("{} -- channel={} address={}", __FUNCTION__, channel, address); - tt_metal::detail::WriteToDeviceDRAMChannel(device, channel, address, data); -} -void readDramBackdoor( - tt::tt_metal::Device* device, uint32_t channel, uint32_t address, uint32_t byte_size, std::vector& data) { - tt::log_info("{} -- channel={} address={} byte_size={}", __FUNCTION__, channel, address, byte_size); - tt_metal::detail::ReadFromDeviceDRAMChannel(device, channel, address, byte_size, data); -} -} // namespace tt::test::buffer::detail diff --git a/tests/tt_metal/tt_metal/unit_tests/buffer/test_buffer_utils.hpp b/tests/tt_metal/tt_metal/unit_tests/buffer/test_buffer_utils.hpp index e3b46a78266..9c694fe65e5 100644 --- a/tests/tt_metal/tt_metal/unit_tests/buffer/test_buffer_utils.hpp +++ b/tests/tt_metal/tt_metal/unit_tests/buffer/test_buffer_utils.hpp @@ -7,9 +7,22 @@ #include "tt_metal/host_api.hpp" namespace tt::test::buffer::detail { -void writeL1Backdoor(tt::tt_metal::Device* device, CoreCoord coord, uint32_t address, std::vector& data); -void readL1Backdoor(tt::tt_metal::Device* device, CoreCoord coord, uint32_t address, uint32_t byte_size, std::vector& data); -void writeDramBackdoor(tt::tt_metal::Device* device, uint32_t channel, uint32_t address, std::vector& data); +void writeL1Backdoor(tt::tt_metal::Device* device, CoreCoord coord, uint32_t address, std::vector& data) { + tt::log_info("{} -- coord={} address={}", __FUNCTION__, coord.str(), address); + tt_metal::detail::WriteToDeviceL1(device, coord, address, data); +} +void readL1Backdoor( + tt::tt_metal::Device* device, CoreCoord coord, uint32_t address, uint32_t byte_size, std::vector& data) { + tt::log_info("{} -- coord={} address={} byte_size={}", __FUNCTION__, coord.str(), address, byte_size); + tt_metal::detail::ReadFromDeviceL1(device, coord, address, byte_size, data); +} +void writeDramBackdoor(tt::tt_metal::Device* device, uint32_t channel, uint32_t address, std::vector& data) { + tt::log_info("{} -- channel={} address={}", __FUNCTION__, channel, address); + tt_metal::detail::WriteToDeviceDRAMChannel(device, channel, address, data); +} void readDramBackdoor( - tt::tt_metal::Device* device, uint32_t channel, uint32_t address, uint32_t byte_size, std::vector& data); + tt::tt_metal::Device* device, uint32_t channel, uint32_t address, uint32_t byte_size, std::vector& data) { + tt::log_info("{} -- channel={} address={} byte_size={}", __FUNCTION__, channel, address, byte_size); + tt_metal::detail::ReadFromDeviceDRAMChannel(device, channel, address, byte_size, data); +} } // namespace tt::test::buffer::detail diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp index d5db485111e..10339aac32e 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/basic_eth_kernels.cpp @@ -5,17 +5,12 @@ #include #include -#include -#include #include "device_fixture.hpp" #include "multi_device_fixture.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/impl/kernels/kernel.hpp" -#include "tt_metal/test_utils/comparison.hpp" -#include "tt_metal/test_utils/df/df.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" #include "tt_metal/test_utils/stimulus.hpp" using namespace tt; diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/ring_gather_kernels.cpp b/tests/tt_metal/tt_metal/unit_tests/ethernet/ring_gather_kernels.cpp index 721ef99e4c2..71c8b79e4bf 100644 --- a/tests/tt_metal/tt_metal/unit_tests/ethernet/ring_gather_kernels.cpp +++ b/tests/tt_metal/tt_metal/unit_tests/ethernet/ring_gather_kernels.cpp @@ -453,7 +453,7 @@ bool eth_interleaved_ring_gather_sender_receiver_kernels( } // namespace unit_tests::erisc::kernels -TEST_F(DeviceFixture, EthKernelsDirectRingGatherAllChips) { +TEST_F(DeviceFixture, ActiveEthKernelsDirectRingGatherAllChips) { const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE + 32; const size_t dst_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE + 32; const size_t sem_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; @@ -465,7 +465,7 @@ TEST_F(DeviceFixture, EthKernelsDirectRingGatherAllChips) { device_ring, WORD_SIZE, src_eth_l1_byte_address, dst_eth_l1_byte_address, sem_l1_byte_address)); } -TEST_F(DeviceFixture, EthKernelsInterleavedRingGatherAllChips) { +TEST_F(DeviceFixture, ActiveEthKernelsInterleavedRingGatherAllChips) { const size_t src_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE + 32; const size_t dst_eth_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE + 32; const size_t sem_l1_byte_address = eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE; diff --git a/tests/tt_metal/tt_metal/unit_tests/tests_main.cpp b/tests/tt_metal/tt_metal/unit_tests/tests_main.cpp deleted file mode 100644 index 1e42f41a46c..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests/tests_main.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "gtest/gtest.h" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp deleted file mode 100644 index 5aff132e1f3..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/command_queue/test_EnqueueProgram.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include -#include "command_queue_fixture.hpp" -#include "command_queue_test_utils.hpp" -#include "gtest/gtest.h" -#include "impl/buffers/buffer.hpp" -#include "impl/device/device.hpp" -#include "tt_metal/common/bfloat16.hpp" -#include "tt_metal/common/scoped_timer.hpp" -#include "tt_metal/host_api.hpp" -#include "tt_metal/detail/tt_metal.hpp" - -using std::vector; -using namespace tt::tt_metal; - -struct CBConfig { - uint32_t cb_id; - uint32_t num_pages; - uint32_t page_size; - tt::DataFormat data_format; -}; - -struct DummyProgramConfig { - CoreRangeSet cr_set; - CBConfig cb_config; - uint32_t num_cbs; - uint32_t num_sems; -}; - -struct DummyProgramMultiCBConfig { - CoreRangeSet cr_set; - std::vector cb_config_vector; - uint32_t num_sems; -}; - - -namespace local_test_functions { - -// Create randomly sized pair of unique and common runtime args vectors, with careful not to exceed max between the two. -// Optionally force the max size for one of the vectors. -std::pair, std::vector> create_runtime_args(bool force_max_size = false, uint32_t unique_base = 0, uint32_t common_base = 100){ - - constexpr uint32_t MAX_RUNTIME_ARGS = 255; - - // Generate Unique Runtime Args. Common RT args starting address must be L1 Aligned, so account for that here via padding - uint32_t num_rt_args_unique = num_rt_args_unique = rand() % (MAX_RUNTIME_ARGS + 1); - uint32_t num_rt_args_unique_padded = align(num_rt_args_unique, hal.get_alignment(HalMemType::L1) / sizeof(uint32_t)); - uint32_t num_rt_args_common = num_rt_args_unique_padded < MAX_RUNTIME_ARGS ? rand() % (MAX_RUNTIME_ARGS - num_rt_args_unique_padded + 1) : 0; - - if (force_max_size) { - if (rand() % 2) { - num_rt_args_unique = MAX_RUNTIME_ARGS; - num_rt_args_common = 0; - } else { - num_rt_args_common = MAX_RUNTIME_ARGS; - num_rt_args_unique = 0; - } - } - - vector rt_args_common; - for (uint32_t i = 0; i < num_rt_args_common; i++) { - rt_args_common.push_back(common_base + i); - } - - vector rt_args_unique; - for (uint32_t i = 0; i < num_rt_args_unique; i++) { - rt_args_unique.push_back(unique_base + i); - } - - log_trace(tt::LogTest, "{} - num_rt_args_unique: {} num_rt_args_common: {} force_max_size: {}", __FUNCTION__, num_rt_args_unique, num_rt_args_common, force_max_size); - return std::make_pair(rt_args_unique, rt_args_common); -} - - -} // namespace local_test_functions - -namespace stress_tests { - - - -} // namespace stress_tests diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp deleted file mode 100644 index 79794d25748..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_fixture.hpp +++ /dev/null @@ -1,96 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include "gtest/gtest.h" -#include "event_fixture.hpp" -#include "buffer_fixture.hpp" -#include "dispatch_fixture.hpp" -#include "program_fixture.hpp" -#include "tt_metal/host_api.hpp" -#include "tt_metal/detail/tt_metal.hpp" -#include "tt_metal/test_utils/env_vars.hpp" -#include "tt_metal/llrt/rtoptions.hpp" - -using namespace tt::tt_metal; - -class MultiCommandQueueSingleDeviceFixture : virtual public DispatchFixture { - protected: - void SetUp() override { - auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); - if (slow_dispatch) { - TT_THROW("This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); - GTEST_SKIP(); - } - auto num_cqs = tt::llrt::OptionsG.get_num_hw_cqs(); - if (num_cqs != 2) { - TT_THROW("This suite must be run with TT_METAL_GTEST_NUM_HW_CQS=2"); - GTEST_SKIP(); - } - arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); - DispatchCoreType dispatch_core_type = DispatchCoreType::WORKER; - if (arch_ == tt::ARCH::WORMHOLE_B0 and tt::tt_metal::GetNumAvailableDevices() != 1) { - if (!tt::tt_metal::IsGalaxyCluster()) { - tt::log_warning(tt::LogTest, "Ethernet Dispatch not being explicitly used. Set this configuration in Setup()"); - dispatch_core_type = DispatchCoreType::ETH; - } - } - device_ = tt::tt_metal::CreateDevice(0, num_cqs, DEFAULT_L1_SMALL_SIZE, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); - } - - void TearDown() override { - tt::tt_metal::CloseDevice(device_); - } - - tt::tt_metal::Device* device_; - tt::ARCH arch_; -}; - -class MultiCommandQueueSingleDeviceEventFixture : public MultiCommandQueueSingleDeviceFixture, public EventFixture {}; - -class MultiCommandQueueSingleDeviceBufferFixture : public MultiCommandQueueSingleDeviceFixture, public BufferFixture {}; - -class MultiCommandQueueSingleDeviceProgramFixture : public MultiCommandQueueSingleDeviceFixture, public ProgramFixture {}; - -class MultiCommandQueueMultiDeviceFixture : virtual public DispatchFixture { - protected: - void SetUp() override { - auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); - if (slow_dispatch) { - TT_THROW("This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); - GTEST_SKIP(); - } - auto num_cqs = tt::llrt::OptionsG.get_num_hw_cqs(); - if (num_cqs != 2) { - TT_THROW("This suite must be run with TT_METAL_GTEST_NUM_HW_CQS=2"); - GTEST_SKIP(); - } - const tt::ARCH arch = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); - - - DispatchCoreType dispatch_core_type = DispatchCoreType::WORKER; - if (arch == tt::ARCH::WORMHOLE_B0 and tt::tt_metal::GetNumAvailableDevices() != 1) { - if (!tt::tt_metal::IsGalaxyCluster()) { - tt::log_warning(tt::LogTest, "Ethernet Dispatch not being explicitly used. Set this configuration in Setup()"); - dispatch_core_type = DispatchCoreType::ETH; - } - } - - const chip_id_t mmio_device_id = 0; - reserved_devices_ = tt::tt_metal::detail::CreateDevices({mmio_device_id}, num_cqs, DEFAULT_L1_SMALL_SIZE, DEFAULT_TRACE_REGION_SIZE, dispatch_core_type); - for (const auto &[id, device] : reserved_devices_) { - devices_.push_back(device); - } - } - - void TearDown() override { tt::tt_metal::detail::CloseDevices(reserved_devices_); } - - std::vector devices_; - std::map reserved_devices_; -}; - -class MultiCommandQueueMultiDeviceBufferFixture : public MultiCommandQueueMultiDeviceFixture, public BufferFixture {}; - -class MultiCommandQueueMultiDeviceEventFixture : public MultiCommandQueueMultiDeviceFixture, public EventFixture {}; From ffe75be91c671132c8d4eb3ffd305fa1af978462 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Fri, 8 Nov 2024 14:55:46 +0000 Subject: [PATCH 18/26] #0: More restructuring --- tests/tt_metal/tt_metal/CMakeLists.txt | 8 +- .../tt_metal/dispatch_program/CMakeLists.txt | 1 + .../dispatch_program/test_sub_device.cpp | 329 +++++++++++ .../tt_metal/dispatch_trace/CMakeLists.txt | 5 +- .../dispatch_trace/test_sub_device.cpp | 382 ++++++++++++ tests/tt_metal/tt_metal/eth/CMakeLists.txt | 26 + ...s.cpp => test_buffer_movement_kernels.cpp} | 0 ...end.cpp => test_erisc_app_direct_send.cpp} | 0 .../tt_metal/integration/CMakeLists.txt | 32 + ...matmul_utils.hpp => matmul_test_utils.hpp} | 0 .../integration/matmul/test_matmul_X_tile.cpp | 6 +- .../matmul/test_matmul_large_block.cpp | 7 +- .../matmul/test_matmul_multi_core_X_dram.cpp | 5 +- ...ti_core_multi_dram_in0_mcast_in1_mcast.cpp | 6 +- ...matmul_multi_core_multi_dram_inX_mcast.cpp | 4 +- .../matmul/test_matmul_single_core.cpp | 6 +- tests/tt_metal/tt_metal/llk/CMakeLists.txt | 2 +- .../test_enqueue_program.cpp | 0 .../misc/sub_device}/incrementer.cpp | 0 .../sub_device}/persistent_remote_waiter.cpp | 0 .../misc/sub_device}/persistent_waiter.cpp | 0 .../misc/sub_device}/syncer.cpp | 0 .../tt_metal/unit_tests/CMakeLists.txt | 102 ---- tests/tt_metal/tt_metal/unit_tests/README.md | 44 -- .../tt_metal/unit_tests_common/CMakeLists.txt | 54 -- .../unit_tests_fast_dispatch/CMakeLists.txt | 1 - .../unit_tests_fast_dispatch/README.md | 44 -- .../sub_device/test_sub_device.cpp | 557 ------------------ .../unit_tests_fast_dispatch/tests_main.cpp | 5 - .../CMakeLists.txt | 28 - .../tests_main.cpp | 5 - .../unit_tests_frequent/CMakeLists.txt | 27 - .../unit_tests_frequent/tests_main.cpp | 5 - 33 files changed, 790 insertions(+), 901 deletions(-) create mode 100644 tests/tt_metal/tt_metal/dispatch_program/test_sub_device.cpp create mode 100644 tests/tt_metal/tt_metal/dispatch_trace/test_sub_device.cpp create mode 100644 tests/tt_metal/tt_metal/eth/CMakeLists.txt rename tests/tt_metal/tt_metal/eth/{buffer_movement_kernels.cpp => test_buffer_movement_kernels.cpp} (100%) rename tests/tt_metal/tt_metal/eth/{erisc_app_direct_send.cpp => test_erisc_app_direct_send.cpp} (100%) create mode 100644 tests/tt_metal/tt_metal/integration/CMakeLists.txt rename tests/tt_metal/tt_metal/integration/matmul/{matmul_utils.hpp => matmul_test_utils.hpp} (100%) rename tests/tt_metal/tt_metal/{tt_dispatch => }/test_enqueue_program.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch/sub_device/kernels => test_kernels/misc/sub_device}/incrementer.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch/sub_device/kernels => test_kernels/misc/sub_device}/persistent_remote_waiter.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch/sub_device/kernels => test_kernels/misc/sub_device}/persistent_waiter.cpp (100%) rename tests/tt_metal/tt_metal/{unit_tests_fast_dispatch/sub_device/kernels => test_kernels/misc/sub_device}/syncer.cpp (100%) delete mode 100644 tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt delete mode 100644 tests/tt_metal/tt_metal/unit_tests/README.md delete mode 100644 tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt delete mode 100644 tests/tt_metal/tt_metal/unit_tests_fast_dispatch/README.md delete mode 100644 tests/tt_metal/tt_metal/unit_tests_fast_dispatch/tests_main.cpp delete mode 100644 tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/CMakeLists.txt delete mode 100644 tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/tests_main.cpp delete mode 100644 tests/tt_metal/tt_metal/unit_tests_frequent/CMakeLists.txt delete mode 100644 tests/tt_metal/tt_metal/unit_tests_frequent/tests_main.cpp diff --git a/tests/tt_metal/tt_metal/CMakeLists.txt b/tests/tt_metal/tt_metal/CMakeLists.txt index 565294b163c..81c1aa43123 100644 --- a/tests/tt_metal/tt_metal/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/CMakeLists.txt @@ -76,6 +76,9 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_buffer) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_event) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_program) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_trace) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/eth) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/integration) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/llk) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/perf_microbenchmark) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stl) @@ -87,8 +90,8 @@ add_custom_target( #unit_tests_fast_dispatch #unit_tests_fast_dispatch_single_chip_multi_queue #unit_tests_frequent - #metal_perf_microbenchmark_tests #unit_tests_galaxy + metal_perf_microbenchmark_tests unit_tests_api unit_tests_debug_tools unit_tests_device @@ -96,5 +99,8 @@ add_custom_target( unit_tests_dispatch_event unit_tests_dispatch_program unit_tests_dispatch_trace + unit_tests_eth + unit_tests_integration + unit_tests_llk unit_tests_stl ) diff --git a/tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt index 1efcfe6f72e..1b773c26b2c 100644 --- a/tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt @@ -1,6 +1,7 @@ set(UNIT_TESTS_DISPATCH_PROGRAM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_dispatch.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueProgram.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_sub_device.cpp ) add_executable(unit_tests_dispatch_program ${UNIT_TESTS_DISPATCH_PROGRAM_SRC}) diff --git a/tests/tt_metal/tt_metal/dispatch_program/test_sub_device.cpp b/tests/tt_metal/tt_metal/dispatch_program/test_sub_device.cpp new file mode 100644 index 00000000000..f92bc4df06e --- /dev/null +++ b/tests/tt_metal/tt_metal/dispatch_program/test_sub_device.cpp @@ -0,0 +1,329 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#include +#include +#include +#include +#include + +#include "gtest/gtest.h" +#include "tt_metal/common/core_coord.hpp" +#include "tt_metal/impl/buffers/global_semaphore.hpp" +#include "tt_metal/impl/device/device.hpp" +#include "tt_metal/impl/event/event.hpp" +#include "tt_metal/impl/sub_device/sub_device.hpp" +#include "test_utils/stimulus.hpp" +#include "command_queue_fixture.hpp" +#include "command_queue_test_utils.hpp" + +std::tuple> create_single_sync_program(Device *device, SubDevice sub_device) { + auto syncer_coord = sub_device.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; + auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); + auto global_sem = CreateGlobalSemaphore(device, sub_device.cores(HalProgrammableCoreType::TENSIX), INVALID); + + Program syncer_program = CreateProgram(); + auto syncer_kernel = CreateKernel( + syncer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", + syncer_core, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, + .noc = NOC::RISCV_0_default}); + std::array syncer_rt_args = {global_sem->address()}; + SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); + return {std::move(syncer_program), std::move(syncer_coord), std::move(global_sem)}; +} + +std::tuple> create_basic_sync_program(Device *device, const SubDevice& sub_device_1, const SubDevice& sub_device_2) { + auto waiter_coord = sub_device_2.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; + auto waiter_core = CoreRangeSet(CoreRange(waiter_coord, waiter_coord)); + auto waiter_core_physical = device->worker_core_from_logical_core(waiter_coord); + auto incrementer_cores = sub_device_1.cores(HalProgrammableCoreType::TENSIX); + auto syncer_coord = incrementer_cores.ranges().back().end_coord; + auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); + auto syncer_core_physical = device->worker_core_from_logical_core(syncer_coord); + auto all_cores = waiter_core.merge(incrementer_cores).merge(syncer_core); + auto global_sem = CreateGlobalSemaphore(device, all_cores, INVALID); + + Program waiter_program = CreateProgram(); + auto waiter_kernel = CreateKernel( + waiter_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_waiter.cpp", + waiter_core, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, + .noc = NOC::RISCV_0_default}); + std::array waiter_rt_args = {global_sem->address(), incrementer_cores.num_cores(), syncer_core_physical.x, syncer_core_physical.y}; + SetRuntimeArgs(waiter_program, waiter_kernel, waiter_core, waiter_rt_args); + + Program syncer_program = CreateProgram(); + auto syncer_kernel = CreateKernel( + syncer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", + syncer_core, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, + .noc = NOC::RISCV_0_default}); + std::array syncer_rt_args = {global_sem->address()}; + SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); + + Program incrementer_program = CreateProgram(); + auto incrementer_kernel = CreateKernel( + incrementer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/incrementer.cpp", + incrementer_cores, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_1, + .noc = NOC::RISCV_1_default}); + std::array incrementer_rt_args = {global_sem->address(), waiter_core_physical.x, waiter_core_physical.y}; + SetRuntimeArgs(incrementer_program, incrementer_kernel, incrementer_cores, incrementer_rt_args); + return {std::move(waiter_program), std::move(syncer_program), std::move(incrementer_program), std::move(global_sem)}; +} + +std::tuple> create_basic_eth_sync_program(Device *device, const SubDevice& sub_device_1, const SubDevice& sub_device_2) { + auto waiter_coord = sub_device_2.cores(HalProgrammableCoreType::ACTIVE_ETH).ranges().at(0).start_coord; + auto waiter_core = CoreRangeSet(CoreRange(waiter_coord, waiter_coord)); + auto waiter_core_physical = device->ethernet_core_from_logical_core(waiter_coord); + auto tensix_waiter_coord = sub_device_2.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; + auto tensix_waiter_core = CoreRangeSet(CoreRange(tensix_waiter_coord, tensix_waiter_coord)); + auto tensix_waiter_core_physical = device->worker_core_from_logical_core(tensix_waiter_coord); + auto incrementer_cores = sub_device_1.cores(HalProgrammableCoreType::TENSIX); + auto syncer_coord = incrementer_cores.ranges().back().end_coord; + auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); + auto syncer_core_physical = device->worker_core_from_logical_core(syncer_coord); + auto all_cores = tensix_waiter_core.merge(incrementer_cores).merge(syncer_core); + auto global_sem = CreateGlobalSemaphore(device, all_cores, INVALID); + + Program waiter_program = CreateProgram(); + auto waiter_kernel = CreateKernel( + waiter_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_remote_waiter.cpp", + waiter_core, + EthernetConfig{ + .noc = NOC::RISCV_0_default, + .processor = DataMovementProcessor::RISCV_0}); + std::array waiter_rt_args = {global_sem->address(), incrementer_cores.num_cores(), syncer_core_physical.x, syncer_core_physical.y, tensix_waiter_core_physical.x, tensix_waiter_core_physical.y, eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE}; + SetRuntimeArgs(waiter_program, waiter_kernel, waiter_core, waiter_rt_args); + + Program syncer_program = CreateProgram(); + auto syncer_kernel = CreateKernel( + syncer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", + syncer_core, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, + .noc = NOC::RISCV_0_default}); + std::array syncer_rt_args = {global_sem->address()}; + SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); + + Program incrementer_program = CreateProgram(); + auto incrementer_kernel = CreateKernel( + incrementer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/incrementer.cpp", + incrementer_cores, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_1, + .noc = NOC::RISCV_1_default}); + std::array incrementer_rt_args = {global_sem->address(), tensix_waiter_core_physical.x, tensix_waiter_core_physical.y}; + SetRuntimeArgs(incrementer_program, incrementer_kernel, incrementer_cores, incrementer_rt_args); + return {std::move(waiter_program), std::move(syncer_program), std::move(incrementer_program), std::move(global_sem)}; +} + +TEST_F(CommandQueueSingleCardFixture, TensixTestSubDeviceAllocations) { + uint32_t local_l1_size = 3200; + SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); + SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); + CoreRangeSet sharded_cores_1 = CoreRange({0, 0}, {2, 2}); + CoreRangeSet sharded_cores_2 = CoreRange({4, 4}, {4, 4}); + + auto sharded_cores_1_vec = corerange_to_cores(sharded_cores_1, std::nullopt, true); + auto sharded_cores_2_vec = corerange_to_cores(sharded_cores_2, std::nullopt, true); + + ShardSpecBuffer shard_spec_buffer_1 = ShardSpecBuffer(sharded_cores_1, {1, 1}, ShardOrientation::ROW_MAJOR, false, {1, 1}, {sharded_cores_1.num_cores(), 1}); + uint32_t page_size_1 = 32; + ShardedBufferConfig shard_config_1 = {nullptr, sharded_cores_1.num_cores() * page_size_1, page_size_1, BufferType::L1, TensorMemoryLayout::HEIGHT_SHARDED, shard_spec_buffer_1}; + auto input_1 = tt::test_utils::generate_uniform_random_vector(0, 100, shard_config_1.size / sizeof(uint32_t)); + + ShardSpecBuffer shard_spec_buffer_2 = ShardSpecBuffer(sharded_cores_2, {1, 1}, ShardOrientation::ROW_MAJOR, false, {1, 1}, {sharded_cores_2.num_cores(), 1}); + uint32_t page_size_2 = 64; + ShardedBufferConfig shard_config_2 = {nullptr, sharded_cores_2.num_cores() * page_size_2, page_size_2, BufferType::L1, TensorMemoryLayout::HEIGHT_SHARDED, shard_spec_buffer_2}; + auto input_2 = tt::test_utils::generate_uniform_random_vector(0, 100, shard_config_2.size / sizeof(uint32_t)); + + uint32_t page_size_3 = 1024; + InterleavedBufferConfig interleaved_config = {nullptr, page_size_3, page_size_3, BufferType::L1, TensorMemoryLayout::INTERLEAVED}; + auto input_3 = tt::test_utils::generate_uniform_random_vector(0, 100, interleaved_config.size / sizeof(uint32_t)); + + for (Device *device : devices_) { + auto sub_device_manager_1 = device->create_sub_device_manager({sub_device_1}, local_l1_size); + auto sub_device_manager_2 = device->create_sub_device_manager({sub_device_1, sub_device_2}, local_l1_size); + DeviceAddr l1_unreserved_base = device->get_base_allocator_addr(HalMemType::L1); + DeviceAddr max_addr = l1_unreserved_base + local_l1_size; + + shard_config_1.device = device; + shard_config_2.device = device; + interleaved_config.device = device; + + std::vector physical_cores_1; + physical_cores_1.reserve(sharded_cores_1_vec.size()); + for (const auto& core : sharded_cores_1_vec) { + physical_cores_1.push_back(device->worker_core_from_logical_core(core)); + } + + std::vector physical_cores_2; + physical_cores_2.reserve(sharded_cores_2_vec.size()); + for (const auto& core : sharded_cores_2_vec) { + physical_cores_2.push_back(device->worker_core_from_logical_core(core)); + } + + device->load_sub_device_manager(sub_device_manager_1); + + auto buffer_1 = CreateBuffer(shard_config_1, SubDeviceId{0}); + EXPECT_EQ(buffer_1->address(), max_addr - page_size_1); + EnqueueWriteBuffer(device->command_queue(), buffer_1, input_1, false); + std::vector output_1; + EnqueueReadBuffer(device->command_queue(), buffer_1, output_1, true); + EXPECT_EQ(input_1, output_1); + auto input_1_it = input_1.begin(); + for (const auto& physical_core : physical_cores_1) { + auto readback = tt::llrt::read_hex_vec_from_core( + device->id(), physical_core, buffer_1->address(), page_size_1); + EXPECT_TRUE(std::equal(input_1_it, input_1_it + page_size_1 / sizeof(uint32_t), readback.begin())); + input_1_it += page_size_1 / sizeof(uint32_t); + } + + auto buffer_2 = CreateBuffer(interleaved_config); + EXPECT_THROW(CreateBuffer(shard_config_1, SubDeviceId{1}), std::exception); + EXPECT_THROW(device->clear_loaded_sub_device_manager(), std::exception); + EXPECT_THROW(device->load_sub_device_manager(sub_device_manager_2), std::exception); + DeallocateBuffer(*buffer_1); + device->clear_loaded_sub_device_manager(); + device->load_sub_device_manager(sub_device_manager_2); + + auto buffer_3 = CreateBuffer(shard_config_2, SubDeviceId{1}); + EXPECT_EQ(buffer_3->address(), max_addr - page_size_2); + EnqueueWriteBuffer(device->command_queue(), buffer_3, input_2, false); + std::vector output_2; + EnqueueReadBuffer(device->command_queue(), buffer_3, output_2, true); + EXPECT_EQ(input_2, output_2); + auto input_2_it = input_2.begin(); + for (const auto& physical_core : physical_cores_2) { + auto readback = tt::llrt::read_hex_vec_from_core( + device->id(), physical_core, buffer_3->address(), page_size_2); + EXPECT_TRUE(std::equal(input_2_it, input_2_it + page_size_2 / sizeof(uint32_t), readback.begin())); + input_2_it += page_size_2 / sizeof(uint32_t); + } + + auto buffer_4 = CreateBuffer(shard_config_1, SubDeviceId{0}); + EXPECT_EQ(buffer_4->address(), max_addr - page_size_1); + EXPECT_THROW(CreateBuffer(interleaved_config, SubDeviceId{0}), std::exception); + } +} + +TEST_F(CommandQueueSingleCardFixture, TensixTestSubDeviceSynchronization) { + uint32_t local_l1_size = 3200; + SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); + SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); + CoreRangeSet sharded_cores_1 = CoreRange({0, 0}, {2, 2}); + + auto sharded_cores_1_vec = corerange_to_cores(sharded_cores_1, std::nullopt, true); + + ShardSpecBuffer shard_spec_buffer_1 = ShardSpecBuffer(sharded_cores_1, {1, 1}, ShardOrientation::ROW_MAJOR, false, {1, 1}, {sharded_cores_1.num_cores(), 1}); + uint32_t page_size_1 = 32; + ShardedBufferConfig shard_config_1 = {nullptr, sharded_cores_1.num_cores() * page_size_1, page_size_1, BufferType::L1, TensorMemoryLayout::HEIGHT_SHARDED, shard_spec_buffer_1}; + auto input_1 = tt::test_utils::generate_uniform_random_vector(0, 100, shard_config_1.size / sizeof(uint32_t)); + + std::array sub_device_ids_to_block = {SubDeviceId{0}}; + for (Device *device : devices_) { + auto sub_device_manager = device->create_sub_device_manager({sub_device_1, sub_device_2}, local_l1_size); + + shard_config_1.device = device; + + std::vector physical_cores_1; + physical_cores_1.reserve(sharded_cores_1_vec.size()); + for (const auto& core : sharded_cores_1_vec) { + physical_cores_1.push_back(device->worker_core_from_logical_core(core)); + } + + device->load_sub_device_manager(sub_device_manager); + + auto [program, syncer_core, global_semaphore] = create_single_sync_program(device, sub_device_2); + EnqueueProgram(device->command_queue(), program, false); + + auto buffer_1 = CreateBuffer(shard_config_1, sub_device_ids_to_block[0]); + + // Test blocking synchronize doesn't stall + Synchronize(device, 0, sub_device_ids_to_block); + + // Test blocking write buffer doesn't stall + EnqueueWriteBuffer(device->command_queue(), buffer_1, input_1, true, sub_device_ids_to_block); + + // Test record event won't cause a stall + auto event = std::make_shared(); + EnqueueRecordEvent(device->command_queue(), event, sub_device_ids_to_block); + Synchronize(device, 0, sub_device_ids_to_block); + + // Test blocking read buffer doesn't stall + std::vector output_1; + EnqueueReadBuffer(device->command_queue(), buffer_1, output_1, true, sub_device_ids_to_block); + EXPECT_EQ(input_1, output_1); + auto input_1_it = input_1.begin(); + for (const auto& physical_core : physical_cores_1) { + auto readback = tt::llrt::read_hex_vec_from_core( + device->id(), physical_core, buffer_1->address(), page_size_1); + EXPECT_TRUE(std::equal(input_1_it, input_1_it + page_size_1 / sizeof(uint32_t), readback.begin())); + input_1_it += page_size_1 / sizeof(uint32_t); + } + auto sem_addr = global_semaphore->address(); + auto physical_syncer_core = device->worker_core_from_logical_core(syncer_core); + tt::llrt::write_hex_vec_to_core(device->id(), physical_syncer_core, std::vector{1}, sem_addr); + + // Full synchronization + Synchronize(device); + } +} + +TEST_F(CommandQueueSingleCardFixture, TensixTestSubDeviceBasicPrograms) { + SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); + SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); + uint32_t num_iters = 5; + for (Device *device : devices_) { + auto sub_device_manager = device->create_sub_device_manager({sub_device_1, sub_device_2}, 3200); + device->load_sub_device_manager(sub_device_manager); + + auto [waiter_program, syncer_program, incrementer_program, global_sem] = create_basic_sync_program(device, sub_device_1, sub_device_2); + + for (uint32_t i = 0; i < num_iters; i++) { + EnqueueProgram(device->command_queue(), waiter_program, false); + // Test blocking on one sub-device + EnqueueProgram(device->command_queue(), syncer_program, true); + EnqueueProgram(device->command_queue(), incrementer_program, false); + } + Synchronize(device); + } +} + +TEST_F(CommandQueueSingleCardFixture, TensixActiveEthTestSubDeviceBasicEthPrograms) { + SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); + uint32_t num_iters = 5; + for (Device *device : devices_) { + if (!does_device_have_active_eth_cores(device)) { + GTEST_SKIP() << "Skipping test because device " << device->id() << " does not have any active ethernet cores"; + } + auto eth_core = *device->get_active_ethernet_cores(true).begin(); + SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})}), CoreRangeSet(CoreRange(eth_core, eth_core))}); + auto sub_device_manager = device->create_sub_device_manager({sub_device_1, sub_device_2}, 3200); + device->load_sub_device_manager(sub_device_manager); + + auto [waiter_program, syncer_program, incrementer_program, global_sem] = create_basic_eth_sync_program(device, sub_device_1, sub_device_2); + + for (uint32_t i = 0; i < num_iters; i++) { + EnqueueProgram(device->command_queue(), waiter_program, false); + // Test blocking on one sub-device + EnqueueProgram(device->command_queue(), syncer_program, true); + EnqueueProgram(device->command_queue(), incrementer_program, false); + } + Synchronize(device); + } +} \ No newline at end of file diff --git a/tests/tt_metal/tt_metal/dispatch_trace/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch_trace/CMakeLists.txt index d33ff80f029..3be36870c5e 100644 --- a/tests/tt_metal/tt_metal/dispatch_trace/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/dispatch_trace/CMakeLists.txt @@ -1,4 +1,7 @@ -set(UNIT_TESTS_DISPATCH_TRACE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueTrace.cpp) +set(UNIT_TESTS_DISPATCH_TRACE_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueTrace.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_sub_device.cpp +) add_executable(unit_tests_dispatch_trace ${UNIT_TESTS_DISPATCH_TRACE_SRC}) TT_ENABLE_UNITY_BUILD(unit_tests_dispatch_trace) diff --git a/tests/tt_metal/tt_metal/dispatch_trace/test_sub_device.cpp b/tests/tt_metal/tt_metal/dispatch_trace/test_sub_device.cpp new file mode 100644 index 00000000000..378433d6b01 --- /dev/null +++ b/tests/tt_metal/tt_metal/dispatch_trace/test_sub_device.cpp @@ -0,0 +1,382 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#include +#include +#include +#include +#include + +#include "gtest/gtest.h" +#include "tt_metal/common/core_coord.hpp" +#include "tt_metal/impl/buffers/global_semaphore.hpp" +#include "tt_metal/impl/device/device.hpp" +#include "tt_metal/impl/event/event.hpp" +#include "tt_metal/impl/sub_device/sub_device.hpp" +#include "test_utils/stimulus.hpp" +#include "command_queue_fixture.hpp" +#include "command_queue_test_utils.hpp" + +std::tuple> create_single_sync_program(Device *device, SubDevice sub_device) { + auto syncer_coord = sub_device.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; + auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); + auto global_sem = CreateGlobalSemaphore(device, sub_device.cores(HalProgrammableCoreType::TENSIX), INVALID); + + Program syncer_program = CreateProgram(); + auto syncer_kernel = CreateKernel( + syncer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", + syncer_core, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, + .noc = NOC::RISCV_0_default}); + std::array syncer_rt_args = {global_sem->address()}; + SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); + return {std::move(syncer_program), std::move(syncer_coord), std::move(global_sem)}; +} + +std::tuple> create_basic_sync_program(Device *device, const SubDevice& sub_device_1, const SubDevice& sub_device_2) { + auto waiter_coord = sub_device_2.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; + auto waiter_core = CoreRangeSet(CoreRange(waiter_coord, waiter_coord)); + auto waiter_core_physical = device->worker_core_from_logical_core(waiter_coord); + auto incrementer_cores = sub_device_1.cores(HalProgrammableCoreType::TENSIX); + auto syncer_coord = incrementer_cores.ranges().back().end_coord; + auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); + auto syncer_core_physical = device->worker_core_from_logical_core(syncer_coord); + auto all_cores = waiter_core.merge(incrementer_cores).merge(syncer_core); + auto global_sem = CreateGlobalSemaphore(device, all_cores, INVALID); + + Program waiter_program = CreateProgram(); + auto waiter_kernel = CreateKernel( + waiter_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_waiter.cpp", + waiter_core, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, + .noc = NOC::RISCV_0_default}); + std::array waiter_rt_args = {global_sem->address(), incrementer_cores.num_cores(), syncer_core_physical.x, syncer_core_physical.y}; + SetRuntimeArgs(waiter_program, waiter_kernel, waiter_core, waiter_rt_args); + + Program syncer_program = CreateProgram(); + auto syncer_kernel = CreateKernel( + syncer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", + syncer_core, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, + .noc = NOC::RISCV_0_default}); + std::array syncer_rt_args = {global_sem->address()}; + SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); + + Program incrementer_program = CreateProgram(); + auto incrementer_kernel = CreateKernel( + incrementer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/incrementer.cpp", + incrementer_cores, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_1, + .noc = NOC::RISCV_1_default}); + std::array incrementer_rt_args = {global_sem->address(), waiter_core_physical.x, waiter_core_physical.y}; + SetRuntimeArgs(incrementer_program, incrementer_kernel, incrementer_cores, incrementer_rt_args); + return {std::move(waiter_program), std::move(syncer_program), std::move(incrementer_program), std::move(global_sem)}; +} + +std::tuple> create_basic_eth_sync_program(Device *device, const SubDevice& sub_device_1, const SubDevice& sub_device_2) { + auto waiter_coord = sub_device_2.cores(HalProgrammableCoreType::ACTIVE_ETH).ranges().at(0).start_coord; + auto waiter_core = CoreRangeSet(CoreRange(waiter_coord, waiter_coord)); + auto waiter_core_physical = device->ethernet_core_from_logical_core(waiter_coord); + auto tensix_waiter_coord = sub_device_2.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; + auto tensix_waiter_core = CoreRangeSet(CoreRange(tensix_waiter_coord, tensix_waiter_coord)); + auto tensix_waiter_core_physical = device->worker_core_from_logical_core(tensix_waiter_coord); + auto incrementer_cores = sub_device_1.cores(HalProgrammableCoreType::TENSIX); + auto syncer_coord = incrementer_cores.ranges().back().end_coord; + auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); + auto syncer_core_physical = device->worker_core_from_logical_core(syncer_coord); + auto all_cores = tensix_waiter_core.merge(incrementer_cores).merge(syncer_core); + auto global_sem = CreateGlobalSemaphore(device, all_cores, INVALID); + + Program waiter_program = CreateProgram(); + auto waiter_kernel = CreateKernel( + waiter_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_remote_waiter.cpp", + waiter_core, + EthernetConfig{ + .noc = NOC::RISCV_0_default, + .processor = DataMovementProcessor::RISCV_0}); + std::array waiter_rt_args = {global_sem->address(), incrementer_cores.num_cores(), syncer_core_physical.x, syncer_core_physical.y, tensix_waiter_core_physical.x, tensix_waiter_core_physical.y, eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE}; + SetRuntimeArgs(waiter_program, waiter_kernel, waiter_core, waiter_rt_args); + + Program syncer_program = CreateProgram(); + auto syncer_kernel = CreateKernel( + syncer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", + syncer_core, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, + .noc = NOC::RISCV_0_default}); + std::array syncer_rt_args = {global_sem->address()}; + SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); + + Program incrementer_program = CreateProgram(); + auto incrementer_kernel = CreateKernel( + incrementer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/incrementer.cpp", + incrementer_cores, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_1, + .noc = NOC::RISCV_1_default}); + std::array incrementer_rt_args = {global_sem->address(), tensix_waiter_core_physical.x, tensix_waiter_core_physical.y}; + SetRuntimeArgs(incrementer_program, incrementer_kernel, incrementer_cores, incrementer_rt_args); + return {std::move(waiter_program), std::move(syncer_program), std::move(incrementer_program), std::move(global_sem)}; +} + +TEST_F(CommandQueueSingleCardTraceFixture, TensixTestSubDeviceTraceBasicPrograms) { + SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); + SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); + uint32_t num_iters = 5; + for (Device *device : devices_) { + auto sub_device_manager = device->create_sub_device_manager({sub_device_1, sub_device_2}, 3200); + device->load_sub_device_manager(sub_device_manager); + + auto [waiter_program, syncer_program, incrementer_program, global_sem] = create_basic_sync_program(device, sub_device_1, sub_device_2); + + // Compile the programs + EnqueueProgram(device->command_queue(), waiter_program, false); + // Test blocking on one sub-device + EnqueueProgram(device->command_queue(), syncer_program, true); + EnqueueProgram(device->command_queue(), incrementer_program, false); + Synchronize(device); + + // Capture the trace + auto tid_1 = BeginTraceCapture(device, device->command_queue().id()); + EnqueueProgram(device->command_queue(), waiter_program, false); + EnqueueProgram(device->command_queue(), syncer_program, false); + EnqueueProgram(device->command_queue(), incrementer_program, false); + EndTraceCapture(device, device->command_queue().id(), tid_1); + + auto tid_2 = BeginTraceCapture(device, device->command_queue().id()); + EnqueueProgram(device->command_queue(), syncer_program, false); + EnqueueProgram(device->command_queue(), incrementer_program, false); + EndTraceCapture(device, device->command_queue().id(), tid_2); + + for (uint32_t i = 0; i < num_iters; i++) { + // Regular program execution + EnqueueProgram(device->command_queue(), waiter_program, false); + // Test blocking on one sub-device + EnqueueProgram(device->command_queue(), syncer_program, true); + EnqueueProgram(device->command_queue(), incrementer_program, false); + + // Full trace execution + ReplayTrace(device, device->command_queue().id(), tid_1, false); + + // Partial trace execution + EnqueueProgram(device->command_queue(), waiter_program, false); + ReplayTrace(device, device->command_queue().id(), tid_2, false); + } + Synchronize(device); + } +} + +TEST_F(CommandQueueSingleCardTraceFixture, TensixActiveEthTestSubDeviceTraceBasicEthPrograms) { + SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); + uint32_t num_iters = 5; + for (Device *device : devices_) { + if (!does_device_have_active_eth_cores(device)) { + GTEST_SKIP() << "Skipping test because device " << device->id() << " does not have any active ethernet cores"; + } + auto eth_core = *device->get_active_ethernet_cores(true).begin(); + SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})}), CoreRangeSet(CoreRange(eth_core, eth_core))}); + auto sub_device_manager = device->create_sub_device_manager({sub_device_1, sub_device_2}, 3200); + device->load_sub_device_manager(sub_device_manager); + + auto [waiter_program, syncer_program, incrementer_program, global_sem] = create_basic_eth_sync_program(device, sub_device_1, sub_device_2); + + // Compile the programs + EnqueueProgram(device->command_queue(), waiter_program, false); + // Test blocking on one sub-device + EnqueueProgram(device->command_queue(), syncer_program, true); + EnqueueProgram(device->command_queue(), incrementer_program, false); + Synchronize(device); + + // Capture the trace + auto tid_1 = BeginTraceCapture(device, device->command_queue().id()); + EnqueueProgram(device->command_queue(), waiter_program, false); + EnqueueProgram(device->command_queue(), syncer_program, false); + EnqueueProgram(device->command_queue(), incrementer_program, false); + EndTraceCapture(device, device->command_queue().id(), tid_1); + + auto tid_2 = BeginTraceCapture(device, device->command_queue().id()); + EnqueueProgram(device->command_queue(), syncer_program, false); + EnqueueProgram(device->command_queue(), incrementer_program, false); + EndTraceCapture(device, device->command_queue().id(), tid_2); + + for (uint32_t i = 0; i < num_iters; i++) { + // Regular program execution + EnqueueProgram(device->command_queue(), waiter_program, false); + // Test blocking on one sub-device + EnqueueProgram(device->command_queue(), syncer_program, true); + EnqueueProgram(device->command_queue(), incrementer_program, false); + + // Full trace execution + ReplayTrace(device, device->command_queue().id(), tid_1, false); + + // Partial trace execution + EnqueueProgram(device->command_queue(), waiter_program, false); + ReplayTrace(device, device->command_queue().id(), tid_2, false); + } + Synchronize(device); + } +} + +TEST_F(CommandQueueSingleCardTraceFixture, TensixActiveEthTestSubDeviceTraceProgramsReconfigureSubDevices) { + SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); + SubDevice sub_device_2(std::array{CoreRangeSet(std::array{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); + SubDevice sub_device_3(std::array{CoreRangeSet(std::array{CoreRange({2, 4}, {3, 4}), CoreRange({5, 1}, {6, 3})})}); + uint32_t num_iters = 5; + for (Device *device : devices_) { + if (!does_device_have_active_eth_cores(device)) { + GTEST_SKIP() << "Skipping test because device " << device->id() << " does not have any active ethernet cores"; + } + auto eth_core = *device->get_active_ethernet_cores(true).begin(); + SubDevice sub_device_4(std::array{CoreRangeSet(std::array{CoreRange({2, 1}, {2, 2}), CoreRange({1, 5}, {5, 5})}), CoreRangeSet(CoreRange(eth_core, eth_core))}); + + auto sub_device_manager_1 = device->create_sub_device_manager({sub_device_1, sub_device_2}, 3200); + auto sub_device_manager_2 = device->create_sub_device_manager({sub_device_3, sub_device_4}, 3200); + + device->load_sub_device_manager(sub_device_manager_1); + + auto [waiter_program_1, syncer_program_1, incrementer_program_1, global_sem_1] = create_basic_sync_program(device, sub_device_1, sub_device_2); + + // Compile the programs + EnqueueProgram(device->command_queue(), waiter_program_1, false); + EnqueueProgram(device->command_queue(), syncer_program_1, false); + EnqueueProgram(device->command_queue(), incrementer_program_1, false); + Synchronize(device); + + // Capture the trace + auto tid_1 = BeginTraceCapture(device, device->command_queue().id()); + EnqueueProgram(device->command_queue(), waiter_program_1, false); + EnqueueProgram(device->command_queue(), syncer_program_1, false); + EnqueueProgram(device->command_queue(), incrementer_program_1, false); + EndTraceCapture(device, device->command_queue().id(), tid_1); + + auto tid_2 = BeginTraceCapture(device, device->command_queue().id()); + EnqueueProgram(device->command_queue(), syncer_program_1, false); + EnqueueProgram(device->command_queue(), incrementer_program_1, false); + EndTraceCapture(device, device->command_queue().id(), tid_2); + + device->load_sub_device_manager(sub_device_manager_2); + + auto [waiter_program_2, syncer_program_2, incrementer_program_2, global_sem_2] = create_basic_eth_sync_program(device, sub_device_3, sub_device_4); + + // Compile the programs + EnqueueProgram(device->command_queue(), waiter_program_2, false); + EnqueueProgram(device->command_queue(), syncer_program_2, false); + EnqueueProgram(device->command_queue(), incrementer_program_2, false); + Synchronize(device); + + // Capture the trace + auto tid_3 = BeginTraceCapture(device, device->command_queue().id()); + EnqueueProgram(device->command_queue(), waiter_program_2, false); + EnqueueProgram(device->command_queue(), syncer_program_2, false); + EnqueueProgram(device->command_queue(), incrementer_program_2, false); + EndTraceCapture(device, device->command_queue().id(), tid_3); + + auto tid_4 = BeginTraceCapture(device, device->command_queue().id()); + EnqueueProgram(device->command_queue(), syncer_program_2, false); + EnqueueProgram(device->command_queue(), incrementer_program_2, false); + EndTraceCapture(device, device->command_queue().id(), tid_4); + + for (uint32_t i = 0; i < num_iters; i++) { + device->load_sub_device_manager(sub_device_manager_1); + // Regular program execution + EnqueueProgram(device->command_queue(), waiter_program_1, false); + // Test blocking on one sub-device + EnqueueProgram(device->command_queue(), syncer_program_1, false); + EnqueueProgram(device->command_queue(), incrementer_program_1, false); + + // Full trace execution + ReplayTrace(device, device->command_queue().id(), tid_1, false); + + // Partial trace execution + EnqueueProgram(device->command_queue(), waiter_program_1, false); + ReplayTrace(device, device->command_queue().id(), tid_2, false); + + device->load_sub_device_manager(sub_device_manager_2); + // Regular program execution + EnqueueProgram(device->command_queue(), waiter_program_2, false); + // Test blocking on one sub-device + EnqueueProgram(device->command_queue(), syncer_program_2, false); + EnqueueProgram(device->command_queue(), incrementer_program_2, false); + + // Full trace execution + ReplayTrace(device, device->command_queue().id(), tid_3, false); + + // Partial trace execution + EnqueueProgram(device->command_queue(), waiter_program_2, false); + ReplayTrace(device, device->command_queue().id(), tid_4, false); + } + Synchronize(device); + } +} + +TEST_F(CommandQueueSingleCardTraceFixture, TensixTestSubDeviceIllegalOperations) { + SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); + SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); + + // Assert no idle eth cores specified + EXPECT_THROW(SubDevice sub_device_3(std::array{CoreRangeSet(CoreRange({3, 3}, {3, 3})), CoreRangeSet(CoreRange({4, 4}, {4, 4})), CoreRangeSet(CoreRange({5, 5}, {5, 5}))}), std::exception); + for (Device *device : devices_) { + auto sub_device_manager_1 = device->create_sub_device_manager({sub_device_1, sub_device_2}, 3200); + auto sub_device_manager_2 = device->create_sub_device_manager({sub_device_2, sub_device_1}, 3200); + device->load_sub_device_manager(sub_device_manager_1); + + auto [waiter_program_1, syncer_program_1, incrementer_program_1, global_sem_1] = create_basic_sync_program(device, sub_device_1, sub_device_2); + + // Compile the programs + EnqueueProgram(device->command_queue(), waiter_program_1, false); + // Test blocking on one sub-device + EnqueueProgram(device->command_queue(), syncer_program_1, false); + EnqueueProgram(device->command_queue(), incrementer_program_1, false); + Synchronize(device); + + // Capture the trace + auto tid_1 = BeginTraceCapture(device, device->command_queue().id()); + // Can not load a sub-device manager while tracing + EXPECT_THROW(device->load_sub_device_manager(sub_device_manager_2), std::exception); + EnqueueProgram(device->command_queue(), waiter_program_1, false); + EnqueueProgram(device->command_queue(), syncer_program_1, false); + EnqueueProgram(device->command_queue(), incrementer_program_1, false); + EndTraceCapture(device, device->command_queue().id(), tid_1); + + device->load_sub_device_manager(sub_device_manager_2); + auto [waiter_program_2, syncer_program_2, incrementer_program_2, global_sem_2] = create_basic_sync_program(device, sub_device_2, sub_device_1); + + EnqueueProgram(device->command_queue(), waiter_program_2, false); + EnqueueProgram(device->command_queue(), syncer_program_2, false); + EnqueueProgram(device->command_queue(), incrementer_program_2, false); + Synchronize(device); + + auto tid_2 = BeginTraceCapture(device, device->command_queue().id()); + EnqueueProgram(device->command_queue(), waiter_program_2, false); + EnqueueProgram(device->command_queue(), syncer_program_2, false); + EnqueueProgram(device->command_queue(), incrementer_program_2, false); + EndTraceCapture(device, device->command_queue().id(), tid_2); + + // Regular program execution + // Can not run a program on a different sub-device manager + EXPECT_THROW(EnqueueProgram(device->command_queue(), waiter_program_1, false), std::exception); + + // Full trace execution + ReplayTrace(device, device->command_queue().id(), tid_2, false); + + // Can not replay a trace on a different sub-device manager + EXPECT_THROW(ReplayTrace(device, device->command_queue().id(), tid_1, false), std::exception); + + Synchronize(device); + + device->remove_sub_device_manager(sub_device_manager_1); + EXPECT_THROW(device->load_sub_device_manager(sub_device_manager_1), std::exception); + } +} \ No newline at end of file diff --git a/tests/tt_metal/tt_metal/eth/CMakeLists.txt b/tests/tt_metal/tt_metal/eth/CMakeLists.txt new file mode 100644 index 00000000000..819a3721db3 --- /dev/null +++ b/tests/tt_metal/tt_metal/eth/CMakeLists.txt @@ -0,0 +1,26 @@ +set(UNIT_TESTS_ETH_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/test_buffer_movement_kernels.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_erisc_app_direct_send.cpp +) + +add_executable(unit_tests_eth ${UNIT_TESTS_ETH_SRC}) +TT_ENABLE_UNITY_BUILD(unit_tests_eth) + +target_link_libraries(unit_tests_eth PUBLIC test_metal_common_libs) +target_include_directories( + unit_tests_eth + PRIVATE + ${UMD_HOME} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/common +) +set_target_properties( + unit_tests_eth + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/test/tt_metal +) diff --git a/tests/tt_metal/tt_metal/eth/buffer_movement_kernels.cpp b/tests/tt_metal/tt_metal/eth/test_buffer_movement_kernels.cpp similarity index 100% rename from tests/tt_metal/tt_metal/eth/buffer_movement_kernels.cpp rename to tests/tt_metal/tt_metal/eth/test_buffer_movement_kernels.cpp diff --git a/tests/tt_metal/tt_metal/eth/erisc_app_direct_send.cpp b/tests/tt_metal/tt_metal/eth/test_erisc_app_direct_send.cpp similarity index 100% rename from tests/tt_metal/tt_metal/eth/erisc_app_direct_send.cpp rename to tests/tt_metal/tt_metal/eth/test_erisc_app_direct_send.cpp diff --git a/tests/tt_metal/tt_metal/integration/CMakeLists.txt b/tests/tt_metal/tt_metal/integration/CMakeLists.txt new file mode 100644 index 00000000000..6fff006dbba --- /dev/null +++ b/tests/tt_metal/tt_metal/integration/CMakeLists.txt @@ -0,0 +1,32 @@ +set(UNIT_TESTS_INTEGRATION_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/test_flatten.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_sfpu_compute.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/matmul/test_matmul_large_block.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/matmul/test_matmul_multi_core_X_dram.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/matmul/test_matmul_single_core.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/matmul/test_matmul_X_tile.cpp +) + +add_executable(unit_tests_integration ${UNIT_TESTS_INTEGRATION_SRC}) +TT_ENABLE_UNITY_BUILD(unit_tests_integration) + +target_link_libraries(unit_tests_integration PUBLIC test_metal_common_libs) +target_include_directories( + unit_tests_integration + PRIVATE + ${UMD_HOME} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/common +) +set_target_properties( + unit_tests_integration + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/test/tt_metal +) diff --git a/tests/tt_metal/tt_metal/integration/matmul/matmul_utils.hpp b/tests/tt_metal/tt_metal/integration/matmul/matmul_test_utils.hpp similarity index 100% rename from tests/tt_metal/tt_metal/integration/matmul/matmul_utils.hpp rename to tests/tt_metal/tt_metal/integration/matmul/matmul_test_utils.hpp diff --git a/tests/tt_metal/tt_metal/integration/matmul/test_matmul_X_tile.cpp b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_X_tile.cpp index 530071248e7..4af31133b7a 100644 --- a/tests/tt_metal/tt_metal/integration/matmul/test_matmul_X_tile.cpp +++ b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_X_tile.cpp @@ -2,10 +2,6 @@ // // SPDX-License-Identifier: Apache-2.0 -#include -#include -#include - #include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" @@ -15,7 +11,7 @@ #include "test_tiles.hpp" #include "tests/tt_metal/test_utils/tilization.hpp" #include "tests/tt_metal/test_utils/print_helpers.hpp" -#include "tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/matmul_utils.hpp" +#include "matmul_test_utils.hpp" using std::vector; using namespace tt; diff --git a/tests/tt_metal/tt_metal/integration/matmul/test_matmul_large_block.cpp b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_large_block.cpp index dbb206b7501..88f84f8c1fc 100644 --- a/tests/tt_metal/tt_metal/integration/matmul/test_matmul_large_block.cpp +++ b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_large_block.cpp @@ -2,10 +2,6 @@ // // SPDX-License-Identifier: Apache-2.0 -#include -#include -#include - #include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" @@ -13,8 +9,7 @@ #include "tt_metal/test_utils/deprecated/tensor.hpp" #include "test_tiles.hpp" #include "tests/tt_metal/test_utils/tilization.hpp" -#include "tests/tt_metal/test_utils/print_helpers.hpp" -#include "tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/matmul_utils.hpp" +#include "matmul_test_utils.hpp" using std::vector; using namespace tt; diff --git a/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_X_dram.cpp b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_X_dram.cpp index 0aed1106ee9..678ccace55c 100644 --- a/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_X_dram.cpp +++ b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_X_dram.cpp @@ -3,8 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include -#include #include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" @@ -14,8 +12,7 @@ #include "test_tiles.hpp" #include "tt_metal/impl/dispatch/command_queue.hpp" #include "tests/tt_metal/test_utils/tilization.hpp" -#include "tests/tt_metal/test_utils/print_helpers.hpp" -#include "tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/matmul_utils.hpp" + using std::vector; using namespace tt; diff --git a/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp index 8fd6967f007..aaeba58f704 100644 --- a/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp +++ b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp @@ -3,8 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include -#include #include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" @@ -14,8 +12,8 @@ #include "test_tiles.hpp" #include "hostdevcommon/common_values.hpp" #include "tests/tt_metal/test_utils/tilization.hpp" -#include "tests/tt_metal/test_utils/print_helpers.hpp" -#include "tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/matmul_utils.hpp" +#include "matmul_test_utils.hpp" + using std::vector; using namespace tt; namespace unit_tests_common::matmul::test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast { diff --git a/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp index fa678cd94b4..47a798e4ff2 100644 --- a/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp +++ b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp @@ -12,8 +12,8 @@ #include "test_tiles.hpp" #include "hostdevcommon/common_values.hpp" #include "tests/tt_metal/test_utils/tilization.hpp" -#include "tests/tt_metal/test_utils/print_helpers.hpp" -#include "tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/matmul_utils.hpp" +#include "matmul_test_utils.hpp" + using std::vector; using namespace tt; diff --git a/tests/tt_metal/tt_metal/integration/matmul/test_matmul_single_core.cpp b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_single_core.cpp index f8aca2715c4..62831212fa0 100644 --- a/tests/tt_metal/tt_metal/integration/matmul/test_matmul_single_core.cpp +++ b/tests/tt_metal/tt_metal/integration/matmul/test_matmul_single_core.cpp @@ -2,10 +2,6 @@ // // SPDX-License-Identifier: Apache-2.0 -#include -#include -#include - #include "dispatch_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" @@ -15,7 +11,7 @@ #include "test_tiles.hpp" #include "tests/tt_metal/test_utils/tilization.hpp" #include "tests/tt_metal/test_utils/print_helpers.hpp" -#include "tests/tt_metal/tt_metal/unit_tests_common/compute/matmul/matmul_utils.hpp" +#include "matmul_test_utils.hpp" using std::vector; using namespace tt; diff --git a/tests/tt_metal/tt_metal/llk/CMakeLists.txt b/tests/tt_metal/tt_metal/llk/CMakeLists.txt index a7800aaf352..b70212a3885 100644 --- a/tests/tt_metal/tt_metal/llk/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/llk/CMakeLists.txt @@ -3,7 +3,7 @@ set(UNIT_TESTS_LLK_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_copy_block_matmul_partials.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_cumsum.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_dropout_sfpu_compute.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/test_golden_impl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_golden_impls.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_reconfig.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_reduce.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_sfpu_compute.cpp diff --git a/tests/tt_metal/tt_metal/tt_dispatch/test_enqueue_program.cpp b/tests/tt_metal/tt_metal/test_enqueue_program.cpp similarity index 100% rename from tests/tt_metal/tt_metal/tt_dispatch/test_enqueue_program.cpp rename to tests/tt_metal/tt_metal/test_enqueue_program.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/incrementer.cpp b/tests/tt_metal/tt_metal/test_kernels/misc/sub_device/incrementer.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/incrementer.cpp rename to tests/tt_metal/tt_metal/test_kernels/misc/sub_device/incrementer.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/persistent_remote_waiter.cpp b/tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_remote_waiter.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/persistent_remote_waiter.cpp rename to tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_remote_waiter.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/persistent_waiter.cpp b/tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_waiter.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/persistent_waiter.cpp rename to tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_waiter.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/syncer.cpp b/tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/syncer.cpp rename to tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt deleted file mode 100644 index 80e3bbd8510..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt +++ /dev/null @@ -1,102 +0,0 @@ -set(UNIT_TESTS_SRC - ${CMAKE_CURRENT_SOURCE_DIR}/allocator/test_free_list_allocator.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/allocator/test_l1_banking_allocator.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/basic/device.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/basic/initialize_semaphores.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/basic/runtime_args.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/basic/test_noc.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/basic/test_soc_descriptor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/buffer/test_banked.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/buffer/test_buffer_utils.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/buffer/test_sharded_l1.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/buffer/test_simple_dram_buffer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/buffer/test_simple_l1_buffer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/circular_buffer/test_CircularBuffer_allocation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/circular_buffer/test_CircularBuffer_creation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/circular_buffer/test_CircularBuffer_non_blocking.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_golden_impls.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_reduce.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_single_core_binary_compute.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_single_core_matmul_compute.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_sfpu_compute.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_dropout_sfpu_compute.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_untilize_tilize.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_copy_block_matmul_partials.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_reconfig.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_transpose.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_broadcast.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_cumsum.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRange_adjacent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRange_contains.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRange_intersects.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRange_iterator.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRange_merge.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRangeSet_construct.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRangeSet_contains.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRangeSet_intersects.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/core_coord/test_CoreRangeSet_merge.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dram/direct.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/host_apis/test_tilize_untilize.cpp - # ${CMAKE_CURRENT_SOURCE_DIR}/fast_dispatch_kernels/test_write_host.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ethernet/basic_eth_kernels.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ethernet/buffer_movement_kernels.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ethernet/device_cluster_api.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ethernet/erisc_app_direct_send.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ethernet/ring_gather_kernels.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/global_semaphore/test_global_semaphores.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tt_stl/test_any_range.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tt_stl/slotmap.cpp -) - -add_executable( - unit_tests - ${UNIT_TESTS_SRC} - $ -) -TT_ENABLE_UNITY_BUILD(unit_tests) -add_executable(unit_tests_galaxy ${CMAKE_CURRENT_SOURCE_DIR}/ethernet/galaxy_cluster_api.cpp) - -target_link_libraries( - unit_tests - PRIVATE - test_metal_common_libs - Boost::smart_ptr -) -target_link_libraries( - unit_tests_galaxy - PRIVATE - test_metal_common_libs - Boost::smart_ptr -) - -target_include_directories( - unit_tests - PRIVATE - ${UMD_HOME} - ${PROJECT_SOURCE_DIR} - ${PROJECT_SOURCE_DIR}/tt_metal - ${PROJECT_SOURCE_DIR}/tests - ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/common - ${CMAKE_CURRENT_SOURCE_DIR}/circular_buffer -) -target_include_directories( - unit_tests_galaxy - PRIVATE - ${UMD_HOME} - ${PROJECT_SOURCE_DIR} - ${PROJECT_SOURCE_DIR}/tt_metal - ${PROJECT_SOURCE_DIR}/tests - ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/common -) - -set_target_properties( - unit_tests - unit_tests_galaxy - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/test/tt_metal -) diff --git a/tests/tt_metal/tt_metal/unit_tests/README.md b/tests/tt_metal/tt_metal/unit_tests/README.md deleted file mode 100644 index 55aab607296..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Summary -Unit testing uses the doctest framework. See https://github.com/doctest/doctest/ -Generally, there are three main levels of organization: -* TEST_SUITE - Used to group main areas of tests -* TEST_CASE - How Test case and sub-case gets split up is at test-writer discretion, but see the test_case section -* SUB_CASE - - -## Build && Execution -### Build -`make tests/tt_metal/unit_tests` -### Get Help -`./build/test/tt_metal/unit_tests --help` -### Execute all tests -`./build/test/tt_metal/unit_tests` -### Execute filtered test-suite -`./build/test/tt_metal/unit_tests -ts="*Sfpu*"` -### List all test-suite with filter -`./build/test/tt_metal/unit_tests -ts="*Sfpu*" -lts` - -## Folder Structure -General structure of the tests are as follows, more sub-folders can be added -
-Directory Structure - Please add any new-tests to a corresponding folder. -
-
-tt_metal/unit_tests/
-  > test_main.cpp
-  > basic/
-    > # Any basic test files can exist here, will be automatically added to test_main
-  > common/
-    > # Used to hold any common structures across all test suites like fixtures
-  > dram/
-    > # Any dram unit/stress test files can exist here, will be automatically added to test_main
-  > compute/
-    > # Any basic test files can exist here, will be automatically added to test_main
-  > new_folders/
-    > # Any test files can exist here, will be automatically added to test_main
-test_utils/
-  > comparison.cpp # Useful utils for comparing, see example usages in unit tests
-  > print_helpers.cpp # Useful utils for printin
-  > stimulus.cpp # Useful utils for generating random vectors or specific vectors, see example usages in unit tests
-  > tilization.cpp # Useful utils for converting between tiled vectors or not, see example usages in unit tests
-
diff --git a/tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt deleted file mode 100644 index 8bf66065a7b..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt +++ /dev/null @@ -1,54 +0,0 @@ -set(UNIT_TESTS_COMMON_SRC - ${CMAKE_CURRENT_SOURCE_DIR}/basic/test_device_init.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/common/test_bit_utils.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/common/test_dispatch.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/test_flatten.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/matmul/test_matmul_large_block.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/matmul/test_matmul_multi_core_multi_dram_in0_mcast_in1_mcast.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/matmul/test_matmul_multi_core_multi_dram_inX_mcast.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/matmul/test_matmul_multi_core_X_dram.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/matmul/test_matmul_single_core.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compute/matmul/test_matmul_X_tile.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_eth_cores.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_invalid_print_core.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_mute_device.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_mute_print_server.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_print_all_harts.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_print_before_finish.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_print_hanging.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_print_tensix_dest.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_raise_wait.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dprint/test_print_tiles.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dram/test_dram_to_l1_multicast.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dram/test_dram.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_assert.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_noc_sanitize.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_noc_sanitize_delays.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_pause.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_ringbuf.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_waypoint.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_link_training.cpp -) -add_library(unit_tests_common_o STATIC ${UNIT_TESTS_COMMON_SRC}) -TT_ENABLE_UNITY_BUILD(unit_tests_common_o) -target_link_libraries( - unit_tests_common_o - PUBLIC - gtest - gtest_main - magic_enum - fmt::fmt-header-only - span -) -target_include_directories( - unit_tests_common_o - PUBLIC - $ - ${UMD_HOME} - ${PROJECT_SOURCE_DIR} - ${PROJECT_SOURCE_DIR}/tt_metal - ${PROJECT_SOURCE_DIR}/tt_metal/common - ${PROJECT_SOURCE_DIR}/tests - ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common - ${CMAKE_CURRENT_SOURCE_DIR}/common -) diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/CMakeLists.txt index 6c251c99a95..368a9966d33 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/CMakeLists.txt @@ -12,7 +12,6 @@ set(UNIT_TESTS_FD_SRC ${CMAKE_CURRENT_SOURCE_DIR}/multichip/test_eth_ring_gather_EnqueueProgram.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pipelining/basic_pipeline.cpp ${CMAKE_CURRENT_SOURCE_DIR}/streams/test_autonomous_relay_streams.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/sub_device/test_sub_device.cpp ) add_executable( diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/README.md b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/README.md deleted file mode 100644 index 55aab607296..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Summary -Unit testing uses the doctest framework. See https://github.com/doctest/doctest/ -Generally, there are three main levels of organization: -* TEST_SUITE - Used to group main areas of tests -* TEST_CASE - How Test case and sub-case gets split up is at test-writer discretion, but see the test_case section -* SUB_CASE - - -## Build && Execution -### Build -`make tests/tt_metal/unit_tests` -### Get Help -`./build/test/tt_metal/unit_tests --help` -### Execute all tests -`./build/test/tt_metal/unit_tests` -### Execute filtered test-suite -`./build/test/tt_metal/unit_tests -ts="*Sfpu*"` -### List all test-suite with filter -`./build/test/tt_metal/unit_tests -ts="*Sfpu*" -lts` - -## Folder Structure -General structure of the tests are as follows, more sub-folders can be added -
-Directory Structure - Please add any new-tests to a corresponding folder. -
-
-tt_metal/unit_tests/
-  > test_main.cpp
-  > basic/
-    > # Any basic test files can exist here, will be automatically added to test_main
-  > common/
-    > # Used to hold any common structures across all test suites like fixtures
-  > dram/
-    > # Any dram unit/stress test files can exist here, will be automatically added to test_main
-  > compute/
-    > # Any basic test files can exist here, will be automatically added to test_main
-  > new_folders/
-    > # Any test files can exist here, will be automatically added to test_main
-test_utils/
-  > comparison.cpp # Useful utils for comparing, see example usages in unit tests
-  > print_helpers.cpp # Useful utils for printin
-  > stimulus.cpp # Useful utils for generating random vectors or specific vectors, see example usages in unit tests
-  > tilization.cpp # Useful utils for converting between tiled vectors or not, see example usages in unit tests
-
diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/test_sub_device.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/test_sub_device.cpp index 83ef6759c4d..3146c0babfe 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/test_sub_device.cpp +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/test_sub_device.cpp @@ -22,564 +22,7 @@ using namespace tt::tt_metal; namespace basic_tests { -std::tuple> create_single_sync_program(Device *device, SubDevice sub_device) { - auto syncer_coord = sub_device.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; - auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); - auto global_sem = CreateGlobalSemaphore(device, sub_device.cores(HalProgrammableCoreType::TENSIX), INVALID); - Program syncer_program = CreateProgram(); - auto syncer_kernel = CreateKernel( - syncer_program, - "tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/syncer.cpp", - syncer_core, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, - .noc = NOC::RISCV_0_default}); - std::array syncer_rt_args = {global_sem->address()}; - SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); - return {std::move(syncer_program), std::move(syncer_coord), std::move(global_sem)}; -} -std::tuple> create_basic_sync_program(Device *device, const SubDevice& sub_device_1, const SubDevice& sub_device_2) { - auto waiter_coord = sub_device_2.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; - auto waiter_core = CoreRangeSet(CoreRange(waiter_coord, waiter_coord)); - auto waiter_core_physical = device->worker_core_from_logical_core(waiter_coord); - auto incrementer_cores = sub_device_1.cores(HalProgrammableCoreType::TENSIX); - auto syncer_coord = incrementer_cores.ranges().back().end_coord; - auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); - auto syncer_core_physical = device->worker_core_from_logical_core(syncer_coord); - auto all_cores = waiter_core.merge(incrementer_cores).merge(syncer_core); - auto global_sem = CreateGlobalSemaphore(device, all_cores, INVALID); - - Program waiter_program = CreateProgram(); - auto waiter_kernel = CreateKernel( - waiter_program, - "tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/persistent_waiter.cpp", - waiter_core, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, - .noc = NOC::RISCV_0_default}); - std::array waiter_rt_args = {global_sem->address(), incrementer_cores.num_cores(), syncer_core_physical.x, syncer_core_physical.y}; - SetRuntimeArgs(waiter_program, waiter_kernel, waiter_core, waiter_rt_args); - - Program syncer_program = CreateProgram(); - auto syncer_kernel = CreateKernel( - syncer_program, - "tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/syncer.cpp", - syncer_core, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, - .noc = NOC::RISCV_0_default}); - std::array syncer_rt_args = {global_sem->address()}; - SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); - - Program incrementer_program = CreateProgram(); - auto incrementer_kernel = CreateKernel( - incrementer_program, - "tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/incrementer.cpp", - incrementer_cores, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_1, - .noc = NOC::RISCV_1_default}); - std::array incrementer_rt_args = {global_sem->address(), waiter_core_physical.x, waiter_core_physical.y}; - SetRuntimeArgs(incrementer_program, incrementer_kernel, incrementer_cores, incrementer_rt_args); - return {std::move(waiter_program), std::move(syncer_program), std::move(incrementer_program), std::move(global_sem)}; -} - -std::tuple> create_basic_eth_sync_program(Device *device, const SubDevice& sub_device_1, const SubDevice& sub_device_2) { - auto waiter_coord = sub_device_2.cores(HalProgrammableCoreType::ACTIVE_ETH).ranges().at(0).start_coord; - auto waiter_core = CoreRangeSet(CoreRange(waiter_coord, waiter_coord)); - auto waiter_core_physical = device->ethernet_core_from_logical_core(waiter_coord); - auto tensix_waiter_coord = sub_device_2.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; - auto tensix_waiter_core = CoreRangeSet(CoreRange(tensix_waiter_coord, tensix_waiter_coord)); - auto tensix_waiter_core_physical = device->worker_core_from_logical_core(tensix_waiter_coord); - auto incrementer_cores = sub_device_1.cores(HalProgrammableCoreType::TENSIX); - auto syncer_coord = incrementer_cores.ranges().back().end_coord; - auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); - auto syncer_core_physical = device->worker_core_from_logical_core(syncer_coord); - auto all_cores = tensix_waiter_core.merge(incrementer_cores).merge(syncer_core); - auto global_sem = CreateGlobalSemaphore(device, all_cores, INVALID); - - Program waiter_program = CreateProgram(); - auto waiter_kernel = CreateKernel( - waiter_program, - "tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/persistent_remote_waiter.cpp", - waiter_core, - EthernetConfig{ - .noc = NOC::RISCV_0_default, - .processor = DataMovementProcessor::RISCV_0}); - std::array waiter_rt_args = {global_sem->address(), incrementer_cores.num_cores(), syncer_core_physical.x, syncer_core_physical.y, tensix_waiter_core_physical.x, tensix_waiter_core_physical.y, eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE}; - SetRuntimeArgs(waiter_program, waiter_kernel, waiter_core, waiter_rt_args); - - Program syncer_program = CreateProgram(); - auto syncer_kernel = CreateKernel( - syncer_program, - "tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/syncer.cpp", - syncer_core, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, - .noc = NOC::RISCV_0_default}); - std::array syncer_rt_args = {global_sem->address()}; - SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); - - Program incrementer_program = CreateProgram(); - auto incrementer_kernel = CreateKernel( - incrementer_program, - "tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/kernels/incrementer.cpp", - incrementer_cores, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_1, - .noc = NOC::RISCV_1_default}); - std::array incrementer_rt_args = {global_sem->address(), tensix_waiter_core_physical.x, tensix_waiter_core_physical.y}; - SetRuntimeArgs(incrementer_program, incrementer_kernel, incrementer_cores, incrementer_rt_args); - return {std::move(waiter_program), std::move(syncer_program), std::move(incrementer_program), std::move(global_sem)}; -} - -TEST_F(CommandQueueSingleCardFixture, TestSubDeviceAllocations) { - uint32_t local_l1_size = 3200; - SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); - SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); - CoreRangeSet sharded_cores_1 = CoreRange({0, 0}, {2, 2}); - CoreRangeSet sharded_cores_2 = CoreRange({4, 4}, {4, 4}); - - auto sharded_cores_1_vec = corerange_to_cores(sharded_cores_1, std::nullopt, true); - auto sharded_cores_2_vec = corerange_to_cores(sharded_cores_2, std::nullopt, true); - - ShardSpecBuffer shard_spec_buffer_1 = ShardSpecBuffer(sharded_cores_1, {1, 1}, ShardOrientation::ROW_MAJOR, false, {1, 1}, {sharded_cores_1.num_cores(), 1}); - uint32_t page_size_1 = 32; - ShardedBufferConfig shard_config_1 = {nullptr, sharded_cores_1.num_cores() * page_size_1, page_size_1, BufferType::L1, TensorMemoryLayout::HEIGHT_SHARDED, shard_spec_buffer_1}; - auto input_1 = tt::test_utils::generate_uniform_random_vector(0, 100, shard_config_1.size / sizeof(uint32_t)); - - ShardSpecBuffer shard_spec_buffer_2 = ShardSpecBuffer(sharded_cores_2, {1, 1}, ShardOrientation::ROW_MAJOR, false, {1, 1}, {sharded_cores_2.num_cores(), 1}); - uint32_t page_size_2 = 64; - ShardedBufferConfig shard_config_2 = {nullptr, sharded_cores_2.num_cores() * page_size_2, page_size_2, BufferType::L1, TensorMemoryLayout::HEIGHT_SHARDED, shard_spec_buffer_2}; - auto input_2 = tt::test_utils::generate_uniform_random_vector(0, 100, shard_config_2.size / sizeof(uint32_t)); - - uint32_t page_size_3 = 1024; - InterleavedBufferConfig interleaved_config = {nullptr, page_size_3, page_size_3, BufferType::L1, TensorMemoryLayout::INTERLEAVED}; - auto input_3 = tt::test_utils::generate_uniform_random_vector(0, 100, interleaved_config.size / sizeof(uint32_t)); - - for (Device *device : devices_) { - auto sub_device_manager_1 = device->create_sub_device_manager({sub_device_1}, local_l1_size); - auto sub_device_manager_2 = device->create_sub_device_manager({sub_device_1, sub_device_2}, local_l1_size); - DeviceAddr l1_unreserved_base = device->get_base_allocator_addr(HalMemType::L1); - DeviceAddr max_addr = l1_unreserved_base + local_l1_size; - - shard_config_1.device = device; - shard_config_2.device = device; - interleaved_config.device = device; - - std::vector physical_cores_1; - physical_cores_1.reserve(sharded_cores_1_vec.size()); - for (const auto& core : sharded_cores_1_vec) { - physical_cores_1.push_back(device->worker_core_from_logical_core(core)); - } - - std::vector physical_cores_2; - physical_cores_2.reserve(sharded_cores_2_vec.size()); - for (const auto& core : sharded_cores_2_vec) { - physical_cores_2.push_back(device->worker_core_from_logical_core(core)); - } - - device->load_sub_device_manager(sub_device_manager_1); - - auto buffer_1 = CreateBuffer(shard_config_1, SubDeviceId{0}); - EXPECT_EQ(buffer_1->address(), max_addr - buffer_1->aligned_page_size()); - EnqueueWriteBuffer(device->command_queue(), buffer_1, input_1, false); - std::vector output_1; - EnqueueReadBuffer(device->command_queue(), buffer_1, output_1, true); - EXPECT_EQ(input_1, output_1); - auto input_1_it = input_1.begin(); - for (const auto& physical_core : physical_cores_1) { - auto readback = tt::llrt::read_hex_vec_from_core( - device->id(), physical_core, buffer_1->address(), page_size_1); - EXPECT_TRUE(std::equal(input_1_it, input_1_it + page_size_1 / sizeof(uint32_t), readback.begin())); - input_1_it += page_size_1 / sizeof(uint32_t); - } - - auto buffer_2 = CreateBuffer(interleaved_config); - EXPECT_THROW(CreateBuffer(shard_config_1, SubDeviceId{1}), std::exception); - EXPECT_THROW(device->clear_loaded_sub_device_manager(), std::exception); - EXPECT_THROW(device->load_sub_device_manager(sub_device_manager_2), std::exception); - DeallocateBuffer(*buffer_1); - device->clear_loaded_sub_device_manager(); - device->load_sub_device_manager(sub_device_manager_2); - - auto buffer_3 = CreateBuffer(shard_config_2, SubDeviceId{1}); - EXPECT_EQ(buffer_3->address(), max_addr - buffer_3->aligned_page_size()); - EnqueueWriteBuffer(device->command_queue(), buffer_3, input_2, false); - std::vector output_2; - EnqueueReadBuffer(device->command_queue(), buffer_3, output_2, true); - EXPECT_EQ(input_2, output_2); - auto input_2_it = input_2.begin(); - for (const auto& physical_core : physical_cores_2) { - auto readback = tt::llrt::read_hex_vec_from_core( - device->id(), physical_core, buffer_3->address(), page_size_2); - EXPECT_TRUE(std::equal(input_2_it, input_2_it + page_size_2 / sizeof(uint32_t), readback.begin())); - input_2_it += page_size_2 / sizeof(uint32_t); - } - - auto buffer_4 = CreateBuffer(shard_config_1, SubDeviceId{0}); - EXPECT_EQ(buffer_4->address(), max_addr - buffer_4->aligned_page_size()); - EXPECT_THROW(CreateBuffer(interleaved_config, SubDeviceId{0}), std::exception); - } -} - -TEST_F(CommandQueueSingleCardFixture, TestSubDeviceSynchronization) { - uint32_t local_l1_size = 3200; - SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); - SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); - CoreRangeSet sharded_cores_1 = CoreRange({0, 0}, {2, 2}); - - auto sharded_cores_1_vec = corerange_to_cores(sharded_cores_1, std::nullopt, true); - - ShardSpecBuffer shard_spec_buffer_1 = ShardSpecBuffer(sharded_cores_1, {1, 1}, ShardOrientation::ROW_MAJOR, false, {1, 1}, {sharded_cores_1.num_cores(), 1}); - uint32_t page_size_1 = 32; - ShardedBufferConfig shard_config_1 = {nullptr, sharded_cores_1.num_cores() * page_size_1, page_size_1, BufferType::L1, TensorMemoryLayout::HEIGHT_SHARDED, shard_spec_buffer_1}; - auto input_1 = tt::test_utils::generate_uniform_random_vector(0, 100, shard_config_1.size / sizeof(uint32_t)); - - std::array sub_device_ids_to_block = {SubDeviceId{0}}; - for (Device *device : devices_) { - auto sub_device_manager = device->create_sub_device_manager({sub_device_1, sub_device_2}, local_l1_size); - - shard_config_1.device = device; - - std::vector physical_cores_1; - physical_cores_1.reserve(sharded_cores_1_vec.size()); - for (const auto& core : sharded_cores_1_vec) { - physical_cores_1.push_back(device->worker_core_from_logical_core(core)); - } - - device->load_sub_device_manager(sub_device_manager); - - auto [program, syncer_core, global_semaphore] = create_single_sync_program(device, sub_device_2); - EnqueueProgram(device->command_queue(), program, false); - - auto buffer_1 = CreateBuffer(shard_config_1, sub_device_ids_to_block[0]); - - // Test blocking synchronize doesn't stall - Synchronize(device, 0, sub_device_ids_to_block); - - // Test blocking write buffer doesn't stall - EnqueueWriteBuffer(device->command_queue(), buffer_1, input_1, true, sub_device_ids_to_block); - - // Test record event won't cause a stall - auto event = std::make_shared(); - EnqueueRecordEvent(device->command_queue(), event, sub_device_ids_to_block); - Synchronize(device, 0, sub_device_ids_to_block); - - // Test blocking read buffer doesn't stall - std::vector output_1; - EnqueueReadBuffer(device->command_queue(), buffer_1, output_1, true, sub_device_ids_to_block); - EXPECT_EQ(input_1, output_1); - auto input_1_it = input_1.begin(); - for (const auto& physical_core : physical_cores_1) { - auto readback = tt::llrt::read_hex_vec_from_core( - device->id(), physical_core, buffer_1->address(), page_size_1); - EXPECT_TRUE(std::equal(input_1_it, input_1_it + page_size_1 / sizeof(uint32_t), readback.begin())); - input_1_it += page_size_1 / sizeof(uint32_t); - } - auto sem_addr = global_semaphore->address(); - auto physical_syncer_core = device->worker_core_from_logical_core(syncer_core); - tt::llrt::write_hex_vec_to_core(device->id(), physical_syncer_core, std::vector{1}, sem_addr); - - // Full synchronization - Synchronize(device); - } -} - -TEST_F(CommandQueueSingleCardFixture, TestSubDeviceBasicPrograms) { - SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); - SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); - uint32_t num_iters = 5; - for (Device *device : devices_) { - auto sub_device_manager = device->create_sub_device_manager({sub_device_1, sub_device_2}, 3200); - device->load_sub_device_manager(sub_device_manager); - - auto [waiter_program, syncer_program, incrementer_program, global_sem] = create_basic_sync_program(device, sub_device_1, sub_device_2); - - for (uint32_t i = 0; i < num_iters; i++) { - EnqueueProgram(device->command_queue(), waiter_program, false); - // Test blocking on one sub-device - EnqueueProgram(device->command_queue(), syncer_program, true); - EnqueueProgram(device->command_queue(), incrementer_program, false); - } - Synchronize(device); - } -} - -TEST_F(CommandQueueSingleCardFixture, TestSubDeviceBasicEthPrograms) { - SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); - uint32_t num_iters = 5; - for (Device *device : devices_) { - if (!does_device_have_active_eth_cores(device)) { - GTEST_SKIP() << "Skipping test because device " << device->id() << " does not have any active ethernet cores"; - } - auto eth_core = *device->get_active_ethernet_cores(true).begin(); - SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})}), CoreRangeSet(CoreRange(eth_core, eth_core))}); - auto sub_device_manager = device->create_sub_device_manager({sub_device_1, sub_device_2}, 3200); - device->load_sub_device_manager(sub_device_manager); - - auto [waiter_program, syncer_program, incrementer_program, global_sem] = create_basic_eth_sync_program(device, sub_device_1, sub_device_2); - - for (uint32_t i = 0; i < num_iters; i++) { - EnqueueProgram(device->command_queue(), waiter_program, false); - // Test blocking on one sub-device - EnqueueProgram(device->command_queue(), syncer_program, true); - EnqueueProgram(device->command_queue(), incrementer_program, false); - } - Synchronize(device); - } -} - -TEST_F(CommandQueueSingleCardTraceFixture, TestSubDeviceTraceBasicPrograms) { - SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); - SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); - uint32_t num_iters = 5; - for (Device *device : devices_) { - auto sub_device_manager = device->create_sub_device_manager({sub_device_1, sub_device_2}, 3200); - device->load_sub_device_manager(sub_device_manager); - - auto [waiter_program, syncer_program, incrementer_program, global_sem] = create_basic_sync_program(device, sub_device_1, sub_device_2); - - // Compile the programs - EnqueueProgram(device->command_queue(), waiter_program, false); - // Test blocking on one sub-device - EnqueueProgram(device->command_queue(), syncer_program, true); - EnqueueProgram(device->command_queue(), incrementer_program, false); - Synchronize(device); - - // Capture the trace - auto tid_1 = BeginTraceCapture(device, device->command_queue().id()); - EnqueueProgram(device->command_queue(), waiter_program, false); - EnqueueProgram(device->command_queue(), syncer_program, false); - EnqueueProgram(device->command_queue(), incrementer_program, false); - EndTraceCapture(device, device->command_queue().id(), tid_1); - - auto tid_2 = BeginTraceCapture(device, device->command_queue().id()); - EnqueueProgram(device->command_queue(), syncer_program, false); - EnqueueProgram(device->command_queue(), incrementer_program, false); - EndTraceCapture(device, device->command_queue().id(), tid_2); - - for (uint32_t i = 0; i < num_iters; i++) { - // Regular program execution - EnqueueProgram(device->command_queue(), waiter_program, false); - // Test blocking on one sub-device - EnqueueProgram(device->command_queue(), syncer_program, true); - EnqueueProgram(device->command_queue(), incrementer_program, false); - - // Full trace execution - ReplayTrace(device, device->command_queue().id(), tid_1, false); - - // Partial trace execution - EnqueueProgram(device->command_queue(), waiter_program, false); - ReplayTrace(device, device->command_queue().id(), tid_2, false); - } - Synchronize(device); - } -} - -TEST_F(CommandQueueSingleCardTraceFixture, TestSubDeviceTraceBasicEthPrograms) { - SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); - uint32_t num_iters = 5; - for (Device *device : devices_) { - if (!does_device_have_active_eth_cores(device)) { - GTEST_SKIP() << "Skipping test because device " << device->id() << " does not have any active ethernet cores"; - } - auto eth_core = *device->get_active_ethernet_cores(true).begin(); - SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})}), CoreRangeSet(CoreRange(eth_core, eth_core))}); - auto sub_device_manager = device->create_sub_device_manager({sub_device_1, sub_device_2}, 3200); - device->load_sub_device_manager(sub_device_manager); - - auto [waiter_program, syncer_program, incrementer_program, global_sem] = create_basic_eth_sync_program(device, sub_device_1, sub_device_2); - - // Compile the programs - EnqueueProgram(device->command_queue(), waiter_program, false); - // Test blocking on one sub-device - EnqueueProgram(device->command_queue(), syncer_program, true); - EnqueueProgram(device->command_queue(), incrementer_program, false); - Synchronize(device); - - // Capture the trace - auto tid_1 = BeginTraceCapture(device, device->command_queue().id()); - EnqueueProgram(device->command_queue(), waiter_program, false); - EnqueueProgram(device->command_queue(), syncer_program, false); - EnqueueProgram(device->command_queue(), incrementer_program, false); - EndTraceCapture(device, device->command_queue().id(), tid_1); - - auto tid_2 = BeginTraceCapture(device, device->command_queue().id()); - EnqueueProgram(device->command_queue(), syncer_program, false); - EnqueueProgram(device->command_queue(), incrementer_program, false); - EndTraceCapture(device, device->command_queue().id(), tid_2); - - for (uint32_t i = 0; i < num_iters; i++) { - // Regular program execution - EnqueueProgram(device->command_queue(), waiter_program, false); - // Test blocking on one sub-device - EnqueueProgram(device->command_queue(), syncer_program, true); - EnqueueProgram(device->command_queue(), incrementer_program, false); - - // Full trace execution - ReplayTrace(device, device->command_queue().id(), tid_1, false); - - // Partial trace execution - EnqueueProgram(device->command_queue(), waiter_program, false); - ReplayTrace(device, device->command_queue().id(), tid_2, false); - } - Synchronize(device); - } -} - -TEST_F(CommandQueueSingleCardTraceFixture, TestSubDeviceTraceProgramsReconfigureSubDevices) { - SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); - SubDevice sub_device_2(std::array{CoreRangeSet(std::array{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); - SubDevice sub_device_3(std::array{CoreRangeSet(std::array{CoreRange({2, 4}, {3, 4}), CoreRange({5, 1}, {6, 3})})}); - uint32_t num_iters = 5; - for (Device *device : devices_) { - if (!does_device_have_active_eth_cores(device)) { - GTEST_SKIP() << "Skipping test because device " << device->id() << " does not have any active ethernet cores"; - } - auto eth_core = *device->get_active_ethernet_cores(true).begin(); - SubDevice sub_device_4(std::array{CoreRangeSet(std::array{CoreRange({2, 1}, {2, 2}), CoreRange({1, 5}, {5, 5})}), CoreRangeSet(CoreRange(eth_core, eth_core))}); - - auto sub_device_manager_1 = device->create_sub_device_manager({sub_device_1, sub_device_2}, 3200); - auto sub_device_manager_2 = device->create_sub_device_manager({sub_device_3, sub_device_4}, 3200); - - device->load_sub_device_manager(sub_device_manager_1); - - auto [waiter_program_1, syncer_program_1, incrementer_program_1, global_sem_1] = create_basic_sync_program(device, sub_device_1, sub_device_2); - - // Compile the programs - EnqueueProgram(device->command_queue(), waiter_program_1, false); - EnqueueProgram(device->command_queue(), syncer_program_1, false); - EnqueueProgram(device->command_queue(), incrementer_program_1, false); - Synchronize(device); - - // Capture the trace - auto tid_1 = BeginTraceCapture(device, device->command_queue().id()); - EnqueueProgram(device->command_queue(), waiter_program_1, false); - EnqueueProgram(device->command_queue(), syncer_program_1, false); - EnqueueProgram(device->command_queue(), incrementer_program_1, false); - EndTraceCapture(device, device->command_queue().id(), tid_1); - - auto tid_2 = BeginTraceCapture(device, device->command_queue().id()); - EnqueueProgram(device->command_queue(), syncer_program_1, false); - EnqueueProgram(device->command_queue(), incrementer_program_1, false); - EndTraceCapture(device, device->command_queue().id(), tid_2); - - device->load_sub_device_manager(sub_device_manager_2); - - auto [waiter_program_2, syncer_program_2, incrementer_program_2, global_sem_2] = create_basic_eth_sync_program(device, sub_device_3, sub_device_4); - - // Compile the programs - EnqueueProgram(device->command_queue(), waiter_program_2, false); - EnqueueProgram(device->command_queue(), syncer_program_2, false); - EnqueueProgram(device->command_queue(), incrementer_program_2, false); - Synchronize(device); - - // Capture the trace - auto tid_3 = BeginTraceCapture(device, device->command_queue().id()); - EnqueueProgram(device->command_queue(), waiter_program_2, false); - EnqueueProgram(device->command_queue(), syncer_program_2, false); - EnqueueProgram(device->command_queue(), incrementer_program_2, false); - EndTraceCapture(device, device->command_queue().id(), tid_3); - - auto tid_4 = BeginTraceCapture(device, device->command_queue().id()); - EnqueueProgram(device->command_queue(), syncer_program_2, false); - EnqueueProgram(device->command_queue(), incrementer_program_2, false); - EndTraceCapture(device, device->command_queue().id(), tid_4); - - for (uint32_t i = 0; i < num_iters; i++) { - device->load_sub_device_manager(sub_device_manager_1); - // Regular program execution - EnqueueProgram(device->command_queue(), waiter_program_1, false); - // Test blocking on one sub-device - EnqueueProgram(device->command_queue(), syncer_program_1, false); - EnqueueProgram(device->command_queue(), incrementer_program_1, false); - - // Full trace execution - ReplayTrace(device, device->command_queue().id(), tid_1, false); - - // Partial trace execution - EnqueueProgram(device->command_queue(), waiter_program_1, false); - ReplayTrace(device, device->command_queue().id(), tid_2, false); - - device->load_sub_device_manager(sub_device_manager_2); - // Regular program execution - EnqueueProgram(device->command_queue(), waiter_program_2, false); - // Test blocking on one sub-device - EnqueueProgram(device->command_queue(), syncer_program_2, false); - EnqueueProgram(device->command_queue(), incrementer_program_2, false); - - // Full trace execution - ReplayTrace(device, device->command_queue().id(), tid_3, false); - - // Partial trace execution - EnqueueProgram(device->command_queue(), waiter_program_2, false); - ReplayTrace(device, device->command_queue().id(), tid_4, false); - } - Synchronize(device); - } -} - -TEST_F(CommandQueueSingleCardTraceFixture, TestSubDeviceIllegalOperations) { - SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); - SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); - - // Assert no idle eth cores specified - EXPECT_THROW(SubDevice sub_device_3(std::array{CoreRangeSet(CoreRange({3, 3}, {3, 3})), CoreRangeSet(CoreRange({4, 4}, {4, 4})), CoreRangeSet(CoreRange({5, 5}, {5, 5}))}), std::exception); - for (Device *device : devices_) { - auto sub_device_manager_1 = device->create_sub_device_manager({sub_device_1, sub_device_2}, 3200); - auto sub_device_manager_2 = device->create_sub_device_manager({sub_device_2, sub_device_1}, 3200); - device->load_sub_device_manager(sub_device_manager_1); - - auto [waiter_program_1, syncer_program_1, incrementer_program_1, global_sem_1] = create_basic_sync_program(device, sub_device_1, sub_device_2); - - // Compile the programs - EnqueueProgram(device->command_queue(), waiter_program_1, false); - // Test blocking on one sub-device - EnqueueProgram(device->command_queue(), syncer_program_1, false); - EnqueueProgram(device->command_queue(), incrementer_program_1, false); - Synchronize(device); - - // Capture the trace - auto tid_1 = BeginTraceCapture(device, device->command_queue().id()); - // Can not load a sub-device manager while tracing - EXPECT_THROW(device->load_sub_device_manager(sub_device_manager_2), std::exception); - EnqueueProgram(device->command_queue(), waiter_program_1, false); - EnqueueProgram(device->command_queue(), syncer_program_1, false); - EnqueueProgram(device->command_queue(), incrementer_program_1, false); - EndTraceCapture(device, device->command_queue().id(), tid_1); - - device->load_sub_device_manager(sub_device_manager_2); - auto [waiter_program_2, syncer_program_2, incrementer_program_2, global_sem_2] = create_basic_sync_program(device, sub_device_2, sub_device_1); - - EnqueueProgram(device->command_queue(), waiter_program_2, false); - EnqueueProgram(device->command_queue(), syncer_program_2, false); - EnqueueProgram(device->command_queue(), incrementer_program_2, false); - Synchronize(device); - - auto tid_2 = BeginTraceCapture(device, device->command_queue().id()); - EnqueueProgram(device->command_queue(), waiter_program_2, false); - EnqueueProgram(device->command_queue(), syncer_program_2, false); - EnqueueProgram(device->command_queue(), incrementer_program_2, false); - EndTraceCapture(device, device->command_queue().id(), tid_2); - - // Regular program execution - // Can not run a program on a different sub-device manager - EXPECT_THROW(EnqueueProgram(device->command_queue(), waiter_program_1, false), std::exception); - - // Full trace execution - ReplayTrace(device, device->command_queue().id(), tid_2, false); - - // Can not replay a trace on a different sub-device manager - EXPECT_THROW(ReplayTrace(device, device->command_queue().id(), tid_1, false), std::exception); - - Synchronize(device); - - device->remove_sub_device_manager(sub_device_manager_1); - EXPECT_THROW(device->load_sub_device_manager(sub_device_manager_1), std::exception); - } -} } // namespace basic_tests diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/tests_main.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/tests_main.cpp deleted file mode 100644 index 1e42f41a46c..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/tests_main.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "gtest/gtest.h" diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/CMakeLists.txt deleted file mode 100644 index 49d29eddb8f..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -set(UNIT_TESTS_FD_SINGLEC_MULTIQ_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/command_queue/test_EnqueueProgram.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/command_queue/test_EnqueueTrace.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/command_queue/test_EnqueueWaitForEvent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/command_queue/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp -) - -add_executable(unit_tests_fast_dispatch_single_chip_multi_queue ${UNIT_TESTS_FD_SINGLEC_MULTIQ_SRCS}) -TT_ENABLE_UNITY_BUILD(unit_tests_fast_dispatch_single_chip_multi_queue) - -target_link_libraries(unit_tests_fast_dispatch_single_chip_multi_queue PUBLIC test_metal_common_libs) -target_include_directories( - unit_tests_fast_dispatch_single_chip_multi_queue - PRIVATE - ${UMD_HOME} - ${PROJECT_SOURCE_DIR} - ${PROJECT_SOURCE_DIR}/tt_metal - ${PROJECT_SOURCE_DIR}/tests - ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/common -) -set_target_properties( - unit_tests_fast_dispatch_single_chip_multi_queue - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/test/tt_metal -) diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/tests_main.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/tests_main.cpp deleted file mode 100644 index 1e42f41a46c..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/tests_main.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "gtest/gtest.h" diff --git a/tests/tt_metal/tt_metal/unit_tests_frequent/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests_frequent/CMakeLists.txt deleted file mode 100644 index b6c16256148..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_frequent/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -set(UNIT_TESTS_FREQUENT_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/tests/run_many_times.cpp) - -add_executable(unit_tests_frequent ${UNIT_TESTS_FREQUENT_SRCS}) - -target_link_libraries( - unit_tests_frequent - PUBLIC - test_metal_common_libs - gtest - gtest_main -) -target_include_directories( - unit_tests_frequent - PRIVATE - ${UMD_HOME} - ${PROJECT_SOURCE_DIR} - ${PROJECT_SOURCE_DIR}/tt_metal - ${PROJECT_SOURCE_DIR}/tests - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/common -) -set_target_properties( - unit_tests_frequent - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/test/tt_metal -) diff --git a/tests/tt_metal/tt_metal/unit_tests_frequent/tests_main.cpp b/tests/tt_metal/tt_metal/unit_tests_frequent/tests_main.cpp deleted file mode 100644 index 1e42f41a46c..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_frequent/tests_main.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include "gtest/gtest.h" From 881dea661b17d1bcb0480cfeba20daa39849e8f0 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Fri, 8 Nov 2024 18:21:08 +0000 Subject: [PATCH 19/26] #0: More test structuring --- tests/scripts/run_tools_tests.sh | 6 +-- tests/scripts/t3000/run_t3000_unit_tests.sh | 14 +++--- tests/tt_metal/tt_metal/CMakeLists.txt | 25 +++------- .../test_CircularBuffer_allocation.cpp | 1 - .../tt_metal/api/test_kernel_creation.cpp | 3 -- .../tt_metal/api/test_runtime_args.cpp | 1 + .../tt_metal/api/test_sharded_l1_buffer.cpp | 6 --- tests/tt_metal/tt_metal/common/test_utils.hpp | 47 +++++++++++++++++++ .../tt_metal/tt_metal/dispatch/CMakeLists.txt | 32 +++++++++++++ .../dispatch_buffer/CMakeLists.txt | 7 ++- ...queueWriteBuffer_and_EnqueueReadBuffer.cpp | 15 +----- .../dispatch_event/CMakeLists.txt | 8 +++- .../test_EnqueueWaitForEvent.cpp | 4 +- .../dispatch_event/test_events.cpp | 1 - .../dispatch_program/CMakeLists.txt | 6 +++ .../dispatch_program/test_EnqueueProgram.cpp | 2 +- .../dispatch_program/test_dispatch.cpp | 0 .../dispatch_trace/CMakeLists.txt | 3 ++ .../dispatch_trace/test_EnqueueTrace.cpp | 2 +- tests/tt_metal/tt_metal/eth/CMakeLists.txt | 1 + .../test_ring_gather_kernels.cpp} | 0 .../command_queue_test_utils.hpp | 32 ------------- .../common/command_queue_test_utils.hpp | 38 --------------- 23 files changed, 123 insertions(+), 131 deletions(-) create mode 100644 tests/tt_metal/tt_metal/dispatch/CMakeLists.txt rename tests/tt_metal/tt_metal/{ => dispatch}/dispatch_buffer/CMakeLists.txt (76%) rename tests/tt_metal/tt_metal/{ => dispatch}/dispatch_buffer/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp (99%) rename tests/tt_metal/tt_metal/{ => dispatch}/dispatch_event/CMakeLists.txt (74%) rename tests/tt_metal/tt_metal/{ => dispatch}/dispatch_event/test_EnqueueWaitForEvent.cpp (99%) rename tests/tt_metal/tt_metal/{ => dispatch}/dispatch_event/test_events.cpp (99%) rename tests/tt_metal/tt_metal/{ => dispatch}/dispatch_program/CMakeLists.txt (76%) rename tests/tt_metal/tt_metal/{ => dispatch}/dispatch_program/test_EnqueueProgram.cpp (99%) rename tests/tt_metal/tt_metal/{ => dispatch}/dispatch_program/test_dispatch.cpp (100%) rename tests/tt_metal/tt_metal/{ => dispatch}/dispatch_trace/CMakeLists.txt (89%) rename tests/tt_metal/tt_metal/{ => dispatch}/dispatch_trace/test_EnqueueTrace.cpp (99%) rename tests/tt_metal/tt_metal/{unit_tests/ethernet/ring_gather_kernels.cpp => eth/test_ring_gather_kernels.cpp} (100%) delete mode 100644 tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/command_queue_test_utils.hpp delete mode 100644 tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_test_utils.hpp diff --git a/tests/scripts/run_tools_tests.sh b/tests/scripts/run_tools_tests.sh index d86be0f8c0e..7283788336c 100755 --- a/tests/scripts/run_tools_tests.sh +++ b/tests/scripts/run_tools_tests.sh @@ -12,7 +12,7 @@ if [[ -z "$TT_METAL_SLOW_DISPATCH_MODE" ]] ; then echo "Running watcher dump tool tests..." # Run a test that populates basic fields but not watcher fields - ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter=*PrintHanging + ./build/test/tt_metal/unit_tests_debug_tools --gtest_filter=*PrintHanging # Run dump tool w/ minimum data - no error expected. ./build/tools/watcher_dump -d=0 -w -c @@ -22,7 +22,7 @@ if [[ -z "$TT_METAL_SLOW_DISPATCH_MODE" ]] ; then echo "Watcher dump minimal test - Pass" # Now run with all watcher features, expect it to throw. - ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter=*WatcherAssertBrisc + ./build/test/tt_metal/unit_tests_debug_tools --gtest_filter=*WatcherAssertBrisc ./build/tools/watcher_dump -d=0 -w &> tmp.log || { echo "Above failure is expected."; } # Verify the error we expect showed up in the program output. @@ -30,7 +30,7 @@ if [[ -z "$TT_METAL_SLOW_DISPATCH_MODE" ]] ; then echo "Watcher dump all data test - Pass" # Check that stack dumping is working - ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter=*TestWatcherRingBufferBrisc + ./build/test/tt_metal/unit_tests_debug_tools --gtest_filter=*TestWatcherRingBufferBrisc ./build/tools/watcher_dump -d=0 -w grep "brisc highest stack usage:" generated/watcher/watcher.log > /dev/null || { echo "Error: couldn't find stack usage in watcher log after dump." ; exit 1; } echo "Watcher stack usage test - Pass" diff --git a/tests/scripts/t3000/run_t3000_unit_tests.sh b/tests/scripts/t3000/run_t3000_unit_tests.sh index 6e89ceff603..5cd8c12883c 100755 --- a/tests/scripts/t3000/run_t3000_unit_tests.sh +++ b/tests/scripts/t3000/run_t3000_unit_tests.sh @@ -8,13 +8,13 @@ run_t3000_ttmetal_tests() { echo "LOG_METAL: Running run_t3000_ttmetal_tests" - TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests --gtest_filter="DeviceFixture.EthKernelsDirectSendAllConnectedChips" ; fail+=$? - TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests --gtest_filter="DeviceFixture.EthKernelsSendInterleavedBufferAllConnectedChips" ; fail+=$? - TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests --gtest_filter="DeviceFixture.EthKernelsDirectRingGatherAllChips" ; fail+=$? - TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests --gtest_filter="DeviceFixture.EthKernelsInterleavedRingGatherAllChips" ; fail+=$? - TT_METAL_ENABLE_REMOTE_CHIP=1 ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="CommandQueueSingleCardFixture.*" ; fail+=$? - ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="CommandQueueMultiDeviceFixture.*" ; fail+=$? - ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="DPrintFixture.*:WatcherFixture.*" ; fail+=$? + TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests_eth --gtest_filter="DeviceFixture.ActiveEthKernelsDirectSendAllConnectedChips" ; fail+=$? + TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests_eth --gtest_filter="DeviceFixture.ActiveEthKernelsSendInterleavedBufferAllConnectedChips" ; fail+=$? + TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests_eth --gtest_filter="DeviceFixture.ActiveEthKernelsDirectRingGatherAllChips" ; fail+=$? + TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests_eth --gtest_filter="DeviceFixture.ActiveEthKernelsInterleavedRingGatherAllChips" ; fail+=$? + TT_METAL_ENABLE_REMOTE_CHIP=1 ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="CommandQueueSingleCard.*Fixture.*" ; fail+=$? + ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="CommandQueueMultiDevice.*Fixture.*" ; fail+=$? + ./build/test/tt_metal/unit_tests_debug_tools --gtest_filter="DPrintFixture.*:WatcherFixture.*" ; fail+=$? # Record the end time end_time=$(date +%s) diff --git a/tests/tt_metal/tt_metal/CMakeLists.txt b/tests/tt_metal/tt_metal/CMakeLists.txt index 81c1aa43123..f1bf004d2af 100644 --- a/tests/tt_metal/tt_metal/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/CMakeLists.txt @@ -63,19 +63,10 @@ foreach(TEST_SRC ${TT_METAL_TESTS_SRCS}) list(APPEND METAL_TEST_TARGETS ${TEST}) endforeach() -#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests_common) -#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests) -#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests_fast_dispatch) -#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests_fast_dispatch_single_chip_multi_queue) -#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit_tests_frequent) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/api) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/debug_tools) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/device) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_buffer) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_event) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_program) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_trace) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/eth) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/integration) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/llk) @@ -86,19 +77,15 @@ add_custom_target( metal_tests DEPENDS ${METAL_TEST_TARGETS} - #unit_tests - #unit_tests_fast_dispatch - #unit_tests_fast_dispatch_single_chip_multi_queue - #unit_tests_frequent - #unit_tests_galaxy metal_perf_microbenchmark_tests unit_tests_api unit_tests_debug_tools unit_tests_device - unit_tests_dispatch_buffer - unit_tests_dispatch_event - unit_tests_dispatch_program - unit_tests_dispatch_trace + #unit_tests_dispatch_buffer + #unit_tests_dispatch_event + #unit_tests_dispatch_program + #unit_tests_dispatch_trace + unit_tests_dispatch unit_tests_eth unit_tests_integration unit_tests_llk diff --git a/tests/tt_metal/tt_metal/api/circular_buffer/test_CircularBuffer_allocation.cpp b/tests/tt_metal/tt_metal/api/circular_buffer/test_CircularBuffer_allocation.cpp index a3fd2d2c9c4..04182323c6d 100644 --- a/tests/tt_metal/tt_metal/api/circular_buffer/test_CircularBuffer_allocation.cpp +++ b/tests/tt_metal/tt_metal/api/circular_buffer/test_CircularBuffer_allocation.cpp @@ -6,7 +6,6 @@ #include "gtest/gtest.h" #include "circular_buffer_test_utils.hpp" #include "tt_metal/host_api.hpp" -#include "tt_metal/impl/buffers/circular_buffer.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "common/bfloat16.hpp" diff --git a/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp b/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp index 14350f86741..75646c299e2 100644 --- a/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp +++ b/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp @@ -6,9 +6,6 @@ #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" -#include "tt_metal/test_utils/env_vars.hpp" -#include "tt_metal/impl/dispatch/command_queue.hpp" -#include "tt_metal/common/logger.hpp" using namespace tt; diff --git a/tests/tt_metal/tt_metal/api/test_runtime_args.cpp b/tests/tt_metal/tt_metal/api/test_runtime_args.cpp index 404222e3246..31d83f4783f 100644 --- a/tests/tt_metal/tt_metal/api/test_runtime_args.cpp +++ b/tests/tt_metal/tt_metal/api/test_runtime_args.cpp @@ -5,6 +5,7 @@ #include #include "device_fixture.hpp" +#include "kernels/kernel.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" diff --git a/tests/tt_metal/tt_metal/api/test_sharded_l1_buffer.cpp b/tests/tt_metal/tt_metal/api/test_sharded_l1_buffer.cpp index 9b59692df8f..34496c7e491 100644 --- a/tests/tt_metal/tt_metal/api/test_sharded_l1_buffer.cpp +++ b/tests/tt_metal/tt_metal/api/test_sharded_l1_buffer.cpp @@ -4,16 +4,10 @@ #include "device_fixture.hpp" #include "gtest/gtest.h" -#include "tt_metal/common/logger.hpp" -#include "tt_metal/common/math.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" -#include "tt_metal/test_utils/comparison.hpp" -#include "tt_metal/test_utils/df/df.hpp" -#include "tt_metal/test_utils/print_helpers.hpp" #include "tt_metal/test_utils/stimulus.hpp" #include "tt_metal/common/constants.hpp" -#include using namespace tt::tt_metal; diff --git a/tests/tt_metal/tt_metal/common/test_utils.hpp b/tests/tt_metal/tt_metal/common/test_utils.hpp index e7074237636..2affb620cf1 100644 --- a/tests/tt_metal/tt_metal/common/test_utils.hpp +++ b/tests/tt_metal/tt_metal/common/test_utils.hpp @@ -5,8 +5,55 @@ #pragma once #include #include +#include "tt_metal/host_api.hpp" #include "impl/kernels/kernel.hpp" +struct TestBufferConfig { + uint32_t num_pages; + uint32_t page_size; + BufferType buftype; +}; + +struct BufferStressTestConfig { + // Used for normal write/read tests + uint32_t seed; + uint32_t num_pages_total; + + uint32_t page_size; + uint32_t max_num_pages_per_buffer; + + // Used for wrap test + uint32_t num_iterations; + uint32_t num_unique_vectors; +}; + +inline std::vector generate_arange_vector(uint32_t size_bytes, uint32_t start = 0) { + TT_FATAL(size_bytes % sizeof(uint32_t) == 0, "Error"); + std::vector src(size_bytes / sizeof(uint32_t), 0); + + for (uint32_t i = 0; i < src.size(); i++) { + src.at(i) = start + i; + } + return src; +} + +inline std::pair, std::vector> EnqueueWriteBuffer_prior_to_wrap(tt::tt_metal::Device* device, tt::tt_metal::CommandQueue& cq, const TestBufferConfig& config) { + // This function just enqueues a buffer (which should be large in the config) + // write as a precursor to testing the wrap mechanism + size_t buf_size = config.num_pages * config.page_size; + auto buffer = Buffer::create(device, buf_size, config.page_size, config.buftype); + + std::vector src = create_random_vector_of_bfloat16( + buf_size, 100, std::chrono::system_clock::now().time_since_epoch().count()); + + EnqueueWriteBuffer(cq, *buffer, src, false); + return std::make_pair(std::move(buffer), src); +} + +inline bool does_device_have_active_eth_cores(const Device *device) { + return !(device->get_active_ethernet_cores(true).empty()); +} + inline std::pair, std::vector> create_runtime_args( const uint32_t num_unique_rt_args, const uint32_t num_common_rt_args, diff --git a/tests/tt_metal/tt_metal/dispatch/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch/CMakeLists.txt new file mode 100644 index 00000000000..820eac5a899 --- /dev/null +++ b/tests/tt_metal/tt_metal/dispatch/CMakeLists.txt @@ -0,0 +1,32 @@ +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_buffer) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_event) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_program) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dispatch_trace) + +add_executable( + unit_tests_dispatch + ${UNIT_TESTS_DISPATCH_BUFFER_SRC} + ${UNIT_TESTS_DISPATCH_EVENT_SRC} + ${UNIT_TESTS_DISPATCH_PROGRAM_SRC} + ${UNIT_TESTS_DISPATCH_TRACE_SRC} +) +TT_ENABLE_UNITY_BUILD(unit_tests_dispatch) + +target_link_libraries(unit_tests_dispatch PUBLIC test_metal_common_libs) +target_include_directories( + unit_tests_dispatch + PRIVATE + ${UMD_HOME} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tests + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/common +) +set_target_properties( + unit_tests_dispatch + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/test/tt_metal +) diff --git a/tests/tt_metal/tt_metal/dispatch_buffer/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch/dispatch_buffer/CMakeLists.txt similarity index 76% rename from tests/tt_metal/tt_metal/dispatch_buffer/CMakeLists.txt rename to tests/tt_metal/tt_metal/dispatch/dispatch_buffer/CMakeLists.txt index 46436a5c86d..0eb34156aeb 100644 --- a/tests/tt_metal/tt_metal/dispatch_buffer/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_buffer/CMakeLists.txt @@ -1,4 +1,8 @@ -set(UNIT_TESTS_DISPATCH_BUFFER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp) +set(UNIT_TESTS_DISPATCH_BUFFER_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp + CACHE INTERNAL + "" +) add_executable(unit_tests_dispatch_buffer ${UNIT_TESTS_DISPATCH_BUFFER_SRC}) TT_ENABLE_UNITY_BUILD(unit_tests_dispatch_buffer) @@ -12,6 +16,7 @@ target_include_directories( ${PROJECT_SOURCE_DIR}/tt_metal ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/dispatch/common ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common ) diff --git a/tests/tt_metal/tt_metal/dispatch_buffer/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_buffer/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp similarity index 99% rename from tests/tt_metal/tt_metal/dispatch_buffer/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp rename to tests/tt_metal/tt_metal/dispatch/dispatch_buffer/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp index d55ece84598..03554908a72 100644 --- a/tests/tt_metal/tt_metal/dispatch_buffer/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_buffer/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp @@ -5,7 +5,7 @@ #include #include "command_queue_fixture.hpp" -#include "command_queue_test_utils.hpp" +#include "test_utils.hpp" #include "gtest/gtest.h" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" @@ -14,19 +14,6 @@ using std::vector; using namespace tt::tt_metal; -struct BufferStressTestConfig { - // Used for normal write/read tests - uint32_t seed; - uint32_t num_pages_total; - - uint32_t page_size; - uint32_t max_num_pages_per_buffer; - - // Used for wrap test - uint32_t num_iterations; - uint32_t num_unique_vectors; -}; - class BufferStressTestConfigSharded { public: uint32_t seed; diff --git a/tests/tt_metal/tt_metal/dispatch_event/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch/dispatch_event/CMakeLists.txt similarity index 74% rename from tests/tt_metal/tt_metal/dispatch_event/CMakeLists.txt rename to tests/tt_metal/tt_metal/dispatch/dispatch_event/CMakeLists.txt index 6c0f162c6bd..e95422183c8 100644 --- a/tests/tt_metal/tt_metal/dispatch_event/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_event/CMakeLists.txt @@ -1,4 +1,9 @@ -set(UNIT_TESTS_DISPATCH_EVENT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueWaitForEvent.cpp) +set(UNIT_TESTS_DISPATCH_EVENT_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueWaitForEvent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_events.cpp + CACHE INTERNAL + "" +) add_executable(unit_tests_dispatch_event ${UNIT_TESTS_DISPATCH_EVENT_SRC}) TT_ENABLE_UNITY_BUILD(unit_tests_dispatch_event) @@ -12,6 +17,7 @@ target_include_directories( ${PROJECT_SOURCE_DIR}/tt_metal ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/dispatch/common ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common ) diff --git a/tests/tt_metal/tt_metal/dispatch_event/test_EnqueueWaitForEvent.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_event/test_EnqueueWaitForEvent.cpp similarity index 99% rename from tests/tt_metal/tt_metal/dispatch_event/test_EnqueueWaitForEvent.cpp rename to tests/tt_metal/tt_metal/dispatch/dispatch_event/test_EnqueueWaitForEvent.cpp index bf71ca75e9a..b7ae5da7add 100644 --- a/tests/tt_metal/tt_metal/dispatch_event/test_EnqueueWaitForEvent.cpp +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_event/test_EnqueueWaitForEvent.cpp @@ -8,7 +8,7 @@ #include "tt_metal/common/logger.hpp" #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" -#include "command_queue_test_utils.hpp" +#include "test_utils.hpp" #include "tt_metal/impl/event/event.hpp" #include "tt_metal/impl/device/device.hpp" @@ -22,8 +22,6 @@ void FinishAllCqs(vector>& cqs) { Finish(cqs[i]); } } - - } namespace basic_tests { diff --git a/tests/tt_metal/tt_metal/dispatch_event/test_events.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_event/test_events.cpp similarity index 99% rename from tests/tt_metal/tt_metal/dispatch_event/test_events.cpp rename to tests/tt_metal/tt_metal/dispatch/dispatch_event/test_events.cpp index 28f125d1bf2..183391149c3 100644 --- a/tests/tt_metal/tt_metal/dispatch_event/test_events.cpp +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_event/test_events.cpp @@ -3,7 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 #include "command_queue_fixture.hpp" -#include "command_queue_test_utils.hpp" #include "gtest/gtest.h" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" diff --git a/tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt similarity index 76% rename from tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt rename to tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt index 1b773c26b2c..5498681c39d 100644 --- a/tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt @@ -1,7 +1,12 @@ set(UNIT_TESTS_DISPATCH_PROGRAM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_dispatch.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueProgram.cpp +<<<<<<< HEAD:tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/test_sub_device.cpp +======= + CACHE INTERNAL + "" +>>>>>>> #0: More test structuring:tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt ) add_executable(unit_tests_dispatch_program ${UNIT_TESTS_DISPATCH_PROGRAM_SRC}) @@ -16,6 +21,7 @@ target_include_directories( ${PROJECT_SOURCE_DIR}/tt_metal ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/dispatch/common ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common ) diff --git a/tests/tt_metal/tt_metal/dispatch_program/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_EnqueueProgram.cpp similarity index 99% rename from tests/tt_metal/tt_metal/dispatch_program/test_EnqueueProgram.cpp rename to tests/tt_metal/tt_metal/dispatch/dispatch_program/test_EnqueueProgram.cpp index 3fcb44acb1d..784388d695f 100644 --- a/tests/tt_metal/tt_metal/dispatch_program/test_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_EnqueueProgram.cpp @@ -5,7 +5,7 @@ #include #include #include "command_queue_fixture.hpp" -#include "command_queue_test_utils.hpp" +#include "test_utils.hpp" #include "gtest/gtest.h" #include "impl/buffers/buffer.hpp" #include "impl/device/device.hpp" diff --git a/tests/tt_metal/tt_metal/dispatch_program/test_dispatch.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_dispatch.cpp similarity index 100% rename from tests/tt_metal/tt_metal/dispatch_program/test_dispatch.cpp rename to tests/tt_metal/tt_metal/dispatch/dispatch_program/test_dispatch.cpp diff --git a/tests/tt_metal/tt_metal/dispatch_trace/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch/dispatch_trace/CMakeLists.txt similarity index 89% rename from tests/tt_metal/tt_metal/dispatch_trace/CMakeLists.txt rename to tests/tt_metal/tt_metal/dispatch/dispatch_trace/CMakeLists.txt index 3be36870c5e..f4e64955b3a 100644 --- a/tests/tt_metal/tt_metal/dispatch_trace/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_trace/CMakeLists.txt @@ -1,6 +1,8 @@ set(UNIT_TESTS_DISPATCH_TRACE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueTrace.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_sub_device.cpp + CACHE INTERNAL + "" ) add_executable(unit_tests_dispatch_trace ${UNIT_TESTS_DISPATCH_TRACE_SRC}) @@ -15,6 +17,7 @@ target_include_directories( ${PROJECT_SOURCE_DIR}/tt_metal ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common + ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/dispatch/common ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common ) diff --git a/tests/tt_metal/tt_metal/dispatch_trace/test_EnqueueTrace.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_trace/test_EnqueueTrace.cpp similarity index 99% rename from tests/tt_metal/tt_metal/dispatch_trace/test_EnqueueTrace.cpp rename to tests/tt_metal/tt_metal/dispatch/dispatch_trace/test_EnqueueTrace.cpp index 48238799d7b..97393e92746 100644 --- a/tests/tt_metal/tt_metal/dispatch_trace/test_EnqueueTrace.cpp +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_trace/test_EnqueueTrace.cpp @@ -7,7 +7,7 @@ #include #include "command_queue_fixture.hpp" -#include "command_queue_test_utils.hpp" +#include "test_utils.hpp" #include "detail/tt_metal.hpp" #include "tt_metal/common/env_lib.hpp" #include "gtest/gtest.h" diff --git a/tests/tt_metal/tt_metal/eth/CMakeLists.txt b/tests/tt_metal/tt_metal/eth/CMakeLists.txt index 819a3721db3..6068d8978a4 100644 --- a/tests/tt_metal/tt_metal/eth/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/eth/CMakeLists.txt @@ -1,6 +1,7 @@ set(UNIT_TESTS_ETH_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_buffer_movement_kernels.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_erisc_app_direct_send.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_ring_gather_kernels.cpp ) add_executable(unit_tests_eth ${UNIT_TESTS_ETH_SRC}) diff --git a/tests/tt_metal/tt_metal/unit_tests/ethernet/ring_gather_kernels.cpp b/tests/tt_metal/tt_metal/eth/test_ring_gather_kernels.cpp similarity index 100% rename from tests/tt_metal/tt_metal/unit_tests/ethernet/ring_gather_kernels.cpp rename to tests/tt_metal/tt_metal/eth/test_ring_gather_kernels.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/command_queue_test_utils.hpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/command_queue_test_utils.hpp deleted file mode 100644 index 7aa1811ecd5..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/command_queue_test_utils.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include "tt_metal/host_api.hpp" -#include "tt_metal/common/bfloat16.hpp" -#include "tt_metal/impl/buffers/buffer.hpp" - -struct TestBufferConfig { - uint32_t num_pages; - uint32_t page_size; - tt::tt_metal::BufferType buftype; -}; - -inline std::pair, std::vector> EnqueueWriteBuffer_prior_to_wrap(tt::tt_metal::Device* device, tt::tt_metal::CommandQueue& cq, const TestBufferConfig& config) { - // This function just enqueues a buffer (which should be large in the config) - // write as a precursor to testing the wrap mechanism - size_t buf_size = config.num_pages * config.page_size; - auto buffer = Buffer::create(device, buf_size, config.page_size, config.buftype); - - std::vector src = create_random_vector_of_bfloat16( - buf_size, 100, std::chrono::system_clock::now().time_since_epoch().count()); - - EnqueueWriteBuffer(cq, *buffer, src, false); - return std::make_pair(std::move(buffer), src); -} - -inline bool does_device_have_active_eth_cores(const Device *device) { - return !(device->get_active_ethernet_cores(true).empty()); -} diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_test_utils.hpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_test_utils.hpp deleted file mode 100644 index e1e02ae6e16..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/common/command_queue_test_utils.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include "tt_metal/host_api.hpp" -#include "tt_metal/common/bfloat16.hpp" - -struct TestBufferConfig { - uint32_t num_pages; - uint32_t page_size; - BufferType buftype; -}; - -struct BufferStressTestConfig { - // Used for normal write/read tests - uint32_t seed; - uint32_t num_pages_total; - - uint32_t page_size; - uint32_t max_num_pages_per_buffer; - - // Used for wrap test - uint32_t num_iterations; - uint32_t num_unique_vectors; -}; - - -inline std::vector generate_arange_vector(uint32_t size_bytes, uint32_t start = 0) { - TT_FATAL(size_bytes % sizeof(uint32_t) == 0, "Error"); - std::vector src(size_bytes / sizeof(uint32_t), 0); - - for (uint32_t i = 0; i < src.size(); i++) { - src.at(i) = start + i; - } - return src; -} From 666dea20ff8313eded6e1a6a52cced1f9a29e89d Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Fri, 8 Nov 2024 19:30:22 +0000 Subject: [PATCH 20/26] #0: More test structuring --- CONTRIBUTING.md | 2 +- tests/scripts/run_testpoint_perprocess.py | 2 +- tests/scripts/t3000/run_t3000_unit_tests.sh | 4 ++-- tests/scripts/tg/run_tg_unit_tests.sh | 8 ++++---- tests/scripts/tgg/run_tgg_unit_tests.sh | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b34119280b6..4839a39fab5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -263,7 +263,7 @@ On slow dispatch, to run another specific test, the equivalent would be: 2. Run with the slow dispatch mode: ``` export TT_METAL_SLOW_DISPATCH_MODE=1 - ./build/test/tt_metal/unit_tests/fast_dispatch --gtest_filter="DeviceSingleCardBufferFixture.TestL1BuffersAllocatedTopDown" + ./build/test/tt_metal/unit_tests/unit_tests_api --gtest_filter="DeviceSingleCardBufferFixture.TestL1BuffersAllocatedTopDown" ``` We have split our tests into the two dispatch modes for less pollution of state diff --git a/tests/scripts/run_testpoint_perprocess.py b/tests/scripts/run_testpoint_perprocess.py index 8a2feb156bb..3d2c4a88e9d 100755 --- a/tests/scripts/run_testpoint_perprocess.py +++ b/tests/scripts/run_testpoint_perprocess.py @@ -13,7 +13,7 @@ DEBUG = False TT_METAL_HOME = os.environ["TT_METAL_HOME"] -DEFAULT_GTEST = f"{TT_METAL_HOME}/build/test/tt_metal/unit_tests" +DEFAULT_GTEST = f"{TT_METAL_HOME}/build/test/tt_metal/unit_tests_api" def extract_list_of_test_points(args: argparse.Namespace): diff --git a/tests/scripts/t3000/run_t3000_unit_tests.sh b/tests/scripts/t3000/run_t3000_unit_tests.sh index 5cd8c12883c..fcf34934903 100755 --- a/tests/scripts/t3000/run_t3000_unit_tests.sh +++ b/tests/scripts/t3000/run_t3000_unit_tests.sh @@ -12,8 +12,8 @@ run_t3000_ttmetal_tests() { TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests_eth --gtest_filter="DeviceFixture.ActiveEthKernelsSendInterleavedBufferAllConnectedChips" ; fail+=$? TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests_eth --gtest_filter="DeviceFixture.ActiveEthKernelsDirectRingGatherAllChips" ; fail+=$? TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests_eth --gtest_filter="DeviceFixture.ActiveEthKernelsInterleavedRingGatherAllChips" ; fail+=$? - TT_METAL_ENABLE_REMOTE_CHIP=1 ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="CommandQueueSingleCard.*Fixture.*" ; fail+=$? - ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="CommandQueueMultiDevice.*Fixture.*" ; fail+=$? + TT_METAL_ENABLE_REMOTE_CHIP=1 ./build/test/tt_metal/unit_tests_dispatch --gtest_filter="CommandQueueSingleCard.*Fixture.*" ; fail+=$? + ./build/test/tt_metal/unit_tests_dispatch --gtest_filter="CommandQueueMultiDevice.*Fixture.*" ; fail+=$? ./build/test/tt_metal/unit_tests_debug_tools --gtest_filter="DPrintFixture.*:WatcherFixture.*" ; fail+=$? # Record the end time diff --git a/tests/scripts/tg/run_tg_unit_tests.sh b/tests/scripts/tg/run_tg_unit_tests.sh index 52ad5748558..05046bb8c3f 100755 --- a/tests/scripts/tg/run_tg_unit_tests.sh +++ b/tests/scripts/tg/run_tg_unit_tests.sh @@ -5,11 +5,11 @@ run_tg_tests() { echo "LOG_METAL: running run_tg_unit_tests" - TT_METAL_ENABLE_REMOTE_CHIP=1 ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="CommandQueueSingleCardFixture.*" + TT_METAL_ENABLE_REMOTE_CHIP=1 ./build/test/tt_metal/unit_tests_dispatch --gtest_filter="CommandQueueSingleCard.*Fixture.*" ./build/test/ttnn/galaxy_unit_tests_ttnn - TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests_galaxy --gtest_filter="GalaxyFixture.*:TGFixture.*" - ./build/test/tt_metal/unit_tests_galaxy --gtest_filter="GalaxyFixture.*:TGFixture.*" - TT_METAL_GTEST_NUM_HW_CQS=2 ./build/test/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue --gtest_filter="MultiCommandQueueMultiDeviceFixture.*" + TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests_multichip --gtest_filter="GalaxyFixture.*:TGFixture.*" + ./build/test/tt_metal/unit_tests_multichip --gtest_filter="GalaxyFixture.*:TGFixture.*" + TT_METAL_GTEST_NUM_HW_CQS=2 ./build/test/tt_metal/unit_tests_dispatch --gtest_filter="MultiCommandQueueMultiDevice.*Fixture.*" } diff --git a/tests/scripts/tgg/run_tgg_unit_tests.sh b/tests/scripts/tgg/run_tgg_unit_tests.sh index 08f8f08c421..dca480b4d36 100755 --- a/tests/scripts/tgg/run_tgg_unit_tests.sh +++ b/tests/scripts/tgg/run_tgg_unit_tests.sh @@ -5,10 +5,10 @@ run_tgg_tests() { echo "LOG_METAL: running run_tgg_unit_tests" - TT_METAL_ENABLE_REMOTE_CHIP=1 ./build/test/tt_metal/unit_tests_fast_dispatch --gtest_filter="CommandQueueSingleCardFixture.*" + TT_METAL_ENABLE_REMOTE_CHIP=1 ./build/test/tt_metal/unit_tests_dispatch --gtest_filter="CommandQueueSingleCard.*Fixture.*" ./build/test/ttnn/galaxy_unit_tests_ttnn - TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests_galaxy --gtest_filter="GalaxyFixture.*:TGGFixture.*" - ./build/test/tt_metal/unit_tests_galaxy --gtest_filter="GalaxyFixture.*:TGGFixture.*" + TT_METAL_SLOW_DISPATCH_MODE=1 ./build/test/tt_metal/unit_tests_multichip --gtest_filter="GalaxyFixture.*:TGGFixture.*" + ./build/test/tt_metal/unit_tests_multichip --gtest_filter="GalaxyFixture.*:TGGFixture.*" pytest -s tests/ttnn/distributed/test_mesh_device_TGG.py } From 25c55e194a30123c9770a96855e2e9a6fe7cfef8 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Tue, 12 Nov 2024 14:53:20 +0000 Subject: [PATCH 21/26] #0: More work --- .../tt_metal/api/test_kernel_creation.cpp | 29 +++++ .../dispatch/dispatch_program/CMakeLists.txt | 1 + ...rogram_with_kernel_created_from_string.cpp | 102 ++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 tests/tt_metal/tt_metal/dispatch/dispatch_program/test_dispatch_program_with_kernel_created_from_string.cpp diff --git a/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp b/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp index 75646c299e2..9f520414252 100644 --- a/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp +++ b/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp @@ -74,3 +74,32 @@ TEST_F(DispatchFixture, TensixIdleEthCreateKernelsOnDispatchCores) { } } } + +TEST_F(CompileProgramWithKernelPathEnvVarFixture, TensixKernelUnderMetalRootDir) { + const string &kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/reader_unary_push_4.cpp"; + create_kernel(kernel_file); + detail::CompileProgram(this->device_, this->program_); +} + +TEST_F(CompileProgramWithKernelPathEnvVarFixture, TensixKernelUnderKernelRootDir) { + const string &orig_kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/reader_unary_push_4.cpp"; + const string &new_kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/new_kernel.cpp"; + this->setup_kernel_dir(orig_kernel_file, new_kernel_file); + this->create_kernel(new_kernel_file); + detail::CompileProgram(this->device_, this->program_); + this->cleanup_kernel_dir(); +} + +TEST_F(CompileProgramWithKernelPathEnvVarFixture, TensixKernelUnderMetalRootDirAndKernelRootDir) { + const string &kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/reader_unary_push_4.cpp"; + this->setup_kernel_dir(kernel_file, kernel_file); + this->create_kernel(kernel_file); + detail::CompileProgram(this->device_, this->program_); + this->cleanup_kernel_dir(); +} + +TEST_F(CompileProgramWithKernelPathEnvVarFixture, TensixNonExistentKernel) { + const string &kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/non_existent_kernel.cpp"; + this->create_kernel(kernel_file); + EXPECT_THROW(detail::CompileProgram(this->device_, this->program_), std::exception); +} diff --git a/tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt index 5498681c39d..e43627bd549 100644 --- a/tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt @@ -1,4 +1,5 @@ set(UNIT_TESTS_DISPATCH_PROGRAM_SRC + ${CMAKE_CURRENT_SOURCE_DIR}/test_dispatch_program_with_kernel_created_from_string.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_dispatch.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueProgram.cpp <<<<<<< HEAD:tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt diff --git a/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_dispatch_program_with_kernel_created_from_string.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_dispatch_program_with_kernel_created_from_string.cpp new file mode 100644 index 00000000000..f86b6878ba1 --- /dev/null +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_dispatch_program_with_kernel_created_from_string.cpp @@ -0,0 +1,102 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "core_coord.hpp" +#include "detail/tt_metal.hpp" +#include "host_api.hpp" +#include "impl/device/device.hpp" +#include "impl/kernels/data_types.hpp" +#include "impl/kernels/kernel_types.hpp" +#include "impl/program/program.hpp" +#include "tt_cluster_descriptor_types.h" + +#include "tests/tt_metal/tt_metal/common/dispatch_fixture.hpp" + +TEST_F(ProgramWithKernelCreatedFromStringFixture, TensixDataMovementKernel) { + const CoreRange cores({0, 0}, {1, 1}); + const string &kernel_src_code = R"( + #include "debug/dprint.h" + #include "dataflow_api.h" + + void kernel_main() { + + DPRINT_DATA0(DPRINT << "Hello, I am running a void data movement kernel on NOC 0." << ENDL()); + DPRINT_DATA1(DPRINT << "Hello, I am running a void data movement kernel on NOC 1." << ENDL()); + + } + )"; + + for (Device *device : this->devices_) { + Program program = CreateProgram(); + tt_metal::CreateKernelFromString( + program, + kernel_src_code, + cores, + tt_metal::DataMovementConfig{.processor = DataMovementProcessor::RISCV_1, .noc = NOC::RISCV_1_default}); + this->RunProgram(device, program); + }; +} + +TEST_F(ProgramWithKernelCreatedFromStringFixture, TensixComputeKernel) { + const CoreRange cores({0, 0}, {1, 1}); + const string &kernel_src_code = R"( + #include "debug/dprint.h" + #include "compute_kernel_api.h" + + namespace NAMESPACE { + + void MAIN { + + DPRINT_MATH(DPRINT << "Hello, I am running a void compute kernel." << ENDL()); + + } + + } + )"; + + for (Device *device : this->devices_) { + Program program = CreateProgram(); + tt_metal::CreateKernelFromString( + program, + kernel_src_code, + cores, + tt_metal::ComputeConfig{ + .math_fidelity = MathFidelity::HiFi4, + .fp32_dest_acc_en = false, + .math_approx_mode = false, + .compile_args = {}}); + this->RunProgram(device, program); + }; +} + +TEST_F(ProgramWithKernelCreatedFromStringFixture, ActiveEthEthernetKernel) { + const string &kernel_src_code = R"( + #include "debug/dprint.h" + #include "dataflow_api.h" + + void kernel_main() { + + DPRINT << "Hello, I am running a void ethernet kernel." << ENDL(); + + } + )"; + + for (Device *device : this->devices_) { + const std::unordered_set &active_ethernet_cores = device->get_active_ethernet_cores(true); + if (active_ethernet_cores.empty()) { + const chip_id_t device_id = device->id(); + log_info(LogTest, "Skipping this test on device {} because it has no active ethernet cores.", device_id); + continue; + } + Program program = CreateProgram(); + tt_metal::CreateKernelFromString( + program, + kernel_src_code, + *active_ethernet_cores.begin(), + tt_metal::EthernetConfig{.noc = tt_metal::NOC::NOC_0}); + this->RunProgram(device, program); + }; +} From 4cf8f7377e53e6c4f7bc6af6452cf1067f5ac8b3 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Thu, 14 Nov 2024 16:32:41 +0000 Subject: [PATCH 22/26] More work --- tests/scripts/run_cpp_unit_tests.sh | 2 +- tests/tt_metal/tt_metal/CMakeLists.txt | 2 - tests/tt_metal/tt_metal/api/CMakeLists.txt | 1 + ...gram_with_kernel_path_env_var_fixture.hpp} | 54 +------- .../tt_metal/api/test_kernel_creation.cpp | 47 +++---- .../tt_metal/common/buffer_fixture.hpp | 9 -- .../tt_metal/common/command_queue_fixture.hpp | 36 ++--- .../tt_metal/common/device_fixture.hpp | 5 +- .../tt_metal/common/dispatch_fixture.hpp | 2 +- .../tt_metal/common/event_fixture.hpp | 9 -- .../tt_metal/common/program_fixture.hpp | 9 -- .../tt_metal/common/trace_fixture.hpp | 4 +- .../tt_metal/debug_tools/CMakeLists.txt | 1 + .../debug_tools/debug_tools_fixture.hpp | 45 ++++--- .../dprint/test_print_tensix_dest.cpp | 1 + tests/tt_metal/tt_metal/device/CMakeLists.txt | 1 + .../tt_metal/tt_metal/dispatch/CMakeLists.txt | 1 + ...ith_kernel_created_from_string_fixture.hpp | 27 ++++ .../dispatch_program/test_EnqueueProgram.cpp | 6 +- ...rogram_with_kernel_created_from_string.cpp | 5 +- tests/tt_metal/tt_metal/eth/CMakeLists.txt | 1 + .../tt_metal/integration/CMakeLists.txt | 1 + tests/tt_metal/tt_metal/llk/CMakeLists.txt | 1 + tests/tt_metal/tt_metal/stl/CMakeLists.txt | 1 + .../test_create_kernel_from_string.cpp | 124 ------------------ 25 files changed, 116 insertions(+), 279 deletions(-) rename tests/tt_metal/tt_metal/{test_kernel_path_env_var.cpp => api/compile_program_with_kernel_path_env_var_fixture.hpp} (59%) delete mode 100644 tests/tt_metal/tt_metal/common/buffer_fixture.hpp delete mode 100644 tests/tt_metal/tt_metal/common/event_fixture.hpp delete mode 100644 tests/tt_metal/tt_metal/common/program_fixture.hpp create mode 100644 tests/tt_metal/tt_metal/dispatch/dispatch_program/program_with_kernel_created_from_string_fixture.hpp delete mode 100644 tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp diff --git a/tests/scripts/run_cpp_unit_tests.sh b/tests/scripts/run_cpp_unit_tests.sh index 7da1c173021..eb62dfa5ccf 100755 --- a/tests/scripts/run_cpp_unit_tests.sh +++ b/tests/scripts/run_cpp_unit_tests.sh @@ -9,7 +9,7 @@ fi kernel_path="/tmp/kernels" mkdir -p $kernel_path -TT_METAL_KERNEL_PATH=$kernel_path ./build/test/tt_metal/test_kernel_path_env_var +TT_METAL_KERNEL_PATH=$kernel_path ./build/test/tt_metal/ --gtest_filter=CompileProgramWithKernelPathEnvVarFixture.* rm -rf $kernel_path if [[ ! -z "$TT_METAL_SLOW_DISPATCH_MODE" ]]; then diff --git a/tests/tt_metal/tt_metal/CMakeLists.txt b/tests/tt_metal/tt_metal/CMakeLists.txt index f1bf004d2af..484bf3e35f5 100644 --- a/tests/tt_metal/tt_metal/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/CMakeLists.txt @@ -35,9 +35,7 @@ set(TT_METAL_TESTS_SRCS test_core_range_set.cpp test_compile_sets_kernel_binaries.cpp test_compile_program.cpp - test_kernel_path_env_var.cpp test_clean_init.cpp - test_create_kernel_from_string.cpp ) foreach(TEST_SRC ${TT_METAL_TESTS_SRCS}) diff --git a/tests/tt_metal/tt_metal/api/CMakeLists.txt b/tests/tt_metal/tt_metal/api/CMakeLists.txt index 6ed40b1572d..7e335b8bd8e 100644 --- a/tests/tt_metal/tt_metal/api/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/api/CMakeLists.txt @@ -32,6 +32,7 @@ target_include_directories( ${UMD_HOME} ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tt_metal/common ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tests/tt_metal/tt_metal/test_kernel_path_env_var.cpp b/tests/tt_metal/tt_metal/api/compile_program_with_kernel_path_env_var_fixture.hpp similarity index 59% rename from tests/tt_metal/tt_metal/test_kernel_path_env_var.cpp rename to tests/tt_metal/tt_metal/api/compile_program_with_kernel_path_env_var_fixture.hpp index 68a84d904c0..b2b887e0246 100644 --- a/tests/tt_metal/tt_metal/test_kernel_path_env_var.cpp +++ b/tests/tt_metal/tt_metal/api/compile_program_with_kernel_path_env_var_fixture.hpp @@ -2,23 +2,12 @@ // // SPDX-License-Identifier: Apache-2.0 -#include - -#include -#include +#pragma once -#include "assert.hpp" -#include "core_coord.hpp" -#include "detail/tt_metal.hpp" +#include #include "host_api.hpp" -#include "impl/kernels/data_types.hpp" -#include "impl/program/program.hpp" -#include "llrt/rtoptions.hpp" -#include "tt_cluster_descriptor_types.h" using namespace tt; -using namespace tt::tt_metal; -using namespace tt::llrt; class CompileProgramWithKernelPathEnvVarFixture : public ::testing::Test { protected: @@ -42,18 +31,18 @@ class CompileProgramWithKernelPathEnvVarFixture : public ::testing::Test { } void setup_kernel_dir(const string &orig_kernel_file, const string &new_kernel_file) { - const string &kernel_dir = OptionsG.get_kernel_dir(); + const string &kernel_dir = llrt::OptionsG.get_kernel_dir(); const std::filesystem::path &kernel_file_path_under_kernel_dir(kernel_dir + new_kernel_file); const std::filesystem::path &dirs_under_kernel_dir = kernel_file_path_under_kernel_dir.parent_path(); std::filesystem::create_directories(dirs_under_kernel_dir); - const string &metal_root = OptionsG.get_root_dir(); + const string &metal_root = llrt::OptionsG.get_root_dir(); const std::filesystem::path &kernel_file_path_under_metal_root(metal_root + orig_kernel_file); std::filesystem::copy(kernel_file_path_under_metal_root, kernel_file_path_under_kernel_dir); } void cleanup_kernel_dir() { - const string &kernel_dir = OptionsG.get_kernel_dir(); + const string &kernel_dir = llrt::OptionsG.get_kernel_dir(); for (const std::filesystem::directory_entry &entry : std::filesystem::directory_iterator(kernel_dir)) { std::filesystem::remove_all(entry); } @@ -69,10 +58,10 @@ class CompileProgramWithKernelPathEnvVarFixture : public ::testing::Test { } void validate_env_vars_are_set() { - if (!OptionsG.is_root_dir_specified()) { + if (!llrt::OptionsG.is_root_dir_specified()) { GTEST_SKIP() << "Skipping test: TT_METAL_HOME must be set"; } - if (!OptionsG.is_kernel_dir_specified()) { + if (!llrt::OptionsG.is_kernel_dir_specified()) { GTEST_SKIP() << "Skipping test: TT_METAL_KERNEL_PATH must be set"; } } @@ -103,32 +92,3 @@ class CompileProgramWithKernelPathEnvVarFixture : public ::testing::Test { return std::filesystem::is_empty(file_path); } }; - -TEST_F(CompileProgramWithKernelPathEnvVarFixture, TensixKernelUnderMetalRootDir) { - const string &kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/reader_unary_push_4.cpp"; - create_kernel(kernel_file); - detail::CompileProgram(this->device_, this->program_); -} - -TEST_F(CompileProgramWithKernelPathEnvVarFixture, TensixKernelUnderKernelRootDir) { - const string &orig_kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/reader_unary_push_4.cpp"; - const string &new_kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/new_kernel.cpp"; - this->setup_kernel_dir(orig_kernel_file, new_kernel_file); - this->create_kernel(new_kernel_file); - detail::CompileProgram(this->device_, this->program_); - this->cleanup_kernel_dir(); -} - -TEST_F(CompileProgramWithKernelPathEnvVarFixture, TensixKernelUnderMetalRootDirAndKernelRootDir) { - const string &kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/reader_unary_push_4.cpp"; - this->setup_kernel_dir(kernel_file, kernel_file); - this->create_kernel(kernel_file); - detail::CompileProgram(this->device_, this->program_); - this->cleanup_kernel_dir(); -} - -TEST_F(CompileProgramWithKernelPathEnvVarFixture, TensixNonExistentKernel) { - const string &kernel_file = "tests/tt_metal/tt_metal/test_kernels/dataflow/non_existent_kernel.cpp"; - this->create_kernel(kernel_file); - EXPECT_THROW(detail::CompileProgram(this->device_, this->program_), std::exception); -} diff --git a/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp b/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp index 9f520414252..af101a8dee9 100644 --- a/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp +++ b/tests/tt_metal/tt_metal/api/test_kernel_creation.cpp @@ -2,45 +2,43 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "dispatch_fixture.hpp" #include "gtest/gtest.h" -#include "tt_metal/host_api.hpp" +#include "common/core_coord.hpp" +#include "dispatch_fixture.hpp" #include "tt_metal/detail/tt_metal.hpp" - +#include "host_api.hpp" +#include "compile_program_with_kernel_path_env_var_fixture.hpp" using namespace tt; // Ensures we can successfully create kernels on available compute grid TEST_F(DispatchFixture, TensixCreateKernelsOnComputeCores) { - for (unsigned int id = 0; id < devices_.size(); id++) { + for (unsigned int id = 0; id < this->devices_.size(); id++) { tt_metal::Program program = CreateProgram(); - CoreCoord compute_grid = devices_.at(id)->compute_with_storage_grid_size(); + CoreCoord compute_grid = this->devices_.at(id)->compute_with_storage_grid_size(); EXPECT_NO_THROW( auto test_kernel = tt_metal::CreateKernel( program, "tests/tt_metal/tt_metal/test_kernels/dataflow/dram_copy.cpp", CoreRange(CoreCoord(0, 0), CoreCoord(compute_grid.x, compute_grid.y)), - {.processor = tt_metal::DataMovementProcessor::RISCV_0, .noc = tt_metal::NOC::RISCV_0_default} - ); - ); + {.processor = tt_metal::DataMovementProcessor::RISCV_0, .noc = tt_metal::NOC::RISCV_0_default});); } } // Ensure we cannot create kernels on storage cores TEST_F(DispatchFixture, TensixCreateKernelsOnStorageCores) { - for (unsigned int id=0; id < devices_.size(); id++) { - if (devices_.at(id)->storage_only_cores().empty()) { + for (unsigned int id = 0; id < this->devices_.size(); id++) { + if (this->devices_.at(id)->storage_only_cores().empty()) { GTEST_SKIP() << "This test only runs on devices with storage only cores"; } - CoreRangeSet storage_core_range_set = CoreRangeSet(devices_.at(id)->storage_only_cores()); + tt_metal::Program program = CreateProgram(); + CoreRangeSet storage_core_range_set = CoreRangeSet(this->devices_.at(id)->storage_only_cores()); EXPECT_ANY_THROW( auto test_kernel = tt_metal::CreateKernel( program, "tests/tt_metal/tt_metal/test_kernels/dataflow/dram_copy.cpp", storage_core_range_set, - {.processor = tt_metal::DataMovementProcessor::RISCV_0, .noc = tt_metal::NOC::RISCV_0_default} - ); - ); + {.processor = tt_metal::DataMovementProcessor::RISCV_0, .noc = tt_metal::NOC::RISCV_0_default});); } } @@ -48,7 +46,9 @@ TEST_F(DispatchFixture, TensixIdleEthCreateKernelsOnDispatchCores) { if (getenv("TT_METAL_SLOW_DISPATCH_MODE")) { GTEST_SKIP() << "This test is only supported in fast dispatch mode"; } - for (unsigned int id=0; id < devices_.size(); id++) { + for (unsigned int id = 0; id < this->devices_.size(); id++) { + tt_metal::Program program = CreateProgram(); + Device* device = this->devices_.at(id); std::vector dispatch_cores = tt::get_logical_dispatch_cores(device->id(), device->num_hw_cqs()); CoreType dispatch_core_type = dispatch_core_manager::instance().get_dispatch_core_type(device->id()); std::set dispatch_core_range_set(dispatch_cores.begin(), dispatch_cores.end()); @@ -59,18 +59,13 @@ TEST_F(DispatchFixture, TensixIdleEthCreateKernelsOnDispatchCores) { program, "tests/tt_metal/tt_metal/test_kernels/dataflow/dram_copy.cpp", dispatch_core_range_set, - {.processor = tt_metal::DataMovementProcessor::RISCV_0, .noc = tt_metal::NOC::RISCV_0_default} - ); - ); + {.processor = tt_metal::DataMovementProcessor::RISCV_0, .noc = tt_metal::NOC::RISCV_0_default});); } else if (dispatch_core_type == CoreType::ETH) { - EXPECT_ANY_THROW( - auto test_kernel = tt_metal::CreateKernel( - program, - "tests/tt_metal/tt_metal/test_kernels/misc/erisc_print.cpp", - dispatch_core_range_set, - {.noc = tt_metal::NOC::NOC_0, .eth_mode = Eth::IDLE} - ); - ); + EXPECT_ANY_THROW(auto test_kernel = tt_metal::CreateKernel( + program, + "tests/tt_metal/tt_metal/test_kernels/misc/erisc_print.cpp", + dispatch_core_range_set, + {.noc = tt_metal::NOC::NOC_0, .eth_mode = Eth::IDLE});); } } } diff --git a/tests/tt_metal/tt_metal/common/buffer_fixture.hpp b/tests/tt_metal/tt_metal/common/buffer_fixture.hpp deleted file mode 100644 index c11461c677e..00000000000 --- a/tests/tt_metal/tt_metal/common/buffer_fixture.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include - -class BufferFixture : virtual public ::testing::Test {}; diff --git a/tests/tt_metal/tt_metal/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/common/command_queue_fixture.hpp index 172cbb4b62b..7a6f0ee7a42 100644 --- a/tests/tt_metal/tt_metal/common/command_queue_fixture.hpp +++ b/tests/tt_metal/tt_metal/common/command_queue_fixture.hpp @@ -7,6 +7,9 @@ #include "common/core_coord.hpp" #include "common/env_lib.hpp" #include "gtest/gtest.h" +#include "dispatch_fixture.hpp" +#include "trace_fixture.hpp" +#include "hostdevcommon/common_runtime_address_map.h" #include "hostdevcommon/common_values.hpp" #include "impl/buffers/circular_buffer_types.hpp" #include "impl/device/device.hpp" @@ -24,7 +27,7 @@ #include "test_utils.hpp" #include "tt_soc_descriptor.h" -class CommandQueueFixture : virtual public DispatchFixture { +class CommandQueueFixture : public DispatchFixture { protected: tt::tt_metal::Device* device_; void SetUp() override { @@ -47,11 +50,11 @@ class CommandQueueFixture : virtual public DispatchFixture { } }; -class CommandQueueEventFixture : virtual public CommandQueueFixture, virtual public EventFixture {}; +class CommandQueueEventFixture : public CommandQueueFixture {}; -class CommandQueueBufferFixture : virtual public CommandQueueFixture, virtual public BufferFixture {}; +class CommandQueueBufferFixture : public CommandQueueFixture {}; -class CommandQueueProgramFixture : virtual public CommandQueueFixture, virtual public ProgramFixture {}; +class CommandQueueProgramFixture : public CommandQueueFixture {}; class CommandQueueSingleCardFixture : virtual public DispatchFixture { protected: @@ -90,10 +93,9 @@ class CommandQueueSingleCardFixture : virtual public DispatchFixture { std::map reserved_devices_; }; -class CommandQueueSingleCardBufferFixture : virtual public CommandQueueSingleCardFixture, - virtual public BufferFixture {}; +class CommandQueueSingleCardBufferFixture : public CommandQueueSingleCardFixture {}; -class CommandQueueSingleCardTraceFixture : virtual public CommandQueueSingleCardFixture, virtual public TraceFixture { +class CommandQueueSingleCardTraceFixture : virtual public CommandQueueSingleCardFixture { protected: void SetUp() override { this->validate_dispatch_mode(); @@ -102,8 +104,7 @@ class CommandQueueSingleCardTraceFixture : virtual public CommandQueueSingleCard } }; -class CommandQueueSingleCardProgramFixture : virtual public CommandQueueSingleCardFixture, - virtual public ProgramFixture {}; +class CommandQueueSingleCardProgramFixture : virtual public CommandQueueSingleCardFixture {}; class CommandQueueMultiDeviceFixture : public DispatchFixture { protected: @@ -138,8 +139,7 @@ class CommandQueueMultiDeviceFixture : public DispatchFixture { size_t num_devices_; }; -class CommandQueueMultiDeviceProgramFixture : virtual public CommandQueueMultiDeviceFixture, - virtual public ProgramFixture {}; +class CommandQueueMultiDeviceProgramFixture : public CommandQueueMultiDeviceFixture {}; class RandomProgramFixture : virtual public CommandQueueSingleCardProgramFixture { protected: @@ -513,7 +513,7 @@ class RandomProgramTraceFixture : virtual public RandomProgramFixture, virtual p } }; -class MultiCommandQueueSingleDeviceFixture : virtual public DispatchFixture { +class MultiCommandQueueSingleDeviceFixture : public DispatchFixture { protected: void SetUp() override { auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); @@ -545,13 +545,13 @@ class MultiCommandQueueSingleDeviceFixture : virtual public DispatchFixture { tt::ARCH arch_; }; -class MultiCommandQueueSingleDeviceEventFixture : public MultiCommandQueueSingleDeviceFixture, public EventFixture {}; +class MultiCommandQueueSingleDeviceEventFixture : public MultiCommandQueueSingleDeviceFixture {}; -class MultiCommandQueueSingleDeviceBufferFixture : public MultiCommandQueueSingleDeviceFixture, public BufferFixture {}; +class MultiCommandQueueSingleDeviceBufferFixture : public MultiCommandQueueSingleDeviceFixture {}; -class MultiCommandQueueSingleDeviceProgramFixture : public MultiCommandQueueSingleDeviceFixture, public ProgramFixture {}; +class MultiCommandQueueSingleDeviceProgramFixture : public MultiCommandQueueSingleDeviceFixture {}; -class MultiCommandQueueMultiDeviceFixture : virtual public DispatchFixture { +class MultiCommandQueueMultiDeviceFixture : public DispatchFixture { protected: void SetUp() override { auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); @@ -588,6 +588,6 @@ class MultiCommandQueueMultiDeviceFixture : virtual public DispatchFixture { std::map reserved_devices_; }; -class MultiCommandQueueMultiDeviceBufferFixture : public MultiCommandQueueMultiDeviceFixture, public BufferFixture {}; +class MultiCommandQueueMultiDeviceBufferFixture : public MultiCommandQueueMultiDeviceFixture {}; -class MultiCommandQueueMultiDeviceEventFixture : public MultiCommandQueueMultiDeviceFixture, public EventFixture {}; +class MultiCommandQueueMultiDeviceEventFixture : public MultiCommandQueueMultiDeviceFixture {}; diff --git a/tests/tt_metal/tt_metal/common/device_fixture.hpp b/tests/tt_metal/tt_metal/common/device_fixture.hpp index 938df53a0f6..4977795cdbf 100644 --- a/tests/tt_metal/tt_metal/common/device_fixture.hpp +++ b/tests/tt_metal/tt_metal/common/device_fixture.hpp @@ -6,7 +6,6 @@ #include -#include "buffer_fixture.hpp" #include "tt_metal/host_api.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/test_utils/env_vars.hpp" @@ -53,7 +52,7 @@ class DeviceFixture : public ::testing::Test { size_t num_devices_; }; -class DeviceSingleCardFixture : virtual public ::testing::Test { +class DeviceSingleCardFixture : public ::testing::Test { protected: void SetUp() override { this->validate_dispatch_mode(); @@ -84,7 +83,7 @@ class DeviceSingleCardFixture : virtual public ::testing::Test { size_t num_devices_; }; -class DeviceSingleCardBufferFixture : virtual public DeviceSingleCardFixture, virtual public BufferFixture {}; +class DeviceSingleCardBufferFixture : public DeviceSingleCardFixture {}; class BlackholeSingleCardFixture : public DeviceSingleCardFixture { protected: diff --git a/tests/tt_metal/tt_metal/common/dispatch_fixture.hpp b/tests/tt_metal/tt_metal/common/dispatch_fixture.hpp index 23a3c3380a9..c0e070205c6 100644 --- a/tests/tt_metal/tt_metal/common/dispatch_fixture.hpp +++ b/tests/tt_metal/tt_metal/common/dispatch_fixture.hpp @@ -14,7 +14,7 @@ #include "tt_metal/impl/device/device_pool.hpp" // A dispatch-agnostic test fixture -class DispatchFixture : virtual public ::testing::Test { +class DispatchFixture : public ::testing::Test { public: // A function to run a program, according to which dispatch mode is set. void RunProgram(tt::tt_metal::Device* device, tt::tt_metal::Program& program) { diff --git a/tests/tt_metal/tt_metal/common/event_fixture.hpp b/tests/tt_metal/tt_metal/common/event_fixture.hpp deleted file mode 100644 index cb4f1ed44d6..00000000000 --- a/tests/tt_metal/tt_metal/common/event_fixture.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include - -class EventFixture : virtual public ::testing::Test {}; diff --git a/tests/tt_metal/tt_metal/common/program_fixture.hpp b/tests/tt_metal/tt_metal/common/program_fixture.hpp deleted file mode 100644 index 985309dea0d..00000000000 --- a/tests/tt_metal/tt_metal/common/program_fixture.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include - -class ProgramFixture : virtual public ::testing::Test {}; diff --git a/tests/tt_metal/tt_metal/common/trace_fixture.hpp b/tests/tt_metal/tt_metal/common/trace_fixture.hpp index 36aae845707..99375c436b0 100644 --- a/tests/tt_metal/tt_metal/common/trace_fixture.hpp +++ b/tests/tt_metal/tt_metal/common/trace_fixture.hpp @@ -9,9 +9,7 @@ #include "tt_metal/test_utils/env_vars.hpp" #include "impl/kernels/kernel.hpp" -class TraceFixture : virtual public ::testing::Test {}; - -class SingleDeviceTraceFixture : virtual public TraceFixture { +class SingleDeviceTraceFixture : public ::testing::Test { protected: Device* device_; tt::ARCH arch_; diff --git a/tests/tt_metal/tt_metal/debug_tools/CMakeLists.txt b/tests/tt_metal/tt_metal/debug_tools/CMakeLists.txt index 4bf92a2f68d..a21612c0b2b 100644 --- a/tests/tt_metal/tt_metal/debug_tools/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/debug_tools/CMakeLists.txt @@ -28,6 +28,7 @@ target_include_directories( ${UMD_HOME} ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tt_metal/common ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tests/tt_metal/tt_metal/debug_tools/debug_tools_fixture.hpp b/tests/tt_metal/tt_metal/debug_tools/debug_tools_fixture.hpp index a5709ce219c..96e28785d9f 100644 --- a/tests/tt_metal/tt_metal/debug_tools/debug_tools_fixture.hpp +++ b/tests/tt_metal/tt_metal/debug_tools/debug_tools_fixture.hpp @@ -8,10 +8,23 @@ #include "dispatch_fixture.hpp" #include "tt_metal/tt_metal/common/dispatch_fixture.hpp" -class DebugToolsFixture : virtual public ::testing::Test {}; +class DebugToolsFixture : public DispatchFixture { + protected: + bool watcher_previous_enabled; + + void TearDown() override { + tt::llrt::OptionsG.set_watcher_enabled(watcher_previous_enabled); + } + + template + void RunTestOnDevice(const std::function& run_function, Device* device) { + auto run_function_no_args = [=]() { run_function(static_cast(this), device); }; + DispatchFixture::RunTestOnDevice(run_function_no_args, device); + } +}; // A version of DispatchFixture with DPrint enabled on all cores. -class DPrintFixture : virtual public DispatchFixture, virtual public DebugToolsFixture { +class DPrintFixture : public DebugToolsFixture { public: inline static const string dprint_file_name = "gtest_dprint_log.txt"; @@ -19,14 +32,13 @@ class DPrintFixture : virtual public DispatchFixture, virtual public DebugToolsF void RunProgram(Device* device, Program& program) { // Only difference is that we need to wait for the print server to catch // up after running a test. - DispatchFixture::RunProgram(device, program); + DebugToolsFixture::RunProgram(device, program); tt::DprintServerAwait(); } protected: // Running with dprint + watcher enabled can make the code size blow up, so let's force watcher // disabled for DPRINT tests. - bool watcher_previous_enabled; void SetUp() override { // The core range (physical) needs to be set >= the set of all cores // used by all tests using this fixture, so set dprint enabled for @@ -46,12 +58,12 @@ class DPrintFixture : virtual public DispatchFixture, virtual public DebugToolsF ExtraSetUp(); // Parent class initializes devices and any necessary flags - DispatchFixture::SetUp(); + DebugToolsFixture::SetUp(); } void TearDown() override { // Parent class tears down devices - DispatchFixture::TearDown(); + DebugToolsFixture::TearDown(); // Remove the DPrint output file after the test is finished. std::remove(dprint_file_name.c_str()); @@ -66,17 +78,13 @@ class DPrintFixture : virtual public DispatchFixture, virtual public DebugToolsF tt::llrt::OptionsG.set_feature_all_chips(tt::llrt::RunTimeDebugFeatureDprint, false); tt::llrt::OptionsG.set_feature_file_name(tt::llrt::RunTimeDebugFeatureDprint, ""); tt::llrt::OptionsG.set_test_mode_enabled(false); - tt::llrt::OptionsG.set_watcher_enabled(watcher_previous_enabled); } void RunTestOnDevice( const std::function& run_function, Device* device ) { - auto run_function_no_args = [=]() { - run_function(this, device); - }; - DispatchFixture::RunTestOnDevice(run_function_no_args, device); + DebugToolsFixture::RunTestOnDevice(run_function, device); tt::DPrintServerClearLogFile(); tt::DPrintServerClearSignals(); } @@ -97,7 +105,7 @@ class DPrintDisableDevicesFixture : public DPrintFixture { }; // A version of DispatchFixture with watcher enabled -class WatcherFixture : virtual public DispatchFixture, virtual public DebugToolsFixture { +class WatcherFixture : public DebugToolsFixture { public: inline static const string log_file_name = "generated/watcher/watcher.log"; inline static const int interval_ms = 250; @@ -106,7 +114,7 @@ class WatcherFixture : virtual public DispatchFixture, virtual public DebugTools void RunProgram(Device* device, Program& program, bool wait_for_dump = false) { // Only difference is that we need to wait for the print server to catch // up after running a test. - DispatchFixture::RunProgram(device, program); + DebugToolsFixture::RunProgram(device, program); // Wait for watcher to run a full dump before finishing, need to wait for dump count to // increase because we'll likely check in the middle of a dump. @@ -117,7 +125,6 @@ class WatcherFixture : virtual public DispatchFixture, virtual public DebugTools } protected: - bool watcher_previous_enabled; int watcher_previous_interval; bool watcher_previous_dump_all; bool watcher_previous_append; @@ -143,15 +150,14 @@ class WatcherFixture : virtual public DispatchFixture, virtual public DebugTools tt::watcher_clear_log(); // Parent class initializes devices and any necessary flags - DispatchFixture::SetUp(); + DebugToolsFixture::SetUp(); } void TearDown() override { // Parent class tears down devices - DispatchFixture::TearDown(); + DebugToolsFixture::TearDown(); // Reset watcher settings to their previous values - tt::llrt::OptionsG.set_watcher_enabled(watcher_previous_enabled); tt::llrt::OptionsG.set_watcher_interval(watcher_previous_interval); tt::llrt::OptionsG.set_watcher_dump_all(watcher_previous_dump_all); tt::llrt::OptionsG.set_watcher_append(watcher_previous_append); @@ -165,10 +171,7 @@ class WatcherFixture : virtual public DispatchFixture, virtual public DebugTools const std::function& run_function, Device* device ) { - auto run_function_no_args = [=]() { - run_function(this, device); - }; - DispatchFixture::RunTestOnDevice(run_function_no_args, device); + DebugToolsFixture::RunTestOnDevice(run_function, device); // Wait for a final watcher poll and then clear the log. std::this_thread::sleep_for(std::chrono::milliseconds(interval_ms)); tt::watcher_clear_log(); diff --git a/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_tensix_dest.cpp b/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_tensix_dest.cpp index d195e56e030..3aa498a38aa 100644 --- a/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_tensix_dest.cpp +++ b/tests/tt_metal/tt_metal/debug_tools/dprint/test_print_tensix_dest.cpp @@ -8,6 +8,7 @@ #include "test_utils.hpp" #include "tt_metal/detail/tt_metal.hpp" #include "tt_metal/host_api.hpp" +#include "tt_metal/test_utils/df/df.hpp" #include "tt_metal/test_utils/stimulus.hpp" ////////////////////////////////////////////////////////////////////////////////////////// // A test for checking dprint diff --git a/tests/tt_metal/tt_metal/device/CMakeLists.txt b/tests/tt_metal/tt_metal/device/CMakeLists.txt index 206411187aa..3d15d253cfb 100644 --- a/tests/tt_metal/tt_metal/device/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/device/CMakeLists.txt @@ -16,6 +16,7 @@ target_include_directories( ${UMD_HOME} ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tt_metal/common ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tests/tt_metal/tt_metal/dispatch/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch/CMakeLists.txt index 820eac5a899..31c17b0132c 100644 --- a/tests/tt_metal/tt_metal/dispatch/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/dispatch/CMakeLists.txt @@ -19,6 +19,7 @@ target_include_directories( ${UMD_HOME} ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tt_metal/common ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tests/tt_metal/tt_metal/dispatch/dispatch_program/program_with_kernel_created_from_string_fixture.hpp b/tests/tt_metal/tt_metal/dispatch/dispatch_program/program_with_kernel_created_from_string_fixture.hpp new file mode 100644 index 00000000000..b15f3cc8deb --- /dev/null +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_program/program_with_kernel_created_from_string_fixture.hpp @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include +#include "dispatch_fixture.hpp" + +class ProgramWithKernelCreatedFromStringFixture : public DispatchFixture { + protected: + void SetUp() override { + DispatchFixture::SetUp(); + for (Device *device : this->devices_) + { + const chip_id_t device_id = device->id(); + this->device_ids_to_devices_[device_id] = device; + } + } + + void TearDown() override { + detail::CloseDevices(this->device_ids_to_devices_); + } + + private: + std::map device_ids_to_devices_; +}; diff --git a/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_EnqueueProgram.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_EnqueueProgram.cpp index 784388d695f..91fbd289f61 100644 --- a/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_EnqueueProgram.cpp +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_EnqueueProgram.cpp @@ -1242,7 +1242,7 @@ TEST_F(MultiCommandQueueSingleDeviceProgramFixture, TensixTestRandomizedProgram) CreateSemaphore(program, cr_set, j + 1); } - auto [brisc_unique_rtargs, brisc_common_rtargs] = local_test_functions::create_runtime_args(USE_MAX_RT_ARGS); + auto [brisc_unique_rtargs, brisc_common_rtargs] = create_runtime_args(USE_MAX_RT_ARGS); uint32_t num_brisc_unique_rtargs = brisc_unique_rtargs.size(); uint32_t num_brisc_common_rtargs = brisc_common_rtargs.size(); vector brisc_compile_args = {BRISC_OUTER_LOOP, BRISC_MIDDLE_LOOP, BRISC_INNER_LOOP, NUM_CBS, NUM_SEMS, num_brisc_unique_rtargs, num_brisc_common_rtargs, page_size}; @@ -1259,7 +1259,7 @@ TEST_F(MultiCommandQueueSingleDeviceProgramFixture, TensixTestRandomizedProgram) NCRISC_INNER_LOOP = rand() % (MAX_LOOP) + 1; } - auto [ncrisc_unique_rtargs, ncrisc_common_rtargs] = local_test_functions::create_runtime_args(USE_MAX_RT_ARGS); + auto [ncrisc_unique_rtargs, ncrisc_common_rtargs] = create_runtime_args(USE_MAX_RT_ARGS); uint32_t num_ncrisc_unique_rtargs = ncrisc_unique_rtargs.size(); uint32_t num_ncrisc_common_rtargs = ncrisc_common_rtargs.size(); vector ncrisc_compile_args = {NCRISC_OUTER_LOOP, NCRISC_MIDDLE_LOOP, NCRISC_INNER_LOOP, NUM_CBS, NUM_SEMS, num_ncrisc_unique_rtargs, num_ncrisc_common_rtargs, page_size}; @@ -1276,7 +1276,7 @@ TEST_F(MultiCommandQueueSingleDeviceProgramFixture, TensixTestRandomizedProgram) TRISC_INNER_LOOP = rand() % (MAX_LOOP) + 1; } - auto [trisc_unique_rtargs, trisc_common_rtargs] = local_test_functions::create_runtime_args(USE_MAX_RT_ARGS); + auto [trisc_unique_rtargs, trisc_common_rtargs] = create_runtime_args(USE_MAX_RT_ARGS); uint32_t num_trisc_unique_rtargs = trisc_unique_rtargs.size(); uint32_t num_trisc_common_rtargs = trisc_common_rtargs.size(); vector trisc_compile_args = {TRISC_OUTER_LOOP, TRISC_MIDDLE_LOOP, TRISC_INNER_LOOP, NUM_CBS, NUM_SEMS, num_trisc_unique_rtargs, num_trisc_common_rtargs, page_size}; diff --git a/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_dispatch_program_with_kernel_created_from_string.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_dispatch_program_with_kernel_created_from_string.cpp index f86b6878ba1..1322f2f4331 100644 --- a/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_dispatch_program_with_kernel_created_from_string.cpp +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_dispatch_program_with_kernel_created_from_string.cpp @@ -4,7 +4,7 @@ #include -#include "core_coord.hpp" +#include "common/core_coord.hpp" #include "detail/tt_metal.hpp" #include "host_api.hpp" #include "impl/device/device.hpp" @@ -12,8 +12,7 @@ #include "impl/kernels/kernel_types.hpp" #include "impl/program/program.hpp" #include "tt_cluster_descriptor_types.h" - -#include "tests/tt_metal/tt_metal/common/dispatch_fixture.hpp" +#include "program_with_kernel_created_from_string_fixture.hpp" TEST_F(ProgramWithKernelCreatedFromStringFixture, TensixDataMovementKernel) { const CoreRange cores({0, 0}, {1, 1}); diff --git a/tests/tt_metal/tt_metal/eth/CMakeLists.txt b/tests/tt_metal/tt_metal/eth/CMakeLists.txt index 6068d8978a4..1560fae655a 100644 --- a/tests/tt_metal/tt_metal/eth/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/eth/CMakeLists.txt @@ -14,6 +14,7 @@ target_include_directories( ${UMD_HOME} ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tt_metal/common ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tests/tt_metal/tt_metal/integration/CMakeLists.txt b/tests/tt_metal/tt_metal/integration/CMakeLists.txt index 6fff006dbba..3061bbf1d7b 100644 --- a/tests/tt_metal/tt_metal/integration/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/integration/CMakeLists.txt @@ -19,6 +19,7 @@ target_include_directories( ${UMD_HOME} ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tt_metal/common ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tests/tt_metal/tt_metal/llk/CMakeLists.txt b/tests/tt_metal/tt_metal/llk/CMakeLists.txt index b70212a3885..9b0a277362c 100644 --- a/tests/tt_metal/tt_metal/llk/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/llk/CMakeLists.txt @@ -23,6 +23,7 @@ target_include_directories( ${UMD_HOME} ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tt_metal/common ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tests/tt_metal/tt_metal/stl/CMakeLists.txt b/tests/tt_metal/tt_metal/stl/CMakeLists.txt index 0a7362b1a9f..b908688c309 100644 --- a/tests/tt_metal/tt_metal/stl/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/stl/CMakeLists.txt @@ -13,6 +13,7 @@ target_include_directories( ${UMD_HOME} ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/tt_metal + ${PROJECT_SOURCE_DIR}/tt_metal/common ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp b/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp deleted file mode 100644 index 0e7e8e5213f..00000000000 --- a/tests/tt_metal/tt_metal/test_create_kernel_from_string.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include - -#include "core_coord.hpp" -#include "detail/tt_metal.hpp" -#include "host_api.hpp" -#include "impl/device/device.hpp" -#include "impl/kernels/data_types.hpp" -#include "impl/kernels/kernel_types.hpp" -#include "impl/program/program.hpp" -#include "tt_cluster_descriptor_types.h" - -#include "tests/tt_metal/tt_metal/common/dispatch_fixture.hpp" - -using namespace tt; -using namespace tt::tt_metal; - -class ProgramWithKernelCreatedFromStringFixture : public DispatchFixture { - protected: - void SetUp() override { - DispatchFixture::SetUp(); - for (Device *device : this->devices_) - { - const chip_id_t device_id = device->id(); - this->device_ids_to_devices_[device_id] = device; - } - } - - void TearDown() override { - detail::CloseDevices(this->device_ids_to_devices_); - } - - private: - std::map device_ids_to_devices_; -}; - -TEST_F(ProgramWithKernelCreatedFromStringFixture, TensixDataMovementKernel) { - const CoreRange cores({0, 0}, {1, 1}); - const string &kernel_src_code = R"( - #include "debug/dprint.h" - #include "dataflow_api.h" - - void kernel_main() { - - DPRINT_DATA0(DPRINT << "Hello, I am running a void data movement kernel on NOC 0." << ENDL()); - DPRINT_DATA1(DPRINT << "Hello, I am running a void data movement kernel on NOC 1." << ENDL()); - - } - )"; - - for (Device *device : this->devices_) { - Program program = CreateProgram(); - tt_metal::CreateKernelFromString( - program, - kernel_src_code, - cores, - tt_metal::DataMovementConfig{.processor = DataMovementProcessor::RISCV_1, .noc = NOC::RISCV_1_default}); - this->RunProgram(device, program); - }; -} - -TEST_F(ProgramWithKernelCreatedFromStringFixture, TensixComputeKernel) { - const CoreRange cores({0, 0}, {1, 1}); - const string &kernel_src_code = R"( - #include "debug/dprint.h" - #include "compute_kernel_api.h" - - namespace NAMESPACE { - - void MAIN { - - DPRINT_MATH(DPRINT << "Hello, I am running a void compute kernel." << ENDL()); - - } - - } - )"; - - for (Device *device : this->devices_) { - Program program = CreateProgram(); - tt_metal::CreateKernelFromString( - program, - kernel_src_code, - cores, - tt_metal::ComputeConfig{ - .math_fidelity = MathFidelity::HiFi4, - .fp32_dest_acc_en = false, - .math_approx_mode = false, - .compile_args = {}}); - this->RunProgram(device, program); - }; -} - -TEST_F(ProgramWithKernelCreatedFromStringFixture, ActiveEthEthernetKernel) { - const string &kernel_src_code = R"( - #include "debug/dprint.h" - #include "dataflow_api.h" - - void kernel_main() { - - DPRINT << "Hello, I am running a void ethernet kernel." << ENDL(); - - } - )"; - - for (Device *device : this->devices_) { - const std::unordered_set &active_ethernet_cores = device->get_active_ethernet_cores(true); - if (active_ethernet_cores.empty()) { - const chip_id_t device_id = device->id(); - log_info(LogTest, "Skipping this test on device {} because it has no active ethernet cores.", device_id); - continue; - } - Program program = CreateProgram(); - tt_metal::CreateKernelFromString( - program, - kernel_src_code, - *active_ethernet_cores.begin(), - tt_metal::EthernetConfig{.noc = tt_metal::NOC::NOC_0}); - this->RunProgram(device, program); - }; -} From c6d57f6e129141166de8d51313305d7767ec6327 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Thu, 14 Nov 2024 18:21:31 +0000 Subject: [PATCH 23/26] More work --- .../tt_metal/common/command_queue_fixture.hpp | 1 - .../tt_metal/common/device_fixture.hpp | 32 +++++ .../tt_metal/common/trace_fixture.hpp | 42 ------- .../dispatch/dispatch_program/CMakeLists.txt | 4 - .../dispatch_program/test_sub_device.cpp | 116 +---------------- .../dispatch_trace/test_sub_device.cpp | 116 +---------------- .../dispatch/sub_device_test_utils.hpp | 118 ++++++++++++++++++ 7 files changed, 154 insertions(+), 275 deletions(-) delete mode 100644 tests/tt_metal/tt_metal/common/trace_fixture.hpp rename tests/tt_metal/tt_metal/{ => dispatch}/dispatch_program/test_sub_device.cpp (62%) rename tests/tt_metal/tt_metal/{ => dispatch}/dispatch_trace/test_sub_device.cpp (67%) create mode 100644 tests/tt_metal/tt_metal/dispatch/sub_device_test_utils.hpp diff --git a/tests/tt_metal/tt_metal/common/command_queue_fixture.hpp b/tests/tt_metal/tt_metal/common/command_queue_fixture.hpp index 7a6f0ee7a42..c8d94c706bd 100644 --- a/tests/tt_metal/tt_metal/common/command_queue_fixture.hpp +++ b/tests/tt_metal/tt_metal/common/command_queue_fixture.hpp @@ -8,7 +8,6 @@ #include "common/env_lib.hpp" #include "gtest/gtest.h" #include "dispatch_fixture.hpp" -#include "trace_fixture.hpp" #include "hostdevcommon/common_runtime_address_map.h" #include "hostdevcommon/common_values.hpp" #include "impl/buffers/circular_buffer_types.hpp" diff --git a/tests/tt_metal/tt_metal/common/device_fixture.hpp b/tests/tt_metal/tt_metal/common/device_fixture.hpp index 4977795cdbf..5d419a86d12 100644 --- a/tests/tt_metal/tt_metal/common/device_fixture.hpp +++ b/tests/tt_metal/tt_metal/common/device_fixture.hpp @@ -85,6 +85,38 @@ class DeviceSingleCardFixture : public ::testing::Test { class DeviceSingleCardBufferFixture : public DeviceSingleCardFixture {}; +class SingleDeviceTraceFixture : public ::testing::Test { + protected: + Device* device_; + tt::ARCH arch_; + + void Setup(const size_t buffer_size, const uint8_t num_hw_cqs = 1) { + auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); + if (slow_dispatch) { + tt::log_info( + tt::LogTest, "This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); + GTEST_SKIP(); + } + if (num_hw_cqs > 1) { + // Running multi-CQ test. User must set this explicitly. + auto num_cqs = getenv("TT_METAL_GTEST_NUM_HW_CQS"); + if (num_cqs == nullptr or strcmp(num_cqs, "2")) { + TT_THROW("This suite must be run with TT_METAL_GTEST_NUM_HW_CQS=2"); + GTEST_SKIP(); + } + } + this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); + const int device_id = 0; + this->device_ = tt::tt_metal::CreateDevice(device_id, num_hw_cqs, 0, buffer_size); + } + + void TearDown() override { + if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")) { + tt::tt_metal::CloseDevice(this->device_); + } + } +}; + class BlackholeSingleCardFixture : public DeviceSingleCardFixture { protected: void SetUp() override { diff --git a/tests/tt_metal/tt_metal/common/trace_fixture.hpp b/tests/tt_metal/tt_metal/common/trace_fixture.hpp deleted file mode 100644 index 99375c436b0..00000000000 --- a/tests/tt_metal/tt_metal/common/trace_fixture.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include "gtest/gtest.h" -#include "tt_metal/host_api.hpp" -#include "tt_metal/test_utils/env_vars.hpp" -#include "impl/kernels/kernel.hpp" - -class SingleDeviceTraceFixture : public ::testing::Test { - protected: - Device* device_; - tt::ARCH arch_; - - void Setup(const size_t buffer_size, const uint8_t num_hw_cqs = 1) { - auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); - if (slow_dispatch) { - tt::log_info( - tt::LogTest, "This suite can only be run with fast dispatch or TT_METAL_SLOW_DISPATCH_MODE unset"); - GTEST_SKIP(); - } - if (num_hw_cqs > 1) { - // Running multi-CQ test. User must set this explicitly. - auto num_cqs = getenv("TT_METAL_GTEST_NUM_HW_CQS"); - if (num_cqs == nullptr or strcmp(num_cqs, "2")) { - TT_THROW("This suite must be run with TT_METAL_GTEST_NUM_HW_CQS=2"); - GTEST_SKIP(); - } - } - this->arch_ = tt::get_arch_from_string(tt::test_utils::get_umd_arch_name()); - const int device_id = 0; - this->device_ = tt::tt_metal::CreateDevice(device_id, num_hw_cqs, 0, buffer_size); - } - - void TearDown() override { - if (!getenv("TT_METAL_SLOW_DISPATCH_MODE")) { - tt::tt_metal::CloseDevice(this->device_); - } - } -}; diff --git a/tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt index e43627bd549..4d105a41601 100644 --- a/tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt @@ -1,13 +1,9 @@ set(UNIT_TESTS_DISPATCH_PROGRAM_SRC - ${CMAKE_CURRENT_SOURCE_DIR}/test_dispatch_program_with_kernel_created_from_string.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_dispatch.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueProgram.cpp -<<<<<<< HEAD:tests/tt_metal/tt_metal/dispatch_program/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/test_sub_device.cpp -======= CACHE INTERNAL "" ->>>>>>> #0: More test structuring:tests/tt_metal/tt_metal/dispatch/dispatch_program/CMakeLists.txt ) add_executable(unit_tests_dispatch_program ${UNIT_TESTS_DISPATCH_PROGRAM_SRC}) diff --git a/tests/tt_metal/tt_metal/dispatch_program/test_sub_device.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_sub_device.cpp similarity index 62% rename from tests/tt_metal/tt_metal/dispatch_program/test_sub_device.cpp rename to tests/tt_metal/tt_metal/dispatch/dispatch_program/test_sub_device.cpp index f92bc4df06e..7343f25e022 100644 --- a/tests/tt_metal/tt_metal/dispatch_program/test_sub_device.cpp +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_sub_device.cpp @@ -17,119 +17,7 @@ #include "test_utils/stimulus.hpp" #include "command_queue_fixture.hpp" #include "command_queue_test_utils.hpp" - -std::tuple> create_single_sync_program(Device *device, SubDevice sub_device) { - auto syncer_coord = sub_device.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; - auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); - auto global_sem = CreateGlobalSemaphore(device, sub_device.cores(HalProgrammableCoreType::TENSIX), INVALID); - - Program syncer_program = CreateProgram(); - auto syncer_kernel = CreateKernel( - syncer_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", - syncer_core, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, - .noc = NOC::RISCV_0_default}); - std::array syncer_rt_args = {global_sem->address()}; - SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); - return {std::move(syncer_program), std::move(syncer_coord), std::move(global_sem)}; -} - -std::tuple> create_basic_sync_program(Device *device, const SubDevice& sub_device_1, const SubDevice& sub_device_2) { - auto waiter_coord = sub_device_2.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; - auto waiter_core = CoreRangeSet(CoreRange(waiter_coord, waiter_coord)); - auto waiter_core_physical = device->worker_core_from_logical_core(waiter_coord); - auto incrementer_cores = sub_device_1.cores(HalProgrammableCoreType::TENSIX); - auto syncer_coord = incrementer_cores.ranges().back().end_coord; - auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); - auto syncer_core_physical = device->worker_core_from_logical_core(syncer_coord); - auto all_cores = waiter_core.merge(incrementer_cores).merge(syncer_core); - auto global_sem = CreateGlobalSemaphore(device, all_cores, INVALID); - - Program waiter_program = CreateProgram(); - auto waiter_kernel = CreateKernel( - waiter_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_waiter.cpp", - waiter_core, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, - .noc = NOC::RISCV_0_default}); - std::array waiter_rt_args = {global_sem->address(), incrementer_cores.num_cores(), syncer_core_physical.x, syncer_core_physical.y}; - SetRuntimeArgs(waiter_program, waiter_kernel, waiter_core, waiter_rt_args); - - Program syncer_program = CreateProgram(); - auto syncer_kernel = CreateKernel( - syncer_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", - syncer_core, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, - .noc = NOC::RISCV_0_default}); - std::array syncer_rt_args = {global_sem->address()}; - SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); - - Program incrementer_program = CreateProgram(); - auto incrementer_kernel = CreateKernel( - incrementer_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/incrementer.cpp", - incrementer_cores, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_1, - .noc = NOC::RISCV_1_default}); - std::array incrementer_rt_args = {global_sem->address(), waiter_core_physical.x, waiter_core_physical.y}; - SetRuntimeArgs(incrementer_program, incrementer_kernel, incrementer_cores, incrementer_rt_args); - return {std::move(waiter_program), std::move(syncer_program), std::move(incrementer_program), std::move(global_sem)}; -} - -std::tuple> create_basic_eth_sync_program(Device *device, const SubDevice& sub_device_1, const SubDevice& sub_device_2) { - auto waiter_coord = sub_device_2.cores(HalProgrammableCoreType::ACTIVE_ETH).ranges().at(0).start_coord; - auto waiter_core = CoreRangeSet(CoreRange(waiter_coord, waiter_coord)); - auto waiter_core_physical = device->ethernet_core_from_logical_core(waiter_coord); - auto tensix_waiter_coord = sub_device_2.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; - auto tensix_waiter_core = CoreRangeSet(CoreRange(tensix_waiter_coord, tensix_waiter_coord)); - auto tensix_waiter_core_physical = device->worker_core_from_logical_core(tensix_waiter_coord); - auto incrementer_cores = sub_device_1.cores(HalProgrammableCoreType::TENSIX); - auto syncer_coord = incrementer_cores.ranges().back().end_coord; - auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); - auto syncer_core_physical = device->worker_core_from_logical_core(syncer_coord); - auto all_cores = tensix_waiter_core.merge(incrementer_cores).merge(syncer_core); - auto global_sem = CreateGlobalSemaphore(device, all_cores, INVALID); - - Program waiter_program = CreateProgram(); - auto waiter_kernel = CreateKernel( - waiter_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_remote_waiter.cpp", - waiter_core, - EthernetConfig{ - .noc = NOC::RISCV_0_default, - .processor = DataMovementProcessor::RISCV_0}); - std::array waiter_rt_args = {global_sem->address(), incrementer_cores.num_cores(), syncer_core_physical.x, syncer_core_physical.y, tensix_waiter_core_physical.x, tensix_waiter_core_physical.y, eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE}; - SetRuntimeArgs(waiter_program, waiter_kernel, waiter_core, waiter_rt_args); - - Program syncer_program = CreateProgram(); - auto syncer_kernel = CreateKernel( - syncer_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", - syncer_core, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, - .noc = NOC::RISCV_0_default}); - std::array syncer_rt_args = {global_sem->address()}; - SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); - - Program incrementer_program = CreateProgram(); - auto incrementer_kernel = CreateKernel( - incrementer_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/incrementer.cpp", - incrementer_cores, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_1, - .noc = NOC::RISCV_1_default}); - std::array incrementer_rt_args = {global_sem->address(), tensix_waiter_core_physical.x, tensix_waiter_core_physical.y}; - SetRuntimeArgs(incrementer_program, incrementer_kernel, incrementer_cores, incrementer_rt_args); - return {std::move(waiter_program), std::move(syncer_program), std::move(incrementer_program), std::move(global_sem)}; -} +#include "sub_device_test_utils.hpp" TEST_F(CommandQueueSingleCardFixture, TensixTestSubDeviceAllocations) { uint32_t local_l1_size = 3200; @@ -326,4 +214,4 @@ TEST_F(CommandQueueSingleCardFixture, TensixActiveEthTestSubDeviceBasicEthProgra } Synchronize(device); } -} \ No newline at end of file +} diff --git a/tests/tt_metal/tt_metal/dispatch_trace/test_sub_device.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_trace/test_sub_device.cpp similarity index 67% rename from tests/tt_metal/tt_metal/dispatch_trace/test_sub_device.cpp rename to tests/tt_metal/tt_metal/dispatch/dispatch_trace/test_sub_device.cpp index 378433d6b01..8e0ee2aa133 100644 --- a/tests/tt_metal/tt_metal/dispatch_trace/test_sub_device.cpp +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_trace/test_sub_device.cpp @@ -17,119 +17,7 @@ #include "test_utils/stimulus.hpp" #include "command_queue_fixture.hpp" #include "command_queue_test_utils.hpp" - -std::tuple> create_single_sync_program(Device *device, SubDevice sub_device) { - auto syncer_coord = sub_device.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; - auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); - auto global_sem = CreateGlobalSemaphore(device, sub_device.cores(HalProgrammableCoreType::TENSIX), INVALID); - - Program syncer_program = CreateProgram(); - auto syncer_kernel = CreateKernel( - syncer_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", - syncer_core, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, - .noc = NOC::RISCV_0_default}); - std::array syncer_rt_args = {global_sem->address()}; - SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); - return {std::move(syncer_program), std::move(syncer_coord), std::move(global_sem)}; -} - -std::tuple> create_basic_sync_program(Device *device, const SubDevice& sub_device_1, const SubDevice& sub_device_2) { - auto waiter_coord = sub_device_2.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; - auto waiter_core = CoreRangeSet(CoreRange(waiter_coord, waiter_coord)); - auto waiter_core_physical = device->worker_core_from_logical_core(waiter_coord); - auto incrementer_cores = sub_device_1.cores(HalProgrammableCoreType::TENSIX); - auto syncer_coord = incrementer_cores.ranges().back().end_coord; - auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); - auto syncer_core_physical = device->worker_core_from_logical_core(syncer_coord); - auto all_cores = waiter_core.merge(incrementer_cores).merge(syncer_core); - auto global_sem = CreateGlobalSemaphore(device, all_cores, INVALID); - - Program waiter_program = CreateProgram(); - auto waiter_kernel = CreateKernel( - waiter_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_waiter.cpp", - waiter_core, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, - .noc = NOC::RISCV_0_default}); - std::array waiter_rt_args = {global_sem->address(), incrementer_cores.num_cores(), syncer_core_physical.x, syncer_core_physical.y}; - SetRuntimeArgs(waiter_program, waiter_kernel, waiter_core, waiter_rt_args); - - Program syncer_program = CreateProgram(); - auto syncer_kernel = CreateKernel( - syncer_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", - syncer_core, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, - .noc = NOC::RISCV_0_default}); - std::array syncer_rt_args = {global_sem->address()}; - SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); - - Program incrementer_program = CreateProgram(); - auto incrementer_kernel = CreateKernel( - incrementer_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/incrementer.cpp", - incrementer_cores, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_1, - .noc = NOC::RISCV_1_default}); - std::array incrementer_rt_args = {global_sem->address(), waiter_core_physical.x, waiter_core_physical.y}; - SetRuntimeArgs(incrementer_program, incrementer_kernel, incrementer_cores, incrementer_rt_args); - return {std::move(waiter_program), std::move(syncer_program), std::move(incrementer_program), std::move(global_sem)}; -} - -std::tuple> create_basic_eth_sync_program(Device *device, const SubDevice& sub_device_1, const SubDevice& sub_device_2) { - auto waiter_coord = sub_device_2.cores(HalProgrammableCoreType::ACTIVE_ETH).ranges().at(0).start_coord; - auto waiter_core = CoreRangeSet(CoreRange(waiter_coord, waiter_coord)); - auto waiter_core_physical = device->ethernet_core_from_logical_core(waiter_coord); - auto tensix_waiter_coord = sub_device_2.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; - auto tensix_waiter_core = CoreRangeSet(CoreRange(tensix_waiter_coord, tensix_waiter_coord)); - auto tensix_waiter_core_physical = device->worker_core_from_logical_core(tensix_waiter_coord); - auto incrementer_cores = sub_device_1.cores(HalProgrammableCoreType::TENSIX); - auto syncer_coord = incrementer_cores.ranges().back().end_coord; - auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); - auto syncer_core_physical = device->worker_core_from_logical_core(syncer_coord); - auto all_cores = tensix_waiter_core.merge(incrementer_cores).merge(syncer_core); - auto global_sem = CreateGlobalSemaphore(device, all_cores, INVALID); - - Program waiter_program = CreateProgram(); - auto waiter_kernel = CreateKernel( - waiter_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_remote_waiter.cpp", - waiter_core, - EthernetConfig{ - .noc = NOC::RISCV_0_default, - .processor = DataMovementProcessor::RISCV_0}); - std::array waiter_rt_args = {global_sem->address(), incrementer_cores.num_cores(), syncer_core_physical.x, syncer_core_physical.y, tensix_waiter_core_physical.x, tensix_waiter_core_physical.y, eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE}; - SetRuntimeArgs(waiter_program, waiter_kernel, waiter_core, waiter_rt_args); - - Program syncer_program = CreateProgram(); - auto syncer_kernel = CreateKernel( - syncer_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", - syncer_core, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_0, - .noc = NOC::RISCV_0_default}); - std::array syncer_rt_args = {global_sem->address()}; - SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); - - Program incrementer_program = CreateProgram(); - auto incrementer_kernel = CreateKernel( - incrementer_program, - "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/incrementer.cpp", - incrementer_cores, - DataMovementConfig{ - .processor = DataMovementProcessor::RISCV_1, - .noc = NOC::RISCV_1_default}); - std::array incrementer_rt_args = {global_sem->address(), tensix_waiter_core_physical.x, tensix_waiter_core_physical.y}; - SetRuntimeArgs(incrementer_program, incrementer_kernel, incrementer_cores, incrementer_rt_args); - return {std::move(waiter_program), std::move(syncer_program), std::move(incrementer_program), std::move(global_sem)}; -} +#include "sub_device_test_utils.hpp" TEST_F(CommandQueueSingleCardTraceFixture, TensixTestSubDeviceTraceBasicPrograms) { SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); @@ -379,4 +267,4 @@ TEST_F(CommandQueueSingleCardTraceFixture, TensixTestSubDeviceIllegalOperations) device->remove_sub_device_manager(sub_device_manager_1); EXPECT_THROW(device->load_sub_device_manager(sub_device_manager_1), std::exception); } -} \ No newline at end of file +} diff --git a/tests/tt_metal/tt_metal/dispatch/sub_device_test_utils.hpp b/tests/tt_metal/tt_metal/dispatch/sub_device_test_utils.hpp new file mode 100644 index 00000000000..ae1c6da1e9a --- /dev/null +++ b/tests/tt_metal/tt_metal/dispatch/sub_device_test_utils.hpp @@ -0,0 +1,118 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#include "host_api.hpp" + +std::tuple> create_single_sync_program(Device *device, SubDevice sub_device) { + auto syncer_coord = sub_device.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; + auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); + auto global_sem = CreateGlobalSemaphore(device, sub_device.cores(HalProgrammableCoreType::TENSIX), INVALID); + + Program syncer_program = CreateProgram(); + auto syncer_kernel = CreateKernel( + syncer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", + syncer_core, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, + .noc = NOC::RISCV_0_default}); + std::array syncer_rt_args = {global_sem->address()}; + SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); + return {std::move(syncer_program), std::move(syncer_coord), std::move(global_sem)}; +} + +std::tuple> create_basic_sync_program(Device *device, const SubDevice& sub_device_1, const SubDevice& sub_device_2) { + auto waiter_coord = sub_device_2.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; + auto waiter_core = CoreRangeSet(CoreRange(waiter_coord, waiter_coord)); + auto waiter_core_physical = device->worker_core_from_logical_core(waiter_coord); + auto incrementer_cores = sub_device_1.cores(HalProgrammableCoreType::TENSIX); + auto syncer_coord = incrementer_cores.ranges().back().end_coord; + auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); + auto syncer_core_physical = device->worker_core_from_logical_core(syncer_coord); + auto all_cores = waiter_core.merge(incrementer_cores).merge(syncer_core); + auto global_sem = CreateGlobalSemaphore(device, all_cores, INVALID); + + Program waiter_program = CreateProgram(); + auto waiter_kernel = CreateKernel( + waiter_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_waiter.cpp", + waiter_core, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, + .noc = NOC::RISCV_0_default}); + std::array waiter_rt_args = {global_sem->address(), incrementer_cores.num_cores(), syncer_core_physical.x, syncer_core_physical.y}; + SetRuntimeArgs(waiter_program, waiter_kernel, waiter_core, waiter_rt_args); + + Program syncer_program = CreateProgram(); + auto syncer_kernel = CreateKernel( + syncer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", + syncer_core, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, + .noc = NOC::RISCV_0_default}); + std::array syncer_rt_args = {global_sem->address()}; + SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); + + Program incrementer_program = CreateProgram(); + auto incrementer_kernel = CreateKernel( + incrementer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/incrementer.cpp", + incrementer_cores, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_1, + .noc = NOC::RISCV_1_default}); + std::array incrementer_rt_args = {global_sem->address(), waiter_core_physical.x, waiter_core_physical.y}; + SetRuntimeArgs(incrementer_program, incrementer_kernel, incrementer_cores, incrementer_rt_args); + return {std::move(waiter_program), std::move(syncer_program), std::move(incrementer_program), std::move(global_sem)}; +} + +std::tuple> create_basic_eth_sync_program(Device *device, const SubDevice& sub_device_1, const SubDevice& sub_device_2) { + auto waiter_coord = sub_device_2.cores(HalProgrammableCoreType::ACTIVE_ETH).ranges().at(0).start_coord; + auto waiter_core = CoreRangeSet(CoreRange(waiter_coord, waiter_coord)); + auto waiter_core_physical = device->ethernet_core_from_logical_core(waiter_coord); + auto tensix_waiter_coord = sub_device_2.cores(HalProgrammableCoreType::TENSIX).ranges().at(0).start_coord; + auto tensix_waiter_core = CoreRangeSet(CoreRange(tensix_waiter_coord, tensix_waiter_coord)); + auto tensix_waiter_core_physical = device->worker_core_from_logical_core(tensix_waiter_coord); + auto incrementer_cores = sub_device_1.cores(HalProgrammableCoreType::TENSIX); + auto syncer_coord = incrementer_cores.ranges().back().end_coord; + auto syncer_core = CoreRangeSet(CoreRange(syncer_coord, syncer_coord)); + auto syncer_core_physical = device->worker_core_from_logical_core(syncer_coord); + auto all_cores = tensix_waiter_core.merge(incrementer_cores).merge(syncer_core); + auto global_sem = CreateGlobalSemaphore(device, all_cores, INVALID); + + Program waiter_program = CreateProgram(); + auto waiter_kernel = CreateKernel( + waiter_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/persistent_remote_waiter.cpp", + waiter_core, + EthernetConfig{ + .noc = NOC::RISCV_0_default, + .processor = DataMovementProcessor::RISCV_0}); + std::array waiter_rt_args = {global_sem->address(), incrementer_cores.num_cores(), syncer_core_physical.x, syncer_core_physical.y, tensix_waiter_core_physical.x, tensix_waiter_core_physical.y, eth_l1_mem::address_map::ERISC_L1_UNRESERVED_BASE}; + SetRuntimeArgs(waiter_program, waiter_kernel, waiter_core, waiter_rt_args); + + Program syncer_program = CreateProgram(); + auto syncer_kernel = CreateKernel( + syncer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/syncer.cpp", + syncer_core, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_0, + .noc = NOC::RISCV_0_default}); + std::array syncer_rt_args = {global_sem->address()}; + SetRuntimeArgs(syncer_program, syncer_kernel, syncer_core, syncer_rt_args); + + Program incrementer_program = CreateProgram(); + auto incrementer_kernel = CreateKernel( + incrementer_program, + "tests/tt_metal/tt_metal/test_kernels/misc/sub_device/incrementer.cpp", + incrementer_cores, + DataMovementConfig{ + .processor = DataMovementProcessor::RISCV_1, + .noc = NOC::RISCV_1_default}); + std::array incrementer_rt_args = {global_sem->address(), tensix_waiter_core_physical.x, tensix_waiter_core_physical.y}; + SetRuntimeArgs(incrementer_program, incrementer_kernel, incrementer_cores, incrementer_rt_args); + return {std::move(waiter_program), std::move(syncer_program), std::move(incrementer_program), std::move(global_sem)}; +} From 6a4b684b4474821ecb83f17f87d1094b60580969 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Thu, 14 Nov 2024 22:27:28 +0000 Subject: [PATCH 24/26] Added README --- tests/tt_metal/tt_metal/README.md | 90 +++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 tests/tt_metal/tt_metal/README.md diff --git a/tests/tt_metal/tt_metal/README.md b/tests/tt_metal/tt_metal/README.md new file mode 100644 index 00000000000..9e426c8c258 --- /dev/null +++ b/tests/tt_metal/tt_metal/README.md @@ -0,0 +1,90 @@ +In order to keep our test suite clean, organized and searchable, please follow the guidelines provided below when adding new tests, modifying existing tests or deleting outdated tests. + + + +Table of Contents +================= + +- [Table of Contents](#table-of-contents) + - [Test Naming](#test-naming) + - [Fixture Naming](#fixture-naming) + - [Fixture Organization](#fixture-organization) + - [File Naming](#file-naming) + - [File Organization](#fixture-organization) + - [api/](#api) + - [debug_tools/](#debug_tools) + - [device/](#device) + - [dispatch/](#dispatch) + - [eth/](#eth) + - [integration/](#integration) + - [llk/](#llk) + - [stl/](#stl) + - [test_kernels/](#test_kernels) + - [common/](#common) + + + + + +## Test Naming +Prefix test names with the core type(s) that the test is using. + - If it's using Tensix cores, prefix it with `Tensix` + - If it's using active ethernet cores, prefix it with `ActiveEth` + - If it's using idle ethernet cores, prefix it with `IdleEth` + - If it's using both active and idle ethernet cores, prefix it with `Eth` + - If it's using multiple core types, prefix it with each core type, eg. `TensixActiveEth`, `TensixIdleEth`, `TensixEth`, etc. + - If it isn't using any core type, don't prefix it with anything + +## Fixture Naming + - All fixture names should end in `Fixture` + +## Fixture Organization +Before creating a new fixture, check if an existing fixture meets your needs. If you need to create a new fixture, consider subclassing an existing fixture to avoid duplicating functionality already provided by another fixture. + +## File Naming + - Files that contain fixtures should have their names end with `_fixture` + - Files that contain helper functions and/or test utilities should have their names end with `_test_utils` + - Files that contain tests should have their names start with `test_` + +## File Organization +Place test utility files and fixture files as close as possible to the files that rely on them. For example, if you have a test file `test_A.cpp` in `tests/tt_metal/tt_metal/dispatch/dispatch_buffer/` and another test file `test_B.cpp` in `tests/tt_metal/tt_metal/dispatch/dispatch_program/`, and both need to use a fixture file `C_fixture.hpp`, it is logical to place `C_fixture.hpp` in `tests/tt_metal/tt_metal/dispatch/`. This ensures the fixture is easily accessible to the relevant test files while avoiding unnecessary clutter in a more generic directory like `tests/tt_metal/tt_metal/common/`. + +Tests using Google Test should be placed in one of the directories listed below that best aligns with their purpose. If multiple directories seem suitable, use your best judgment to select the most appropriate one. + +__Important note: only tests that use Google Test should be placed in the following directories.__ + +### `api/` + - Contains tests that explicitly test `tt-metal`'s API + +### `debug_tools/` + - Contains tests for DPrint and Watcher + +### `device/` + - Contains tests for device initialization and teardown + - Contains tests that check device-specific properties + - Contains tests that read from and/or write to the device, but don't launch anything + +### `dispatch/` + - Contains tests that explicitly test for properties relating to dispatch + - Contains both slow dispatch and fast dispatch tests + +### `eth/` + - Contains tests for ethernet communication between 2 or more devices + +### `integration/` + - Contains tests for real-world use cases, eg. matmul, etc + +### `llk/` + - + +### `stl/` + - Contains tests which test custom data structures and algorithms used in `tt-metal` + - None of the tests in this directory should run on the device + +The following directories should be reserved for files that support testing but should not contain actual tests themselves. + +### `test_kernels/` + - Contains kernels that are used in tests + +### `common/` + - Contains test fixtures and utilities shared across multiple directories listed above From 7506fdefadee8ca283000b133e39117b6f40d002 Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Thu, 14 Nov 2024 22:45:19 +0000 Subject: [PATCH 25/26] Move a sub_device test --- .../api/test_worker_config_buffer.cpp | 2 +- .../dispatch/dispatch_buffer/CMakeLists.txt | 1 + .../dispatch_buffer/test_sub_device.cpp | 110 ++++++++++++++++++ .../dispatch_program/test_sub_device.cpp | 90 -------------- 4 files changed, 112 insertions(+), 91 deletions(-) create mode 100644 tests/tt_metal/tt_metal/dispatch/dispatch_buffer/test_sub_device.cpp diff --git a/tests/tt_metal/tt_metal/api/test_worker_config_buffer.cpp b/tests/tt_metal/tt_metal/api/test_worker_config_buffer.cpp index 285286a67b9..3c3a31cf314 100644 --- a/tests/tt_metal/tt_metal/api/test_worker_config_buffer.cpp +++ b/tests/tt_metal/tt_metal/api/test_worker_config_buffer.cpp @@ -54,4 +54,4 @@ TEST(WorkerConfigBuffer, SmallSize) { } } -} // namespace working_config_buffer_tests +} // namespace worker_config_buffer_tests diff --git a/tests/tt_metal/tt_metal/dispatch/dispatch_buffer/CMakeLists.txt b/tests/tt_metal/tt_metal/dispatch/dispatch_buffer/CMakeLists.txt index 0eb34156aeb..da300c56e72 100644 --- a/tests/tt_metal/tt_metal/dispatch/dispatch_buffer/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_buffer/CMakeLists.txt @@ -1,5 +1,6 @@ set(UNIT_TESTS_DISPATCH_BUFFER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_EnqueueWriteBuffer_and_EnqueueReadBuffer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_sub_device.cpp CACHE INTERNAL "" ) diff --git a/tests/tt_metal/tt_metal/dispatch/dispatch_buffer/test_sub_device.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_buffer/test_sub_device.cpp new file mode 100644 index 00000000000..9dbcb60599f --- /dev/null +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_buffer/test_sub_device.cpp @@ -0,0 +1,110 @@ +// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#include +#include +#include +#include +#include + +#include "gtest/gtest.h" +#include "tt_metal/common/core_coord.hpp" +#include "tt_metal/impl/buffers/global_semaphore.hpp" +#include "tt_metal/impl/device/device.hpp" +#include "tt_metal/impl/event/event.hpp" +#include "tt_metal/impl/sub_device/sub_device.hpp" +#include "test_utils/stimulus.hpp" +#include "command_queue_fixture.hpp" +#include "command_queue_test_utils.hpp" +#include "sub_device_test_utils.hpp" + +TEST_F(CommandQueueSingleCardFixture, TensixTestSubDeviceAllocations) { + uint32_t local_l1_size = 3200; + SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); + SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); + CoreRangeSet sharded_cores_1 = CoreRange({0, 0}, {2, 2}); + CoreRangeSet sharded_cores_2 = CoreRange({4, 4}, {4, 4}); + + auto sharded_cores_1_vec = corerange_to_cores(sharded_cores_1, std::nullopt, true); + auto sharded_cores_2_vec = corerange_to_cores(sharded_cores_2, std::nullopt, true); + + ShardSpecBuffer shard_spec_buffer_1 = ShardSpecBuffer(sharded_cores_1, {1, 1}, ShardOrientation::ROW_MAJOR, false, {1, 1}, {sharded_cores_1.num_cores(), 1}); + uint32_t page_size_1 = 32; + ShardedBufferConfig shard_config_1 = {nullptr, sharded_cores_1.num_cores() * page_size_1, page_size_1, BufferType::L1, TensorMemoryLayout::HEIGHT_SHARDED, shard_spec_buffer_1}; + auto input_1 = tt::test_utils::generate_uniform_random_vector(0, 100, shard_config_1.size / sizeof(uint32_t)); + + ShardSpecBuffer shard_spec_buffer_2 = ShardSpecBuffer(sharded_cores_2, {1, 1}, ShardOrientation::ROW_MAJOR, false, {1, 1}, {sharded_cores_2.num_cores(), 1}); + uint32_t page_size_2 = 64; + ShardedBufferConfig shard_config_2 = {nullptr, sharded_cores_2.num_cores() * page_size_2, page_size_2, BufferType::L1, TensorMemoryLayout::HEIGHT_SHARDED, shard_spec_buffer_2}; + auto input_2 = tt::test_utils::generate_uniform_random_vector(0, 100, shard_config_2.size / sizeof(uint32_t)); + + uint32_t page_size_3 = 1024; + InterleavedBufferConfig interleaved_config = {nullptr, page_size_3, page_size_3, BufferType::L1, TensorMemoryLayout::INTERLEAVED}; + auto input_3 = tt::test_utils::generate_uniform_random_vector(0, 100, interleaved_config.size / sizeof(uint32_t)); + + for (Device *device : devices_) { + auto sub_device_manager_1 = device->create_sub_device_manager({sub_device_1}, local_l1_size); + auto sub_device_manager_2 = device->create_sub_device_manager({sub_device_1, sub_device_2}, local_l1_size); + DeviceAddr l1_unreserved_base = device->get_base_allocator_addr(HalMemType::L1); + DeviceAddr max_addr = l1_unreserved_base + local_l1_size; + + shard_config_1.device = device; + shard_config_2.device = device; + interleaved_config.device = device; + + std::vector physical_cores_1; + physical_cores_1.reserve(sharded_cores_1_vec.size()); + for (const auto& core : sharded_cores_1_vec) { + physical_cores_1.push_back(device->worker_core_from_logical_core(core)); + } + + std::vector physical_cores_2; + physical_cores_2.reserve(sharded_cores_2_vec.size()); + for (const auto& core : sharded_cores_2_vec) { + physical_cores_2.push_back(device->worker_core_from_logical_core(core)); + } + + device->load_sub_device_manager(sub_device_manager_1); + + auto buffer_1 = CreateBuffer(shard_config_1, SubDeviceId{0}); + EXPECT_EQ(buffer_1->address(), max_addr - page_size_1); + EnqueueWriteBuffer(device->command_queue(), buffer_1, input_1, false); + std::vector output_1; + EnqueueReadBuffer(device->command_queue(), buffer_1, output_1, true); + EXPECT_EQ(input_1, output_1); + auto input_1_it = input_1.begin(); + for (const auto& physical_core : physical_cores_1) { + auto readback = tt::llrt::read_hex_vec_from_core( + device->id(), physical_core, buffer_1->address(), page_size_1); + EXPECT_TRUE(std::equal(input_1_it, input_1_it + page_size_1 / sizeof(uint32_t), readback.begin())); + input_1_it += page_size_1 / sizeof(uint32_t); + } + + auto buffer_2 = CreateBuffer(interleaved_config); + EXPECT_THROW(CreateBuffer(shard_config_1, SubDeviceId{1}), std::exception); + EXPECT_THROW(device->clear_loaded_sub_device_manager(), std::exception); + EXPECT_THROW(device->load_sub_device_manager(sub_device_manager_2), std::exception); + DeallocateBuffer(*buffer_1); + device->clear_loaded_sub_device_manager(); + device->load_sub_device_manager(sub_device_manager_2); + + auto buffer_3 = CreateBuffer(shard_config_2, SubDeviceId{1}); + EXPECT_EQ(buffer_3->address(), max_addr - page_size_2); + EnqueueWriteBuffer(device->command_queue(), buffer_3, input_2, false); + std::vector output_2; + EnqueueReadBuffer(device->command_queue(), buffer_3, output_2, true); + EXPECT_EQ(input_2, output_2); + auto input_2_it = input_2.begin(); + for (const auto& physical_core : physical_cores_2) { + auto readback = tt::llrt::read_hex_vec_from_core( + device->id(), physical_core, buffer_3->address(), page_size_2); + EXPECT_TRUE(std::equal(input_2_it, input_2_it + page_size_2 / sizeof(uint32_t), readback.begin())); + input_2_it += page_size_2 / sizeof(uint32_t); + } + + auto buffer_4 = CreateBuffer(shard_config_1, SubDeviceId{0}); + EXPECT_EQ(buffer_4->address(), max_addr - page_size_1); + EXPECT_THROW(CreateBuffer(interleaved_config, SubDeviceId{0}), std::exception); + } +} diff --git a/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_sub_device.cpp b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_sub_device.cpp index 7343f25e022..475393c9557 100644 --- a/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_sub_device.cpp +++ b/tests/tt_metal/tt_metal/dispatch/dispatch_program/test_sub_device.cpp @@ -19,96 +19,6 @@ #include "command_queue_test_utils.hpp" #include "sub_device_test_utils.hpp" -TEST_F(CommandQueueSingleCardFixture, TensixTestSubDeviceAllocations) { - uint32_t local_l1_size = 3200; - SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); - SubDevice sub_device_2(std::array{CoreRangeSet(std::vector{CoreRange({3, 3}, {3, 3}), CoreRange({4, 4}, {4, 4})})}); - CoreRangeSet sharded_cores_1 = CoreRange({0, 0}, {2, 2}); - CoreRangeSet sharded_cores_2 = CoreRange({4, 4}, {4, 4}); - - auto sharded_cores_1_vec = corerange_to_cores(sharded_cores_1, std::nullopt, true); - auto sharded_cores_2_vec = corerange_to_cores(sharded_cores_2, std::nullopt, true); - - ShardSpecBuffer shard_spec_buffer_1 = ShardSpecBuffer(sharded_cores_1, {1, 1}, ShardOrientation::ROW_MAJOR, false, {1, 1}, {sharded_cores_1.num_cores(), 1}); - uint32_t page_size_1 = 32; - ShardedBufferConfig shard_config_1 = {nullptr, sharded_cores_1.num_cores() * page_size_1, page_size_1, BufferType::L1, TensorMemoryLayout::HEIGHT_SHARDED, shard_spec_buffer_1}; - auto input_1 = tt::test_utils::generate_uniform_random_vector(0, 100, shard_config_1.size / sizeof(uint32_t)); - - ShardSpecBuffer shard_spec_buffer_2 = ShardSpecBuffer(sharded_cores_2, {1, 1}, ShardOrientation::ROW_MAJOR, false, {1, 1}, {sharded_cores_2.num_cores(), 1}); - uint32_t page_size_2 = 64; - ShardedBufferConfig shard_config_2 = {nullptr, sharded_cores_2.num_cores() * page_size_2, page_size_2, BufferType::L1, TensorMemoryLayout::HEIGHT_SHARDED, shard_spec_buffer_2}; - auto input_2 = tt::test_utils::generate_uniform_random_vector(0, 100, shard_config_2.size / sizeof(uint32_t)); - - uint32_t page_size_3 = 1024; - InterleavedBufferConfig interleaved_config = {nullptr, page_size_3, page_size_3, BufferType::L1, TensorMemoryLayout::INTERLEAVED}; - auto input_3 = tt::test_utils::generate_uniform_random_vector(0, 100, interleaved_config.size / sizeof(uint32_t)); - - for (Device *device : devices_) { - auto sub_device_manager_1 = device->create_sub_device_manager({sub_device_1}, local_l1_size); - auto sub_device_manager_2 = device->create_sub_device_manager({sub_device_1, sub_device_2}, local_l1_size); - DeviceAddr l1_unreserved_base = device->get_base_allocator_addr(HalMemType::L1); - DeviceAddr max_addr = l1_unreserved_base + local_l1_size; - - shard_config_1.device = device; - shard_config_2.device = device; - interleaved_config.device = device; - - std::vector physical_cores_1; - physical_cores_1.reserve(sharded_cores_1_vec.size()); - for (const auto& core : sharded_cores_1_vec) { - physical_cores_1.push_back(device->worker_core_from_logical_core(core)); - } - - std::vector physical_cores_2; - physical_cores_2.reserve(sharded_cores_2_vec.size()); - for (const auto& core : sharded_cores_2_vec) { - physical_cores_2.push_back(device->worker_core_from_logical_core(core)); - } - - device->load_sub_device_manager(sub_device_manager_1); - - auto buffer_1 = CreateBuffer(shard_config_1, SubDeviceId{0}); - EXPECT_EQ(buffer_1->address(), max_addr - page_size_1); - EnqueueWriteBuffer(device->command_queue(), buffer_1, input_1, false); - std::vector output_1; - EnqueueReadBuffer(device->command_queue(), buffer_1, output_1, true); - EXPECT_EQ(input_1, output_1); - auto input_1_it = input_1.begin(); - for (const auto& physical_core : physical_cores_1) { - auto readback = tt::llrt::read_hex_vec_from_core( - device->id(), physical_core, buffer_1->address(), page_size_1); - EXPECT_TRUE(std::equal(input_1_it, input_1_it + page_size_1 / sizeof(uint32_t), readback.begin())); - input_1_it += page_size_1 / sizeof(uint32_t); - } - - auto buffer_2 = CreateBuffer(interleaved_config); - EXPECT_THROW(CreateBuffer(shard_config_1, SubDeviceId{1}), std::exception); - EXPECT_THROW(device->clear_loaded_sub_device_manager(), std::exception); - EXPECT_THROW(device->load_sub_device_manager(sub_device_manager_2), std::exception); - DeallocateBuffer(*buffer_1); - device->clear_loaded_sub_device_manager(); - device->load_sub_device_manager(sub_device_manager_2); - - auto buffer_3 = CreateBuffer(shard_config_2, SubDeviceId{1}); - EXPECT_EQ(buffer_3->address(), max_addr - page_size_2); - EnqueueWriteBuffer(device->command_queue(), buffer_3, input_2, false); - std::vector output_2; - EnqueueReadBuffer(device->command_queue(), buffer_3, output_2, true); - EXPECT_EQ(input_2, output_2); - auto input_2_it = input_2.begin(); - for (const auto& physical_core : physical_cores_2) { - auto readback = tt::llrt::read_hex_vec_from_core( - device->id(), physical_core, buffer_3->address(), page_size_2); - EXPECT_TRUE(std::equal(input_2_it, input_2_it + page_size_2 / sizeof(uint32_t), readback.begin())); - input_2_it += page_size_2 / sizeof(uint32_t); - } - - auto buffer_4 = CreateBuffer(shard_config_1, SubDeviceId{0}); - EXPECT_EQ(buffer_4->address(), max_addr - page_size_1); - EXPECT_THROW(CreateBuffer(interleaved_config, SubDeviceId{0}), std::exception); - } -} - TEST_F(CommandQueueSingleCardFixture, TensixTestSubDeviceSynchronization) { uint32_t local_l1_size = 3200; SubDevice sub_device_1(std::array{CoreRangeSet(CoreRange({0, 0}, {2, 2}))}); From 94e856df510864f4d303171dff90cc5f4e96dbef Mon Sep 17 00:00:00 2001 From: Samarth Agarwal Date: Thu, 14 Nov 2024 22:50:11 +0000 Subject: [PATCH 26/26] Deleted file --- .../sub_device/test_sub_device.cpp | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/test_sub_device.cpp diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/test_sub_device.cpp b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/test_sub_device.cpp deleted file mode 100644 index 3146c0babfe..00000000000 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/sub_device/test_sub_device.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. -// -// SPDX-License-Identifier: Apache-2.0 - -#include -#include -#include -#include -#include - -#include "command_queue_fixture.hpp" -#include "gtest/gtest.h" -#include "tt_metal/common/core_coord.hpp" -#include "tt_metal/impl/buffers/global_semaphore.hpp" -#include "tt_metal/impl/device/device.hpp" -#include "tt_metal/impl/event/event.hpp" -#include "tt_metal/impl/sub_device/sub_device.hpp" -#include "tests/tt_metal/test_utils/stimulus.hpp" -#include "tests/tt_metal/tt_metal/unit_tests_fast_dispatch/command_queue/command_queue_test_utils.hpp" - -using namespace tt::tt_metal; - -namespace basic_tests { - - - - -} // namespace basic_tests