Skip to content

Commit

Permalink
revert Arch to ARCH
Browse files Browse the repository at this point in the history
  • Loading branch information
broskoTT committed Dec 5, 2024
1 parent 73d5507 commit eafd170
Show file tree
Hide file tree
Showing 25 changed files with 185 additions and 185 deletions.
4 changes: 2 additions & 2 deletions device/api/umd/device/architecture_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class architecture_implementation {
public:
virtual ~architecture_implementation() = default;

virtual tt::Arch get_architecture() const = 0;
virtual tt::ARCH get_architecture() const = 0;
virtual uint32_t get_arc_message_arc_get_harvesting() const = 0;
virtual uint32_t get_arc_message_arc_go_busy() const = 0;
virtual uint32_t get_arc_message_arc_go_long_idle() const = 0;
Expand Down Expand Up @@ -73,7 +73,7 @@ class architecture_implementation {
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);
static std::unique_ptr<architecture_implementation> create(tt::ARCH architecture);
};

} // namespace tt::umd
2 changes: 1 addition & 1 deletion device/api/umd/device/blackhole_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static const size_t dram_translated_coordinate_start_y = 12;

class blackhole_implementation : public architecture_implementation {
public:
tt::Arch get_architecture() const override { return tt::Arch::BLACKHOLE; }
tt::ARCH get_architecture() const override { return tt::ARCH::BLACKHOLE; }

uint32_t get_arc_message_arc_get_harvesting() const override {
return static_cast<uint32_t>(blackhole::arc_message_type::ARC_GET_HARVESTING);
Expand Down
10 changes: 5 additions & 5 deletions device/api/umd/device/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,12 @@ class Cluster : public tt_device {
virtual void* host_dma_address(std::uint64_t offset, chip_id_t src_device_id, uint16_t channel) const;
virtual std::uint64_t get_pcie_base_addr_from_device(const chip_id_t chip_id) const;
static std::vector<int> extract_rows_to_remove(
const tt::Arch& arch, const int worker_grid_rows, const int harvested_rows);
const tt::ARCH& arch, const int worker_grid_rows, const int harvested_rows);
static void remove_worker_row_from_descriptor(
tt_SocDescriptor& full_soc_descriptor, const std::vector<int>& row_coordinates_to_remove);
static void harvest_rows_in_soc_descriptor(tt::Arch arch, tt_SocDescriptor& sdesc, uint32_t harvested_rows);
static void harvest_rows_in_soc_descriptor(tt::ARCH arch, tt_SocDescriptor& sdesc, uint32_t harvested_rows);
static std::unordered_map<tt_xy_pair, tt_xy_pair> create_harvested_coord_translation(
const tt::Arch arch, bool identity_map);
const tt::ARCH arch, bool identity_map);
std::unordered_map<tt_xy_pair, tt_xy_pair> get_harvested_coord_translation_map(chip_id_t logical_device_id);
virtual std::uint32_t get_num_dram_channels(std::uint32_t device_id);
virtual std::uint64_t get_dram_channel_size(std::uint32_t device_id, std::uint32_t channel);
Expand Down Expand Up @@ -786,10 +786,10 @@ class Cluster : public tt_device {
tt_driver_host_address_params host_address_params;
tt_driver_noc_params noc_params;
tt_driver_eth_interface_params eth_interface_params;
std::vector<tt::Arch> archs_in_cluster = {};
std::vector<tt::ARCH> archs_in_cluster = {};
std::set<chip_id_t> target_devices_in_cluster = {};
std::set<chip_id_t> target_remote_chips = {};
tt::Arch arch_name;
tt::ARCH arch_name;
std::unordered_map<chip_id_t, std::unique_ptr<PCIDevice>> m_pci_device_map; // Map of enabled pci devices
int m_num_pci_devices; // Number of pci devices in system (enabled or disabled)
std::shared_ptr<tt_ClusterDescriptor> cluster_desc;
Expand Down
6 changes: 3 additions & 3 deletions device/api/umd/device/coordinate_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CoordinateManager {
const std::vector<tt_xy_pair>& pcie_cores);

static std::shared_ptr<CoordinateManager> create_coordinate_manager(
tt::Arch arch,
tt::ARCH arch,
const tt_xy_pair& tensix_grid_size,
const std::vector<tt_xy_pair>& tensix_cores,
const size_t tensix_harvesting_mask,
Expand All @@ -46,7 +46,7 @@ class CoordinateManager {
const std::vector<tt_xy_pair>& pcie_cores);

static std::shared_ptr<CoordinateManager> create_coordinate_manager(
tt::Arch arch, const size_t tensix_harvesting_mask = 0, const size_t dram_harvesting_mask = 0);
tt::ARCH arch, const size_t tensix_harvesting_mask = 0, const size_t dram_harvesting_mask = 0);

static size_t get_num_harvested(const size_t harvesting_mask);

Expand All @@ -65,7 +65,7 @@ class CoordinateManager {
tt::umd::CoreCoord to_translated(const tt::umd::CoreCoord core_coord);

static void assert_create_coordinate_manager(
const tt::Arch arch, const size_t tensix_harvesting_mask, const size_t dram_harvesting_mask);
const tt::ARCH arch, const size_t tensix_harvesting_mask, const size_t dram_harvesting_mask);

protected:
virtual void translate_tensix_coords();
Expand Down
2 changes: 1 addition & 1 deletion device/api/umd/device/grayskull_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static constexpr uint32_t TENSIX_SOFT_RESET_ADDR = 0xFFB121B0;

class grayskull_implementation : public architecture_implementation {
public:
tt::Arch get_architecture() const override { return tt::Arch::GRAYSKULL; }
tt::ARCH get_architecture() const override { return tt::ARCH::GRAYSKULL; }

uint32_t get_arc_message_arc_get_harvesting() const override {
return static_cast<uint32_t>(grayskull::arc_message_type::ARC_GET_HARVESTING);
Expand Down
6 changes: 3 additions & 3 deletions device/api/umd/device/pci_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct PciDeviceInfo {
uint16_t pci_device;
uint16_t pci_function;

tt::Arch get_arch() const;
tt::ARCH get_arch() const;
// TODO: does it make sense to move attributes that we can read from sysfs
// onto this struct as methods? e.g. current_link_width etc.
};
Expand All @@ -70,7 +70,7 @@ class PCIDevice {
const PciDeviceInfo info; // PCI device info
const int numa_node; // -1 if non-NUMA
const int revision; // PCI revision value from sysfs
const tt::Arch arch; // e.g. Grayskull, Wormhole, Blackhole
const tt::ARCH arch; // e.g. Grayskull, Wormhole, Blackhole
const semver_t kmd_version; // KMD version
const bool iommu_enabled; // Whether the system is protected from this device by an IOMMU
std::unique_ptr<tt::umd::architecture_implementation> architecture_implementation;
Expand Down Expand Up @@ -142,7 +142,7 @@ class PCIDevice {
/**
* @return what architecture this device is (e.g. Wormhole, Blackhole, etc.)
*/
tt::Arch get_arch() const { return arch; }
tt::ARCH get_arch() const { return arch; }

/**
* @return whether the system is protected from this device by an IOMMU
Expand Down
8 changes: 4 additions & 4 deletions device/api/umd/device/tt_cluster_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class tt_ClusterDescriptor {
std::unordered_map<chip_id_t, chip_id_t> closest_mmio_chip_cache = {};
std::unordered_map<chip_id_t, BoardType> chip_board_type = {};
std::unordered_map<chip_id_t, std::unordered_set<chip_id_t>> chips_grouped_by_closest_mmio;
std::unordered_map<chip_id_t, tt::Arch> chip_arch = {};
std::unordered_map<chip_id_t, tt::ARCH> chip_arch = {};

// one-to-many chip connections
struct Chip2ChipConnection {
Expand Down Expand Up @@ -97,11 +97,11 @@ class tt_ClusterDescriptor {
static std::string get_cluster_descriptor_file_path();
static std::unique_ptr<tt_ClusterDescriptor> create_from_yaml(const std::string &cluster_descriptor_file_path);
static std::unique_ptr<tt_ClusterDescriptor> create();
static tt::Arch detect_arch(const chip_id_t chip_id);
static tt::ARCH detect_arch(const chip_id_t chip_id);

// This function is used to create mock cluster descriptor yaml files, for example for simulation.
static std::unique_ptr<tt_ClusterDescriptor> create_mock_cluster(
const std::vector<chip_id_t> &logical_device_ids, tt::Arch arch);
const std::vector<chip_id_t> &logical_device_ids, tt::ARCH arch);

const std::unordered_map<chip_id_t, std::uint32_t> &get_harvesting_info() const;
const std::unordered_map<chip_id_t, bool> &get_noc_translation_table_en() const;
Expand All @@ -117,7 +117,7 @@ class tt_ClusterDescriptor {
int get_ethernet_link_distance(chip_id_t chip_a, chip_id_t chip_b) const;

BoardType get_board_type(chip_id_t chip_id) const;
tt::Arch get_arch(chip_id_t chip_id) const;
tt::ARCH get_arch(chip_id_t chip_id) const;

bool ethernet_core_has_active_ethernet_link(chip_id_t local_chip, ethernet_channel_t local_ethernet_channel) const;
std::tuple<chip_id_t, ethernet_channel_t> get_chip_and_channel_of_remote_ethernet_core(
Expand Down
4 changes: 2 additions & 2 deletions device/api/umd/device/tt_simulation_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ class tt_SimulationDevice : public tt_device {
tt_driver_host_address_params host_address_params;
tt_driver_noc_params noc_params;
tt_driver_eth_interface_params eth_interface_params;
std::vector<tt::Arch> archs_in_cluster = {};
std::vector<tt::ARCH> archs_in_cluster = {};
std::set<chip_id_t> target_devices_in_cluster = {};
std::set<chip_id_t> target_remote_chips = {};
tt::Arch arch_name;
tt::ARCH arch_name;
std::shared_ptr<tt_ClusterDescriptor> cluster_descriptor;
};
4 changes: 2 additions & 2 deletions device/api/umd/device/tt_soc_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct CoreDescriptor {
*/
class tt_SocDescriptor {
public:
tt::Arch arch;
tt::ARCH arch;
tt_xy_pair grid_size;
tt_xy_pair physical_grid_size;
tt_xy_pair worker_grid_size;
Expand Down Expand Up @@ -124,7 +124,7 @@ class tt_SocDescriptor {
// CoreCoord conversions.
tt::umd::CoreCoord to(const tt::umd::CoreCoord core_coord, const CoordSystem coord_system);

static std::string get_soc_descriptor_path(tt::Arch arch);
static std::string get_soc_descriptor_path(tt::ARCH arch);

private:
void create_coordinate_manager(const std::size_t tensix_harvesting_mask, const std::size_t dram_harvesting_mask);
Expand Down
24 changes: 12 additions & 12 deletions device/api/umd/device/types/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,41 @@ static inline std::string to_lower(const std::string &str) {
/**
* Enums for different architectures.
*/
enum class Arch {
enum class ARCH {
GRAYSKULL = 1,
WORMHOLE_B0 = 2,
BLACKHOLE = 3,
Invalid = 0xFF,
};

static inline tt::Arch arch_from_str(const std::string &arch_str) {
static inline tt::ARCH arch_from_str(const std::string &arch_str) {
std::string arch_str_lower = to_lower(arch_str);

if (arch_str_lower == "grayskull") {
return tt::Arch::GRAYSKULL;
return tt::ARCH::GRAYSKULL;
} else if ((arch_str_lower == "wormhole") || (arch_str_lower == "wormhole_b0")) {
return tt::Arch::WORMHOLE_B0;
return tt::ARCH::WORMHOLE_B0;
} else if (arch_str_lower == "blackhole") {
return tt::Arch::BLACKHOLE;
return tt::ARCH::BLACKHOLE;
} else {
return tt::Arch::Invalid;
return tt::ARCH::Invalid;
}
}

static inline std::string arch_to_str(const tt::Arch arch) {
static inline std::string arch_to_str(const tt::ARCH arch) {
switch (arch) {
case tt::Arch::GRAYSKULL:
case tt::ARCH::GRAYSKULL:
return "grayskull";
case tt::Arch::WORMHOLE_B0:
case tt::ARCH::WORMHOLE_B0:
return "wormhole_b0";
case tt::Arch::BLACKHOLE:
case tt::ARCH::BLACKHOLE:
return "blackhole";
case tt::Arch::Invalid:
case tt::ARCH::Invalid:
default:
return "Invalid";
}
}

} // namespace tt

static inline std::ostream &operator<<(std::ostream &out, const tt::Arch &arch) { return out << arch_to_str(arch); }
static inline std::ostream &operator<<(std::ostream &out, const tt::ARCH &arch) { return out << arch_to_str(arch); }
2 changes: 1 addition & 1 deletion device/api/umd/device/wormhole_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ static const size_t eth_translated_coordinate_start_y = 16;

class wormhole_implementation : public architecture_implementation {
public:
tt::Arch get_architecture() const override { return tt::Arch::WORMHOLE_B0; }
tt::ARCH get_architecture() const override { return tt::ARCH::WORMHOLE_B0; }

uint32_t get_arc_message_arc_get_harvesting() const override {
return static_cast<uint32_t>(wormhole::arc_message_type::ARC_GET_HARVESTING);
Expand Down
8 changes: 4 additions & 4 deletions device/architecture_implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

namespace tt::umd {

std::unique_ptr<architecture_implementation> architecture_implementation::create(tt::Arch architecture) {
std::unique_ptr<architecture_implementation> architecture_implementation::create(tt::ARCH architecture) {
switch (architecture) {
case tt::Arch::BLACKHOLE:
case tt::ARCH::BLACKHOLE:
return std::make_unique<blackhole_implementation>();
case tt::Arch::GRAYSKULL:
case tt::ARCH::GRAYSKULL:
return std::make_unique<grayskull_implementation>();
case tt::Arch::WORMHOLE_B0:
case tt::ARCH::WORMHOLE_B0:
return std::make_unique<wormhole_implementation>();
default:
return nullptr;
Expand Down
Loading

0 comments on commit eafd170

Please sign in to comment.