-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add EmitC support in TTRT; Enable CI (#1732)
- Loading branch information
1 parent
5aa2503
commit 990c6a3
Showing
17 changed files
with
513 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tools/ttnn-standalone/*.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,8 +97,9 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
build: [ | ||
{runs-on: ubuntu-latest, enable_perf: OFF, enable_op_model: OFF, name: "run", ttrt_flags: ""}, | ||
{runs-on: ubuntu-latest, enable_perf: ON, enable_op_model: OFF, name: "perf", ttrt_flags: ""}, | ||
{runs-on: ubuntu-latest, enable_perf: OFF, enable_op_model: OFF, enable_emitc: OFF, name: "run", ttrt_flags: ""}, | ||
{runs-on: ubuntu-latest, enable_perf: ON, enable_op_model: OFF, enable_emitc: OFF, name: "perf", ttrt_flags: ""}, | ||
{runs-on: ubuntu-latest, enable_perf: OFF, enable_op_model: OFF, enable_emitc: ON, name: "emitc", ttrt_flags: ""}, | ||
] | ||
|
||
name: Build and test tt-mlir (compute machine) | ||
|
@@ -117,7 +118,7 @@ jobs: | |
id: strings | ||
shell: bash | ||
env: | ||
job-name: "Build tt-mlir (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_op_model }}, ${{ matrix.build.name }})" | ||
job-name: "Build tt-mlir (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_op_model }}, ${{ matrix.build.enable_emitc }}, ${{ matrix.build.name }})" | ||
run: | | ||
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT" | ||
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT" | ||
|
@@ -146,6 +147,7 @@ jobs: | |
with: | ||
enable-perf: ${{ matrix.build.enable_perf }} | ||
enable-op-model: ${{ matrix.build.enable_op_model }} | ||
enable-emitc: ${{ matrix.build.enable_emitc }} | ||
build-name: ${{ matrix.build.name }} | ||
build-output-dir: ${{ steps.strings.outputs.build-output-dir }} | ||
install-output-dir: ${{ steps.strings.outputs.install-output-dir }} | ||
|
@@ -164,12 +166,13 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
build: [ | ||
{runs-on: n150, enable_perf: OFF, name: "run", ttrt_flags: "--non-zero"}, | ||
{runs-on: n150, enable_perf: ON, name: "perf"}, | ||
{runs-on: n300, enable_perf: OFF, name: "run", ttrt_flags: "--non-zero"}, | ||
{runs-on: n300, enable_perf: ON, name: "perf"}, | ||
{runs-on: n150, enable_perf: OFF, enable_emitc: OFF, name: "run", build_name: "run", ttrt_flags: "--non-zero"}, | ||
{runs-on: n150, enable_perf: ON, enable_emitc: OFF, name: "perf", build_name: "perf"}, | ||
{runs-on: n150, enable_perf: OFF, enable_emitc: ON, name: "run", build_name: "emitc", ttrt_flags: "--emitc"}, | ||
{runs-on: n300, enable_perf: OFF, enable_emitc: OFF, name: "run", build_name: "run", ttrt_flags: "--non-zero"}, | ||
{runs-on: n300, enable_perf: ON, enable_emitc: OFF, name: "perf", build_name: "perf"}, | ||
] | ||
name: "run-tests (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.name }})" | ||
name: "run-tests (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_emitc }}, ${{ matrix.build.build_name }})" | ||
|
||
runs-on: | ||
- in-service | ||
|
@@ -194,7 +197,7 @@ jobs: | |
id: strings | ||
shell: bash | ||
env: | ||
job-name: "run-tests (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.name }})" | ||
job-name: "run-tests (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_emitc }}, ${{ matrix.build.build_name }})" | ||
run: | | ||
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT" | ||
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT" | ||
|
@@ -216,7 +219,7 @@ jobs: | |
- name: Use build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: install-artifacts-${{ matrix.build.name }} | ||
name: install-artifacts-${{ matrix.build.build_name }} | ||
path: ${{ steps.strings.outputs.install-output-dir }} | ||
|
||
# This is needed to preserve file permissions | ||
|
@@ -234,7 +237,7 @@ jobs: | |
- name: Download ttrt run whls | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ttrt-whl-${{ matrix.build.name }} | ||
name: ttrt-whl-${{ matrix.build.build_name }} | ||
|
||
- name: Install ttrt run whls | ||
shell: bash | ||
|
@@ -258,9 +261,19 @@ jobs: | |
ln -sf ${{ steps.strings.outputs.install-output-dir }} ${{ steps.strings.outputs.build-output-dir }} | ||
llvm-lit -sv ${{ steps.strings.outputs.build-output-dir }}/test | ||
- name: Generate EmitC tests | ||
shell: bash | ||
if: matrix.build.enable_emitc == 'ON' | ||
run: | | ||
source env/activate | ||
export LD_LIBRARY_PATH="${TTMLIR_TOOLCHAIN_DIR}/lib:${LD_LIBRARY_PATH}" | ||
export SYSTEM_DESC_PATH="${GITHUB_WORKSPACE}/ttrt-artifacts/system_desc.ttsys" | ||
ln -sf ${{ steps.strings.outputs.install-output-dir }} ${{ steps.strings.outputs.build-output-dir }} | ||
llvm-lit -sv ${{ steps.strings.outputs.build-output-dir }}/test/ttmlir/EmitC/TTNN | ||
- name: Run functional tests | ||
shell: bash | ||
if: matrix.build.enable_perf == 'OFF' | ||
if: matrix.build.enable_perf == 'OFF' && matrix.build.enable_emitc == 'OFF' | ||
run: | | ||
source env/activate | ||
ttrt ${{ matrix.build.name }} ${{ matrix.build.ttrt_flags }} ${{ steps.strings.outputs.build-output-dir }}/test/ttmlir/Silicon | ||
|
@@ -273,12 +286,19 @@ jobs: | |
ttrt ${{ matrix.build.name }} ${{ matrix.build.ttrt_flags }} ${{ steps.strings.outputs.build-output-dir }}/test/ttmlir/Silicon/TTNN/perf_unit | ||
cp ttrt_report.xml ${{ steps.strings.outputs.test_report_path }} | ||
- name: Run emitc tests | ||
shell: bash | ||
if: matrix.build.enable_emitc == 'ON' | ||
run: | | ||
source env/activate | ||
ttrt ${{ matrix.build.name }} ${{ matrix.build.ttrt_flags }} ${{ steps.strings.outputs.build-output-dir }}/test/ttmlir/EmitC | ||
- name: Upload ttrt test report json | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.build.runs-on }}_${{ matrix.build.name }}_results.json | ||
path: ${{ matrix.build.name }}_results.json | ||
name: ${{ matrix.build.runs-on }}_${{ matrix.build.enable_perf }}_${{ matrix.build.enable_emitc }}_${{ matrix.build.build_name }}_results.json | ||
path: ${{ matrix.build.build_name }}_results.json | ||
|
||
- name: Upload Test Report xml | ||
uses: actions/upload-artifact@v4 | ||
|
@@ -292,7 +312,7 @@ jobs: | |
if: success() || failure() | ||
with: | ||
report_paths: ${{ steps.strings.outputs.test_report_path }} | ||
check_name: TTRT ${{ matrix.build.runs-on }} ${{ matrix.build.name }} Tests | ||
check_name: TTRT ${{ matrix.build.runs-on }} ${{ matrix.build.build_name }} Tests | ||
|
||
run-ttrt-tests: | ||
|
||
|
@@ -304,7 +324,7 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
build: [ | ||
{runs-on: n150, enable_perf: ON, name: "perf"}, | ||
{runs-on: n150, enable_perf: ON, name: "perf", build_name: "perf"}, | ||
] | ||
|
||
runs-on: | ||
|
@@ -331,7 +351,7 @@ jobs: | |
id: strings | ||
shell: bash | ||
env: | ||
job-name: "${{ github.job }} (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.name }})" | ||
job-name: "${{ github.job }} (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_emitc }}, ${{ matrix.build.build_name }})" | ||
run: | | ||
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT" | ||
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT" | ||
|
@@ -352,7 +372,7 @@ jobs: | |
- name: Use build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: install-artifacts-${{ matrix.build.name }} | ||
name: install-artifacts-${{ matrix.build.build_name }} | ||
path: ${{ steps.strings.outputs.install-output-dir }} | ||
|
||
# This is needed to preserve file permissions | ||
|
@@ -370,7 +390,7 @@ jobs: | |
- name: Download ttrt run whls | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ttrt-whl-${{ matrix.build.name }} | ||
name: ttrt-whl-${{ matrix.build.build_name }} | ||
|
||
- name: Install ttrt run whls | ||
shell: bash | ||
|
@@ -406,7 +426,7 @@ jobs: | |
uses: actions/upload-artifact@v4 | ||
if: success() || failure() | ||
with: | ||
name: test-reports-${{ matrix.build.runs-on }}-${{ matrix.build.name }} | ||
name: test-reports-${{ matrix.build.runs-on }}-${{ matrix.build.build_name }} | ||
path: ${{ steps.strings.outputs.test_report_path }} | ||
|
||
- name: Show Test Report | ||
|
@@ -426,7 +446,7 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
build: [ | ||
{runs-on: n150, enable_perf: OFF, name: "run"}, | ||
{runs-on: n150, enable_perf: OFF, name: "run", build_name: "run"}, | ||
] | ||
|
||
runs-on: | ||
|
@@ -462,7 +482,7 @@ jobs: | |
- name: Use build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: install-artifacts-${{ matrix.build.name }} | ||
name: install-artifacts-${{ matrix.build.build_name }} | ||
path: ${{ steps.strings.outputs.install-output-dir }} | ||
|
||
# This is needed to preserve file permissions | ||
|
@@ -480,7 +500,7 @@ jobs: | |
- name: Download ttrt run whls | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ttrt-whl-${{ matrix.build.name }} | ||
name: ttrt-whl-${{ matrix.build.build_name }} | ||
|
||
# Runtime tests currently require ttrt whls to be installed | ||
- name: Install ttrt run whls | ||
|
@@ -596,7 +616,7 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
build: [ | ||
{runs-on: n300, enable_perf: OFF, enable_op_model: ON, name: "op_model" , ttrt_flags: ""} | ||
{runs-on: n300, enable_perf: OFF, enable_op_model: ON, enable_emitc: OFF, name: "op_model", build_name: "op_model", ttrt_flags: ""} | ||
] | ||
|
||
name: Run build and test tt-mlir (TT machine) | ||
|
@@ -622,7 +642,7 @@ jobs: | |
id: strings | ||
shell: bash | ||
env: | ||
job-name: "Build tt-mlir (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_op_model }}, ${{ matrix.build.name }})" | ||
job-name: "Build tt-mlir (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_op_model }}, ${{ matrix.build.enable_emitc }}, ${{ matrix.build.build_name }})" | ||
run: | | ||
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT" | ||
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT" | ||
|
@@ -644,15 +664,16 @@ jobs: | |
uses: hendrikmuhs/[email protected] | ||
with: | ||
create-symlink: true | ||
key: ${{ matrix.build.runs-on }}-run-ON-perf-${{ matrix.build.enable_perf }}-op_model-${{ matrix.build.enable_op_model }}-${{ env.SDK_VERSION }} | ||
key: ${{ matrix.build.runs-on }}-run-ON-perf-${{ matrix.build.enable_perf }}-op_model-${{ matrix.build.enable_op_model }}-${{ matrix.build.enable_emitc }}-${{ env.SDK_VERSION }} | ||
|
||
# Build project | ||
- name: Run build and test tt-mlir | ||
uses: ./.github/actions/build-tt-mlir-action | ||
with: | ||
enable-perf: ${{ matrix.build.enable_perf }} | ||
enable-op-model: ${{ matrix.build.enable_op_model }} | ||
build-name: ${{ matrix.build.name }} | ||
enable-emitc: ${{ matrix.build.enable_emitc }} | ||
build-name: ${{ matrix.build.build_name }} | ||
build-output-dir: ${{ steps.strings.outputs.build-output-dir }} | ||
install-output-dir: ${{ steps.strings.outputs.install-output-dir }} | ||
work-dir: ${{ steps.strings.outputs.work-dir }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-FileCopyrightText: (c) 2024 Tenstorrent AI ULC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef TT_RUNTIME_TEST_DYLIB_H | ||
#define TT_RUNTIME_TEST_DYLIB_H | ||
|
||
#include "tt/runtime/types.h" | ||
|
||
namespace tt::runtime::ttnn::test { | ||
|
||
void *openSo(std::string path); | ||
std::vector<Tensor> runSoProgram(void *so, std::string func_name, | ||
std::vector<Tensor> inputs, Device device); | ||
bool compareOuts(std::vector<Tensor> &lhs, std::vector<Tensor> &rhs); | ||
} // namespace tt::runtime::ttnn::test | ||
|
||
#endif // TT_RUNTIME_TEST_DYLIB_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.