Skip to content

fix(qwen36): restore MoE device-tilemap (MOE_GPU) correctness — masked down-dequant no-op #205

fix(qwen36): restore MoE device-tilemap (MOE_GPU) correctness — masked down-dequant no-op

fix(qwen36): restore MoE device-tilemap (MOE_GPU) correctness — masked down-dequant no-op #205

name: build-attested-binaries
# Build qwen3_gguf_bench for Linux + Windows, attest with GitHub Artifact Attestations,
# upload CI artifacts (bin/lib layout), and publish GitHub Release tarballs on version tags.
#
# Verify locally after download:
# gh run download -R gittensor-ai-lab/sparkinfer -n sparkinfer-linux-amd64
# gh attestation verify sparkinfer-bin/bin/qwen3_gguf_bench -R gittensor-ai-lab/sparkinfer
on:
workflow_dispatch:
pull_request:
paths:
- "CMakeLists.txt"
- "kernels/**"
- "moe/**"
- "runtime/**"
- ".github/workflows/build-attested-binaries.yml"
push:
tags: ["v*"]
branches: [main]
paths:
- "CMakeLists.txt"
- "kernels/**"
- "moe/**"
- "runtime/**"
- ".github/workflows/build-attested-binaries.yml"
permissions:
contents: read
jobs:
build-linux:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
attestations: write
env:
BUNDLE: dist/sparkinfer-linux-amd64/sparkinfer-bin
CUDA_ARCH: "120"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install CUDA toolkit
uses: Jimver/cuda-toolkit@v0.2.35
with:
cuda: "12.8.1"
use-github-cache: false
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CUDA_ARCHITECTURES="${CUDA_ARCH}" \
-DBUILD_TESTS=OFF \
-DBUILD_EXAMPLES=ON
- name: Build
run: cmake --build build -j"$(nproc)" --target qwen3_gguf_bench
- name: Package
run: |
set -euo pipefail
mkdir -p "${BUNDLE}/bin" "${BUNDLE}/lib"
install -m755 build/runtime/qwen3_gguf_bench "${BUNDLE}/bin/"
find build/runtime build/moe -maxdepth 1 \( -name 'libsparkinfer_runtime.so*' -o -name 'libsparkinfer_moe.so*' \) \
-exec install -m755 {} "${BUNDLE}/lib/" \;
BENCH_SHA="$(sha256sum "${BUNDLE}/bin/qwen3_gguf_bench" | awk '{print $1}')"
jq -n \
--arg platform "linux-amd64" \
--arg cuda "12.8" \
--arg sm "${CUDA_ARCH}" \
--arg commit "${GITHUB_SHA}" \
--arg ref "${GITHUB_REF}" \
--arg binary "bin/qwen3_gguf_bench" \
--arg binary_sha256 "${BENCH_SHA}" \
'{platform:$platform,cuda:$cuda,sm:$sm,commit:$commit,ref:$ref,binary:$binary,binary_sha256:$binary_sha256}' \
> "${BUNDLE}/BUILD_MANIFEST.json"
(cd "${BUNDLE}" && find . -type f ! -name SHA256SUMS -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS)
ls -laR "${BUNDLE}"
- name: Generate artifact attestation
uses: actions/attest@v4
with:
subject-path: "${{ env.BUNDLE }}/**/*"
- name: Upload bundle
uses: actions/upload-artifact@v4
with:
name: sparkinfer-linux-amd64
path: dist/sparkinfer-linux-amd64/
if-no-files-found: error
build-windows:
runs-on: windows-2022
permissions:
contents: read
id-token: write
attestations: write
env:
BUNDLE: dist/sparkinfer-windows-amd64/sparkinfer-bin
CUDA_ARCH: "120"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install CUDA toolkit
uses: Jimver/cuda-toolkit@v0.2.35
with:
cuda: "12.8.1"
use-github-cache: false
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x64
- name: Configure
shell: pwsh
run: |
cmake -S . -B build -G "Visual Studio 17 2022" -A x64 `
-DCMAKE_CUDA_ARCHITECTURES="${{ env.CUDA_ARCH }}" `
-DCMAKE_CUDA_RUNTIME_LIBRARY=Shared `
-DBUILD_TESTS=OFF `
-DBUILD_EXAMPLES=ON
- name: Build
shell: pwsh
run: cmake --build build --config Release -j 2 --target qwen3_gguf_bench
- name: Package
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "$env:BUNDLE/bin" | Out-Null
Copy-Item build/runtime/Release/qwen3_gguf_bench.exe "$env:BUNDLE/bin/"
foreach ($pat in @(
"$env:CUDA_PATH/bin/cudart64_*.dll",
"$env:CUDA_PATH/bin/cublas64_*.dll",
"$env:CUDA_PATH/bin/cublasLt64_*.dll"
)) {
Get-ChildItem $pat -ErrorAction SilentlyContinue | Copy-Item -Destination "$env:BUNDLE/bin/"
}
$bench = "$env:BUNDLE/bin/qwen3_gguf_bench.exe"
$hash = (Get-FileHash -Algorithm SHA256 $bench).Hash.ToLower()
$manifest = @{
platform = "windows-amd64"
cuda = "12.8"
sm = $env:CUDA_ARCH
commit = $env:GITHUB_SHA
ref = $env:GITHUB_REF
binary = "bin/qwen3_gguf_bench.exe"
binary_sha256 = $hash
} | ConvertTo-Json -Compress
Set-Content -Path "$env:BUNDLE/BUILD_MANIFEST.json" -Value $manifest -Encoding utf8NoBOM
Push-Location $env:BUNDLE
Get-ChildItem -Recurse -File | Where-Object { $_.Name -ne 'SHA256SUMS' } |
Sort-Object FullName |
ForEach-Object {
$rel = $_.FullName.Substring((Get-Location).Path.Length + 1).Replace('\', '/')
"$((Get-FileHash -Algorithm SHA256 $_.FullName).Hash.ToLower()) ./$rel"
} | Set-Content -Path SHA256SUMS -Encoding utf8NoBOM
Pop-Location
Get-ChildItem -Recurse $env:BUNDLE | Select-Object FullName
- name: Generate artifact attestation
uses: actions/attest@v4
with:
subject-path: "${{ env.BUNDLE }}/**/*"
- name: Upload bundle
uses: actions/upload-artifact@v4
with:
name: sparkinfer-windows-amd64
path: dist/sparkinfer-windows-amd64/
if-no-files-found: error
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build-linux, build-windows]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
steps:
- name: Download Linux bundle
uses: actions/download-artifact@v4
with:
name: sparkinfer-linux-amd64
path: dist/linux
- name: Download Windows bundle
uses: actions/download-artifact@v4
with:
name: sparkinfer-windows-amd64
path: dist/windows
- name: Create release archives
run: |
set -euo pipefail
TAG="${GITHUB_REF_NAME}"
LINUX_TGZ="sparkinfer-${TAG}-linux-x86_64-cuda13-sm120.tar.gz"
WIN_ZIP="sparkinfer-${TAG}-windows-amd64-cuda13-sm120.zip"
tar -C dist/linux -czf "${LINUX_TGZ}" sparkinfer-bin
(cd dist/windows && zip -r "../../${WIN_ZIP}" sparkinfer-bin)
sha256sum "${LINUX_TGZ}" "${WIN_ZIP}" > SHA256SUMS
ls -la "${LINUX_TGZ}" "${WIN_ZIP}" SHA256SUMS
- name: Attest release archives
uses: actions/attest@v4
with:
subject-path: |
sparkinfer-*-linux-*.tar.gz
sparkinfer-*-windows-*.zip
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
sparkinfer-*-linux-*.tar.gz
sparkinfer-*-windows-*.zip
SHA256SUMS
generate_release_notes: true