Skip to content

webgpu: add MatMulBnb4 contrib op support#29587

Open
xhcao wants to merge 1 commit into
microsoft:mainfrom
xhcao:webgpu-matmul-bnb4
Open

webgpu: add MatMulBnb4 contrib op support#29587
xhcao wants to merge 1 commit into
microsoft:mainfrom
xhcao:webgpu-matmul-bnb4

Conversation

@xhcao

@xhcao xhcao commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Implement the MatMulBnb4 quantized matmul operator for the WebGPU execution provider, supporting both FP4 (quant_type=0) and NF4 (quant_type=1) blockwise 4-bit weight dequantization.

Description

Add WebGPU execution provider support for the MatMulBnb4 contrib operator, enabling blockwise 4-bit quantized matmul (bitsandbytes-style FP4 and NF4) to run on WebGPU.

Motivation and Context

Models quantized with bitsandbytes 4-bit weights fell back to CPU when running on WebGPU, causing significant slowdowns, and cannot use graph capture feature.
Adding a native WebGPU kernel keeps these quantized MatMulBnb4 on the GPU, avoiding costly EP fallback and CPU/GPU data transfers.
marqo-fashionSigLIP-text-bnb4: ~30% faster
marqo-fashionSigLIP-vision-bnb4: ~20% faster

Implement the MatMulBnb4 quantized matmul operator for the WebGPU
execution provider, supporting both FP4 (quant_type=0) and NF4
(quant_type=1) blockwise 4-bit weight dequantization.
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