From c7a18f54e8c7c5b77bae6d7b0d7ed785b9a113b7 Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Wed, 13 Nov 2024 09:25:49 +0000 Subject: [PATCH] Added gh workflows --- .github/on-pr.yml | 20 +++++++++++++++++++ .github/workflows/nightly-uplift.yml | 28 ++++++++++++++------------- .github/workflows/on-pr.yml | 4 ++++ .github/workflows/on-push.yml | 20 +++++++++++++++++++ .github/workflows/pre-commit.yml | 29 ++++++++++++++++++++++++++++ tests/TTIR/test_conv2d.py | 2 -- 6 files changed, 88 insertions(+), 15 deletions(-) create mode 100644 .github/on-pr.yml create mode 100644 .github/workflows/on-push.yml create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/on-pr.yml b/.github/on-pr.yml new file mode 100644 index 00000000..6c881e73 --- /dev/null +++ b/.github/on-pr.yml @@ -0,0 +1,20 @@ +name: On PR + +on: + workflow_dispatch: + pull_request: + branches: [ "main" ] + +jobs: + pre-commit: + uses: ./.github/workflows/pre-commit.yml + secrets: inherit + + spdx: + uses: ./.github/workflows/spdx.yml + secrets: inherit + + build-and-test: + needs: [pre-commit, spdx] + uses: ./.github/workflows/build-and-test.yml + secrets: inherit diff --git a/.github/workflows/nightly-uplift.yml b/.github/workflows/nightly-uplift.yml index e80e7952..33cd7445 100644 --- a/.github/workflows/nightly-uplift.yml +++ b/.github/workflows/nightly-uplift.yml @@ -13,29 +13,31 @@ jobs: runs-on: ubuntu-latest env: - SUBMODULE_PATH: third_party/tt-mlir - MLIR_VERSION: origin/main + TT_MLIR_SUBMODULE_PATH: third_party/tt-mlir steps: - - uses: actions/checkout@v4 with: submodules: recursive - fetch-depth: 0 # Fetch all history and tags + fetch-depth: 0 ref: main - - name: Set env variable + - name: Set env variable for today's date run: | echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - - name: Update tt-mlir reference + - name: Fetch latest SHA of tt-mlir submodule + id: get_sha + run: | + LATEST_TT_MLIR_VERSION=$(gh api repos/tenstorrent/tt-mlir/commits/main --jq '.sha') + echo "LATEST_TT_MLIR_VERSION=$LATEST_TT_MLIR_VERSION" >> $GITHUB_ENV + + - name: Update tt-mlir reference in third_party/CMakeLists.txt env: GH_TOKEN: ${{ github.token }} run: | - # Fetch the latest SHA using GitHub CLI - LATEST_SHA=$(gh api repos/tenstorrent/tt-mlir/commits/main --jq '.sha') - # Update the CMakeLists.txt file with the new SHA - sed -i "s/set(TT_MLIR_VERSION \".*\")/set(TT_MLIR_VERSION \"${LATEST_SHA}\")/" third_party/CMakeLists.txt + echo "Updating tt-mlir to SHA: $LATEST_TT_MLIR_VERSION" + sed -i "s/set(TT_MLIR_VERSION \".*\")/set(TT_MLIR_VERSION \"${LATEST_TT_MLIR_VERSION}\")/" third_party/CMakeLists.txt - name: Create Pull Request uses: peter-evans/create-pull-request@v7 @@ -45,9 +47,9 @@ jobs: committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> base: main - commit-message: "Uplift ${{ env.SUBMODULE_PATH }} to ${{ env.SUBMODULE_VERSION }} ${{ env.TODAY }}" - title: "Uplift ${{ env.SUBMODULE_PATH }} to ${{ env.SUBMODULE_VERSION }} ${{ env.TODAY }}" - body: "This PR uplifts the ${{ env.SUBMODULE_PATH }} to the ${{ env.SUBMODULE_VERSION }}" + commit-message: "Uplift ${{ env.TT_MLIR_SUBMODULE_PATH }} to ${{ env.LATEST_TT_MLIR_VERSION }} ${{ env.TODAY }}" + title: "Uplift ${{ env.TT_MLIR_SUBMODULE_PATH }} to ${{ env.LATEST_TT_MLIR_VERSION }} ${{ env.TODAY }}" + body: "This PR uplifts the ${{ env.TT_MLIR_SUBMODULE_PATH }} to the ${{ env.LATEST_TT_MLIR_VERSION }}" labels: uplift delete-branch: true token: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 2ad76a9a..ed5ae1f8 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -6,9 +6,13 @@ on: branches: [ "main" ] jobs: + pre-commit: + uses: ./.github/workflows/pre-commit.yml + secrets: inherit spdx: uses: ./.github/workflows/spdx.yml secrets: inherit build-and-test: + needs: [pre-commit, spdx] uses: ./.github/workflows/build-and-test.yml secrets: inherit diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml new file mode 100644 index 00000000..3c9be349 --- /dev/null +++ b/.github/workflows/on-push.yml @@ -0,0 +1,20 @@ +name: On push + +on: + workflow_dispatch: + push: + branches: [ "main" ] + +jobs: + pre-commit: + uses: ./.github/workflows/pre-commit.yml + secrets: inherit + + spdx: + uses: ./.github/workflows/spdx.yml + secrets: inherit + + build-and-test: + needs: [pre-commit, spdx] + uses: ./.github/workflows/build-and-test.yml + secrets: inherit diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..bdb19267 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,29 @@ +name: pre-commit + +on: + workflow_dispatch: + workflow_call: + +jobs: + pre-commit: + + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pre-commit + pip install -r requirements.txt + + - name: Install pre-commit hooks + run: | + pre-commit install + + - name: Run pre-commit + uses: pre-commit/action@v3.0.1 diff --git a/tests/TTIR/test_conv2d.py b/tests/TTIR/test_conv2d.py index 2a818f53..d48641c1 100644 --- a/tests/TTIR/test_conv2d.py +++ b/tests/TTIR/test_conv2d.py @@ -41,7 +41,6 @@ (1, 256, 64, 56, 56, 1, 1, 2, 2, 0), ), ) - @pytest.mark.skip("AssertionError.") def test_conv2d( batch_size, @@ -55,7 +54,6 @@ def test_conv2d( stride_w, padding, ): - def module_conv(img, weights): return jax.lax.conv_general_dilated( img,