fix(nki): update nc_matmul to NKI 0.3.0 API; make simulator CI gate meaningful #80
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: | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install "ruff>=0.6" | |
| - run: ruff check . | |
| - run: ruff format --check . | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: pip install -e ".[dev]" | |
| - run: pytest tests/ -v -x --tb=short -m "not neuron and not nki_simulator" --cov=trnsparse --cov-report=xml | |
| - name: Upload coverage reports to Codecov | |
| if: matrix.python-version == '3.12' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: trnsci/trnsparse | |
| nki-simulator: | |
| # Runs NKI kernels through nki.simulate(kernel)(numpy_args) on CPU. | |
| # Catches Python-trace-level errors (bad kwargs, dropped ops, shape | |
| # mismatches) pre-merge without AWS round-trips. MLIR verifier | |
| # errors remain hardware-only (simulator explicitly skips compile). | |
| # TRNSPARSE_REQUIRE_NKI=1 disables the PyTorch fallback so kernel | |
| # failures propagate — the simulator tests actually validate NKI kernels. | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install trnsparse + NKI simulator deps | |
| run: | | |
| pip install -e ".[dev]" | |
| pip install --extra-index-url https://pip.repos.neuron.amazonaws.com \ | |
| "nki>=0.3.0" | |
| python -c "import nki.isa as nisa,inspect; src=inspect.getsource(nisa.activation); idx=[i for i,l in enumerate(src.split('\n')) if 'ACTIVATION_OPS' in l]; lines=src.split('\n'); [print(lines[max(0,i-2):i+5]) for i in idx[:3]]" | |
| - name: Run simulator-backed kernel tests | |
| env: | |
| TRNSPARSE_USE_SIMULATOR: "1" | |
| TRNSPARSE_REQUIRE_NKI: "1" | |
| run: pytest tests/ -v -m nki_simulator --tb=short |