Skip to content

Commit

Permalink
#11099: remove everything versim related
Browse files Browse the repository at this point in the history
  • Loading branch information
vtangTT committed Aug 5, 2024
1 parent 117c49e commit 99bec9d
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 108 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ option(WITH_PYTHON_BINDINGS "Enables build of python bindings" ON)
message(STATUS "Build Python bindings: ${WITH_PYTHON_BINDINGS}")

option(ENABLE_CODE_TIMERS "Enable code timers" OFF)
option(TT_METAL_VERSIM_DISABLED "Disable TT_METAL_VERSIM" ON)

option(ENABLE_TRACY "Enable Tracy Profiling" OFF)

Expand Down Expand Up @@ -154,10 +153,6 @@ add_library(compiler_flags INTERFACE)
target_link_libraries(compiler_flags INTERFACE compiler_warnings stdlib)
target_compile_options(compiler_flags INTERFACE -mavx2 -fPIC -DFMT_HEADER_ONLY -fvisibility-inlines-hidden -fno-lto)

if(TT_METAL_VERSIM_DISABLED)
target_compile_options(compiler_flags INTERFACE -DTT_METAL_VERSIM_DISABLED)
endif()

if(ENABLE_CODE_TIMERS)
target_compile_options(compiler_flags INTERFACE -DTT_ENABLE_CODE_TIMERS)
endif()
Expand Down
1 change: 0 additions & 1 deletion cmake/umd_device.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ set(UMD_SRC
${UMD_HOME}/device/tt_silicon_driver.cpp
${UMD_HOME}/device/tt_silicon_driver_common.cpp
${UMD_HOME}/device/tt_soc_descriptor.cpp
${UMD_HOME}/device/tt_versim_stub.cpp
${UMD_HOME}/device/wormhole_implementation.cpp
)

Expand Down
6 changes: 1 addition & 5 deletions tests/tt_metal/tt_metal/perf_microbenchmark/common/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ inline uint64_t get_t0_to_any_riscfw_end_cycle(tt::tt_metal::Device *device, con
}

inline int get_tt_npu_clock(tt::tt_metal::Device *device) {
int ai_clk = 0;
#ifdef TT_METAL_VERSIM_DISABLED
ai_clk = tt::Cluster::instance().get_device_aiclk(device->id());
#endif
return ai_clk;
return tt::Cluster::instance().get_device_aiclk(device->id());
}

template <typename T>
Expand Down
7 changes: 3 additions & 4 deletions tt_metal/common/base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ namespace tt
enum class TargetDevice : uint8_t
{
Model = 0,
Versim = 1,
Silicon = 2,
Golden = 3,
VCS = 4,
Silicon = 1,
Golden = 2,
VCS = 3,
Invalid = 0xFF,
};

Expand Down
17 changes: 2 additions & 15 deletions tt_metal/common/core_descriptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,9 @@ inline std::string get_core_descriptor_file(const tt::ARCH &arch) {
wh_arch = "tt_metal/core_descriptors/";
wh_arch += getenv("WH_ARCH_YAML");
}
bool targeting_versim = false;

bool targeting_vcs = std::getenv("TT_METAL_SIMULATOR_EN") != nullptr;
#ifndef TT_METAL_VERSIM_DISABLED
targeting_versim = true;
#endif
if (targeting_versim) {
switch (arch) {
case tt::ARCH::Invalid: throw std::runtime_error("Invalid arch not supported"); // will be overwritten in tt_global_state constructor
case tt::ARCH::JAWBRIDGE: throw std::runtime_error("JAWBRIDGE arch not supported");
case tt::ARCH::GRAYSKULL: return tt_metal_home + "tt_metal/core_descriptors/grayskull_versim_1x1_arch.yaml";
case tt::ARCH::WORMHOLE: throw std::runtime_error("WORMHOLE arch not supported");
case tt::ARCH::WORMHOLE_B0: return tt_metal_home + "tt_metal/core_descriptors/wormhole_b0_versim_1x1_arch.yaml";
case tt::ARCH::BLACKHOLE: return tt_metal_home + "tt_metal/core_descriptors/blackhole_versim_1x1_arch.yaml";
default: throw std::runtime_error("Unsupported device arch");
};
} else if (targeting_vcs) {
if (targeting_vcs) {
switch (arch) {
case tt::ARCH::Invalid: throw std::runtime_error("Invalid arch not supported"); // will be overwritten in tt_global_state constructor
case tt::ARCH::JAWBRIDGE: throw std::runtime_error("JAWBRIDGE arch not supported");
Expand Down
13 changes: 1 addition & 12 deletions tt_metal/common/test_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

inline std::string get_soc_description_file(const tt::ARCH &arch, tt::TargetDevice target_device, string output_dir = "") {
// Ability to skip this runtime opt, since trimmed SOC desc limits which DRAM channels are available.
bool use_full_soc_desc = getenv("TT_METAL_VERSIM_FORCE_FULL_SOC_DESC");
string tt_metal_home;
if (getenv("TT_METAL_HOME")) {
tt_metal_home = getenv("TT_METAL_HOME");
Expand All @@ -33,17 +32,7 @@ inline std::string get_soc_description_file(const tt::ARCH &arch, tt::TargetDevi
if (tt_metal_home.back() != '/') {
tt_metal_home += "/";
}
if (target_device == tt::TargetDevice::Versim && !use_full_soc_desc) {
switch (arch) {
case tt::ARCH::Invalid: throw std::runtime_error("Invalid arch not supported"); // will be overwritten in tt_global_state constructor
case tt::ARCH::JAWBRIDGE: throw std::runtime_error("JAWBRIDGE arch not supported");
case tt::ARCH::GRAYSKULL: return tt_metal_home + "tt_metal/soc_descriptors/grayskull_versim_1x1_arch.yaml";
case tt::ARCH::WORMHOLE: throw std::runtime_error("WORMHOLE arch not supported");
case tt::ARCH::WORMHOLE_B0: return tt_metal_home + "tt_metal/soc_descriptors/wormhole_b0_versim_1x1_arch.yaml";
case tt::ARCH::BLACKHOLE: return tt_metal_home + "tt_metal/soc_descriptors/blackhole_versim_1x1_arch.yaml";
default: throw std::runtime_error("Unsupported device arch");
};
} else if (target_device == tt::TargetDevice::VCS){
if (target_device == tt::TargetDevice::VCS){
switch (arch) {
case tt::ARCH::Invalid: throw std::runtime_error("Invalid arch not supported");
case tt::ARCH::JAWBRIDGE: throw std::runtime_error("JAWBRIDGE arch not supported");
Expand Down
11 changes: 0 additions & 11 deletions tt_metal/hw/inc/blackhole/dev_mem_map_versim.h

This file was deleted.

11 changes: 0 additions & 11 deletions tt_metal/hw/inc/grayskull/dev_mem_map_versim.h

This file was deleted.

1 change: 0 additions & 1 deletion tt_metal/hw/inc/grayskull/tensix.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <tensix_types.h>
#include "cfg_defines.h"
#include "dev_mem_map.h"
#include "dev_mem_map_versim.h"

// Convenience and type defines
typedef std::uint32_t uint;
Expand Down
11 changes: 0 additions & 11 deletions tt_metal/hw/inc/wormhole/dev_mem_map_versim.h

This file was deleted.

1 change: 0 additions & 1 deletion tt_metal/hw/inc/wormhole/tensix.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <tensix_types.h>
#include "cfg_defines.h"
#include "dev_mem_map.h"
#include "dev_mem_map_versim.h"

// Convenience and type defines
typedef std::uint32_t uint;
Expand Down
2 changes: 0 additions & 2 deletions tt_metal/impl/device/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,8 @@ void Device::initialize_cluster() {
if (llrt::OptionsG.get_clear_l1()) {
this->clear_l1_state();
}
#ifdef TT_METAL_VERSIM_DISABLED
int ai_clk = tt::Cluster::instance().get_device_aiclk(this->id_);
log_info(tt::LogMetal, "AI CLK for device {} is: {} MHz", this->id_, ai_clk);
#endif
}

void Device::initialize_allocator(size_t l1_small_size, size_t trace_region_size, const std::vector<uint32_t> &l1_bank_remap) {
Expand Down
27 changes: 6 additions & 21 deletions tt_metal/llrt/tt_cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Cluster::Cluster() {
}

void Cluster::detect_arch_and_target() {
#ifdef TT_METAL_VERSIM_DISABLED
if(std::getenv("TT_METAL_SIMULATOR_EN")) {
this->target_type_ = TargetDevice::VCS;
auto arch_env = getenv("ARCH_NAME");
Expand All @@ -70,13 +69,6 @@ void Cluster::detect_arch_and_target() {
get_arch_str(detected_arch));
}
}
#else
this->target_type_ = TargetDevice::Versim;
auto arch_env = getenv("ARCH_NAME");
TT_FATAL(arch_env, "arch_env needs to be set for versim (ARCH_NAME=)");
this->arch_ = tt::get_arch_from_string(arch_env);
#endif

#ifdef ARCH_GRAYSKULL
TT_FATAL(
this->arch_ == tt::ARCH::GRAYSKULL,
Expand All @@ -96,7 +88,7 @@ void Cluster::detect_arch_and_target() {
get_string(this->arch_));
#endif

TT_FATAL(this->target_type_ == TargetDevice::Versim or this->target_type_ == TargetDevice::Silicon or this->target_type_ == TargetDevice::VCS);
TT_FATAL(this->target_type_ == TargetDevice::Silicon or this->target_type_ == TargetDevice::VCS);
}

std::filesystem::path get_cluster_desc_yaml() {
Expand Down Expand Up @@ -171,9 +163,9 @@ void Cluster::generate_cluster_descriptor() {
}

// Use cluster descriptor to map MMIO device id to all devices on the same card (including the MMIO device)
if (this->target_type_ == TargetDevice::Versim || this->target_type_ == TargetDevice::VCS) {
std::set<chip_id_t> dummy_versim_card = {0};
this->devices_grouped_by_assoc_mmio_device_[0] = dummy_versim_card;
if (this->target_type_ == TargetDevice::VCS) {
std::set<chip_id_t> dummy_card = {0};
this->devices_grouped_by_assoc_mmio_device_[0] = dummy_card;
this->device_to_mmio_device_[0] = 0;
} else {
for (chip_id_t device_id : this->cluster_desc_->get_all_chips()) {
Expand Down Expand Up @@ -212,10 +204,6 @@ void Cluster::initialize_device_drivers() {
this->open_driver(mmio_device_id, controlled_devices);

tt_device_params default_params;
if (getenv("TT_METAL_VERSIM_DUMP_CORES")) {
std::string dump_cores_string = getenv("TT_METAL_VERSIM_DUMP_CORES");
default_params.vcd_dump_cores = tt::utils::strsplit(dump_cores_string, ',');
}
this->start_driver(mmio_device_id, default_params);
}
}
Expand Down Expand Up @@ -288,10 +276,7 @@ void Cluster::open_driver(
// Adding this check is a workaround for current UMD bug that only uses this getter to populate private metadata
// that is later expected to be populated by unrelated APIs
TT_FATAL(device_driver->get_target_mmio_device_ids().size() == 1);
} else if (this->target_type_ == TargetDevice::Versim) {
device_driver = std::make_unique<tt_VersimDevice>(sdesc_path, this->cluster_desc_path_);
}
else if (this->target_type_ == TargetDevice::VCS) {
} else if (this->target_type_ == TargetDevice::VCS) {
device_driver = std::make_unique<tt_SimulationDevice>(sdesc_path);
}
device_driver->set_device_dram_address_params(dram_address_params);
Expand Down Expand Up @@ -347,7 +332,7 @@ const metal_SocDescriptor &Cluster::get_soc_desc(chip_id_t chip) const {
}

uint32_t Cluster::get_harvested_rows(chip_id_t chip) const {
if (this->target_type_ == TargetDevice::Versim || this->target_type_ == TargetDevice::VCS) {
if (this->target_type_ == TargetDevice::VCS) {
return 0;
} else {
return this->get_driver(chip).harvested_rows_per_target.at(chip);
Expand Down
8 changes: 0 additions & 8 deletions tt_metal/tt_metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,19 +700,11 @@ void EnableAllocs(Device *device) { tt::tt_metal::allocator::enable_allocs(*(dev
} // namespace detail

size_t GetNumAvailableDevices() {
#ifdef TT_METAL_VERSIM_DISABLED
return tt::Cluster::instance().number_of_user_devices();
#else
return 1;
#endif
}

size_t GetNumPCIeDevices() {
#ifdef TT_METAL_VERSIM_DISABLED
return tt::Cluster::instance().number_of_pci_devices();
#else
return 1;
#endif
}

chip_id_t GetPCIeDeviceID(chip_id_t device_id){
Expand Down

0 comments on commit 99bec9d

Please sign in to comment.