Skip to content

Commit

Permalink
Refactor setting of noc_params to architecture abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
blozano-tt committed Nov 6, 2024
1 parent 2132c29 commit 78e33e2
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 5 deletions.
2 changes: 2 additions & 0 deletions device/architecture_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

struct tt_driver_host_address_params;
struct tt_driver_eth_interface_params;
struct tt_driver_noc_params;

namespace tt::umd {

Expand Down Expand Up @@ -68,6 +69,7 @@ class architecture_implementation {

virtual tt_driver_host_address_params get_host_address_params() const = 0;
virtual tt_driver_eth_interface_params get_eth_interface_params() const = 0;
virtual tt_driver_noc_params get_noc_params() const = 0;

static std::unique_ptr<architecture_implementation> create(tt::ARCH architecture);
};
Expand Down
7 changes: 7 additions & 0 deletions device/blackhole/blackhole_implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#include "device/tt_device.h"

constexpr std::uint32_t NOC_ADDR_LOCAL_BITS = 36; // source: noc_parameters.h, common for WH && BH
constexpr std::uint32_t NOC_ADDR_NODE_ID_BITS = 6; // source: noc_parameters.h, common for WH && BH

namespace tt::umd {

std::tuple<xy_pair, xy_pair> blackhole_implementation::multicast_workaround(xy_pair start, xy_pair end) const {
Expand Down Expand Up @@ -108,4 +111,8 @@ tt_driver_eth_interface_params blackhole_implementation::get_eth_interface_param
};
}

tt_driver_noc_params blackhole_implementation::get_noc_params() const {
return {NOC_ADDR_LOCAL_BITS, NOC_ADDR_NODE_ID_BITS};
}

} // namespace tt::umd
1 change: 1 addition & 0 deletions device/blackhole/blackhole_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class blackhole_implementation : public architecture_implementation {

tt_driver_host_address_params get_host_address_params() const override;
tt_driver_eth_interface_params get_eth_interface_params() const override;
tt_driver_noc_params get_noc_params() const override;

};

Expand Down
7 changes: 7 additions & 0 deletions device/grayskull/grayskull_implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#include "device/tt_device.h"

constexpr std::uint32_t NOC_ADDR_LOCAL_BITS = 32; // source: noc_parameters.h, unique for GS
constexpr std::uint32_t NOC_ADDR_NODE_ID_BITS = 6; // source: noc_parameters.h, common for GS && WH && BH

namespace tt::umd {

std::tuple<xy_pair, xy_pair> grayskull_implementation::multicast_workaround(xy_pair start, xy_pair end) const {
Expand Down Expand Up @@ -115,4 +118,8 @@ tt_driver_eth_interface_params grayskull_implementation::get_eth_interface_param
};
}

tt_driver_noc_params grayskull_implementation::get_noc_params() const {
return {NOC_ADDR_LOCAL_BITS, NOC_ADDR_NODE_ID_BITS};
}

} // namespace tt::umd
1 change: 1 addition & 0 deletions device/grayskull/grayskull_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ class grayskull_implementation : public architecture_implementation {

tt_driver_host_address_params get_host_address_params() const override;
tt_driver_eth_interface_params get_eth_interface_params() const override;
tt_driver_noc_params get_noc_params() const override;

};

Expand Down
7 changes: 2 additions & 5 deletions device/tt_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
#include "pcie/pci_device.hpp"
#include "fmt/core.h"

constexpr std::uint32_t NOC_ADDR_LOCAL_BITS = 36; // source: noc_parameters.h, common for WH && BH
constexpr std::uint32_t NOC_ADDR_NODE_ID_BITS = 6; // source: noc_parameters.h, common for WH && BH

using TLB_DATA = tt::umd::tlb_data;

// TODO: Remove this - it's here for Metal backwards compatibility.
Expand Down Expand Up @@ -90,8 +87,8 @@ struct tt_driver_host_address_params {
};

struct tt_driver_noc_params {
std::uint32_t noc_addr_local_bits = NOC_ADDR_LOCAL_BITS;
std::uint32_t noc_addr_node_id_bits = NOC_ADDR_NODE_ID_BITS;
std::uint32_t noc_addr_local_bits = 0;
std::uint32_t noc_addr_node_id_bits = 0;
};

/**
Expand Down
3 changes: 3 additions & 0 deletions device/tt_silicon_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ tt_SiliconDevice::tt_SiliconDevice(const std::string &sdesc_path, const std::str
// Default initialize eth_interface_params based on detected arch
eth_interface_params = architecture_implementation->get_eth_interface_params();

// Default initialize noc_params based on detected arch
noc_params = architecture_implementation->get_noc_params();

}

void tt_SiliconDevice::configure_active_ethernet_cores_for_mmio_device(chip_id_t mmio_chip, const std::unordered_set<tt_xy_pair>& active_eth_cores_per_chip) {
Expand Down
7 changes: 7 additions & 0 deletions device/wormhole/wormhole_implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#include "device/tt_device.h"

constexpr std::uint32_t NOC_ADDR_LOCAL_BITS = 36; // source: noc_parameters.h, common for WH && BH
constexpr std::uint32_t NOC_ADDR_NODE_ID_BITS = 6; // source: noc_parameters.h, common for WH && BH

namespace tt::umd {

std::tuple<xy_pair, xy_pair> wormhole_implementation::multicast_workaround(xy_pair start, xy_pair end) const {
Expand Down Expand Up @@ -123,4 +126,8 @@ tt_driver_eth_interface_params wormhole_implementation::get_eth_interface_params
};
}

tt_driver_noc_params wormhole_implementation::get_noc_params() const {
return {NOC_ADDR_LOCAL_BITS, NOC_ADDR_NODE_ID_BITS};
}

} // namespace tt::umd
1 change: 1 addition & 0 deletions device/wormhole/wormhole_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ class wormhole_implementation : public architecture_implementation {

tt_driver_host_address_params get_host_address_params() const override;
tt_driver_eth_interface_params get_eth_interface_params() const override;
tt_driver_noc_params get_noc_params() const override;

};

Expand Down

0 comments on commit 78e33e2

Please sign in to comment.