Skip to content

Commit

Permalink
Schedule nightly build for model tests (#42)
Browse files Browse the repository at this point in the history
* Remove parse_mlir import.
* Schedule nightly model tests.
  • Loading branch information
uazizTT authored Nov 18, 2024
1 parent 17b868e commit f878f19
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow automates running model tests.

name: Nighty Tests

on:
schedule:
- cron: '0 4 * * *' # Runs at 04:00 UTC every day
workflow_dispatch: # Manual trigger


jobs:
pre-commit:
uses: ./.github/workflows/pre-commit.yml
secrets: inherit
spdx:
uses: ./.github/workflows/spdx.yml
secrets: inherit
build:
needs: [pre-commit, spdx]
uses: ./.github/workflows/run-build.yml
secrets: inherit
collect_dirs:
runs-on: ubuntu-latest
outputs:
dirs: ${{ steps.dirs.outputs.dirs }}
steps:
- uses: actions/checkout@v2
- id: dirs
run: echo "dirs=$(ls -d tests/models/*/ | jq --raw-input --slurp --compact-output 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}
test:
needs: [build, collect_dirs]
strategy:
matrix:
dir: ${{ fromJson(needs.collect_dirs.outputs.dirs) }}
uses: ./.github/workflows/run-model-tests.yml
secrets: inherit
93 changes: 93 additions & 0 deletions .github/workflows/run-model-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Run Model Tests

on:
workflow_dispatch:
workflow_call:
workflow_run:
workflows: [Build]
types: [completed]

jobs:
tests:
timeout-minutes: 120
strategy:
fail-fast: false

runs-on:
- n150

container:
image: ghcr.io/tenstorrent/tt-torch/tt-torch-ci-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:
- uses: actions/checkout@v4
with:
submodules: recursive
lfs: true

- name: Set reusable strings
id: strings
shell: bash
run: |
apt-get install jq -y
apt-get install curl -y
jobs=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs")
job_id=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id')
job_name=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .name')
echo "job_name=$job_name"
searchfront="test ("
searchback=") / tests"
job_name="${job_name#*$searchfront}"
job_name="${job_name%%$searchback*}"
echo "job_id=$job_id"
echo "job_name=$job_name"
echo "job_name=$job_name" >> "$GITHUB_OUTPUT"
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
echo "install-output-dir=$(pwd)/install" >> "$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: install-artifacts
path: ${{ steps.strings.outputs.install-output-dir }}

- name: 'Untar install directory'
shell: bash
working-directory: ${{ steps.strings.outputs.install-output-dir }}
run: tar xvf artifact.tar

- name: make tt-metal directory
shell: bash
working-directory: ${{ steps.strings.outputs.install-output-dir }}
run: mkdir -p ${{ steps.strings.outputs.work-dir }}/third_party/tt-mlir/src/tt-mlir/third_party/tt-metal/src/tt-metal

- name: copy tt-metal dirs
shell: bash
working-directory: ${{ steps.strings.outputs.install-output-dir }}
run: |
cp -r ${{ steps.strings.outputs.install-output-dir }}/tt-metal/* ${{ steps.strings.outputs.work-dir }}/third_party/tt-mlir/src/tt-mlir/third_party/tt-metal/src/tt-metal
- name: Run Model Tests
shell: bash
run: |
echo ${{ steps.strings.outputs.work-dir }}
echo ${{ steps.strings.outputs.test-dir }}
echo ${{ steps.strings.outputs.build-output-dir }}
echo ${{ steps.strings.outputs.install-output-dir }}
source env/activate
export LD_LIBRARY_PATH="/opt/ttmlir-toolchain/lib/:${{ steps.strings.outputs.install-output-dir }}/lib:${{ steps.strings.outputs.build-output-dir }}/lib:./lib/:${LD_LIBRARY_PATH}"
export TT_TORCH_COMPILE_DEPTH=COMPILE_OP_BY_OP
pytest -v ${{ steps.strings.outputs.job_name }}
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import re
from typing import List, Dict, Tuple
from tt_torch.dynamo.backend import backend
from tt_torch.tools.utils import CompilerConfig, CompileDepth, parse_mlir
from tt_torch.tools.utils import CompilerConfig, CompileDepth
import json
from pathlib import Path

Expand Down

0 comments on commit f878f19

Please sign in to comment.