Skip to content

Commit

Permalink
Merge branch 'main' into joelsmith/joelsmith/fix-address-type
Browse files Browse the repository at this point in the history
  • Loading branch information
joelsmithTT authored Nov 26, 2024
2 parents a200cee + 71f8fd6 commit 1901ee8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ on:


env:
BUILD_TARGETS: "umd_tests ubench"
BUILD_TARGET: umd_tests
BUILD_OUTPUT_DIR: ./build
LIB_OUTPUT_DIR: ./build/lib
DEPS_OUTPUT_DIR: ./build/_deps
Expand Down Expand Up @@ -62,11 +62,11 @@ jobs:
submodules: recursive
lfs: 'true'

- name: Build ${{ env.BUILD_TARGETS }}
- name: Build ${{ env.BUILD_TARGET }}
run: |
echo "Compiling the code..."
cmake -B ${{ env.BUILD_OUTPUT_DIR }} -G Ninja -DTT_UMD_BUILD_TESTS=ON
cmake --build ${{ env.BUILD_OUTPUT_DIR }} --target ${{ env.BUILD_TARGETS }}
cmake --build ${{ env.BUILD_OUTPUT_DIR }} --target ${{ env.BUILD_TARGET }}
echo "Compile complete."
# This is needed to preserve file permissions
Expand Down
2 changes: 1 addition & 1 deletion common/disjoint_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DisjointSet {
void merge(T item1, T item2) {
T set1 = get_set(item1);
T set2 = get_set(item2);
parent[set1] = set2;
parent[set1] = parent[set2] = std::min(set1, set2);
}

bool are_same_set(T item1, T item2) { return get_set(item1) == get_set(item2); }
Expand Down
4 changes: 3 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ else()
include_directories("${CMAKE_CURRENT_BINARY_DIR}/$ENV{ARCH_NAME}")
endif()

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/microbenchmark)
if(MASTER_PROJECT)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/microbenchmark)
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/api)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/pcie)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/misc)
Expand Down
18 changes: 10 additions & 8 deletions tests/api/test_cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ TEST(ApiClusterTest, OpenAllChips) { std::unique_ptr<Cluster> umd_cluster = get_
TEST(ApiClusterTest, SimpleIOAllChips) {
std::unique_ptr<Cluster> umd_cluster = get_cluster();

const tt_ClusterDescriptor* cluster_desc = umd_cluster->get_cluster_description();

if (umd_cluster == nullptr || umd_cluster->get_all_chips_in_cluster().empty()) {
GTEST_SKIP() << "No chips present on the system. Skipping test.";
}

const tt_ClusterDescriptor* cluster_desc = umd_cluster->get_cluster_description();

// Initialize random data.
size_t data_size = 1024;
std::vector<uint8_t> data(data_size, 0);
Expand Down Expand Up @@ -117,12 +117,12 @@ TEST(ApiClusterTest, SimpleIOAllChips) {
TEST(ApiClusterTest, RemoteFlush) {
std::unique_ptr<Cluster> umd_cluster = get_cluster();

const tt_ClusterDescriptor* cluster_desc = umd_cluster->get_cluster_description();

if (umd_cluster == nullptr || umd_cluster->get_all_chips_in_cluster().empty()) {
GTEST_SKIP() << "No chips present on the system. Skipping test.";
}

const tt_ClusterDescriptor* cluster_desc = umd_cluster->get_cluster_description();

size_t data_size = 1024;
std::vector<uint8_t> data(data_size, 0);

Expand Down Expand Up @@ -175,14 +175,16 @@ TEST(ApiClusterTest, RemoteFlush) {
}

TEST(ApiClusterTest, SimpleIOSpecificChips) {
std::vector<int> pci_device_ids = PCIDevice::enumerate_devices();
// TODO: Make this test work on a host system without any tt devices.
if (pci_device_ids.empty()) {
GTEST_SKIP() << "No chips present on the system. Skipping test.";
}

std::unique_ptr<Cluster> umd_cluster = std::make_unique<Cluster>(0);

const tt_ClusterDescriptor* cluster_desc = umd_cluster->get_cluster_description();

if (umd_cluster == nullptr || umd_cluster->get_all_chips_in_cluster().empty()) {
GTEST_SKIP() << "No chips present on the system. Skipping test.";
}

// Initialize random data.
size_t data_size = 1024;
std::vector<uint8_t> data(data_size, 0);
Expand Down
11 changes: 10 additions & 1 deletion tests/api/test_cluster_descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ TEST(ApiClusterDescriptorTest, TestAllOfflineClusterDescriptors) {

std::unordered_map<chip_id_t, std::unordered_set<chip_id_t>> chips_grouped_by_closest_mmio =
cluster_desc->get_chips_grouped_by_closest_mmio();

// Check that cluster_id is always the same for the same cluster.
// Cluster id takes the value of the smallest chip_id in the cluster.
for (auto const &[chip, coord] : eth_chip_coords) {
if (cluster_desc_yaml != "wormhole_2xN300_unconnected.yaml") {
EXPECT_EQ(coord.cluster_id, 0);
} else {
EXPECT_TRUE(coord.cluster_id == 0 || coord.cluster_id == 1);
}
}
}
}

Expand All @@ -125,7 +135,6 @@ TEST(ApiClusterDescriptorTest, SeparateClusters) {
std::cout << "Detected " << chip_clusters.get_num_sets() << " separate clusters." << std::endl;

// Check that get_closes_mmio_capable_chip works.
// Currently, it is expected that the following fails if there is more than 1 cluster.
for (auto chip : all_chips) {
chip_id_t closest_mmio_chip = cluster_desc->get_closest_mmio_capable_chip(chip);
EXPECT_TRUE(chip_clusters.are_same_set(chip, closest_mmio_chip));
Expand Down

0 comments on commit 1901ee8

Please sign in to comment.