Skip to content

Commit

Permalink
fix grayskull barrier tests
Browse files Browse the repository at this point in the history
  • Loading branch information
broskoTT committed Dec 13, 2024
1 parent 8760ff9 commit e14c7fa
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 43 deletions.
6 changes: 3 additions & 3 deletions tests/blackhole/test_bh_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ constexpr std::uint32_t DRAM_BARRIER_BASE = 0;

namespace tt::umd::test::utils {

static void set_params_for_remote_txn(Cluster& device) {
// Populate address map and NOC parameters that the driver needs for remote transactions
static void set_barrier_params(Cluster& device) {
// Populate address map and NOC parameters that the driver needs for memory barriers and remote transactions.
device.set_barrier_address_params(
{l1_mem::address_map::L1_BARRIER_BASE, eth_l1_mem::address_map::ERISC_BARRIER_BASE, DRAM_BARRIER_BASE});
}
Expand Down Expand Up @@ -58,7 +58,7 @@ class BlackholeTestFixture : public ::testing::Test {
assert(device != nullptr);
assert(device->get_cluster_description()->get_number_of_chips() == get_detected_num_chips());

set_params_for_remote_txn(*device);
set_barrier_params(*device);

tt_device_params default_params;
device->start_device(default_params);
Expand Down
26 changes: 13 additions & 13 deletions tests/blackhole/test_silicon_driver_bh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ using namespace tt::umd;

constexpr std::uint32_t DRAM_BARRIER_BASE = 0;

static void set_params_for_remote_txn(Cluster& device) {
// Populate address map and NOC parameters that the driver needs for remote transactions
static void set_barrier_params(Cluster& device) {
// Populate address map and NOC parameters that the driver needs for memory barriers and remote transactions.
device.set_barrier_address_params(
{l1_mem::address_map::L1_BARRIER_BASE, eth_l1_mem::address_map::ERISC_BARRIER_BASE, DRAM_BARRIER_BASE});
}
Expand Down Expand Up @@ -92,7 +92,7 @@ TEST(SiliconDriverBH, CreateDestroy) {
false,
true,
false);
set_params_for_remote_txn(device);
set_barrier_params(device);
device.start_device(default_params);
device.deassert_risc_reset();
device.close_device();
Expand Down Expand Up @@ -190,7 +190,7 @@ TEST(SiliconDriverBH, CreateDestroy) {
// true,
// true,
// simulated_harvesting_masks);
// set_params_for_remote_txn(device);
// set_barrier_params(device);
// auto mmio_devices = device.get_target_mmio_device_ids();

// for (int i = 0; i < target_devices.size(); i++) {
Expand Down Expand Up @@ -280,7 +280,7 @@ TEST(SiliconDriverBH, UnalignedStaticTLB_RW) {
uint32_t num_host_mem_ch_per_mmio_device = 1;

Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);
set_params_for_remote_txn(device);
set_barrier_params(device);
auto mmio_devices = device.get_target_mmio_device_ids();

for (int i = 0; i < target_devices.size(); i++) {
Expand Down Expand Up @@ -337,7 +337,7 @@ TEST(SiliconDriverBH, StaticTLB_RW) {
uint32_t num_host_mem_ch_per_mmio_device = 1;

Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);
set_params_for_remote_txn(device);
set_barrier_params(device);
auto mmio_devices = device.get_target_mmio_device_ids();

for (int i = 0; i < target_devices.size(); i++) {
Expand Down Expand Up @@ -402,7 +402,7 @@ TEST(SiliconDriverBH, DynamicTLB_RW) {
uint32_t num_host_mem_ch_per_mmio_device = 1;
Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);

set_params_for_remote_txn(device);
set_barrier_params(device);

tt_device_params default_params;
device.start_device(default_params);
Expand Down Expand Up @@ -492,7 +492,7 @@ TEST(SiliconDriverBH, MultiThreadedDevice) {
uint32_t num_host_mem_ch_per_mmio_device = 1;
Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);

set_params_for_remote_txn(device);
set_barrier_params(device);

tt_device_params default_params;
device.start_device(default_params);
Expand Down Expand Up @@ -562,7 +562,7 @@ TEST(SiliconDriverBH, MultiThreadedMemBar) {
uint32_t num_host_mem_ch_per_mmio_device = 1;

Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);
set_params_for_remote_txn(device);
set_barrier_params(device);
for (int i = 0; i < target_devices.size(); i++) {
// Iterate over devices and only setup static TLBs for functional worker cores
auto& sdesc = device.get_soc_descriptor(i);
Expand Down Expand Up @@ -702,7 +702,7 @@ TEST(SiliconDriverBH, DISABLED_BroadcastWrite) { // Cannot broadcast to tensix/
uint32_t num_host_mem_ch_per_mmio_device = 1;

Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);
set_params_for_remote_txn(device);
set_barrier_params(device);
auto mmio_devices = device.get_target_mmio_device_ids();

tt_device_params default_params;
Expand Down Expand Up @@ -790,7 +790,7 @@ TEST(SiliconDriverBH, DISABLED_VirtualCoordinateBroadcast) { // same problem as
uint32_t num_host_mem_ch_per_mmio_device = 1;

Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);
set_params_for_remote_txn(device);
set_barrier_params(device);
auto mmio_devices = device.get_target_mmio_device_ids();

tt_device_params default_params;
Expand Down Expand Up @@ -891,7 +891,7 @@ TEST(SiliconDriverBH, SysmemTestWithPcie) {
true, // clean system resources - yes
true); // perform harvesting - yes

set_params_for_remote_txn(cluster);
set_barrier_params(cluster);
cluster.start_device(tt_device_params{}); // no special parameters

const chip_id_t mmio_chip_id = 0;
Expand Down Expand Up @@ -962,7 +962,7 @@ TEST(SiliconDriverBH, RandomSysmemTestWithPcie) {
true, // clean system resources - yes
true); // perform harvesting - yes

set_params_for_remote_txn(cluster);
set_barrier_params(cluster);
cluster.start_device(tt_device_params{}); // no special parameters

const chip_id_t mmio_chip_id = 0;
Expand Down
6 changes: 3 additions & 3 deletions tests/galaxy/test_umd_concurrent_threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TEST(GalaxyConcurrentThreads, WriteToAllChipsL1) {
Cluster(test_utils::GetAbsPath(SOC_DESC_PATH), all_devices, num_host_mem_ch_per_mmio_device, false, true);
const auto sdesc_per_chip = device.get_virtual_soc_descriptors();

tt::umd::test::utils::set_params_for_remote_txn(device);
tt::umd::test::utils::set_barrier_params(device);

tt_device_params default_params;
device.start_device(default_params);
Expand Down Expand Up @@ -150,7 +150,7 @@ TEST(GalaxyConcurrentThreads, WriteToAllChipsDram) {
Cluster(test_utils::GetAbsPath(SOC_DESC_PATH), all_devices, num_host_mem_ch_per_mmio_device, false, true);
const auto sdesc_per_chip = device.get_virtual_soc_descriptors();

tt::umd::test::utils::set_params_for_remote_txn(device);
tt::umd::test::utils::set_barrier_params(device);

tt_device_params default_params;
device.start_device(default_params);
Expand Down Expand Up @@ -236,7 +236,7 @@ TEST(GalaxyConcurrentThreads, PushInputsWhileSignalingCluster) {
Cluster(test_utils::GetAbsPath(SOC_DESC_PATH), target_devices, num_host_mem_ch_per_mmio_device, false, true);
const auto sdesc_per_chip = device.get_virtual_soc_descriptors();

tt::umd::test::utils::set_params_for_remote_txn(device);
tt::umd::test::utils::set_barrier_params(device);

tt_device_params default_params;
device.start_device(default_params);
Expand Down
6 changes: 3 additions & 3 deletions tests/galaxy/test_umd_remote_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void run_remote_read_write_test(uint32_t vector_size, bool dram_write) {
Cluster(test_utils::GetAbsPath(SOC_DESC_PATH), target_devices, num_host_mem_ch_per_mmio_device, false, true);
const auto sdesc_per_chip = device.get_virtual_soc_descriptors();

tt::umd::test::utils::set_params_for_remote_txn(device);
tt::umd::test::utils::set_barrier_params(device);

tt_device_params default_params;
device.start_device(default_params);
Expand Down Expand Up @@ -150,7 +150,7 @@ void run_data_mover_test(
Cluster device =
Cluster(test_utils::GetAbsPath(SOC_DESC_PATH), target_devices, num_host_mem_ch_per_mmio_device, false, true);

tt::umd::test::utils::set_params_for_remote_txn(device);
tt::umd::test::utils::set_barrier_params(device);

tt_device_params default_params;
device.start_device(default_params);
Expand Down Expand Up @@ -269,7 +269,7 @@ void run_data_broadcast_test(
Cluster device =
Cluster(test_utils::GetAbsPath(SOC_DESC_PATH), target_devices, num_host_mem_ch_per_mmio_device, false, true);

tt::umd::test::utils::set_params_for_remote_txn(device);
tt::umd::test::utils::set_barrier_params(device);

tt_device_params default_params;
device.start_device(default_params);
Expand Down
32 changes: 28 additions & 4 deletions tests/grayskull/test_silicon_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@

using namespace tt::umd;

constexpr std::uint32_t DRAM_BARRIER_BASE = 0;

static void set_barrier_params(Cluster& device) {
// Populate address map and NOC parameters that the driver needs for memory barriers.
// Grayskull doesn't have ETH, so we don't need to populate the ETH barrier address.
device.set_barrier_address_params({l1_mem::address_map::L1_BARRIER_BASE, 0u, DRAM_BARRIER_BASE});
}

TEST(SiliconDriverGS, CreateDestroySequential) {
std::set<chip_id_t> target_devices = {0};
uint32_t num_host_mem_ch_per_mmio_device = 1;
Expand Down Expand Up @@ -421,20 +429,31 @@ TEST(SiliconDriverGS, MultiThreadedMemBar) { // this tests takes ~5 mins to run
}

tt_device_params default_params;
set_barrier_params(device);
device.start_device(default_params);
device.deassert_risc_reset();
std::vector<uint32_t> readback_membar_vec = {};
for (auto& core : device.get_soc_descriptor(0).workers) {
test_utils::read_data_from_device(
device, readback_membar_vec, tt_cxy_pair(0, core), 0, 4, "SMALL_READ_WRITE_TLB");
device,
readback_membar_vec,
tt_cxy_pair(0, core),
l1_mem::address_map::L1_BARRIER_BASE,
4,
"SMALL_READ_WRITE_TLB");
ASSERT_EQ(
readback_membar_vec.at(0), 187); // Ensure that memory barriers were correctly initialized on all workers
readback_membar_vec = {};
}

for (auto& core : device.get_soc_descriptor(0).workers) {
test_utils::read_data_from_device(
device, readback_membar_vec, tt_cxy_pair(0, core), 0, 4, "SMALL_READ_WRITE_TLB");
device,
readback_membar_vec,
tt_cxy_pair(0, core),
l1_mem::address_map::L1_BARRIER_BASE,
4,
"SMALL_READ_WRITE_TLB");
ASSERT_EQ(
readback_membar_vec.at(0), 187); // Ensure that memory barriers were correctly initialized on all workers
readback_membar_vec = {};
Expand All @@ -443,7 +462,7 @@ TEST(SiliconDriverGS, MultiThreadedMemBar) { // this tests takes ~5 mins to run
for (int chan = 0; chan < device.get_soc_descriptor(0).get_num_dram_channels(); chan++) {
auto core = device.get_soc_descriptor(0).get_core_for_dram_channel(chan, 0);
test_utils::read_data_from_device(
device, readback_membar_vec, tt_cxy_pair(0, core), 0, 4, "SMALL_READ_WRITE_TLB");
device, readback_membar_vec, tt_cxy_pair(0, core), DRAM_BARRIER_BASE, 4, "SMALL_READ_WRITE_TLB");
ASSERT_EQ(
readback_membar_vec.at(0), 187); // Ensure that memory barriers were correctly initialized on all DRAM
readback_membar_vec = {};
Expand Down Expand Up @@ -502,7 +521,12 @@ TEST(SiliconDriverGS, MultiThreadedMemBar) { // this tests takes ~5 mins to run

for (auto& core : device.get_soc_descriptor(0).workers) {
test_utils::read_data_from_device(
device, readback_membar_vec, tt_cxy_pair(0, core), 0, 4, "SMALL_READ_WRITE_TLB");
device,
readback_membar_vec,
tt_cxy_pair(0, core),
l1_mem::address_map::L1_BARRIER_BASE,
4,
"SMALL_READ_WRITE_TLB");
ASSERT_EQ(readback_membar_vec.at(0), 187); // Ensure that memory barriers end up in correct sate workers
readback_membar_vec = {};
}
Expand Down
28 changes: 14 additions & 14 deletions tests/wormhole/test_silicon_driver_wh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ using namespace tt::umd;

constexpr std::uint32_t DRAM_BARRIER_BASE = 0;

static void set_params_for_remote_txn(Cluster& device) {
// Populate address map and NOC parameters that the driver needs for remote transactions
static void set_barrier_params(Cluster& device) {
// Populate address map and NOC parameters that the driver needs for memory barriers and remote transactions.
device.set_barrier_address_params(
{l1_mem::address_map::L1_BARRIER_BASE, eth_l1_mem::address_map::ERISC_BARRIER_BASE, DRAM_BARRIER_BASE});
}
Expand Down Expand Up @@ -93,7 +93,7 @@ TEST(SiliconDriverWH, CreateDestroy) {
false,
true,
false);
set_params_for_remote_txn(device);
set_barrier_params(device);
device.start_device(default_params);
device.deassert_risc_reset();
device.close_device();
Expand Down Expand Up @@ -159,7 +159,7 @@ TEST(SiliconDriverWH, HarvestingRuntime) {
uint32_t num_host_mem_ch_per_mmio_device = 1;

Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true, simulated_harvesting_masks);
set_params_for_remote_txn(device);
set_barrier_params(device);
auto mmio_devices = device.get_target_mmio_device_ids();

for(int i = 0; i < target_devices.size(); i++) {
Expand Down Expand Up @@ -221,7 +221,7 @@ TEST(SiliconDriverWH, UnalignedStaticTLB_RW) {

uint32_t num_host_mem_ch_per_mmio_device = 1;
Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);
set_params_for_remote_txn(device);
set_barrier_params(device);
auto mmio_devices = device.get_target_mmio_device_ids();

for (int i = 0; i < target_devices.size(); i++) {
Expand Down Expand Up @@ -277,7 +277,7 @@ TEST(SiliconDriverWH, StaticTLB_RW) {

uint32_t num_host_mem_ch_per_mmio_device = 1;
Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);
set_params_for_remote_txn(device);
set_barrier_params(device);
auto mmio_devices = device.get_target_mmio_device_ids();

for (int i = 0; i < target_devices.size(); i++) {
Expand Down Expand Up @@ -341,7 +341,7 @@ TEST(SiliconDriverWH, DynamicTLB_RW) {
uint32_t num_host_mem_ch_per_mmio_device = 1;
Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);

set_params_for_remote_txn(device);
set_barrier_params(device);

tt_device_params default_params;
device.start_device(default_params);
Expand Down Expand Up @@ -393,7 +393,7 @@ TEST(SiliconDriverWH, MultiThreadedDevice) {
uint32_t num_host_mem_ch_per_mmio_device = 1;
Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);

set_params_for_remote_txn(device);
set_barrier_params(device);

tt_device_params default_params;
device.start_device(default_params);
Expand Down Expand Up @@ -463,7 +463,7 @@ TEST(SiliconDriverWH, MultiThreadedMemBar) {
uint32_t num_host_mem_ch_per_mmio_device = 1;

Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);
set_params_for_remote_txn(device);
set_barrier_params(device);
auto mmio_devices = device.get_target_mmio_device_ids();

for (int i = 0; i < target_devices.size(); i++) {
Expand Down Expand Up @@ -606,7 +606,7 @@ TEST(SiliconDriverWH, BroadcastWrite) {
uint32_t num_host_mem_ch_per_mmio_device = 1;

Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);
set_params_for_remote_txn(device);
set_barrier_params(device);
auto mmio_devices = device.get_target_mmio_device_ids();

tt_device_params default_params;
Expand Down Expand Up @@ -693,7 +693,7 @@ TEST(SiliconDriverWH, VirtualCoordinateBroadcast) {
uint32_t num_host_mem_ch_per_mmio_device = 1;

Cluster device = Cluster(num_host_mem_ch_per_mmio_device, false, true, true);
set_params_for_remote_txn(device);
set_barrier_params(device);
auto mmio_devices = device.get_target_mmio_device_ids();

tt_device_params default_params;
Expand Down Expand Up @@ -812,7 +812,7 @@ TEST(SiliconDriverWH, SysmemTestWithPcie) {
true, // clean system resources - yes
true); // perform harvesting - yes

set_params_for_remote_txn(cluster);
set_barrier_params(cluster);
cluster.start_device(tt_device_params{}); // no special parameters

const chip_id_t mmio_chip_id = 0;
Expand Down Expand Up @@ -878,7 +878,7 @@ TEST(SiliconDriverWH, RandomSysmemTestWithPcie) {
true, // clean system resources - yes
true); // perform harvesting - yes

set_params_for_remote_txn(cluster);
set_barrier_params(cluster);
cluster.start_device(tt_device_params{}); // no special parameters

const chip_id_t mmio_chip_id = 0;
Expand Down Expand Up @@ -950,7 +950,7 @@ TEST(SiliconDriverWH, LargeAddressTlb) {
const auto ARC = cluster.get_soc_descriptor(0).arc_cores.at(0);
const tt_cxy_pair ARC_CORE(0, ARC.x, ARC.y);

set_params_for_remote_txn(cluster);
set_barrier_params(cluster);
cluster.start_device(tt_device_params{});

auto get_static_tlb_index_callback = [](tt_xy_pair target) { return 0; };
Expand Down
6 changes: 3 additions & 3 deletions tests/wormhole/test_wh_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ constexpr std::uint32_t DRAM_BARRIER_BASE = 0;

namespace tt::umd::test::utils {

static void set_params_for_remote_txn(Cluster& device) {
// Populate address map and NOC parameters that the driver needs for remote transactions
static void set_barrier_params(Cluster& device) {
// Populate address map and NOC parameters that the driver needs for memory barriers and remote transactions.
device.set_barrier_address_params(
{l1_mem::address_map::L1_BARRIER_BASE, eth_l1_mem::address_map::ERISC_BARRIER_BASE, DRAM_BARRIER_BASE});
}
Expand Down Expand Up @@ -58,7 +58,7 @@ class WormholeTestFixture : public ::testing::Test {
assert(device != nullptr);
assert(device->get_cluster_description()->get_number_of_chips() == get_detected_num_chips());

set_params_for_remote_txn(*device);
set_barrier_params(*device);

tt_device_params default_params;
device->start_device(default_params);
Expand Down

0 comments on commit e14c7fa

Please sign in to comment.