Skip to content

Commit

Permalink
Merge branch 'main' into bgrady/dataflow_api_refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrady-tt authored Feb 25, 2025
2 parents 2fe0b45 + 2d6e272 commit 853895c
Show file tree
Hide file tree
Showing 609 changed files with 31,937 additions and 10,220 deletions.
17 changes: 17 additions & 0 deletions .github/actions/generate-gtest-failure-message/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Generate gtest failure message"
description: "Generate gtest failure message for Github workflow annotations"

inputs:
path:
description: "Paths to pass containing gtest XML files"
required: true

runs:
using: "composite"
steps:
- name: Generate gtest failure messages
id: generate-gtest-message
shell: bash
run: |
set +e
python3 .github/scripts/data_analysis/print_gtest_annotations.py ${{ inputs.path }}
89 changes: 89 additions & 0 deletions .github/scripts/data_analysis/print_gtest_annotations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import argparse
import xmltodict
import glob
import os
from typing import Union


def _guaranteed_list(x):
if not x:
return []
elif isinstance(x, list):
return x
else:
return [x]


def _build_workflow_command(
command_name: str,
file: str,
line: int,
end_line: Union[int, None] = None,
column: Union[int, None] = None,
end_column: Union[int, None] = None,
title: Union[str, None] = None,
message: Union[str, None] = None,
):
result = f"::{command_name} "

entries = [
("file", file),
("line", line),
("endLine", end_line),
("col", column),
("endColumn", end_column),
("title", title),
]

result = result + ",".join(f"{k}={v}" for k, v in entries if v is not None)

if message is not None:
result = result + "::" + _escape(message)

return result


def _escape(s: str) -> str:
return s.replace("%", "%25").replace("\r", "%0D").replace("\n", "%0A")


if __name__ == "__main__":
# Get xml dir path from cmdline
parser = argparse.ArgumentParser()
parser.add_argument("directory", type=str, help="Path to the GoogleTest XML directory")
args = parser.parse_args()

# Path to the directory containing XML files
xml_dir = args.directory

# Use glob to find all XML files in the directory
xml_files = glob.glob(os.path.join(xml_dir, "*.xml"))

# Iterate through each XML file
for xml_file in xml_files:
with open(xml_file, "r") as f:
results = xmltodict.parse(f.read())

# Check for failed tests
failed_tests = []
for testsuite in _guaranteed_list(results["testsuites"]["testsuite"]):
for testcase in _guaranteed_list(testsuite["testcase"]):
if "failure" in testcase:
failed_tests.append(testcase)

# Create error annotations for each failed test
for failed_test in failed_tests:
failure_messages = _guaranteed_list(failed_test["failure"])
if failure_messages:
# first message is often enough
failure_message = failure_messages[0]["@message"]
else:
failure_message = "unknown_failure_message"

msg = _build_workflow_command(
command_name="error",
file=failed_test["@file"].lstrip("/work/"),
line=int(failed_test["@line"]),
message=failure_message,
)
print(msg)
1 change: 1 addition & 0 deletions .github/workflows/_produce-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ on:
- "Blackhole post-commit tests"
- "Custom test dispatch"
- "PR Gate"
- "Nightly tt-metal L2 tests"
types:
- completed

Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/_test-wheels-impl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
matrix:
os: ${{ fromJson(inputs.from-precompiled && '["ubuntu-20.04"]' || '["ubuntu-20.04", "ubuntu-22.04"]') }}
runner-hw-info: [
{arch: grayskull},
{arch: wormhole_b0}
]
runs-on: ${{ matrix.os }}
Expand All @@ -46,29 +45,3 @@ jobs:
source tests/end_to_end_tests/env/bin/activate
cd tests/end_to_end_tests
pytest -c conftest.py . -m eager_host_side
test-wheels-silicon:
strategy:
matrix:
# We only have this for non-Docker silicon runners right now
os: [ubuntu-20.04]
runner-hw-info: [
{arch: grayskull, type: E150},
{arch: wormhole_b0, type: N150},
{arch: wormhole_b0, type: N300}
]
runs-on: ["cloud-virtual-machine", "${{ matrix.runner-hw-info.type }}", "in-service"]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: eager-dist-${{ matrix.os }}-any
- name: Set up end-to-end tests environment
run: ./tests/scripts/set_up_end_to_end_tests_env.sh
- name: Activate env and run release tests - silicon
timeout-minutes: 2
shell: bash
run: |
source tests/end_to_end_tests/env/bin/activate
python3 -m ttnn.examples.usage.run_op_on_device
cd tests/end_to_end_tests
pytest -c conftest.py . -m eager_package_silicon
30 changes: 16 additions & 14 deletions .github/workflows/all-post-commit-workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ jobs:
build-type: ${{ inputs.build-type || 'Release' }}
tracy: true
secrets: inherit
test-wheels:
needs: build-artifact
uses: ./.github/workflows/_test-wheels-impl.yaml
with:
from-precompiled: true
secrets: inherit
# Slow Dispatch Unit Tests
sd-unit-tests:
needs: build-artifact
Expand All @@ -64,7 +58,6 @@ jobs:
fail-fast: false
matrix:
test-group: [
{ arch: grayskull, runner-label: E150 },
{ arch: wormhole_b0, runner-label: N150 },
{ arch: wormhole_b0, runner-label: N300 },
]
Expand All @@ -80,7 +73,6 @@ jobs:
fail-fast: false
matrix:
test-group: [
{ arch: grayskull, runner-label: E150 },
{ arch: wormhole_b0, runner-label: N150 },
{ arch: wormhole_b0, runner-label: N300 },
]
Expand All @@ -89,6 +81,21 @@ jobs:
os: ubuntu-20.04
arch: ${{ matrix.test-group.arch }}
runner-label: ${{ matrix.test-group.runner-label }}
# Fabric Unit Tests
fabric-unit-tests:
needs: build-artifact
secrets: inherit
strategy:
fail-fast: false
matrix:
test-group: [
{ arch: wormhole_b0, runner-label: N300 },
]
uses: ./.github/workflows/fabric-build-and-unit-tests.yaml
with:
os: ubuntu-20.04
arch: ${{ matrix.test-group.arch }}
runner-label: ${{ matrix.test-group.runner-label }}
# TTNN FD Unit tests
ttnn-unit-tests:
needs: build-artifact
Expand All @@ -97,7 +104,6 @@ jobs:
fail-fast: false
matrix:
test-group: [
{ arch: grayskull, runner-label: E150 },
{ arch: wormhole_b0, runner-label: N150 },
{ arch: wormhole_b0, runner-label: N300 },
]
Expand All @@ -113,7 +119,6 @@ jobs:
fail-fast: false
matrix:
test-group: [
{ arch: grayskull, runner-label: E150 },
{ arch: wormhole_b0, runner-label: N150 },
{ arch: wormhole_b0, runner-label: N300 },
]
Expand All @@ -129,7 +134,6 @@ jobs:
fail-fast: false
matrix:
test-group: [
{ arch: grayskull, runner-label: E150 },
{ arch: wormhole_b0, runner-label: N150 },
{ arch: wormhole_b0, runner-label: N300 },
]
Expand All @@ -150,8 +154,7 @@ jobs:
matrix:
test-group: [
{ arch: wormhole_b0, runner-label: N150 },
# Disabled due to https://github.com/tenstorrent/tt-metal/issues/16012
# { arch: wormhole_b0, runner-label: N300 },
{ arch: wormhole_b0, runner-label: N300 },
]
uses: ./.github/workflows/tt-train-post-commit.yaml
with:
Expand All @@ -164,7 +167,6 @@ jobs:
fail-fast: false
matrix:
test-group: [
{ arch: grayskull, runner-label: E150 },
{ arch: wormhole_b0, runner-label: N150 },
{ arch: wormhole_b0, runner-label: N300 },
]
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/all-static-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,4 @@ jobs:
# TODO: Use a lukka/run-cmake with a preset after upgrading to a more modern CMake
run: |
echo "Checking compatibility with $(cmake --version)"
# FIXME: Why is HAVE_STD_REGEX needed? Clean up when we solve it.
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/x86_64-linux-clang-17-libcpp-toolchain.cmake -DHAVE_STD_REGEX=ON -B build .
cmake -D BUILD_PROGRAMMING_EXAMPLES=ON -D TT_METAL_BUILD_TESTS=ON -B build .
56 changes: 47 additions & 9 deletions .github/workflows/bisect-dispatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,33 @@ on:
- grayskull
- wormhole_b0
- blackhole
tracy:
required: true
type: boolean
default: false
description: "Build with tracy enabled"
build-wheel:
required: true
type: boolean
default: false
description: "Build Python Wheel"
runner-label:
required: true
type: choice
options:
- E150
- N150
- N300
- P150
- config-t3000
- config-tg
- config-tgg
description: "Runner Type Label"
extra-label:
required: true
type: string
default: "in-service"
description: "Secondary tag to filter runners"
good-commit:
required: true
type: string
Expand All @@ -22,39 +46,53 @@ on:
command:
required: true
type: string
description:
timeout:
required: true
type: string
default: "Git bisect dispatch"
description: "Timeout (eg: 5m, 1h)"
patch:
required: false
type: string
description: "Commit-ish to cherry-pick for each step"

run-name: ${{ inputs.description }}
run-name: "Bisect on ${{ inputs.runner-label }}"
jobs:
build-artifact:
uses: ./.github/workflows/build-artifact.yaml
secrets: inherit
with:
tracy: ${{ inputs.tracy }}
build-wheel: ${{ inputs.build-wheel }}
test-dispatch:
needs: build-artifact
timeout-minutes: 1440
env:
TT_METAL_ENV: ${{ vars.TT_METAL_ENV }}
ARCH_NAME: ${{ inputs.arch }}
runs-on:
- ${{ inputs.runner-label }}
- "in-service"
- ${{ inputs.extra-label }}
steps:
- uses: tenstorrent/tt-metal/.github/actions/checkout-with-submodule-lfs@main
- name: ⬇️ Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set up dyanmic env vars for build
run: |
echo "TT_METAL_HOME=$(pwd)" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
name: TTMetal_build_any
name: ${{ needs.build-artifact.outputs.build-artifact-name }}
- name: Extract files
run: tar -xvf ttm_any.tar
- uses: ./.github/actions/install-python-deps
- name: Run pre/post regression tests in a loop
- name: Run Git Bisect
shell: bash
env:
GIT_COMMITTER_NAME: "GitHub Actions"
GIT_COMMITTER_EMAIL: "actions@github.com"
run: |
source ${{ github.workspace }}/python_env/bin/activate
cd $TT_METAL_HOME
export PYTHONPATH=$TT_METAL_HOME
./tests/scripts/tt_bisect.sh -f "${{ inputs.command }}" -b ${{ inputs.bad-commit }} -g ${{ inputs.good-commit }}
./tests/scripts/tt_bisect.sh -t ${{ inputs.timeout }} -f "${{ inputs.command }}" -b ${{ inputs.bad-commit }} -g ${{ inputs.good-commit }} -p "${{ inputs.patch }}"
2 changes: 2 additions & 0 deletions .github/workflows/build-and-test-wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
if: ${{ github.event_name == 'workflow_dispatch' && inputs.from-precompiled }}
uses: ./.github/workflows/build-artifact.yaml
secrets: inherit
with:
build-wheel: true
test-wheels:
needs: build-artifact
if: ${{ always() }}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/build-and-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
{name: api, cmd: "./build/test/tt_metal/unit_tests_api_${{ inputs.arch }}"},
{name: debug_tools, cmd: "./build/test/tt_metal/unit_tests_debug_tools_${{ inputs.arch }}"},
{name: device, cmd: "./build/test/tt_metal/unit_tests_device"},
{name: dispatch, cmd: "./build/test/tt_metal/unit_tests_dispatch_${{ inputs.arch }}"},
{name: dispatch, cmd: "./build/test/tt_metal/unit_tests_dispatch"},
{name: eth, cmd: "./build/test/tt_metal/unit_tests_eth_${{ inputs.arch }}"},
{name: llk, cmd: "./build/test/tt_metal/unit_tests_llk"},
{name: stl, cmd: "./build/test/tt_metal/unit_tests_stl"},
Expand Down Expand Up @@ -108,3 +108,9 @@ jobs:
- name: Generate system logs on failure
uses: ./.github/actions/generate-system-logs
if: ${{ failure() }}
- name: Generate gtest annotations on failure
uses: ./.github/actions/generate-gtest-failure-message
if: ${{ failure() }}
with:
path: |
generated/test_reports/
1 change: 0 additions & 1 deletion .github/workflows/code-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
distro: ${{ inputs.distro }}
version: ${{ inputs.version }}
architecture: ${{ inputs.architecture }}

clang-tidy:
name: 🤖 Clang Tidy
needs: build-docker-image
Expand Down
Loading

0 comments on commit 853895c

Please sign in to comment.