fix(pass): extend initValue lifetime across loop return_var uses in M… #9
This file contains hidden or 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
| name: CI | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: pre-commit | |
| uses: pre-commit/action@v3.0.0 | |
| with: | |
| extra_args: --all-files | |
| clang-tidy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Fetch base branch for diff | |
| if: github.event_name == 'pull_request' | |
| run: git fetch origin ${{ github.base_ref }} --depth=1 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install clang-tidy and dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install clang-tidy==21.1.0 nanobind | |
| - name: Run clang-tidy | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| python tests/lint/clang_tidy.py --jobs=$(nproc) --diff-base=origin/${{ github.base_ref }} | |
| else | |
| python tests/lint/clang_tidy.py --jobs=$(nproc) | |
| fi | |
| unit-tests: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| python-version: ["3.10"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install project and dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install torch --index-url https://download.pytorch.org/whl/cpu | |
| pip install -v .[dev] | |
| - name: Test unit tests | |
| run: pytest tests/ut -n auto --maxprocesses 8 -v | |
| system-tests: | |
| runs-on: [self-hosted, linux, arm64, npu] | |
| env: | |
| ASCEND_HOME_PATH: /usr/local/Ascend/cann-8.5.0 | |
| SIMPLER_ROOT: ${{ github.workspace }}/simpler | |
| PTOAS_ROOT: ${{ github.workspace }}/ptoas-bin | |
| container: | |
| image: localhost:5000/ci-device-py310:latest | |
| options: >- | |
| --privileged | |
| -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi:ro | |
| -v /usr/local/Ascend:/usr/local/Ascend:ro | |
| -v /dev:/dev | |
| -e ASCEND_HOME_PATH=/usr/local/Ascend/cann-8.5.0 | |
| -e DEVICE_ID | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Check NPU | |
| run: | | |
| npu-smi info | |
| - name: Install project and dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -v .[dev] | |
| - name: Install ptoas | |
| run: | | |
| PTOAS_VERSION=v0.16 | |
| PTOAS_SHA256=276e9a81dacffe269bf528eff0bbdf6b3acfe7bf93a26b16a4356135482e61e4 | |
| curl --fail --location --retry 3 --retry-all-errors \ | |
| https://github.com/zhangstevenunity/PTOAS/releases/download/${PTOAS_VERSION}/ptoas-bin-aarch64.tar.gz \ | |
| -o /tmp/ptoas-bin-aarch64.tar.gz | |
| echo "${PTOAS_SHA256} /tmp/ptoas-bin-aarch64.tar.gz" | sha256sum -c - | |
| mkdir -p $GITHUB_WORKSPACE/ptoas-bin | |
| tar -xzf /tmp/ptoas-bin-aarch64.tar.gz -C $GITHUB_WORKSPACE/ptoas-bin | |
| chmod +x $GITHUB_WORKSPACE/ptoas-bin/ptoas | |
| chmod +x $GITHUB_WORKSPACE/ptoas-bin/bin/ptoas | |
| - name: Clone and install simpler repository (stable) | |
| run: | | |
| git clone --branch stable --depth 1 https://github.com/hw-native-sys/simpler $GITHUB_WORKSPACE/simpler | |
| cd $GITHUB_WORKSPACE/simpler | |
| pip install -v . | |
| - name: Test system tests | |
| run: pytest tests/st -v --device=$DEVICE_ID --forked | |
| fuzz-tests-sim: | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| container: | |
| image: ghcr.io/hw-native-sys/pypto/github-ci:latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Install PyPTO | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -v .[dev] | |
| - name: Clone and install simpler repository (stable) | |
| run: | | |
| git clone --branch stable --depth 1 https://github.com/hw-native-sys/simpler $GITHUB_WORKSPACE/simpler | |
| cd $GITHUB_WORKSPACE/simpler | |
| pip install -v . | |
| - name: Run fuzz tests (sim mode) | |
| id: run_fuzz | |
| continue-on-error: true | |
| run: | | |
| export SIMPLER_ROOT="${GITHUB_WORKSPACE}/simpler" | |
| export PYTHONPATH="${SIMPLER_ROOT}/python:${SIMPLER_ROOT}/examples/scripts:${PYTHONPATH:-}" | |
| mkdir -p build/fuzz-artifacts/sim | |
| cd tests/st/fuzz | |
| python generate_test.py --num-cases 10 --seed ${{ github.run_number }} | |
| cd ../../.. | |
| pytest tests/st/fuzz/generated/test_fuzz_multi_kernel.py \ | |
| -v -s --save-kernels --dump-passes \ | |
| --kernels-dir=build/fuzz-artifacts/sim \ | |
| --forked --platform=a2a3sim \ | |
| --junitxml=fuzz-results-sim.xml || true | |
| python tests/st/fuzz/check_pass_rate.py \ | |
| fuzz-results-sim.xml \ | |
| --threshold 0.7 | |
| - name: Generate warning summary | |
| if: steps.run_fuzz.outcome == 'failure' | |
| run: | | |
| echo "## Fuzz Test Warning" >> $GITHUB_STEP_SUMMARY | |
| echo "Fuzz tests did not meet the 70% pass rate threshold." >> $GITHUB_STEP_SUMMARY | |
| echo "**Seed:** ${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY | |
| echo '```bash' >> $GITHUB_STEP_SUMMARY | |
| echo "cd tests/st/fuzz && python generate_test.py --num-cases 10 --seed ${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY | |
| echo "pytest generated/test_fuzz_multi_kernel.py -v --forked --platform=a2a3sim --save-kernels" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| - name: Comment on PR (fuzz warning) | |
| if: always() && steps.run_fuzz.outcome == 'failure' && github.event_name == 'pull_request' | |
| continue-on-error: true | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const body = [ | |
| '⚠️ **Fuzz Test Warning**', | |
| '', | |
| 'Fuzz tests did not meet the 70% pass rate threshold.', | |
| '', | |
| `**Seed:** ${context.runNumber}`, | |
| '', | |
| 'Reproduce locally:', | |
| '```bash', | |
| `cd tests/st/fuzz && python generate_test.py --num-cases 10 --seed ${context.runNumber}`, | |
| 'pytest generated/test_fuzz_multi_kernel.py -v --forked --platform=a2a3sim --save-kernels', | |
| '```', | |
| '', | |
| `[View artifacts](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})` | |
| ].join('\n'); | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body | |
| }); | |
| - name: Upload fuzz artifacts | |
| if: always() && steps.run_fuzz.outcome == 'failure' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: fuzz-artifacts-sim-${{ github.run_id }} | |
| path: | | |
| fuzz-results-sim.xml | |
| build/fuzz-artifacts/ | |
| retention-days: 2 |