Skip to content

Commit

Permalink
Allow passing optional TensixSoftResetOptions to assert risc reset at…
Browse files Browse the repository at this point in the history
… core API
  • Loading branch information
abhullar-tt committed Dec 28, 2024
1 parent 087bbe2 commit 8c5aa30
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 18 deletions.
16 changes: 12 additions & 4 deletions device/api/umd/device/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,15 @@ class tt_device {
*
* @param core Chip and core being targeted.
*/
virtual void assert_risc_reset_at_core(tt_cxy_pair core) {
virtual void assert_risc_reset_at_core(
tt_cxy_pair core, const TensixSoftResetOptions& soft_resets = TENSIX_ASSERT_SOFT_RESET) {
throw std::runtime_error("---- tt_device::assert_risc_reset_at_core is not implemented\n");
}

virtual void assert_risc_reset_at_core(const chip_id_t chip, const tt::umd::CoreCoord core) {
virtual void assert_risc_reset_at_core(
const chip_id_t chip,
const tt::umd::CoreCoord core,
const TensixSoftResetOptions& soft_resets = TENSIX_ASSERT_SOFT_RESET) {
throw std::runtime_error("---- tt_device::assert_risc_reset_at_core is not implemented\n");
}

Expand Down Expand Up @@ -636,7 +640,8 @@ class Cluster : public tt_device {
chip_id_t mmio_chip, const std::unordered_set<tt_xy_pair>& active_eth_cores_per_chip);
virtual void deassert_risc_reset_at_core(
tt_cxy_pair core, const TensixSoftResetOptions& soft_resets = TENSIX_DEASSERT_SOFT_RESET);
virtual void assert_risc_reset_at_core(tt_cxy_pair core);
virtual void assert_risc_reset_at_core(
tt_cxy_pair core, const TensixSoftResetOptions& soft_resets = TENSIX_ASSERT_SOFT_RESET);
virtual void write_to_device(
const void* mem_ptr, uint32_t size_in_bytes, tt_cxy_pair core, uint64_t addr, const std::string& tlb_to_use);
// TODO: Add CoreCoord API for this function.
Expand Down Expand Up @@ -695,7 +700,10 @@ class Cluster : public tt_device {
const chip_id_t chip,
const tt::umd::CoreCoord core,
const TensixSoftResetOptions& soft_resets = TENSIX_DEASSERT_SOFT_RESET);
virtual void assert_risc_reset_at_core(const chip_id_t chip, const tt::umd::CoreCoord core);
virtual void assert_risc_reset_at_core(
const chip_id_t chip,
const tt::umd::CoreCoord core,
const TensixSoftResetOptions& soft_resets = TENSIX_ASSERT_SOFT_RESET);
virtual void write_to_device(
const void* mem_ptr,
uint32_t size_in_bytes,
Expand Down
3 changes: 2 additions & 1 deletion device/api/umd/device/tt_simulation_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class tt_SimulationDevice : public tt_device {
virtual void deassert_risc_reset();
virtual void deassert_risc_reset_at_core(
tt_cxy_pair core, const TensixSoftResetOptions& soft_resets = TENSIX_DEASSERT_SOFT_RESET);
virtual void assert_risc_reset_at_core(tt_cxy_pair core);
virtual void assert_risc_reset_at_core(
tt_cxy_pair core, const TensixSoftResetOptions& soft_resets = TENSIX_ASSERT_SOFT_RESET);
virtual void close_device();

// Runtime Functions
Expand Down
11 changes: 6 additions & 5 deletions device/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ void Cluster::deassert_risc_reset_at_core(
deassert_risc_reset_at_core({(size_t)chip, virtual_coord}, soft_resets);
}

void Cluster::assert_risc_reset_at_core(tt_cxy_pair core) {
void Cluster::assert_risc_reset_at_core(tt_cxy_pair core, const TensixSoftResetOptions& soft_resets) {
// Get Target Device to query soc descriptor and determine location in cluster
std::uint32_t target_device = core.chip;
log_assert(
Expand All @@ -980,15 +980,16 @@ void Cluster::assert_risc_reset_at_core(tt_cxy_pair core) {
"Cannot assert reset on a non-tensix or harvested core");
bool target_is_mmio_capable = cluster_desc->is_chip_mmio_capable(target_device);
if (target_is_mmio_capable) {
send_tensix_risc_reset_to_core(core, TENSIX_ASSERT_SOFT_RESET);
send_tensix_risc_reset_to_core(core, soft_resets);
} else {
send_remote_tensix_risc_reset_to_core(core, TENSIX_ASSERT_SOFT_RESET);
send_remote_tensix_risc_reset_to_core(core, soft_resets);
}
}

void Cluster::assert_risc_reset_at_core(const chip_id_t chip, const CoreCoord core) {
void Cluster::assert_risc_reset_at_core(
const chip_id_t chip, const CoreCoord core, const TensixSoftResetOptions& soft_resets) {
const CoreCoord virtual_coord = translate_chip_coord(chip, core, CoordSystem::VIRTUAL);
assert_risc_reset_at_core({(size_t)chip, virtual_coord});
assert_risc_reset_at_core({(size_t)chip, virtual_coord}, soft_resets);
}

// Free memory during teardown, and remove (clean/unlock) from any leftover mutexes.
Expand Down
3 changes: 2 additions & 1 deletion device/mockup/tt_mockup_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class tt_MockupDevice : public tt_device {
void deassert_risc_reset_at_core(
tt_cxy_pair core, const TensixSoftResetOptions& soft_resets = TENSIX_DEASSERT_SOFT_RESET) override {}

void assert_risc_reset_at_core(tt_cxy_pair core) override {}
void assert_risc_reset_at_core(
tt_cxy_pair core, const TensixSoftResetOptions& soft_resets = TENSIX_ASSERT_SOFT_RESET) override {}

void close_device() override {}

Expand Down
2 changes: 1 addition & 1 deletion device/simulation/deprecated/tt_emulation_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void tt_emulation_device::deassert_risc_reset_at_core(tt_cxy_pair core, const Te
tt_zebu_wrapper_inst->tensix_reset_deassert(core.x, core.y);
}

void tt_emulation_device::assert_risc_reset_at_core(tt_cxy_pair core) {
void tt_emulation_device::assert_risc_reset_at_core(tt_cxy_pair core, const TensixSoftResetOptions& soft_resets) {
tt_zebu_wrapper_inst->tensix_reset_assert(core.x, core.y);
}

Expand Down
3 changes: 2 additions & 1 deletion device/simulation/deprecated/tt_emulation_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class tt_emulation_device : public tt_device {
virtual void deassert_risc_reset_at_core(
tt_cxy_pair core, const TensixSoftResetOptions& soft_resets = TENSIX_DEASSERT_SOFT_RESET);
virtual void assert_risc_reset();
virtual void assert_risc_reset_at_core(tt_cxy_pair core);
virtual void assert_risc_reset_at_core(
tt_cxy_pair core, const TensixSoftResetOptions& soft_resets = TENSIX_ASSERT_SOFT_RESET);
virtual void write_to_device(
std::vector<uint32_t>& vec,
tt_cxy_pair core,
Expand Down
2 changes: 1 addition & 1 deletion device/simulation/deprecated/tt_emulation_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void tt_emulation_device::assert_risc_reset() {}

void tt_emulation_device::deassert_risc_reset_at_core(tt_cxy_pair core, const TensixSoftResetOptions& soft_resets) {}

void tt_emulation_device::assert_risc_reset_at_core(tt_cxy_pair core) {}
void tt_emulation_device::assert_risc_reset_at_core(tt_cxy_pair core, const TensixSoftResetOptions& soft_resets) {}

void tt_emulation_device::close_device() {}

Expand Down
2 changes: 1 addition & 1 deletion device/simulation/deprecated/tt_versim_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void tt_VersimDevice::assert_risc_reset() {
versim::assert_riscv_reset(*versim);
}

void tt_VersimDevice::assert_risc_reset_at_core(tt_cxy_pair core) {
void tt_VersimDevice::assert_risc_reset_at_core(tt_cxy_pair core, const TensixSoftResetOptions& soft_resets) {
// This function asserts reset on the full versim device (don't need core level granularity for versim)
assert_risc_reset();
}
Expand Down
3 changes: 2 additions & 1 deletion device/simulation/deprecated/tt_versim_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class tt_VersimDevice : public tt_device {
virtual void deassert_risc_reset_at_core(
tt_cxy_pair core, const TensixSoftResetOptions& soft_resets = TENSIX_DEASSERT_SOFT_RESET);
virtual void assert_risc_reset();
virtual void assert_risc_reset_at_core(tt_cxy_pair core);
virtual void assert_risc_reset_at_core(
tt_cxy_pair core, const TensixSoftResetOptions& soft_resets = TENSIX_ASSERT_SOFT_RESET);
virtual void write_to_device(
std::vector<uint32_t>& vec,
tt_cxy_pair core,
Expand Down
2 changes: 1 addition & 1 deletion device/simulation/deprecated/tt_versim_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void tt_VersimDevice::deassert_risc_reset_at_core(tt_cxy_pair core, const Tensix

void tt_VersimDevice::assert_risc_reset() {}

void tt_VersimDevice::assert_risc_reset_at_core(tt_cxy_pair core) {}
void tt_VersimDevice::assert_risc_reset_at_core(tt_cxy_pair core, const TensixSoftResetOptions& soft_resets) {}

void tt_VersimDevice::translate_to_noc_table_coords(chip_id_t device_id, std::size_t& r, std::size_t& c){};

Expand Down
2 changes: 1 addition & 1 deletion device/simulation/tt_simulation_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void tt_SimulationDevice::deassert_risc_reset_at_core(tt_cxy_pair core, const Te
deassert_risc_reset();
}

void tt_SimulationDevice::assert_risc_reset_at_core(tt_cxy_pair core) {
void tt_SimulationDevice::assert_risc_reset_at_core(tt_cxy_pair core, const TensixSoftResetOptions& soft_resets) {
log_info(
tt::LogEmulationDriver,
"Sending 'assert_risc_reset_at_core'.. (Not implemented, defaulting to 'assert_risc_reset' instead)");
Expand Down

0 comments on commit 8c5aa30

Please sign in to comment.