Skip to content

Commit

Permalink
gcc errors
Browse files Browse the repository at this point in the history
  • Loading branch information
broskoTT committed Dec 9, 2024
1 parent 38b78df commit 63dd139
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,15 @@ message(STATUS "UMD build type: ${CMAKE_BUILD_TYPE}")
include(dependencies)

# Enable all warnings and treat them as errors
# Ignore unused variables and functions since there is no harm.
# TODO: Re-enable sign-compare
add_compile_options(
-Wall
-Werror
-Wno-unused-variable
-Wno-unused-function
-Wno-unused-but-set-variable
-Wno-sign-compare
)

add_subdirectory(common)
Expand Down
17 changes: 17 additions & 0 deletions device/coordinate_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ CoreCoord CoordinateManager::to_physical(const CoreCoord core_coord) {
auto& logical_mapping = get_logical_to_physical(core_coord.core_type);
return logical_mapping[{core_coord.x, core_coord.y}];
}
default:
throw std::runtime_error(
"Unexpected CoordSystem value " + std::to_string((uint8_t)core_coord.coord_system));
}
}

Expand All @@ -177,6 +180,9 @@ CoreCoord CoordinateManager::to_virtual(const CoreCoord core_coord) {
auto& logical_mapping = get_logical_to_virtual(core_coord.core_type);
return logical_mapping[{core_coord.x, core_coord.y}];
}
default:
throw std::runtime_error(
"Unexpected CoordSystem value " + std::to_string((uint8_t)core_coord.coord_system));
}
}

Expand All @@ -196,6 +202,9 @@ CoreCoord CoordinateManager::to_logical(const CoreCoord core_coord) {
auto& translated_mapping = get_translated_to_logical(core_coord.core_type);
return translated_mapping[{core_coord.x, core_coord.y}];
}
default:
throw std::runtime_error(
"Unexpected CoordSystem value " + std::to_string((uint8_t)core_coord.coord_system));
}
}

Expand All @@ -210,6 +219,9 @@ CoreCoord CoordinateManager::to_translated(const CoreCoord core_coord) {
auto& logical_mapping = get_logical_to_translated(core_coord.core_type);
return logical_mapping[{core_coord.x, core_coord.y}];
}
default:
throw std::runtime_error(
"Unexpected CoordSystem value " + std::to_string((uint8_t)core_coord.coord_system));
}
}

Expand All @@ -223,6 +235,9 @@ CoreCoord CoordinateManager::to(const CoreCoord core_coord, const CoordSystem co
return to_virtual(core_coord);
case CoordSystem::TRANSLATED:
return to_translated(core_coord);
default:
throw std::runtime_error(
"Unexpected CoordSystem value " + std::to_string((uint8_t)core_coord.coord_system));
}
}

Expand Down Expand Up @@ -457,6 +472,8 @@ std::shared_ptr<CoordinateManager> CoordinateManager::create_coordinate_manager(
tt::umd::blackhole::PCIE_CORES);
case tt::ARCH::Invalid:
throw std::runtime_error("Invalid architecture for creating coordinate manager");
default:
throw std::runtime_error("Unexpected ARCH value " + std::to_string((int)arch));
}
}

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 @@ -25,7 +25,7 @@ flatbuffers::FlatBufferBuilder create_flatbuffer(
flatbuffers::FlatBufferBuilder builder;
auto data = builder.CreateVector(vec);
auto core = tt_vcs_core(core_.x, core_.y);
uint64_t size = size_ == 0 ? size = vec.size() * sizeof(uint32_t) : size = size_;
uint64_t size = (size_ == 0 ? vec.size() * sizeof(uint32_t) : size_);
auto device_cmd = CreateDeviceRequestResponse(builder, rw, data, &core, addr, size);
builder.Finish(device_cmd);
return builder;
Expand Down
20 changes: 10 additions & 10 deletions device/tlb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
namespace tt::umd {

bool tlb_data::check(const tlb_offsets &offset) const {
return local_offset > ((1ULL << (offset.x_end - offset.local_offset)) - 1) |
x_end > ((1ULL << (offset.y_end - offset.x_end)) - 1) |
y_end > ((1ULL << (offset.x_start - offset.y_end)) - 1) |
x_start > ((1ULL << (offset.y_start - offset.x_start)) - 1) |
y_start > ((1ULL << (offset.noc_sel - offset.y_start)) - 1) |
noc_sel > ((1ULL << (offset.mcast - offset.noc_sel)) - 1) |
mcast > ((1ULL << (offset.ordering - offset.mcast)) - 1) |
ordering > ((1ULL << (offset.linked - offset.ordering)) - 1) |
linked > ((1ULL << (offset.static_vc - offset.linked)) - 1) |
static_vc > ((1ULL << (offset.static_vc_end - offset.static_vc)) - 1);
return (local_offset > ((1ULL << (offset.x_end - offset.local_offset)) - 1)) |
(x_end > ((1ULL << (offset.y_end - offset.x_end)) - 1)) |
(y_end > ((1ULL << (offset.x_start - offset.y_end)) - 1)) |
(x_start > ((1ULL << (offset.y_start - offset.x_start)) - 1)) |
(y_start > ((1ULL << (offset.noc_sel - offset.y_start)) - 1)) |
(noc_sel > ((1ULL << (offset.mcast - offset.noc_sel)) - 1)) |
(mcast > ((1ULL << (offset.ordering - offset.mcast)) - 1)) |
(ordering > ((1ULL << (offset.linked - offset.ordering)) - 1)) |
(linked > ((1ULL << (offset.static_vc - offset.linked)) - 1)) |
(static_vc > ((1ULL << (offset.static_vc_end - offset.static_vc)) - 1));
}

// Helper lambda to handle bit packing
Expand Down
5 changes: 3 additions & 2 deletions tests/api/test_cluster_descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ TEST(ApiClusterDescriptorTest, DetectArch) {
EXPECT_THROW(tt_ClusterDescriptor::detect_arch(0), std::runtime_error);
} else {
tt::ARCH arch = tt_ClusterDescriptor::detect_arch(0);
EXPECT_NE(arch, tt::ARCH::Invalid);
std::cout << arch << std::endl;
EXPECT_TRUE(arch != tt::ARCH::Invalid);

// Test that cluster descriptor and PCIDevice::enumerate_devices_info() return the same set of chips.
std::map<int, PciDeviceInfo> pci_device_infos = PCIDevice::enumerate_devices_info();
Expand All @@ -40,7 +41,7 @@ TEST(ApiClusterDescriptorTest, DetectArch) {

// Test that cluster descriptor holds the same arch as pci_device.
for (auto [chip, pci_device_number] : cluster_desc->get_chips_with_mmio()) {
EXPECT_EQ(cluster_desc->get_arch(chip), pci_device_infos.at(pci_device_number).get_arch());
EXPECT_TRUE(cluster_desc->get_arch(chip) == pci_device_infos.at(pci_device_number).get_arch());
}
}
}
Expand Down

0 comments on commit 63dd139

Please sign in to comment.