Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into afuller/clarify-api
Browse files Browse the repository at this point in the history
  • Loading branch information
afuller-TT committed Nov 21, 2024
2 parents 554ff00 + 90ea1ad commit 3e3ca49
Show file tree
Hide file tree
Showing 99 changed files with 7,432 additions and 4,237 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Optional PR checks
name: On PR - Optional
# Build and then run all tests, on all supported archs.
name: Build and run all tests

on:
workflow_dispatch:
pull_request:
branches: ["main"]
push:
branches: ["main"]

jobs:
build-tests:
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/build-clients.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build clients on newest UMD

on:
workflow_dispatch:
inputs:
timeout:
required: true
description: 'The timeout for the job in minutes'
type: number
default: 30
pull_request:
branches: ["main"]
push:
branches: ["main"]

jobs:
build-tt-metal:
# Due to parsing bug, fromJSON is used to convert string to number.
# In pull_request or push events, the input context is not available, stating the default again here.
timeout-minutes: ${{ fromJSON(inputs.timeout || '30') }}
strategy:
fail-fast: false
matrix:
arch_name: [grayskull, wormhole_b0, blackhole]

name: Build tt-metal for ${{ matrix.arch_name }} with newest UMD
runs-on: ubuntu-20.04
container:
image: ghcr.io/tenstorrent/tt-metal/tt-metalium/ubuntu-20.04-amd64:latest
options: --user root

steps:
- name: Checkout client repo
uses: actions/checkout@v4
with:
# Clone under tt-metal directory
path: tt-metal
repository: tenstorrent/tt-metal
submodules: recursive
lfs: 'true'

- name: Checkout UMD
uses: actions/checkout@v4
with:
# Clone directly into tt-metal directory for umd
path: tt-metal/tt_metal/third_party/umd
submodules: recursive
lfs: 'true'

- name: Build tt-metal
run: |
cd tt-metal
export ARCH_NAME=${{ matrix.arch_name }}
export TT_METAL_HOME=$(pwd)
export PYTHONPATH=$(pwd)
./build_metal.sh
18 changes: 10 additions & 8 deletions .github/workflows/build-device.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Builds device.
# Build is performed on all supported OS versions.
name: Build Target
name: Build Device

on:
workflow_call:
inputs:
timeout:
required: true
type: number
workflow_dispatch:
inputs:
timeout:
required: true
description: 'The timeout for the build job in minutes'
description: 'The timeout for the job in minutes'
type: number
default: 15
pull_request:
branches: ["main"]
push:
branches: ["main"]

env:
BUILD_TARGET: device
Expand All @@ -25,7 +25,9 @@ env:

jobs:
build:
timeout-minutes: ${{ inputs.timeout }}
# Due to parsing bug, fromJSON is used to convert string to number.
# In pull_request or push events, the input context is not available, stating the default again here.
timeout-minutes: ${{ fromJSON(inputs.timeout || '15') }}
strategy:
fail-fast: false
matrix:
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ name: Build and Publish Docker Image

on:
workflow_dispatch:
workflow_call:
inputs:
timeout:
required: true
description: 'The timeout for the job in minutes'
type: number
default: 15

jobs:
build:
timeout-minutes: 15
# Due to parsing bug, fromJSON is used to convert string to number
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
strategy:
fail-fast: false
matrix:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/build-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ env:
LIB_OUTPUT_DIR: ./build/lib
DEPS_OUTPUT_DIR: ./build/_deps
TEST_OUTPUT_DIR: ./build/test
CLUSTER_DESCRIPTORS_DIR: ./tests/api/cluster_descriptor_examples

jobs:
build:
timeout-minutes: ${{ inputs.timeout }}
# Due to parsing bug, fromJSON is used to convert string to number
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -74,7 +76,8 @@ jobs:
run: |
tar cvf artifact.tar ${{ env.TEST_OUTPUT_DIR }} \
${{ env.LIB_OUTPUT_DIR }} \
${{ env.DEPS_OUTPUT_DIR }}
${{ env.DEPS_OUTPUT_DIR }} \
${{ env.CLUSTER_DESCRIPTORS_DIR }}
- name: Upload build artifacts archive
uses: actions/upload-artifact@v4
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/on-pr.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/on-push.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
name: Run Pre-commit Hooks

on:
workflow_call:
workflow_dispatch:
pull_request:
branches: ["main"]
push:
branches: ["main"]

jobs:
pre-commit:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ env:

jobs:
test:
timeout-minutes: ${{ inputs.timeout }}
# Due to parsing bug, fromJSON is used to convert string to number
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
strategy:
fail-fast: false
matrix:
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/test-runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ name: Check runner

on:
workflow_dispatch:
inputs:
timeout:
required: true
description: 'The timeout for the job in minutes'
type: number
default: 10

jobs:
check-runners-host:
timeout-minutes: 10
# Due to parsing bug, fromJSON is used to convert string to number
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -52,7 +59,8 @@ jobs:
du -h --max-depth=1 | sort -rh
check-runners-docker:
timeout-minutes: 10
# Due to parsing bug, fromJSON is used to convert string to number
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
strategy:
fail-fast: false
matrix:
Expand Down
42 changes: 42 additions & 0 deletions common/disjoint_set.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* SPDX-FileCopyrightText: (c) 2024 Tenstorrent Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once

#include <unordered_map>
#include <unordered_set>

// A standard disjoint set data structure to track connected components.
template <typename T>
class DisjointSet {
public:
void add_item(T item) { parent[item] = item; }

int get_set(T item) {
while (parent[item] != item) {
item = parent[item];
}
return item;
}

void merge(T item1, T item2) {
T set1 = get_set(item1);
T set2 = get_set(item2);
parent[set1] = set2;
}

bool are_same_set(T item1, T item2) { return get_set(item1) == get_set(item2); }

int get_num_sets() {
std::unordered_set<T> sets;
for (auto [item, _] : parent) {
sets.insert(get_set(item));
}
return sets.size();
}

private:
std::unordered_map<T, T> parent;
};
31 changes: 31 additions & 0 deletions common/utils.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* SPDX-FileCopyrightText: (c) 2024 Tenstorrent Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <filesystem>
#include <iostream>
#include <string>

namespace tt::umd::utils {

std::string get_abs_path(std::string path) {
// Note that __FILE__ might be resolved at compile time to an absolute or relative address, depending on the
// compiler.
std::filesystem::path current_file_path = std::filesystem::path(__FILE__);
std::filesystem::path umd_root;
if (current_file_path.is_absolute()) {
umd_root = current_file_path.parent_path().parent_path();
} else {
std::filesystem::path umd_root_relative =
std::filesystem::relative(std::filesystem::path(__FILE__).parent_path().parent_path(), "../");
umd_root = std::filesystem::canonical(umd_root_relative);
}
std::filesystem::path abs_path = umd_root / path;
return abs_path.string();
}

} // namespace tt::umd::utils
2 changes: 0 additions & 2 deletions device/.clang-format

This file was deleted.

7 changes: 4 additions & 3 deletions device/api/umd/device/architecture_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <vector>

#include "umd/device/tlb.h"
#include "umd/device/xy_pair.h"
#include "umd/device/tt_arch_types.h"
#include "umd/device/xy_pair.h"

struct tt_driver_host_address_params;
struct tt_driver_eth_interface_params;
Expand All @@ -22,7 +22,7 @@ struct tt_driver_noc_params;
namespace tt::umd {

class architecture_implementation {
public:
public:
virtual ~architecture_implementation() = default;

virtual tt::ARCH get_architecture() const = 0;
Expand Down Expand Up @@ -65,7 +65,8 @@ class architecture_implementation {
virtual std::tuple<xy_pair, xy_pair> multicast_workaround(xy_pair start, xy_pair end) const = 0;
virtual tlb_configuration get_tlb_configuration(uint32_t tlb_index) const = 0;
virtual std::optional<std::tuple<std::uint64_t, std::uint64_t>> describe_tlb(std::int32_t tlb_index) const = 0;
virtual std::pair<std::uint64_t, std::uint64_t> get_tlb_data(std::uint32_t tlb_index, const tlb_data& data) const = 0;
virtual std::pair<std::uint64_t, std::uint64_t> get_tlb_data(
std::uint32_t tlb_index, const tlb_data& data) const = 0;

virtual tt_driver_host_address_params get_host_address_params() const = 0;
virtual tt_driver_eth_interface_params get_eth_interface_params() const = 0;
Expand Down
Loading

0 comments on commit 3e3ca49

Please sign in to comment.