diff --git a/CMakeLists.txt b/CMakeLists.txt index 75e023f1..56bf0d4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/device/coordinate_manager.cpp b/device/coordinate_manager.cpp index dc81a55a..e936bdac 100644 --- a/device/coordinate_manager.cpp +++ b/device/coordinate_manager.cpp @@ -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)); } } @@ -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)); } } @@ -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)); } } @@ -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)); } } @@ -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)); } } @@ -457,6 +472,8 @@ std::shared_ptr 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)); } } diff --git a/device/simulation/tt_simulation_device.cpp b/device/simulation/tt_simulation_device.cpp index fc6cce4d..6201ea7e 100644 --- a/device/simulation/tt_simulation_device.cpp +++ b/device/simulation/tt_simulation_device.cpp @@ -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; diff --git a/device/tlb.cpp b/device/tlb.cpp index 77eb0245..6168c9ad 100644 --- a/device/tlb.cpp +++ b/device/tlb.cpp @@ -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 diff --git a/tests/api/test_cluster_descriptor.cpp b/tests/api/test_cluster_descriptor.cpp index 68a0a61e..25557ead 100644 --- a/tests/api/test_cluster_descriptor.cpp +++ b/tests/api/test_cluster_descriptor.cpp @@ -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 pci_device_infos = PCIDevice::enumerate_devices_info(); @@ -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()); } } }