feat(rocm): AMD ROCm support (gfx1100) + Qwen3.5-MoE GGUF loader #1
Workflow file for this run
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
| # NVIDIA unit-tests gate: compile the CUDA sources (catches USE_HIP/USE_ROCM-gated | |
| # refactors that break the CUDA build) and run the test suite on a hosted runner. | |
| # | |
| # The runner has no GPU: cu126 torch installs fine, GPU tests self-skip, and the unit | |
| # suite asserts the CUDA-path *logic* (gating, dispatch, version pairing) which is | |
| # exactly what a HIP port can silently drift. Compile failures surface here. | |
| # | |
| # Trigger policy follows nightly-wheels.yml: only trusted paths for expensive builds. | |
| # fork PRs cannot run the CUDA install (they can: hosted runner, no secrets). Keep | |
| # pull_request restricted to code paths; everything else is workflow_dispatch. | |
| name: Unit tests (NVIDIA) | |
| on: | |
| pull_request: | |
| paths: | |
| - "python/**" | |
| - "tests/**" | |
| - "setup.py" | |
| - "pyproject.toml" | |
| - ".github/workflows/unit-nvidia.yml" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: unit-nvidia-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| cuda-compile-and-unit: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| env: | |
| # torch's CUDA wheel brings its own cudart headers; nvcc from the same toolkit | |
| # major compiles the _pinned_tensor / gguf extensions against them. | |
| TORCH_CUDA_VERSION: "126" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install CUDA toolkit (nvcc) | |
| uses: js-data/add-cuda-toolkit@v1.1.0 | |
| with: | |
| cuda-version: "12.6" | |
| - name: Install pytest (uv is preinstalled on hosted runners) | |
| run: uv pip install --system pytest | |
| - name: Compile CUDA extensions (nvcc gate) | |
| run: | | |
| uv pip install --system torch --index-url https://download.pytorch.org/whl/cu${TORCH_CUDA_VERSION} | |
| uv pip install --system -e . --no-build-isolation | |
| - name: Compile/import legacy GGUF CUDA module | |
| run: | | |
| PYTHONPATH=python python - <<'PY' | |
| import torch | |
| from freetoken.kernel import gguf | |
| assert torch.version.hip is None, "NVIDIA job resolved a ROCm torch wheel" | |
| module = gguf._module() | |
| for symbol in ("ggml_dequantize", "ggml_mul_mat_vec_a8", "ggml_moe_a8_vec"): | |
| assert hasattr(module, symbol), symbol | |
| print("legacy GGUF CUDA module imported:", module.__name__) | |
| PY | |
| - name: Compile/import pinned single-token GGUF ABI | |
| run: | | |
| PYTHONPATH=python python - <<'PY' | |
| from pathlib import Path | |
| import torch | |
| from torch.utils.cpp_extension import load | |
| root = Path("python/freetoken/kernel/csrc/gguf") | |
| module = load( | |
| name="freetoken_gguf_b10434_ci", | |
| sources=[str(root / "gguf_moe_gfx1100.cu"), str(root / "gguf_b10434_kernel.cu")], | |
| extra_cuda_cflags=["-O3", "-DFREETOKEN_GGUF_NO_PYBIND=1"], | |
| verbose=False, | |
| ) | |
| for symbol in ("mmvq_bs1_workspace_bytes", "mmvq_bs1", "ggml_moe_mmvq_id"): | |
| assert hasattr(module, symbol), symbol | |
| assert module.mmvq_bs1_workspace_bytes(512, 16, 8) % 256 == 0 | |
| print("pinned b10434 ABI imported:", module.__name__) | |
| PY | |
| - name: Run unit suite (GPU tests self-skip) | |
| run: | | |
| set -o pipefail | |
| python -m pytest tests/ -m "not slow" -q -x \ | |
| --ignore=tests/e2e --ignore=tests/dsv4 2>&1 | tail -40 | |
| - name: Summarize | |
| if: always() | |
| run: echo "CUDA-compile + unit gate finished; see the step log for failures." |