diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e75b46c8b..fc6fb1c3f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,8 +3,6 @@ name: Build on: workflow_dispatch: workflow_call: - push: - branches: ["tpatel/issue-104"] env: SDK_VERSION: "0" @@ -15,9 +13,8 @@ jobs: fail-fast: false matrix: build: [ - {runs-on: [ubuntu-20.04, n150], c_compiler: clang, cpp_compiler: clang++, build_type: Release, enable_runtime: ON}, - {runs-on: [ubuntu-20.04, n150], c_compiler: clang, cpp_compiler: clang++, build_type: Release, enable_runtime: ON, enable_perf: ON}, - {runs-on: macos-latest, c_compiler: clang, cpp_compiler: clang++, build_type: Release, enable_runtime: OFF}, + {runs-on: ubuntu-20.04, c_compiler: clang, cpp_compiler: clang++, build_type: Release, enable_runtime: ON}, + {runs-on: macos-latest, c_compiler: clang, cpp_compiler: clang++, build_type: Release, enable_runtime: OFF} ] runs-on: ${{ matrix.build.runs-on }} steps: @@ -46,7 +43,7 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2 with: create-symlink: true - key: ${{ matrix.build.runs-on }}-runtime-${{ matrix.build.enable_runtime }}-${{ matrix.build.enable_perf }}-${{ env.SDK_VERSION }} + key: ${{ matrix.build.runs-on }}-runtime-${{ matrix.build.enable_runtime }}-${{ env.SDK_VERSION }} - name: Set reusable strings id: strings @@ -65,15 +62,8 @@ jobs: -DCMAKE_BUILD_TYPE=${{ matrix.build.build_type }} \ -DTTMLIR_ENABLE_RUNTIME=${{ matrix.build.enable_runtime }} \ -DTTMLIR_ENABLE_RUNTIME_TESTS=${{ matrix.build.enable_runtime }} \ - -DTT_RUNTIME_ENABLE_PERF_TRACE=ON=${{ matrix.build.enable_runtime }} \ -S ${{ github.workspace }} - - name: Set perf env variables - if: matrix.enable_perf == 'ON' - shell: bash - run: | - export ENABLE_TRACY=1 - - name: Build shell: bash run: | @@ -99,12 +89,6 @@ jobs: source env/activate cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build.build_type }} -- ttrt - - name: Upload test files - uses: actions/upload-artifact@v4 - with: - name: silicon-tests - path: ${{ steps.strings.outputs.build-output-dir }}/test/ttmlir/Silicon - - name: Upload Test Report uses: actions/upload-artifact@v4 with: @@ -117,27 +101,3 @@ jobs: with: report_paths: build/test/report.xml check_name: ${{ matrix.build.runs-on }} MLIR Tests - - run: - strategy: - fail-fast: false - matrix: - build: [ - {runs-on: n150, enable_perf: OFF}, - {runs-on: n150, enable_perf: ON}, - ] - runs-on: ${{ matrix.build.runs-on }} - steps: - - name: Run ttrt functional tests - if: ${{ matrix.enable_perf }} == 'OFF' - shell: bash - run: | - source env/activate - ttrt run ${{ steps.strings.outputs.build-output-dir }}/test/ttmlir/Silicon - - - name: Run ttrt performance tests - if: ${{ matrix.enable_perf }} == 'ON' - shell: bash - run: | - source env/activate - ttrt run perf ${{ steps.strings.outputs.build-output-dir }}/test/ttmlir/Silicon \ No newline at end of file diff --git a/.github/workflows/post-commit.yml b/.github/workflows/post-commit.yml new file mode 100644 index 000000000..cc9a15681 --- /dev/null +++ b/.github/workflows/post-commit.yml @@ -0,0 +1,126 @@ +name: Build + +on: + workflow_dispatch: + workflow_call: + push: + branches: ["tpatel/issue-104"] + +env: + SDK_VERSION: "0" + +jobs: + build: + strategy: + fail-fast: false + matrix: + build: [ + {runs-on: [n150], c_compiler: clang, cpp_compiler: clang++, build_type: Release, enable_runtime: ON}, + {runs-on: [n150], c_compiler: clang, cpp_compiler: clang++, build_type: Release, enable_runtime: ON, enable_perf: ON}, + ] + runs-on: ${{ matrix.build.runs-on }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history and tags + + - name: Install build dependencies + uses: ./.github/actions/install-deps + with: + os: ${{ matrix.build.runs-on }} + + - name: Get macos sdk version + if: startsWith(matrix.build.runs-on, 'macos') + shell: bash + run: | + echo "SDK_VERSION=$(xcrun --show-sdk-version)" >> $GITHUB_ENV + + - name: Build and cache ttmlir-toolchain + uses: ./.github/actions/build-toolchain + with: + os: ${{ matrix.build.runs-on }} + sdk: ${{ env.SDK_VERSION }} + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + create-symlink: true + key: ${{ matrix.build.runs-on }}-runtime-${{ matrix.build.enable_runtime }}-${{ matrix.build.enable_perf }}-${{ env.SDK_VERSION }} + + - name: Set reusable strings + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Configure CMake + shell: bash + run: | + source env/activate + cmake -G Ninja \ + -B ${{ steps.strings.outputs.build-output-dir }} \ + -DCMAKE_CXX_COMPILER=${{ matrix.build.cpp_compiler }} \ + -DCMAKE_C_COMPILER=${{ matrix.build.c_compiler }} \ + -DCMAKE_BUILD_TYPE=${{ matrix.build.build_type }} \ + -DTTMLIR_ENABLE_RUNTIME=${{ matrix.build.enable_runtime }} \ + -DTTMLIR_ENABLE_RUNTIME_TESTS=${{ matrix.build.enable_runtime }} \ + -DTT_RUNTIME_ENABLE_PERF_TRACE=ON=${{ matrix.build.enable_runtime }} \ + -S ${{ github.workspace }} + + - name: Set perf env variables + if: matrix.enable_perf == 'ON' + shell: bash + run: | + export ENABLE_TRACY=1 + + - name: Build + shell: bash + run: | + source env/activate + cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build.build_type }} + + - name: Lint + if: matrix.enable_runtime == 'OFF' + shell: bash + run: | + source env/activate + cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build.build_type }} -- clang-tidy + + - name: Run Test + shell: bash + run: | + source env/activate + cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build.build_type }} -- check-ttmlir + + - name: Build ttrt + shell: bash + run: | + source env/activate + cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build.build_type }} -- ttrt + + - name: Run ttrt functional tests + if: ${{ matrix.build.enable_perf }} == 'OFF' + shell: bash + run: | + source env/activate + ttrt run ${{ steps.strings.outputs.build-output-dir }}/test/ttmlir/Silicon + + - name: Run ttrt performance tests + if: ${{ matrix.build.enable_perf }} == 'ON' + shell: bash + run: | + source env/activate + ttrt run perf ${{ steps.strings.outputs.build-output-dir }}/test/ttmlir/Silicon + + - name: Upload Test Report + uses: actions/upload-artifact@v4 + with: + name: test-reports-${{ matrix.build.runs-on }} + 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: ${{ matrix.build.runs-on }} MLIR Tests