Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions docs/features/quantization/b12x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# B12X Backends

[B12X](https://pypi.org/project/b12x/) provides optional CUDA kernels for
NVIDIA SM120 and SM121 GPUs. Install the dependency with:

```bash
uv pip install "vllm[b12x]"
```

The B12X backends are opt-in. To select all supported B12X kernels explicitly:

```bash
vllm serve <model> \
--linear-backend b12x \
--moe-backend b12x \
--attention-backend B12X_ATTN
```

Only pass `--moe-backend b12x` for a compatible NVFP4 or MXFP4 MoE model. The
linear and attention backends can be selected independently.

B12X uses MXFP8 activations by default for MXFP4 MoE and the checkpoint's
activation format for NVFP4 MoE. MXFP4 falls back to BF16 when its A8 path does
not support the model configuration. Set `VLLM_B12X_MOE_FORCE_A16=1` to force
BF16 activations for either weight format.

For more targeted linear selection, leave `--linear-backend` at `auto` and
enable B12X for one or both quantization families:

```bash
VLLM_USE_B12X_FP8_GEMM=1 VLLM_USE_B12X_FP4_GEMM=1 \
vllm serve <model>
```

An explicit non-B12X `--linear-backend` takes precedence over these environment
variables.

## Supported Configurations

| Backend | Supported configurations |
| ------- | ------------------------ |
| Linear | Per-tensor FP8, 128x128 block FP8, MXFP8, NVFP4, and MXFP4 |
| MoE | Tensor-parallel MXFP4 weights with BF16 or MXFP8 activations; NVFP4 weights with BF16, NVFP4, or MXFP8 activations |
| Attention | Causal decoder MHA/MQA/GQA with BF16 model dtype; BF16, FP16, or FP8 E4M3 KV cache; head sizes 64, 128, 192, or 256; block size 64 or 128 |

The attention backend supports decode, prefill, mixed batches, speculative
verification, sliding-window attention, attention sinks, and CUDA graphs.

The B12X MoE backend does not support expert parallelism, expert maps, EXL3, or
NF3. The attention backend does not support MLA, non-causal attention, ALiBi,
logits soft capping, or context parallelism. Dense W4A16 layers are not handled
by B12X and continue to use another compatible backend such as Marlin.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ def add_vllm_package_data(filename: str) -> None:
# only; also needs system GStreamer + libv4l (see docs).
"deepstream": ["nvidia-deepstream-videodecode-cu13>=9.0.2"],
"flashinfer": [], # Kept for backwards compatibility
"b12x": ["b12x>=1.2.2"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should pin the version and update as we need to, like flashinfer

# Optional deps for Helion kernel development
# NOTE: When updating helion version, also update CI files:
# - .buildkite/test_areas/kernels.yaml
Expand Down
Loading
Loading