Skip to content

Commit

Permalink
#0: Revert recent fabric changes because it breaks TG unit tests (#18702
Browse files Browse the repository at this point in the history
)

### Ticket

TG unit tests broken. Revert everything relevant

### Problem description
Provide context for the problem.

### What's changed
Describe the approach used to solve the problem.
Summarize the changes made and its impact.

### Checklist
- [ ] [All post
commit](https://github.com/tenstorrent/tt-metal/actions/workflows/all-post-commit-workflows.yaml)
CI passes
- [ ] [Blackhole Post
commit](https://github.com/tenstorrent/tt-metal/actions/workflows/blackhole-post-commit.yaml)
CI passes (if applicable)
- [ ] [Model
regression](https://github.com/tenstorrent/tt-metal/actions/workflows/perf-models.yaml)
CI passes (if applicable)
- [ ] [Device performance
regression](https://github.com/tenstorrent/tt-metal/actions/workflows/perf-device-models.yaml)
CI passes (if applicable)
- [ ] **(For models and ops writers)** Full [new models
tests](https://github.com/tenstorrent/tt-metal/actions/workflows/full-new-models-suite.yaml)
CI passes (if applicable)
- [ ] New/Existing tests provide coverage for changes

---------

Co-authored-by: Raymond Kim <raymond.kim243@outlook.com>
  • Loading branch information
tt-rkim and rayraykay authored Mar 6, 2025
1 parent a33d64a commit 948c8f7
Show file tree
Hide file tree
Showing 52 changed files with 505 additions and 1,106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,6 @@ int main(int argc, char** argv) {
host_completion_queue_wr_ptr,
dev_completion_queue_wr_ptr,
dev_completion_queue_rd_ptr,
0,
0,
0,
0,
0,
0,
true, // is_dram_variant
true, // is_host_variant
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ constexpr CoreType DISPATCH_CORE_TYPE = CoreType::WORKER;
//////////////////////////////////////////////////////////////////////////////////////////
using std::vector;
using namespace tt;
using tt::packet_queue::dispatch_packet_header_t;
using tt::packet_queue::DispatchRemoteNetworkType;
using tt::packet_queue::packet_switch_4B_pack;
using tt::packet_queue::packet_switch_dest_pack;

uint32_t iterations_g = DEFAULT_ITERATIONS;

Expand Down Expand Up @@ -1843,11 +1839,11 @@ void configure_for_single_chip(
const uint32_t dispatch_h_cb_sem = dispatch_h_core_sem_0_id;

std::vector<uint32_t> prefetch_compile_args = {
dispatch_buffer_base, // overridden below for prefetch_h
dispatch_buffer_base, // overridden below for prefetch_h
DispatchSettings::DISPATCH_BUFFER_LOG_PAGE_SIZE, // overridden below for prefetch_h
dispatch_buffer_pages, // overridden below for prefetch_h
prefetch_downstream_cb_sem, // overridden below for prefetch_d
dispatch_cb_sem, // overridden below for prefetch_h
dispatch_buffer_pages, // overridden below for prefetch_h
prefetch_downstream_cb_sem, // overridden below for prefetch_d
dispatch_cb_sem, // overridden below for prefetch_h
dev_hugepage_base_g,
hugepage_issue_buffer_size_g,
prefetch_q_base,
Expand All @@ -1864,17 +1860,11 @@ void configure_for_single_chip(
prefetch_downstream_cb_sem, // prefetch_d only
DispatchSettings::PREFETCH_D_BUFFER_LOG_PAGE_SIZE,
DispatchSettings::PREFETCH_D_BUFFER_BLOCKS, // prefetch_d only
0, // unused: for prefetch_hd <--> dispatch_hd
0, // unused: for prefetch_hd <--> dispatch_hd
0, // unused: for prefetch_hd <--> dispatch_hd
0, // unused: for prefetch_hd <--> dispatch_hd
0, // unused: for prefetch_hd <--> dispatch_hd
0,
0,
0,
0,
0,
0,
0, // unused: for prefetch_hd <--> dispatch_hd
0, // unused: for prefetch_hd <--> dispatch_hd
0, // unused: for prefetch_hd <--> dispatch_hd
0, // unused: for prefetch_hd <--> dispatch_hd
0, // unused: for prefetch_hd <--> dispatch_hd
};

constexpr NOC my_noc_index = NOC::NOC_0;
Expand Down Expand Up @@ -2156,14 +2146,7 @@ void configure_for_single_chip(
0,
host_completion_queue_wr_ptr,
dev_completion_queue_wr_ptr,
dev_completion_queue_rd_ptr,
0,
0,
0,
0,
0,
0,
};
dev_completion_queue_rd_ptr};

CoreCoord phys_upstream_from_dispatch_core = split_prefetcher_g ? phys_prefetch_d_core : phys_prefetch_core_g;
if (split_dispatcher_g) {
Expand Down Expand Up @@ -3522,10 +3505,6 @@ int main(int argc, char** argv) {
}

if (packetized_path_en_g) {
using tt::packet_queue::PACKET_QUEUE_TEST_PASS;
using tt::packet_queue::packet_queue_test_status_to_string;
using tt::packet_queue::PQ_TEST_STATUS_INDEX;

vector<uint32_t> prefetch_relay_mux_results = tt::llrt::read_hex_vec_from_core(
device_r->id(),
phys_prefetch_relay_mux_core,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct input_queue_raw_state_t {
uint32_t max_packet_size_words,
uint64_t total_data_words) {
this->curr_packet_dest = this->num_dests_sent_last_packet + dest_endpoint_start_id;
this->curr_packet_flags = tt::packet_queue::DispatchPacketFlag::PACKET_TEST_LAST;
this->curr_packet_flags = DispatchPacketFlag::PACKET_TEST_LAST;
this->curr_packet_size_words = 2;
this->curr_packet_words_remaining = this->curr_packet_size_words;
this->data_words_input += 2;
Expand Down Expand Up @@ -174,10 +174,10 @@ constexpr auto select_input_queue() {
}

inline void fill_packet_data(tt_l1_ptr uint32_t* start_addr, uint32_t num_words, uint32_t start_val) {
tt_l1_ptr uint32_t* addr = start_addr + (tt::packet_queue::PACKET_WORD_SIZE_BYTES / 4 - 1);
tt_l1_ptr uint32_t* addr = start_addr + (PACKET_WORD_SIZE_BYTES / 4 - 1);
for (uint32_t i = 0; i < num_words; i++) {
*addr = start_val++;
addr += (tt::packet_queue::PACKET_WORD_SIZE_BYTES / 4);
addr += (PACKET_WORD_SIZE_BYTES / 4);
}
}

Expand All @@ -188,7 +188,7 @@ inline bool check_packet_data(
uint32_t& mismatch_addr,
uint32_t& mismatch_val,
uint32_t& expected_val) {
tt_l1_ptr uint32_t* addr = start_addr + (tt::packet_queue::PACKET_WORD_SIZE_BYTES / 4 - 1);
tt_l1_ptr uint32_t* addr = start_addr + (PACKET_WORD_SIZE_BYTES / 4 - 1);
for (uint32_t i = 0; i < num_words; i++) {
if (*addr != start_val) {
mismatch_addr = reinterpret_cast<uint32_t>(addr);
Expand All @@ -197,7 +197,7 @@ inline bool check_packet_data(
return false;
}
start_val++;
addr += (tt::packet_queue::PACKET_WORD_SIZE_BYTES / 4);
addr += (PACKET_WORD_SIZE_BYTES / 4);
}
return true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
#include "tt_metal/impl/dispatch/kernels/packet_queue.hpp"
#include "tests/tt_metal/tt_metal/perf_microbenchmark/routing/kernels/traffic_gen.hpp"

using tt::packet_queue::PACKET_WORD_SIZE_BYTES;
using tt::packet_queue::dispatch_packet_header_t;
using tt::packet_queue::DispatchRemoteNetworkType;

constexpr uint32_t endpoint_id = get_compile_time_arg_val(0);

Expand Down Expand Up @@ -57,12 +54,11 @@ constexpr uint32_t disable_header_check = get_compile_time_arg_val(18);
// the same random seed as the corresponding traffic_gen_tx
input_queue_rnd_state_t src_rnd_state[num_src_endpoints];

tt::packet_queue::packet_input_queue_state_t input_queues[tt::packet_queue::MAX_SWITCH_FAN_IN];
using input_queue_network_sequence = tt::packet_queue::NetworkTypeSequence<rx_rptr_update_network_type>;
using input_queue_cb_mode_sequence = tt::packet_queue::CBModeTypeSequence<false>;
packet_input_queue_state_t input_queues[MAX_SWITCH_FAN_IN];
using input_queue_network_sequence = NetworkTypeSequence<rx_rptr_update_network_type>;
using input_queue_cb_mode_sequence = CBModeTypeSequence<false>;

void kernel_main() {
using namespace tt::packet_queue;

zero_l1_buf(test_results, test_results_size_bytes);
test_results[PQ_TEST_STATUS_INDEX] = PACKET_QUEUE_TEST_STARTED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
#include "tt_metal/fabric/hw/inc/tt_fabric_status.h"
#include "tests/tt_metal/tt_metal/perf_microbenchmark/routing/kernels/traffic_gen.hpp"

using tt::packet_queue::PACKET_WORD_SIZE_BYTES;
using tt::packet_queue::dispatch_packet_header_t;
using tt::packet_queue::DispatchRemoteNetworkType;

constexpr uint32_t src_endpoint_id = get_compile_time_arg_val(0);
constexpr uint32_t num_dest_endpoints = get_compile_time_arg_val(1);

Expand Down Expand Up @@ -65,16 +61,16 @@ constexpr uint32_t data_sent_per_iter_high = get_compile_time_arg_val(21);
constexpr uint32_t input_queue_id = 0;
constexpr uint32_t output_queue_id = 1;

tt::packet_queue::packet_input_queue_state_t input_queue;
using input_queue_network_sequence = tt::packet_queue::NetworkTypeSequence<DispatchRemoteNetworkType::NONE>;
using input_queue_cb_mode_sequence = tt::packet_queue::CBModeTypeSequence<false>;
packet_input_queue_state_t input_queue;
using input_queue_network_sequence = NetworkTypeSequence<DispatchRemoteNetworkType::NONE>;
using input_queue_cb_mode_sequence = CBModeTypeSequence<false>;

tt::packet_queue::packet_output_queue_state_t output_queue;
using output_queue_network_sequence = tt::packet_queue::NetworkTypeSequence<tx_network_type>;
using output_queue_cb_mode_sequence = tt::packet_queue::CBModeTypeSequence<false>;
packet_output_queue_state_t output_queue;
using output_queue_network_sequence = NetworkTypeSequence<tx_network_type>;
using output_queue_cb_mode_sequence = CBModeTypeSequence<false>;

constexpr tt::packet_queue::packet_input_queue_state_t* input_queue_ptr = &input_queue;
constexpr tt::packet_queue::packet_output_queue_state_t* output_queue_ptr = &output_queue;
constexpr packet_input_queue_state_t* input_queue_ptr = &input_queue;
constexpr packet_output_queue_state_t* output_queue_ptr = &output_queue;

// input_queue_rnd_state_t input_queue_state;
auto input_queue_state = select_input_queue<pkt_dest_size_choice>();
Expand Down Expand Up @@ -135,8 +131,6 @@ inline bool input_queue_handler() {
}

void kernel_main() {
using namespace tt::packet_queue;

zero_l1_buf(test_results, test_results_size_bytes);
test_results[PQ_TEST_STATUS_INDEX] = PACKET_QUEUE_TEST_STARTED;
test_results[PQ_TEST_MISC_INDEX] = 0xff000000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
#include "routing_test_common.hpp"
#include "llrt.hpp"

using std::vector;
using namespace tt;
using json = nlohmann::json;

int main(int argc, char **argv) {
using std::vector;
using namespace tt;
using namespace tt::packet_queue;
using json = nlohmann::json;

constexpr uint32_t default_tx_x = 0;
constexpr uint32_t default_tx_y = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#include "routing_test_common.hpp"
#include "llrt.hpp"

using std::vector;
using namespace tt;

int main(int argc, char **argv) {
using std::vector;
using namespace tt;
using namespace tt::packet_queue;

constexpr uint32_t default_prng_seed = 0x100;
constexpr uint32_t default_data_kb_per_tx = 64*1024;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#include "utils.hpp"
#include "llrt.hpp"

using std::vector;
using namespace tt;

int main(int argc, char **argv) {
using std::vector;
using namespace tt;
using namespace tt::packet_queue;

bool pass = true;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
#include "test_common.hpp"
#include "routing_test_common.hpp"

int main(int argc, char** argv) {
using std::vector;
using namespace tt;
using namespace tt::packet_queue;
using std::vector;
using namespace tt;
using json = nlohmann::json;

using json = nlohmann::json;
int main(int argc, char** argv) {
constexpr uint32_t default_tx_x = 0;
constexpr uint32_t default_tx_y = 0;
constexpr uint32_t default_rx_x = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
#include "test_common.hpp"
#include "routing_test_common.hpp"

int main(int argc, char** argv) {
using std::vector;
using namespace tt;
using namespace tt::packet_queue;
using json = nlohmann::json;
using std::vector;
using namespace tt;
using json = nlohmann::json;

int main(int argc, char** argv) {
constexpr uint32_t default_tx_x = 0;
constexpr uint32_t default_tx_y = 0;
constexpr uint32_t default_rx_x = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#include "test_common.hpp"
#include "routing_test_common.hpp"

using std::vector;
using namespace tt;
using json = nlohmann::json;

int main(int argc, char **argv) {
using std::vector;
using namespace tt;
using namespace tt::packet_queue;
using json = nlohmann::json;

constexpr uint32_t default_tx_x = 0;
constexpr uint32_t default_tx_y = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#include "test_common.hpp"
#include "routing_test_common.hpp"

using std::vector;
using namespace tt;
using json = nlohmann::json;

int main(int argc, char **argv) {
using std::vector;
using namespace tt;
using namespace tt::packet_queue;
using json = nlohmann::json;

constexpr uint32_t default_tx_x = 0;
constexpr uint32_t default_tx_y = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
#include "test_common.hpp"
#include "routing_test_common.hpp"

using std::vector;
using namespace tt;
using json = nlohmann::json;


int main(int argc, char **argv) {
using std::vector;
using namespace tt;
using namespace tt::packet_queue;
using json = nlohmann::json;

constexpr uint32_t default_tx_x = 0;
constexpr uint32_t default_tx_y = 0;
Expand Down
1 change: 0 additions & 1 deletion tt_metal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ target_sources(
api/tt-metalium/cq_commands.hpp
api/tt-metalium/dev_msgs.h
api/tt-metalium/tt_log.h
api/tt-metalium/fabric_host_interface.h
core_descriptors/blackhole_140_arch.yaml
core_descriptors/grayskull_120_arch.yaml
core_descriptors/wormhole_b0_80_arch.yaml
Expand Down
14 changes: 1 addition & 13 deletions tt_metal/api/tt-metalium/command_queue_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <magic_enum/magic_enum.hpp>
#include <mutex>
#include <tt-metalium/tt_align.hpp>
#include <tt-metalium/fabric_host_interface.h>
#include <unordered_map>

#include "cq_commands.hpp"
Expand All @@ -18,7 +17,6 @@
#include "dispatch_settings.hpp"
#include "helpers.hpp"
#include "buffer.hpp"
#include "rtoptions.hpp"
#include "umd/device/tt_core_coordinates.h"

namespace tt::tt_metal {
Expand All @@ -35,9 +33,7 @@ enum class CommandQueueDeviceAddrType : uint8_t {
COMPLETION_Q1_LAST_EVENT = 5,
DISPATCH_S_SYNC_SEM = 6,
DISPATCH_MESSAGE = 7,
// Enable for FD on Fabric
FABRIC_INTERFACE = 8,
UNRESERVED = 9,
UNRESERVED = 8
};

enum class CommandQueueHostAddrType : uint8_t {
Expand Down Expand Up @@ -175,12 +171,6 @@ class DispatchMemMap {
device_cq_addr_sizes_[dev_addr_idx] = settings.dispatch_s_sync_sem_;
} else if (dev_addr_type == CommandQueueDeviceAddrType::DISPATCH_MESSAGE) {
device_cq_addr_sizes_[dev_addr_idx] = settings.dispatch_message_;
} else if (dev_addr_type == CommandQueueDeviceAddrType::FABRIC_INTERFACE) {
if (llrt::RunTimeOptions::get_instance().get_fd_fabric()) {
device_cq_addr_sizes_[dev_addr_idx] = tt_fabric::PACKET_HEADER_SIZE_BYTES;
} else {
device_cq_addr_sizes_[dev_addr_idx] = 0;
}
} else {
device_cq_addr_sizes_[dev_addr_idx] = settings.other_ptrs_size;
}
Expand All @@ -194,8 +184,6 @@ class DispatchMemMap {
CommandQueueDeviceAddrType dev_addr_type = magic_enum::enum_value<CommandQueueDeviceAddrType>(dev_addr_idx);
if (dev_addr_type == CommandQueueDeviceAddrType::UNRESERVED) {
device_cq_addrs_[dev_addr_idx] = align(device_cq_addrs_[dev_addr_idx], pcie_alignment);
} else if (dev_addr_type == CommandQueueDeviceAddrType::FABRIC_INTERFACE) {
device_cq_addrs_[dev_addr_idx] = align(device_cq_addrs_[dev_addr_idx], l1_alignment);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tt_metal/api/tt-metalium/control_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ControlPlane {
chip_id_t dst_chip_id,
chan_id_t src_chan_id) const;

// Return routers to get to the destination chip, avoid local eth to eth routing. CoreCoord is a virtual coord.
// Return routers to get to the destination chip, avoid local eth to eth routing
std::vector<std::pair<routing_plane_id_t, CoreCoord>> get_routers_to_chip(
mesh_id_t src_mesh_id, chip_id_t src_chip_id, mesh_id_t dst_mesh_id, chip_id_t dst_chip_id) const;

Expand Down
Loading

0 comments on commit 948c8f7

Please sign in to comment.