跳转至

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-8b-prefillx: [4096, 4096]dtype=bf16
  • llama-8b-decodex: [32, 4096]dtype=bf16
  • qwen3-32b-prefillx: [8192, 5120]dtype=bf16, f32
  • gpt-oss-20b-decodex: [17, 2880]dtype=bf16
  • gpt-oss-20b-prefillx: [3000, 2880]dtype=bf16
  • odd-hidden-prefillx: [1000, 4099]dtype=f16
Workload dtype Ratio Device time Alternatives Throughput SOL Bound
alt / ours ms name ms TFLOP/s of ceiling by
llama-8b-prefillbf161.49×0.0170torch-compile
vllm
torch-ref
0.0253
0.0630
0.3018
4.95··
llama-8b-decodebf161.35×0.0033torch-compile
vllm
torch-ref
0.00445
0.0169
0.0252
0.199··
qwen3-32b-prefillbf161.47×0.0379torch-compile
vllm
torch-ref
0.0557
0.1331
0.7136
5.54··
f321.19×0.0730torch-compile
vllm
torch-ref
0.0869
0.1855
0.5717
2.87··
gpt-oss-20b-decodebf161.40×0.0033torch-compile
vllm
torch-ref
0.00461
0.0196
0.0271
0.0743··
gpt-oss-20b-prefillbf161.58×0.0110torch-compile
vllm
torch-ref
0.0174
0.0417
0.1589
3.94··
odd-hidden-prefillf161.39×0.00726torch-compile
vllm
torch-ref
0.0101
0.0296
0.0749
2.82··

INT8QuantPerChannelFwd

w: [N, K]

  • llama-8b-mlp-upw: [14336, 4096]dtype=bf16
  • llama-70b-mlp-downw: [8192, 28672]dtype=bf16
  • qwen3-32b-o-projw: [5120, 8192]dtype=bf16, f32
  • gpt-oss-20b-mlp-upw: [5760, 2880]dtype=bf16
  • ragged-kw: [3000, 4099]dtype=f16
  • ragged-k-few-rowsw: [17, 4099]dtype=bf16
Workload dtype Ratio Device time Alternatives Throughput SOL Bound
alt / ours ms name ms TFLOP/s of ceiling by
llama-8b-mlp-upbf161.07×0.0424vllm
vllm-cuda
torch-compile
torch-ref
0.0452
0.0500
0.0751
1.0039
6.93··
llama-70b-mlp-downbf161.29×0.1706torch-compile
vllm-cuda
vllm
torch-ref
0.2194
0.2702
0.2835
3.9230
6.88··
qwen3-32b-o-projbf161.02×0.0298vllm
vllm-cuda
torch-compile
torch-ref
0.0304
0.0323
0.0408
0.7380
7.03··
f321.00×0.0484vllm
torch-compile
vllm-cuda
torch-ref
0.0483
0.0499
0.0659
0.5959
4.34··
gpt-oss-20b-mlp-upbf161.25×0.0140vllm
vllm-cuda
torch-compile
torch-ref
0.0175
0.0180
0.0308
0.3010
5.93··
ragged-kf161.64×0.0130torch-compile
vllm
vllm-cuda
torch-ref
0.0212
0.0226
0.0259
0.2360
4.74··
ragged-k-few-rowsbf161.13×0.00221vllm
torch-compile
vllm-cuda
torch-ref
0.0025
0.00291
0.00336
0.0301
0.158··

INT8QuantPerTokenGroupFwd

x: [M, K]

  • ds-v3-prefillx: [4096, 7168]dtype=bf16
  • ds-v3-decodex: [64, 7168]dtype=bf16
  • qwen3-235b-prefillx: [4096, 4096]dtype=bf16, f32
  • ds-v3-decode-few-tokensx: [17, 7168]dtype=bf16
  • gpt-oss-20b-prefillx: [3000, 2880]dtype=bf16
  • ragged-kx: [1000, 4099]dtype=f16
Workload dtype Ratio Device time Alternatives Throughput SOL Bound
alt / ours ms name ms TFLOP/s of ceiling by
ds-v3-prefillbf161.12×0.0211vllm
torch-compile
torch-ref
0.0237
0.0255
0.6186
6.97··
ds-v3-decodebf161.10×0.00189vllm
torch-compile
torch-ref
0.00208
0.00214
0.0278
1.22··
qwen3-235b-prefillbf161.08×0.0129vllm
torch-compile
torch-ref
0.0140
0.0149
0.3644
6.53··
f321.03×0.0196torch-compile
vllm
torch-ref
0.0201
0.0323
0.3085
4.3··
ds-v3-decode-few-tokensbf161.09×0.00182vllm
torch-compile
torch-ref
0.00198
0.00339
0.0246
0.335··
gpt-oss-20b-prefillbf164.99×0.00829torch-compile
torch-ref
0.0413
0.2445
5.23··
ragged-kf162.66×0.00957torch-compile
torch-ref
0.0255
0.1152
2.15··

SmoothQuantFwd

x: [M, K]smooth: [K], f32

  • llama-8b-prefillx: [4096, 4096]smooth: [4096], f32dtype=bf16
  • llama-8b-decodex: [32, 4096]smooth: [4096], f32dtype=bf16
  • llama-70b-prefillx: [4096, 8192]smooth: [8192], f32dtype=bf16
  • gpt-oss-20b-prefillx: [3000, 2880]smooth: [2880], f32dtype=bf16
  • ragged-kx: [1000, 4099]smooth: [4099], f32dtype=f16
  • ragged-k-decodex: [17, 4099]smooth: [4099], f32dtype=bf16
Workload dtype Ratio Device time Alternatives Throughput SOL Bound
alt / ours ms name ms TFLOP/s of ceiling by
llama-8b-prefillbf161.71×0.0192torch-compile
vllm
torch-ref
0.0329
0.1219
0.3689
5.24··
llama-8b-decodebf161.06×0.00259torch-compile
vllm
torch-ref
0.00275
0.00922
0.0323
0.303··
llama-70b-prefillbf161.56×0.0372torch-compile
vllm
torch-ref
0.0578
0.2373
0.7174
5.41··
gpt-oss-20b-prefillbf161.83×0.0140torch-compile
vllm
torch-ref
0.0255
0.0664
0.1989
3.72··
ragged-kf161.56×0.0120torch-compile
vllm
torch-ref
0.0187
0.0448
0.0951
2.05··
ragged-k-decodebf161.23×0.00355torch-compile
vllm
torch-ref
0.00435
0.0108
0.0324
0.118··

FP8QuantPerTokenGroupFwd

x: [*S, K]

  • kv-index-flat-8kx: [8192, 64]group_size=64dtype=bf16/f32
  • kv-index-flat-4kx: [4096, 128]group_size=128dtype=f32/f32
  • kv-index-flat-ctx-chunkx: [3072, 128]group_size=128dtype=bf16/f32
  • dsv3-act-prefillx: [4096, 7168]group_size=128dtype=bf16/f32
  • dsv4-flash-n4096-m1x: [1, 4096]group_size=128eps=0.0001use_ue8m0=truedtype=bf16/float8_e8m0fnu
  • dsv4-flash-n4096-m4kx: [4096, 4096]group_size=128eps=0.0001use_ue8m0=truedtype=bf16/float8_e8m0fnu, bf16/f32
  • dsv4-flash-n4096-m32kx: [32768, 4096]group_size=128eps=0.0001use_ue8m0=truedtype=bf16/float8_e8m0fnu
  • dsv4-flash-n2048-m3000x: [3000, 2048]group_size=128eps=0.0001use_ue8m0=truedtype=bf16/float8_e8m0fnu
  • dsv4-flash-n1024-m4kx: [4096, 1024]group_size=128eps=0.0001use_ue8m0=truedtype=bf16/float8_e8m0fnu
  • dsv4-flash-n8192-m4kx: [4096, 8192]group_size=128eps=0.0001use_ue8m0=truedtype=bf16/float8_e8m0fnu
  • dsv4-flash-kv-fq-m1x: [1, 448]group_size=64eps=0.0001use_ue8m0=trueinplace=truedtype=bf16/f32
  • dsv4-flash-kv-fq-m4kx: [4096, 448]group_size=64eps=0.0001use_ue8m0=trueinplace=truedtype=bf16/f32

x: [*S, K]out_q: [*S, K], fp8e4m3

  • dsv3-act-decode-outx: [2, 64, 7168]out_q: [2, 64, 7168], fp8e4m3group_size=128dtype=bf16/f32
Workload dtype Ratio Device time Alternatives Throughput SOL Bound
alt / ours ms name ms TFLOP/s of ceiling by
kv-index-flat-8kbf16/f321.30×0.00192torch-compile
tilekernels
vllm
torch-ref
0.0025
0.00275
0.00427
0.0206
1.1··
kv-index-flat-4kf32/f321.30×0.00231tilekernels
torch-compile
vllm
torch-ref
0.00301
0.00371
0.00375
0.0152
0.913··
kv-index-flat-ctx-chunkbf16/f321.02×0.00186torch-compile
tilekernels
vllm
torch-ref
0.00189
0.00221
0.00301
0.0184
0.851··
dsv3-act-prefillbf16/f321.03×0.0206torch-compile
tilekernels
vllm
torch-ref
0.0212
0.0217
0.0505
0.4491
5.72··
dsv4-flash-n4096-m1bf16/float8_e8m0fnu1.24×0.00157tilekernels
torch-compile
vllm
torch-ref
0.00195
0.00323
0.0041
0.0240
0.0105··
dsv4-flash-n4096-m4kbf16/float8_e8m0fnu1.20×0.0128tilekernels
torch-compile
vllm
torch-ref
0.0154
0.0187
0.0321
0.2783
5.25··
bf16/f321.18×0.0129tilekernels
torch-compile
vllm
torch-ref
0.0152
0.0172
0.0304
0.2761
5.24··
dsv4-flash-n4096-m32kbf16/float8_e8m0fnu1.02×0.0946tilekernels
torch-compile
vllm
torch-ref
0.0960
0.1292
0.2266
2.0200
5.7··
dsv4-flash-n2048-m3000bf16/float8_e8m0fnu1.13×0.00602tilekernels
torch-compile
vllm
torch-ref
0.00682
0.00944
0.0147
0.1109
4.1··
dsv4-flash-n1024-m4kbf16/float8_e8m0fnu1.09×0.0048tilekernels
torch-compile
vllm
torch-ref
0.00525
0.0073
0.0109
0.0792
3.51··
dsv4-flash-n8192-m4kbf16/float8_e8m0fnu1.13×0.0242tilekernels
torch-compile
vllm
torch-ref
0.0273
0.0340
0.0601
0.5283
5.57··
dsv4-flash-kv-fq-m1bf16/f321.02×0.00141tilekernels
torch-compile
torch-ref
0.00144
0.00278
0.0286
0.0016··
dsv4-flash-kv-fq-m4kbf16/f321.11×0.00304tilekernels
torch-compile
torch-ref
0.00336
0.00973
0.0704
3.04··
dsv3-act-decode-outbf16/f321.07×0.00221torch-compile
tilekernels
vllm
torch-ref
0.00237
0.00266
0.00374
0.0236
1.67··

FP8QuantPerBlockFwd

w: [N, K]

  • ds-v3-mlp-downw: [7168, 18432]dtype=bf16
  • ds-v3-expert-gate-upw: [4096, 7168]dtype=bf16, f32
  • qwen3-235b-qkvw: [9216, 4096]dtype=bf16
  • gpt-oss-expert-downw: [2880, 2880]dtype=bf16
  • ragged-kw: [1000, 4099]dtype=f16
Workload dtype Ratio Device time Alternatives Throughput SOL Bound
alt / ours ms name ms TFLOP/s of ceiling by
ds-v3-mlp-downbf161.81×0.0901torch-compile
torch-ref
vllm
0.1633
2.1116
4.7999
5.86··
ds-v3-expert-gate-upbf161.81×0.0210torch-compile
torch-ref
vllm
0.0382
0.4907
1.0768
5.58··
f321.81×0.0338torch-compile
torch-ref
vllm
0.0612
0.3924
1.0661
3.48··
qwen3-235b-qkvbf161.84×0.0262torch-compile
torch-ref
vllm
0.0483
0.6235
1.3810
5.77··
gpt-oss-expert-downbf163.12×0.00806torch-compile
torch-ref
vllm
0.0251
0.2056
0.4051
4.11··
ragged-kf162.46×0.00758torch-compile
torch-ref
vllm
0.0187
0.1026
0.2152
2.16··

FP4QuantPerGroupFwd

x: [*S, N]

dtype=bf16

  • dsv4-flash-idx-q-t1x: [1, 64, 128]inplace=true
  • dsv4-flash-idx-q-4kx: [4096, 64, 128]inplace=true
  • dsv4-flash-idx-q-32kx: [32768, 64, 128]inplace=true
  • dsv4-flash-idx-k-1kx: [1024, 128]inplace=true
  • dsv4-flash-idx-k-3000x: [3000, 128]inplace=true
  • dsv4-flash-q-4k-quantx: [4096, 64, 128]
Workload dtype Ratio Device time Alternatives Throughput SOL Bound
alt / ours ms name ms TFLOP/s of ceiling by
dsv4-flash-idx-q-t1bf161.94×0.00154torch-compile
tilekernels
torch-ref
0.00298
0.0128
0.0842
0.0275··
dsv4-flash-idx-q-4kbf163.88×0.0381torch-compile
tilekernels
torch-ref
0.1477
0.1855
3.6962
4.54··
dsv4-flash-idx-q-32kbf163.76×0.3011torch-compile
tilekernels
torch-ref
1.1334
1.4090
28.6393
4.6··
dsv4-flash-idx-k-1kbf166.26×0.00173torch-compile
tilekernels
torch-ref
0.0108
0.0131
0.0973
0.391··
dsv4-flash-idx-k-3000bf165.75×0.00192torch-compile
tilekernels
torch-ref
0.0110
0.0129
0.1129
1.03··
dsv4-flash-q-4k-quantbf163.15×0.0388torch-compile
tilekernels
torch-ref
0.1220
0.1424
3.0245
3.6··

INT4QuantPerGroupFwd

w: [N, K]

dtype=f16

  • llama-8b-mlp-upw: [14336, 4096]
  • llama-8b-q-projw: [4096, 4096]group_size=64
  • llama-70b-mlp-downw: [8192, 28672]
  • qwen3-32b-o-projw: [5120, 8192]
  • qwen2-7b-mlp-upw: [18944, 3584]
  • qwen2-7b-mlp-downw: [3584, 18944]
  • opt-13b-mlp-upw: [20480, 5120]group_size=64
  • llama-8b-mlp-up-chanw: [14336, 4096]group_size=4096
Workload dtype Ratio Device time Alternatives Throughput SOL Bound
alt / ours ms name ms TFLOP/s of ceiling by
llama-8b-mlp-upf161.51×0.0368deepspeed0.055611.3··
llama-8b-q-projf161.46×0.0114deepspeed0.016510.5··
llama-70b-mlp-downf161.49×0.1456deepspeed0.217511.4··
qwen3-32b-o-projf161.49×0.0267deepspeed0.039811.1··
qwen2-7b-mlp-upf161.52×0.0422deepspeed0.064111.3··
qwen2-7b-mlp-downf161.52×0.0422deepspeed0.064211.3··
opt-13b-mlp-upf161.45×0.0669deepspeed0.097011.1··
llama-8b-mlp-up-chanf161.43×0.0344deepspeed0.049211.9··

INT8DequantPerTensorFwd

q: [M, K], i8scale: [1], f32

  • llama-8b-prefillq: [4096, 4096], i8scale: [1], f32dtype=bf16
  • llama-8b-decodeq: [32, 4096], i8scale: [1], f32dtype=bf16
  • qwen3-32b-prefillq: [8192, 5120], i8scale: [1], f32dtype=f16, f32
  • gpt-oss-prefillq: [3000, 2880], i8scale: [1], f32dtype=bf16
  • ragged-k-few-rowsq: [17, 4099], i8scale: [1], f32dtype=f16

q: [M, K], i8scale: [1]

  • ragged-kq: [1000, 4099], i8scale: [1]dtype=f32
Workload dtype Ratio Device time Alternatives Throughput SOL Bound
alt / ours ms name ms TFLOP/s of ceiling by
llama-8b-prefillbf161.06×0.0122torch-compile
torch-ref
0.0129
0.1341
1.38··
llama-8b-decodebf161.12×0.00154torch-compile
torch-ref
0.00173
0.00733
0.0853··
qwen3-32b-prefillf161.04×0.0296torch-compile
torch-ref
0.0307
0.3270
1.42··
f321.01×0.0509torch-compile
torch-ref
0.0516
0.2683
0.824··
gpt-oss-prefillbf161.09×0.00682torch-compile
torch-ref
0.00741
0.0703
1.27··
ragged-k-few-rowsf161.05×0.00155torch-compile
torch-ref
0.00163
0.00723
0.0449··
ragged-kf321.01×0.00557torch-compile
torch-ref
0.00563
0.0260
0.736··

INT8DequantPerChannelFwd

q: [M, K], i8scale: [M], f32

  • llama-8b-mlp-upq: [14336, 4096], i8scale: [14336], f32dtype=bf16
  • llama-70b-mlp-downq: [8192, 28672], i8scale: [8192], f32dtype=bf16
  • gpt-oss-20b-mlp-upq: [5760, 2880], i8scale: [5760], f32dtype=bf16
  • ragged-kq: [3000, 4099], i8scale: [3000], f32dtype=f16
  • ragged-k-few-rowsq: [17, 4099], i8scale: [17], f32dtype=bf16

q: [M, K], i8scale: [M]

  • llama-8b-mlp-downq: [4096, 14336], i8scale: [4096]dtype=f32
Workload dtype Ratio Device time Alternatives Throughput SOL Bound
alt / ours ms name ms TFLOP/s of ceiling by
llama-8b-mlp-upbf161.06×0.0423torch-compile
torch-ref
0.0449
0.4713
1.39··
llama-70b-mlp-downbf161.05×0.1713torch-compile
torch-ref
0.1802
1.8562
1.37··
gpt-oss-20b-mlp-upbf161.02×0.0125torch-compile
torch-ref
0.0127
0.1373
1.33··
ragged-kf161.27×0.00973torch-compile
torch-ref
0.0124
0.1029
1.26··
ragged-k-few-rowsbf161.06×0.00154torch-compile
torch-ref
0.00163
0.00726
0.0454··
llama-8b-mlp-downf321.01×0.0725torch-compile
torch-ref
0.0732
0.3874
0.809··

INT8DequantPerBlockFwd

q: [M, K], i8scale: [M, ceil_div(K, 128)], f32

  • ds-v3-prefillq: [4096, 7168], i8scale: [4096, 56], f32dtype=bf16
  • ds-v3-decodeq: [64, 7168], i8scale: [64, 56], f32dtype=bf16
  • qwen3-235b-prefillq: [4096, 4096], i8scale: [4096, 32], f32dtype=f16
  • gpt-oss-prefillq: [3000, 2880], i8scale: [3000, 23], f32dtype=bf16
  • ragged-k-few-rowsq: [17, 4099], i8scale: [17, 33], f32dtype=f16

q: [M, K], i8scale: [M, ceil_div(K, 128)]

  • ragged-kq: [1000, 4099], i8scale: [1000, 33]dtype=f32
Workload dtype Ratio Device time Alternatives Throughput SOL Bound
alt / ours ms name ms TFLOP/s of ceiling by
ds-v3-prefillbf161.06×0.0208torch-compile
torch-ref
0.0220
0.2927
1.41··
ds-v3-decodebf161.13×0.0017torch-compile
torch-ref
0.00192
0.0105
0.27··
qwen3-235b-prefillf161.05×0.0123torch-compile
torch-ref
0.0129
0.1712
1.37··
gpt-oss-prefillbf162.12×0.00717torch-compile
torch-ref
0.0152
0.1006
1.21··
ragged-k-few-rowsf161.06×0.00157torch-compile
torch-ref
0.00166
0.00896
0.0444··
ragged-kf321.77×0.00579torch-compile
torch-ref
0.0102
0.0416
0.708··