Quantization & Dequantization¶
本页暂无中文版。以下为英文原文。
11 ops, 80 workloads.
One table per op, one row per workload. Ratio is the fastest other implementation's device time divided by ours, so green is faster than it, plain is level with it, red is slower. Times are in ms. How these numbers are taken.
INT8QuantPerTensorFwd¶
x: [M, K]
llama-x: [4096, 4096]dtype=bf168b- prefill llama-x: [32, 4096]dtype=bf168b- decode qwen3-x: [8192, 5120]dtype=bf16, f3232b- prefill gpt-x: [17, 2880]dtype=bf16oss- 20b- decode gpt-x: [3000, 2880]dtype=bf16oss- 20b- prefill odd-x: [1000, 4099]dtype=f16hidden- prefill
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
llama- | bf16 | 1.49× | 0.0170 | torch-compilevllmtorch-ref | 0.0253 0.0630 0.3018 | 4.95 | · | · |
llama- | bf16 | 1.35× | 0.0033 | torch-compilevllmtorch-ref | 0.00445 0.0169 0.0252 | 0.199 | · | · |
qwen3- | bf16 | 1.47× | 0.0379 | torch-compilevllmtorch-ref | 0.0557 0.1331 0.7136 | 5.54 | · | · |
| f32 | 1.19× | 0.0730 | torch-compilevllmtorch-ref | 0.0869 0.1855 0.5717 | 2.87 | · | · | |
gpt- | bf16 | 1.40× | 0.0033 | torch-compilevllmtorch-ref | 0.00461 0.0196 0.0271 | 0.0743 | · | · |
gpt- | bf16 | 1.58× | 0.0110 | torch-compilevllmtorch-ref | 0.0174 0.0417 0.1589 | 3.94 | · | · |
odd- | f16 | 1.39× | 0.00726 | torch-compilevllmtorch-ref | 0.0101 0.0296 0.0749 | 2.82 | · | · |
INT8QuantPerChannelFwd¶
w: [N, K]
llama-w: [14336, 4096]dtype=bf168b- mlp- up llama-w: [8192, 28672]dtype=bf1670b- mlp- down qwen3-w: [5120, 8192]dtype=bf16, f3232b- o- proj gpt-w: [5760, 2880]dtype=bf16oss- 20b- mlp- up ragged-w: [3000, 4099]dtype=f16k ragged-w: [17, 4099]dtype=bf16k- few- rows
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
llama- | bf16 | 1.07× | 0.0424 | vllmvllm-cudatorch-compiletorch-ref | 0.0452 0.0500 0.0751 1.0039 | 6.93 | · | · |
llama- | bf16 | 1.29× | 0.1706 | torch-compilevllm-cudavllmtorch-ref | 0.2194 0.2702 0.2835 3.9230 | 6.88 | · | · |
qwen3- | bf16 | 1.02× | 0.0298 | vllmvllm-cudatorch-compiletorch-ref | 0.0304 0.0323 0.0408 0.7380 | 7.03 | · | · |
| f32 | 1.00× | 0.0484 | vllmtorch-compilevllm-cudatorch-ref | 0.0483 0.0499 0.0659 0.5959 | 4.34 | · | · | |
gpt- | bf16 | 1.25× | 0.0140 | vllmvllm-cudatorch-compiletorch-ref | 0.0175 0.0180 0.0308 0.3010 | 5.93 | · | · |
ragged- | f16 | 1.64× | 0.0130 | torch-compilevllmvllm-cudatorch-ref | 0.0212 0.0226 0.0259 0.2360 | 4.74 | · | · |
ragged- | bf16 | 1.13× | 0.00221 | vllmtorch-compilevllm-cudatorch-ref | 0.0025 0.00291 0.00336 0.0301 | 0.158 | · | · |
INT8QuantPerTokenGroupFwd¶
x: [M, K]
ds-x: [4096, 7168]dtype=bf16v3- prefill ds-x: [64, 7168]dtype=bf16v3- decode qwen3-x: [4096, 4096]dtype=bf16, f32235b- prefill ds-x: [17, 7168]dtype=bf16v3- decode- few- tokens gpt-x: [3000, 2880]dtype=bf16oss- 20b- prefill ragged-x: [1000, 4099]dtype=f16k
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
ds- | bf16 | 1.12× | 0.0211 | vllmtorch-compiletorch-ref | 0.0237 0.0255 0.6186 | 6.97 | · | · |
ds- | bf16 | 1.10× | 0.00189 | vllmtorch-compiletorch-ref | 0.00208 0.00214 0.0278 | 1.22 | · | · |
qwen3- | bf16 | 1.08× | 0.0129 | vllmtorch-compiletorch-ref | 0.0140 0.0149 0.3644 | 6.53 | · | · |
| f32 | 1.03× | 0.0196 | torch-compilevllmtorch-ref | 0.0201 0.0323 0.3085 | 4.3 | · | · | |
ds- | bf16 | 1.09× | 0.00182 | vllmtorch-compiletorch-ref | 0.00198 0.00339 0.0246 | 0.335 | · | · |
gpt- | bf16 | 4.99× | 0.00829 | torch-compiletorch-ref | 0.0413 0.2445 | 5.23 | · | · |
ragged- | f16 | 2.66× | 0.00957 | torch-compiletorch-ref | 0.0255 0.1152 | 2.15 | · | · |
SmoothQuantFwd¶
x: [M, K]smooth: [K], f32
llama-x: [4096, 4096]smooth: [4096], f32dtype=bf168b- prefill llama-x: [32, 4096]smooth: [4096], f32dtype=bf168b- decode llama-x: [4096, 8192]smooth: [8192], f32dtype=bf1670b- prefill gpt-x: [3000, 2880]smooth: [2880], f32dtype=bf16oss- 20b- prefill ragged-x: [1000, 4099]smooth: [4099], f32dtype=f16k ragged-x: [17, 4099]smooth: [4099], f32dtype=bf16k- decode
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
llama- | bf16 | 1.71× | 0.0192 | torch-compilevllmtorch-ref | 0.0329 0.1219 0.3689 | 5.24 | · | · |
llama- | bf16 | 1.06× | 0.00259 | torch-compilevllmtorch-ref | 0.00275 0.00922 0.0323 | 0.303 | · | · |
llama- | bf16 | 1.56× | 0.0372 | torch-compilevllmtorch-ref | 0.0578 0.2373 0.7174 | 5.41 | · | · |
gpt- | bf16 | 1.83× | 0.0140 | torch-compilevllmtorch-ref | 0.0255 0.0664 0.1989 | 3.72 | · | · |
ragged- | f16 | 1.56× | 0.0120 | torch-compilevllmtorch-ref | 0.0187 0.0448 0.0951 | 2.05 | · | · |
ragged- | bf16 | 1.23× | 0.00355 | torch-compilevllmtorch-ref | 0.00435 0.0108 0.0324 | 0.118 | · | · |
FP8QuantPerTokenGroupFwd¶
x: [*S, K]
kv-x: [8192, 64]group_size=64dtype=bf16/f32index- flat- 8k kv-x: [4096, 128]group_size=128dtype=f32/f32index- flat- 4k kv-x: [3072, 128]group_size=128dtype=bf16/f32index- flat- ctx- chunk dsv3-x: [4096, 7168]group_size=128dtype=bf16/f32act- prefill dsv4-x: [1, 4096]group_size=128eps=0.0001use_ue8m0=truedtype=bf16/float8_e8m0fnuflash- n4096- m1 dsv4-x: [4096, 4096]group_size=128eps=0.0001use_ue8m0=truedtype=bf16/float8_e8m0fnu, bf16/f32flash- n4096- m4k dsv4-x: [32768, 4096]group_size=128eps=0.0001use_ue8m0=truedtype=bf16/float8_e8m0fnuflash- n4096- m32k dsv4-x: [3000, 2048]group_size=128eps=0.0001use_ue8m0=truedtype=bf16/float8_e8m0fnuflash- n2048- m3000 dsv4-x: [4096, 1024]group_size=128eps=0.0001use_ue8m0=truedtype=bf16/float8_e8m0fnuflash- n1024- m4k dsv4-x: [4096, 8192]group_size=128eps=0.0001use_ue8m0=truedtype=bf16/float8_e8m0fnuflash- n8192- m4k dsv4-x: [1, 448]group_size=64eps=0.0001use_ue8m0=trueinplace=truedtype=bf16/f32flash- kv- fq- m1 dsv4-x: [4096, 448]group_size=64eps=0.0001use_ue8m0=trueinplace=truedtype=bf16/f32flash- kv- fq- m4k
x: [*S, K]out_q: [*S, K], fp8e4m3
dsv3-x: [2, 64, 7168]out_q: [2, 64, 7168], fp8e4m3group_size=128dtype=bf16/f32act- decode- out
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
kv- | bf16/f32 | 1.30× | 0.00192 | torch-compiletilekernelsvllmtorch-ref | 0.0025 0.00275 0.00427 0.0206 | 1.1 | · | · |
kv- | f32/f32 | 1.30× | 0.00231 | tilekernelstorch-compilevllmtorch-ref | 0.00301 0.00371 0.00375 0.0152 | 0.913 | · | · |
kv- | bf16/f32 | 1.02× | 0.00186 | torch-compiletilekernelsvllmtorch-ref | 0.00189 0.00221 0.00301 0.0184 | 0.851 | · | · |
dsv3- | bf16/f32 | 1.03× | 0.0206 | torch-compiletilekernelsvllmtorch-ref | 0.0212 0.0217 0.0505 0.4491 | 5.72 | · | · |
dsv4- | bf16/float8_e8m0fnu | 1.24× | 0.00157 | tilekernelstorch-compilevllmtorch-ref | 0.00195 0.00323 0.0041 0.0240 | 0.0105 | · | · |
dsv4- | bf16/float8_e8m0fnu | 1.20× | 0.0128 | tilekernelstorch-compilevllmtorch-ref | 0.0154 0.0187 0.0321 0.2783 | 5.25 | · | · |
| bf16/f32 | 1.18× | 0.0129 | tilekernelstorch-compilevllmtorch-ref | 0.0152 0.0172 0.0304 0.2761 | 5.24 | · | · | |
dsv4- | bf16/float8_e8m0fnu | 1.02× | 0.0946 | tilekernelstorch-compilevllmtorch-ref | 0.0960 0.1292 0.2266 2.0200 | 5.7 | · | · |
dsv4- | bf16/float8_e8m0fnu | 1.13× | 0.00602 | tilekernelstorch-compilevllmtorch-ref | 0.00682 0.00944 0.0147 0.1109 | 4.1 | · | · |
dsv4- | bf16/float8_e8m0fnu | 1.09× | 0.0048 | tilekernelstorch-compilevllmtorch-ref | 0.00525 0.0073 0.0109 0.0792 | 3.51 | · | · |
dsv4- | bf16/float8_e8m0fnu | 1.13× | 0.0242 | tilekernelstorch-compilevllmtorch-ref | 0.0273 0.0340 0.0601 0.5283 | 5.57 | · | · |
dsv4- | bf16/f32 | 1.02× | 0.00141 | tilekernelstorch-compiletorch-ref | 0.00144 0.00278 0.0286 | 0.0016 | · | · |
dsv4- | bf16/f32 | 1.11× | 0.00304 | tilekernelstorch-compiletorch-ref | 0.00336 0.00973 0.0704 | 3.04 | · | · |
dsv3- | bf16/f32 | 1.07× | 0.00221 | torch-compiletilekernelsvllmtorch-ref | 0.00237 0.00266 0.00374 0.0236 | 1.67 | · | · |
FP8QuantPerBlockFwd¶
w: [N, K]
ds-w: [7168, 18432]dtype=bf16v3- mlp- down ds-w: [4096, 7168]dtype=bf16, f32v3- expert- gate- up qwen3-w: [9216, 4096]dtype=bf16235b- qkv gpt-w: [2880, 2880]dtype=bf16oss- expert- down ragged-w: [1000, 4099]dtype=f16k
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
ds- | bf16 | 1.81× | 0.0901 | torch-compiletorch-refvllm | 0.1633 2.1116 4.7999 | 5.86 | · | · |
ds- | bf16 | 1.81× | 0.0210 | torch-compiletorch-refvllm | 0.0382 0.4907 1.0768 | 5.58 | · | · |
| f32 | 1.81× | 0.0338 | torch-compiletorch-refvllm | 0.0612 0.3924 1.0661 | 3.48 | · | · | |
qwen3- | bf16 | 1.84× | 0.0262 | torch-compiletorch-refvllm | 0.0483 0.6235 1.3810 | 5.77 | · | · |
gpt- | bf16 | 3.12× | 0.00806 | torch-compiletorch-refvllm | 0.0251 0.2056 0.4051 | 4.11 | · | · |
ragged- | f16 | 2.46× | 0.00758 | torch-compiletorch-refvllm | 0.0187 0.1026 0.2152 | 2.16 | · | · |
FP4QuantPerGroupFwd¶
x: [*S, N]
dtype=bf16
dsv4-x: [1, 64, 128]inplace=trueflash- idx- q- t1 dsv4-x: [4096, 64, 128]inplace=trueflash- idx- q- 4k dsv4-x: [32768, 64, 128]inplace=trueflash- idx- q- 32k dsv4-x: [1024, 128]inplace=trueflash- idx- k- 1k dsv4-x: [3000, 128]inplace=trueflash- idx- k- 3000 dsv4-x: [4096, 64, 128]flash- q- 4k- quant
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
dsv4- | bf16 | 1.94× | 0.00154 | torch-compiletilekernelstorch-ref | 0.00298 0.0128 0.0842 | 0.0275 | · | · |
dsv4- | bf16 | 3.88× | 0.0381 | torch-compiletilekernelstorch-ref | 0.1477 0.1855 3.6962 | 4.54 | · | · |
dsv4- | bf16 | 3.76× | 0.3011 | torch-compiletilekernelstorch-ref | 1.1334 1.4090 28.6393 | 4.6 | · | · |
dsv4- | bf16 | 6.26× | 0.00173 | torch-compiletilekernelstorch-ref | 0.0108 0.0131 0.0973 | 0.391 | · | · |
dsv4- | bf16 | 5.75× | 0.00192 | torch-compiletilekernelstorch-ref | 0.0110 0.0129 0.1129 | 1.03 | · | · |
dsv4- | bf16 | 3.15× | 0.0388 | torch-compiletilekernelstorch-ref | 0.1220 0.1424 3.0245 | 3.6 | · | · |
INT4QuantPerGroupFwd¶
w: [N, K]
dtype=f16
llama-w: [14336, 4096]8b- mlp- up llama-w: [4096, 4096]group_size=648b- q- proj llama-w: [8192, 28672]70b- mlp- down qwen3-w: [5120, 8192]32b- o- proj qwen2-w: [18944, 3584]7b- mlp- up qwen2-w: [3584, 18944]7b- mlp- down opt-w: [20480, 5120]group_size=6413b- mlp- up llama-w: [14336, 4096]group_size=40968b- mlp- up- chan
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
llama- | f16 | 1.51× | 0.0368 | deepspeed | 0.0556 | 11.3 | · | · |
llama- | f16 | 1.46× | 0.0114 | deepspeed | 0.0165 | 10.5 | · | · |
llama- | f16 | 1.49× | 0.1456 | deepspeed | 0.2175 | 11.4 | · | · |
qwen3- | f16 | 1.49× | 0.0267 | deepspeed | 0.0398 | 11.1 | · | · |
qwen2- | f16 | 1.52× | 0.0422 | deepspeed | 0.0641 | 11.3 | · | · |
qwen2- | f16 | 1.52× | 0.0422 | deepspeed | 0.0642 | 11.3 | · | · |
opt- | f16 | 1.45× | 0.0669 | deepspeed | 0.0970 | 11.1 | · | · |
llama- | f16 | 1.43× | 0.0344 | deepspeed | 0.0492 | 11.9 | · | · |
INT8DequantPerTensorFwd¶
q: [M, K], i8scale: [1], f32
llama-q: [4096, 4096], i8scale: [1], f32dtype=bf168b- prefill llama-q: [32, 4096], i8scale: [1], f32dtype=bf168b- decode qwen3-q: [8192, 5120], i8scale: [1], f32dtype=f16, f3232b- prefill gpt-q: [3000, 2880], i8scale: [1], f32dtype=bf16oss- prefill ragged-q: [17, 4099], i8scale: [1], f32dtype=f16k- few- rows
q: [M, K], i8scale: [1]
ragged-q: [1000, 4099], i8scale: [1]dtype=f32k
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
llama- | bf16 | 1.06× | 0.0122 | torch-compiletorch-ref | 0.0129 0.1341 | 1.38 | · | · |
llama- | bf16 | 1.12× | 0.00154 | torch-compiletorch-ref | 0.00173 0.00733 | 0.0853 | · | · |
qwen3- | f16 | 1.04× | 0.0296 | torch-compiletorch-ref | 0.0307 0.3270 | 1.42 | · | · |
| f32 | 1.01× | 0.0509 | torch-compiletorch-ref | 0.0516 0.2683 | 0.824 | · | · | |
gpt- | bf16 | 1.09× | 0.00682 | torch-compiletorch-ref | 0.00741 0.0703 | 1.27 | · | · |
ragged- | f16 | 1.05× | 0.00155 | torch-compiletorch-ref | 0.00163 0.00723 | 0.0449 | · | · |
ragged- | f32 | 1.01× | 0.00557 | torch-compiletorch-ref | 0.00563 0.0260 | 0.736 | · | · |
INT8DequantPerChannelFwd¶
q: [M, K], i8scale: [M], f32
llama-q: [14336, 4096], i8scale: [14336], f32dtype=bf168b- mlp- up llama-q: [8192, 28672], i8scale: [8192], f32dtype=bf1670b- mlp- down gpt-q: [5760, 2880], i8scale: [5760], f32dtype=bf16oss- 20b- mlp- up ragged-q: [3000, 4099], i8scale: [3000], f32dtype=f16k ragged-q: [17, 4099], i8scale: [17], f32dtype=bf16k- few- rows
q: [M, K], i8scale: [M]
llama-q: [4096, 14336], i8scale: [4096]dtype=f328b- mlp- down
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
llama- | bf16 | 1.06× | 0.0423 | torch-compiletorch-ref | 0.0449 0.4713 | 1.39 | · | · |
llama- | bf16 | 1.05× | 0.1713 | torch-compiletorch-ref | 0.1802 1.8562 | 1.37 | · | · |
gpt- | bf16 | 1.02× | 0.0125 | torch-compiletorch-ref | 0.0127 0.1373 | 1.33 | · | · |
ragged- | f16 | 1.27× | 0.00973 | torch-compiletorch-ref | 0.0124 0.1029 | 1.26 | · | · |
ragged- | bf16 | 1.06× | 0.00154 | torch-compiletorch-ref | 0.00163 0.00726 | 0.0454 | · | · |
llama- | f32 | 1.01× | 0.0725 | torch-compiletorch-ref | 0.0732 0.3874 | 0.809 | · | · |
INT8DequantPerBlockFwd¶
q: [M, K], i8scale: [M, ceil_div(K, 128)], f32
ds-q: [4096, 7168], i8scale: [4096, 56], f32dtype=bf16v3- prefill ds-q: [64, 7168], i8scale: [64, 56], f32dtype=bf16v3- decode qwen3-q: [4096, 4096], i8scale: [4096, 32], f32dtype=f16235b- prefill gpt-q: [3000, 2880], i8scale: [3000, 23], f32dtype=bf16oss- prefill ragged-q: [17, 4099], i8scale: [17, 33], f32dtype=f16k- few- rows
q: [M, K], i8scale: [M, ceil_div(K, 128)]
ragged-q: [1000, 4099], i8scale: [1000, 33]dtype=f32k
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
ds- | bf16 | 1.06× | 0.0208 | torch-compiletorch-ref | 0.0220 0.2927 | 1.41 | · | · |
ds- | bf16 | 1.13× | 0.0017 | torch-compiletorch-ref | 0.00192 0.0105 | 0.27 | · | · |
qwen3- | f16 | 1.05× | 0.0123 | torch-compiletorch-ref | 0.0129 0.1712 | 1.37 | · | · |
gpt- | bf16 | 2.12× | 0.00717 | torch-compiletorch-ref | 0.0152 0.1006 | 1.21 | · | · |
ragged- | f16 | 1.06× | 0.00157 | torch-compiletorch-ref | 0.00166 0.00896 | 0.0444 | · | · |
ragged- | f32 | 1.77× | 0.00579 | torch-compiletorch-ref | 0.0102 0.0416 | 0.708 | · | · |