Skip to content

Workflow file for this run

name: Build and Test
on:
workflow_dispatch:
workflow_call:
push:
branches:
- tpatel/issue-493
jobs:
build-ttmlir:
strategy:
fail-fast: false
matrix:
build: [
{runs-on: self-hosted, enable_perf: OFF, name: "runtime"},
{runs-on: self-hosted, enable_perf: ON, name: "perf"},
]
runs-on: ${{ matrix.build.runs-on }}
container:
image: ghcr.io/${{ github.repository }}/tt-mlir-ubuntu-22-04:latest
options: --user root
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history and tags
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
- name: Git safe dir
run: git config --global --add safe.directory ${{ steps.strings.outputs.work-dir }}
- name: ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: true
key: ${{ matrix.build.runs-on }}-runtime-ON-perf-${{ matrix.build.enable_perf }}-${{ env.SDK_VERSION }}
- name: Configure CMake
shell: bash
run: |
source env/activate
cmake -G Ninja \
-B ${{ steps.strings.outputs.build-output-dir }} \
-DCMAKE_CXX_COMPILER=clang++-17 \
-DCMAKE_C_COMPILER=clang-17 \
-DCMAKE_BUILD_TYPE=Release \
-DTTMLIR_ENABLE_RUNTIME=ON \
-DTTMLIR_ENABLE_RUNTIME_TESTS=ON \
-DTT_RUNTIME_ENABLE_PERF_TRACE=${{ matrix.build.enable_perf }} \
-DTTMLIR_ENABLE_STABLEHLO=ON \
-S ${{ steps.strings.outputs.work-dir }}
- name: Build
shell: bash
run: |
source env/activate
cmake --build ${{ steps.strings.outputs.build-output-dir }}
- name: Build ttrt
shell: bash
run: |
source env/activate
cmake --build ${{ steps.strings.outputs.build-output-dir }} -- ttrt
- name: Run Test
shell: bash
run: |
source env/activate
cmake --build ${{ steps.strings.outputs.build-output-dir }} -- check-ttmlir
- name: Get the latest tag
id: get_tag
run: |
latest_tag=$(git describe --tags --abbrev=0)
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
- name: Get the number of commits since the latest tag
id: get_commit_count
run: |
commit_count=$(git rev-list ${{ env.latest_tag }}..HEAD --count)
echo "commit_count=$commit_count" >> $GITHUB_ENV
- name: Generate version
id: generate_version
run: |
version="${{ env.latest_tag }}.${{ env.commit_count }}"
echo "version=$version" >> $GITHUB_ENV
- name: Upload ttrt whl
uses: actions/upload-artifact@v4
with:
name: ttrt-whl-${{ matrix.build.name }}.whl
path: build/runtime/tools/python/build/*.whl
- name: Upload Test Report
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.build.runs-on }}-runtime-ON-perf-${{ matrix.build.enable_perf }}
path: build/test/report.xml
- name: Show Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
report_paths: build/test/report.xml
check_name: MLIR Tests
- name: Upload build foder to archive
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: build
#get-system-descs:
# strategy:
# fail-fast: false
# matrix:
# build: [
# {runs-on: n150},
# {runs-on: n300},
# ]
#
# runs-on:
# - self-hosted
# - ${{ matrix.build.runs-on }}
#
# container:
# image: ghcr.io/${{ github.repository }}/tt-mlir-ubuntu-22-04:latest
# options: --user root --device /dev/tenstorrent/0
# volumes:
# - /dev/hugepages:/dev/hugepages
# - /dev/hugepages-1G:/dev/hugepages-1G
# - /etc/udev/rules.d:/etc/udev/rules.d
# - /lib/modules:/lib/modules
# - /opt/tt_metal_infra/provisioning/provisioning_env:/opt/tt_metal_infra/provisioning/provisioning_env
#
# steps:
# - name: Download ttrt runtime whls
# uses: actions/download-artifact@v4
# with:
# name: ttrt-whl-runtime.whl
#
# - name: Install ttrt runtime whls
# shell: bash
# run: |
# python3 -m venv whls_env
# source whls_env/bin/activate
# pip install *.whl --force-reinstall
#
# - name: Generate system descriptor
# run: |
# source whls_env/bin/activate
# ttrt query --save-artifacts
#
# - name: Upload system descriptor
# uses: actions/upload-artifact@v4
# with:
# name: system-desc-${{ matrix.build.runs-on }}.ttsys
# path: ttrt-artifacts/system-desc.ttsys
#
#generate-tests:
# strategy:
# fail-fast: false
# matrix:
# build: [
# {runs-on: self-hosted},
# ]
#
# runs-on: ${{ matrix.build.runs-on }}
#
# container:
# image: ghcr.io/${{ github.repository }}/tt-mlir-ubuntu-22-04:latest
# options: --user root
#
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0 # Fetch all history and tags
#
# - name: Set reusable strings
# id: strings
# shell: bash
# run: |
# echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
# echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
#
# - name: Git safe dir
# run: git config --global --add safe.directory ${{ steps.strings.outputs.work-dir }}
#
# - name: Use build artifacts
# uses: actions/download-artifact@v4
# with:
# name: build-artifacts
# path: build
#
# - name: Config compiler
# shell: bash
# run: |
# source env/activate
# cmake -G Ninja \
# -B build \
# -DCMAKE_CXX_COMPILER=clang++-17 \
# -DCMAKE_C_COMPILER=clang-17 \
# -DCMAKE_BUILD_TYPE=Release \
# -DTTMLIR_ENABLE_RUNTIME=ON \
# -DTTMLIR_ENABLE_RUNTIME_TESTS=ON
#
# - name: Download n150 system descriptor
# uses: actions/download-artifact@v4
# with:
# name: system-desc-n150.ttsys
#
# - name: Download n300 system descriptor
# uses: actions/download-artifact@v4
# with:
# name: system-desc-n300.ttsys
#
# - name: Run test cases against n150 system
# shell: bash
# run: |
# source env/activate
# export SYSTEM_DESC_PATH=system-desc-n150.ttsys
# cmake --build build -- check-ttmlir
#
# - name: Upload n150 test artifacts
# uses: actions/upload-artifact@v4
# with:
# name: n150/Silicon
# path: build/test/ttmlir/Silicon
#
# - name: Run test cases against n300 system
# shell: bash
# run: |
# source env/activate
# export SYSTEM_DESC_PATH=system-desc-n300.ttsys
# cmake --build build -- check-ttmlir
#
# - name: Upload n300 test artifacts
# uses: actions/upload-artifact@v4
# with:
# name: n300/Silicon
# path: build/test/ttmlir/Silicon
#
#run-tests:
# strategy:
# fail-fast: false
# matrix:
# build: [
# {runs-on: n150},
# {runs-on: n300},
# ]
#
# runs-on:
# - self-hosted
# - ${{ matrix.build.runs-on }}
#
# container:
# image: ghcr.io/${{ github.repository }}/tt-mlir-ubuntu-22-04:latest
# options: --user root --device /dev/tenstorrent/0
# volumes:
# - /dev/hugepages:/dev/hugepages
# - /dev/hugepages-1G:/dev/hugepages-1G
# - /etc/udev/rules.d:/etc/udev/rules.d
# - /lib/modules:/lib/modules
# - /opt/tt_metal_infra/provisioning/provisioning_env:/opt/tt_metal_infra/provisioning/provisioning_env
#
# steps:
# - name: Download ttrt runtime whls
# uses: actions/download-artifact@v4
# with:
# name: ttrt-whl-runtime.whl
#
# - name: Install ttrt runtime whls
# shell: bash
# run: |
# python3 -m venv whls_env
# source whls_env/bin/activate
# pip install *.whl --force-reinstall
#
# - name: Download tests
# uses: actions/download-artifact@v4
# with:
# name: ${{ matrix.build.runs-on }}/Silicon
#
# - name: Run tests
# shell: bash
# run: |
# source whls_env/bin/activate
# ttrt run ${{ matrix.build.runs-on }}/Silicon
#
#run-tests-perf:
# strategy:
# fail-fast: false
# matrix:
# build: [
# {runs-on: n150},
# {runs-on: n300},
# ]
#
# runs-on:
# - self-hosted
# - ${{ matrix.build.runs-on }}
#
# container:
# image: ghcr.io/${{ github.repository }}/tt-mlir-ubuntu-22-04:latest
# options: --user root --device /dev/tenstorrent/0
# volumes:
# - /dev/hugepages:/dev/hugepages
# - /dev/hugepages-1G:/dev/hugepages-1G
# - /etc/udev/rules.d:/etc/udev/rules.d
# - /lib/modules:/lib/modules
# - /opt/tt_metal_infra/provisioning/provisioning_env:/opt/tt_metal_infra/provisioning/provisioning_env
#
# steps:
# - name: Download ttrt perf whls
# uses: actions/download-artifact@v4
# with:
# name: ttrt-whl-perf.whl
#
# - name: Install ttrt perf whls
# shell: bash
# run: |
# python3 -m venv whls_env
# source whls_env/bin/activate
# pip install *.whl --force-reinstall
#
# - name: Download tests
# uses: actions/download-artifact@v4
# with:
# name: ${{ matrix.build.runs-on }}/Silicon
#
# - name: Run tests
# shell: bash
# run: |
# source whls_env/bin/activate
# ttrt perf ${{ matrix.build.runs-on }}/Silicon
#