Skip to content

[Atlas Inference] Add GB10/SM121 Hub-kernel path for NVFP4Config - #49756

Open
AzeezIsh wants to merge 1 commit into
huggingface:mainfrom
AzeezIsh:nvfp4-sm121-hub-kernel
Open

AzeezIsh wants to merge 1 commit into
huggingface:mainfrom
AzeezIsh:nvfp4-sm121-hub-kernel

Conversation

@AzeezIsh

@AzeezIsh AzeezIsh commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🤗 Transformers CI

What does this PR do?

On NVIDIA DGX Spark (GB10, compute capability 12.1 / SM121) any NVFP4 models fail at runtime, which is what the majority of edge users are running. Passing quantization_config=NVFP4Config() currently fails to load kernels-community/nvfp4-gemm (RuntimeError: Kernel 'nvfp4-gemm' variant 'torch-stable-abi29-cu130-aarch64-linux' does not support the current device: CUDA capability 12.1 of the current device is not supported by the architectures of the build: 10.0a, 12.0a), and bypassing the architecture check fails at first launch with cudaErrorNoKernelImageForDevice because the a-suffixed sm_100a / sm_120a cubins are not binary-compatible with sm_121.

This PR adds a capability-gated nvfp4-sm121 entry in _HUB_KERNEL_MAPPING pointing at Atlas-Inference/nvfp4-dense-gemm and routes load_nvfp4_kernel() to it when torch.cuda.get_device_capability() == (12, 1). All other Blackwell GPUs (sm_100, sm_120) keep kernels-community/nvfp4-gemm.

  • Exposes the exact NVFP4Kernel interface (PackedWeight, pack, gemm, swizzled_sf_shape) expected by integrations/nvfp4.py.
  • Uses w4a16_gemv_sw (single-warp-per-output W4A16 GEMV) for M <= 8 decode steps and vectorized w4a16_dequant + cuBLAS tensor cores for M > 8 prefill.

Verified on DGX Spark GB10 (SM121, torch.cuda.get_device_capability() == (12, 1)), torch 2.12.1 + CUDA 13.0, kernels 0.17.2, transformers main:

  • End-to-end from_pretrained(..., quantization_config=NVFP4Config(), use_kernels=True) on Qwen/Qwen3.5-0.8B and Qwen/Qwen3.5-4B (kernel pulled live from the Hub):
Model Config GPU Footprint Prompt Tokens TTFT Decode
Qwen/Qwen3.5-0.8B BF16 + use_kernels=True 1,435.1 MiB 1,024 71.0 ms 79.97 tok/s
Qwen/Qwen3.5-0.8B NVFP4Config() + use_kernels=True 797.2 MiB (-44%) 1,024 75.3 ms 89.96 tok/s (+12.5%)
Qwen/Qwen3.5-0.8B BF16 + use_kernels=True 1,435.1 MiB 4,096 293.7 ms 77.64 tok/s
Qwen/Qwen3.5-0.8B NVFP4Config() + use_kernels=True 797.2 MiB (-44%) 4,096 301.4 ms 90.77 tok/s (+16.9%)
Qwen/Qwen3.5-4B BF16 + use_kernels=True 8,021.9 MiB 1,024 211.7 ms 18.31 tok/s
Qwen/Qwen3.5-4B NVFP4Config() + use_kernels=True 3,376.1 MiB (-58%) 1,024 252.8 ms 41.70 tok/s (2.28x)
Qwen/Qwen3.5-4B BF16 + use_kernels=True 8,021.9 MiB 4,096 2,893.0 ms 42.47 tok/s
Qwen/Qwen3.5-4B NVFP4Config() + use_kernels=True 3,376.1 MiB (-58%) 4,096 913.2 ms (3.17x) 39.75 tok/s

Follow-up to #46423 and #47883. The same trust_remote_code=True note applies until Atlas-Inference is on the kernels trusted-publisher allowlist.

Code Agent Policy

  • I confirm that this is not a pure code agent PR.

Before submitting

Who can review?

@vasqu, @drbh (#47883), @danieldk, @stevhliu (docs)

@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 39376359409
Result: success | Grafana metrics are not available yet.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant