RoPE¶
5 ops, 34 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.
RoPEFwd¶
positions: [*S], i64query: [*S, head_size * Hq]key: [*S, head_size * Hk]
llama3-positions: [64], i64query: [64, 4096]key: [64, 1024]rotary_dim=128max_position_embeddings=8192base=500000is_neox_style=truedtype=bf16/i64/bf168b- decode- b64 llama3-positions: [4096], i64query: [4096, 4096]key: [4096, 1024]rotary_dim=128max_position_embeddings=8192base=500000is_neox_style=truedtype=bf16/i64/bf168b- prefill- 4k llama3-positions: [4096], i64query: [4096, 4096]key: [4096, 1024]rotary_dim=128max_position_embeddings=8192base=500000is_neox_style=trueinplace=truedtype=bf16/i64/bf168b- inplace- 4k llama3-positions: [2, 2048], i64query: [2, 2048, 4096]key: [2, 2048, 1024]rotary_dim=128max_position_embeddings=8192base=500000is_neox_style=truedtype=f32/i64/f328b- b2- 2k gptj-positions: [2048], i64query, key: [2048, 4096]rotary_dim=64max_position_embeddings=2048base=10000is_neox_style=falsedtype=f16/i64/f166b- prefill gptj-positions: [2048], i64query, key: [2048, 4096]rotary_dim=64max_position_embeddings=2048base=10000is_neox_style=falseinplace=truedtype=f16/i64/f166b- prefill- inplace gptj-positions: [32], i64query, key: [32, 4096]rotary_dim=64max_position_embeddings=2048base=10000is_neox_style=falsedtype=f16/i64/f166b- decode- b32
positions: [*S], i32query: [*S, head_size * Hq]key: [*S, head_size * Hk]
llama3-positions: [4096], i32query: [4096, 4096]key: [4096, 1024]rotary_dim=128max_position_embeddings=8192base=500000is_neox_style=truedtype=f16/i32/bf168b- prefill- 4k
positions: [*S], i32query: [*S, head_size * Hq]
phi-positions: [1000], i32query: [1000, 2560]rotary_dim=32max_position_embeddings=2048base=10000is_neox_style=truekey=Nonedtype=bf16/i32/bf162- query- only
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
llama3- | bf16/i64/bf16 | 2.06× | 0.00218 | torch-compilevllmtorch-ref | 0.00448 0.00477 0.0568 | 0.452 | · | · |
llama3- | bf16/i64/bf16 | 1.80× | 0.0210 | torch-compilevllmtorch-ref | 0.0378 0.0473 0.4297 | 3 | · | · |
llama3- | bf16/i64/bf16 | 1.84× | 0.0206 | torch-compilevllmtorch-ref | 0.0379 0.0474 0.4292 | 3.06 | · | · |
llama3- | f32/i64/f32 | 1.30× | 0.0396 | torch-compilevllmtorch-ref | 0.0517 0.0530 0.3343 | 1.59 | · | · |
gptj- | f16/i64/f16 | 0.84× | 0.0158 | vllmtorch-compiletorch-ref | 0.0134 0.0630 0.2137 | 0.794 | · | · |
gptj- | f16/i64/f16 | 2.41× | 0.00557 | vllmtorch-compiletorch-ref | 0.0134 0.0629 0.2138 | 2.26 | · | · |
gptj- | f16/i64/f16 | 1.26× | 0.00218 | torch-compilevllmtorch-ref | 0.00275 0.0031 0.0566 | 0.0903 | · | · |
llama3- | f16/i32/bf16 | 1.54× | 0.0210 | torch-compilevllmtorch-ref | 0.0324 0.0477 0.4413 | 2.99 | · | · |
phi- | bf16/i32/bf16 | 1.29× | 0.00413 | vllmtorch-compiletorch-ref | 0.00531 0.0089 0.0608 | 0.744 | · | · |
RoPELlama31Fwd¶
positions: [*S], i64query: [*S, head_size * Hq]key: [*S, head_size * Hk]
rotary_dim=128max_position_embeddings=131072base=500000is_neox_style=truescaling_factor=8low_freq_factor=1high_freq_factor=4orig_max_position=8192dtype=bf16/i64/bf16
llama3.1-positions: [64], i64query: [64, 4096]key: [64, 1024]8b- decode- b64 llama3.1-positions: [8192], i64query: [8192, 4096]key: [8192, 1024]8b- prefill- 8k
positions: [*S], i32query: [*S, head_size * Hq]key: [*S, head_size * Hk]
llama3.1-positions: [8192], i32query: [8192, 4096]key: [8192, 1024]rotary_dim=128max_position_embeddings=131072base=500000is_neox_style=truescaling_factor=8low_freq_factor=1high_freq_factor=4orig_max_position=8192dtype=f16/i32/bf168b- prefill- 8k
positions: [*S], i64query: [*S, head_size * Hq]
llama3.1-positions: [3000], i64query: [3000, 8192]rotary_dim=128max_position_embeddings=131072base=500000is_neox_style=truescaling_factor=8low_freq_factor=1high_freq_factor=4orig_max_position=8192key=Nonedtype=f32/i64/f3270b- query- 3k
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
llama3.1- | bf16/i64/bf16 | 2.00× | 0.00218 | torch-compilevllmtorch-ref | 0.00435 0.00477 0.0565 | 0.452 | · | · |
llama3.1- | bf16/i64/bf16 | 1.77× | 0.0412 | torch-compilevllmtorch-ref | 0.0728 0.0940 0.8175 | 3.06 | · | · |
llama3.1- | f16/i32/bf16 | 1.53× | 0.0412 | torch-compilevllmtorch-ref | 0.0631 0.0945 0.8297 | 3.06 | · | · |
llama3.1- | f32/i64/f32 | 1.24× | 0.0464 | torch-compilevllmtorch-ref | 0.0577 0.0596 0.3685 | 1.59 | · | · |
YaRNFwd¶
positions: [*S], i64query: [*S, head_size * Hq]key: [*S, head_size * Hk]
rotary_dim=128max_position_embeddings=32768base=1e+06is_neox_style=truescaling_factor=4dtype=bf16/i64/bf16
qwen2.5-positions: [64], i64query: [64, 3584]key: [64, 512]7b- decode- b64 qwen2.5-positions: [8192], i64query: [8192, 3584]key: [8192, 512]7b- prefill- 8k
positions: [*S], i32query: [*S, head_size * Hq]key: [*S, head_size * Hk]
qwen2.5-positions: [8192], i32query: [8192, 3584]key: [8192, 512]rotary_dim=128max_position_embeddings=32768base=1e+06is_neox_style=truescaling_factor=4dtype=f16/i32/bf167b- prefill- 8k
positions: [*S], i64query: [*S, head_size * Hq]
qwen2.5-positions: [3000], i64query: [3000, 3584]rotary_dim=128max_position_embeddings=32768base=1e+06is_neox_style=truescaling_factor=4key=Nonedtype=f32/i64/f327b- query- 3k
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
qwen2.5- | bf16/i64/bf16 | 2.11× | 0.00211 | torch-compilevllmtorch-ref | 0.00445 0.00477 0.0550 | 0.372 | · | · |
qwen2.5- | bf16/i64/bf16 | 1.76× | 0.0337 | torch-compilevllmtorch-ref | 0.0591 0.0805 0.6657 | 2.99 | · | · |
qwen2.5- | f16/i32/bf16 | 1.54× | 0.0336 | torch-compilevllmtorch-ref | 0.0518 0.0811 0.6780 | 3 | · | · |
qwen2.5- | f32/i64/f32 | 1.15× | 0.0208 | torch-compilevllmtorch-ref | 0.0240 0.0275 0.1693 | 1.55 | · | · |
LongRoPEFwd¶
positions, offsets: [N], i64query: [N, head_size * Hq]key: [N, head_size * Hk]
phi3-positions, offsets: [64], i64query, key: [64, 3072]rotary_dim=96max_position_embeddings=131072original_max_position_embeddings=4096base=10000is_neox_style=truerescale_factors=[1,1.65957,2.31915,2.97872…]dtype=bf16/i64/i64/bf16mini- 128k- decode
positions: [N], i64query: [N, head_size * Hq]key: [N, head_size * Hk]
phi3-positions: [4096], i64query, key: [4096, 3072]rotary_dim=96max_position_embeddings=131072original_max_position_embeddings=4096base=10000is_neox_style=truerescale_factors=[1,1.65957,2.31915,2.97872…]dtype=bf16/i64/bf16mini- 128k- prefill
positions: [N], i64query: [N, head_size * Hq]key: [N, head_size * Hk]offsets: [N], i32
phi3-positions: [64], i64query, key: [64, 3072]offsets: [64], i32rotary_dim=96max_position_embeddings=131072original_max_position_embeddings=4096base=10000is_neox_style=truerescale_factors=[1,1.65957,2.31915,2.97872…]dtype=f32/i64/i32/f32128k- decode- f32
positions: [N], i32query: [N, head_size * Hq]key: [N, head_size * Hk]
phi3-positions: [2048], i32query, key: [2048, 3072]rotary_dim=96max_position_embeddings=4096original_max_position_embeddings=4096base=10000is_neox_style=truedtype=f16/i32/f16mini- 4k- prefill
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
phi3- | bf16/i64/i64/bf16 | 1.31× | 0.0023 | torch-compilevllmtorch-ref | 0.00301 0.00541 0.0571 | 0.512 | · | · |
phi3- | bf16/i64/bf16 | 1.50× | 0.0256 | torch-compilevllmtorch-ref | 0.0384 0.0598 0.5236 | 2.95 | · | · |
phi3- | f32/i64/i32/f32 | 1.30× | 0.00243 | torch-compilevllmtorch-ref | 0.00317 0.0056 0.0390 | 0.485 | · | · |
phi3- | f16/i32/f16 | 1.23× | 0.0135 | torch-compilevllmtorch-ref | 0.0166 0.0295 0.2836 | 2.79 | · | · |
RoPECosSinFwd¶
x: [B, S, H, D]cos, sin: [P, Rh], f32
dtype=bf16/f32/f32
qwen3.6-x: [1, 4096, 16, 72]cos, sin: [4096, 36], f32vision- 4k qwen3.6-x: [1, 16384, 16, 72]cos, sin: [16384, 36], f32vision- 16k glm-x: [4, 2048, 96, 128]cos, sin: [8192, 32], f32seqlen_offsets=1024interleaved=truemax_seqlen=20484.5- partial glm-x: [1, 4096, 16, 64]cos, sin: [4096, 32], f325.3- vision qwen3.8-x: [1, 4096, 4, 128]cos, sin: [4096, 32], f32qsa- indexer dsv4-x: [1, 4096, 64, 64]cos, sin: [4096, 32], f32interleaved=trueinplace=trueflash- q- tail dsv4-x: [1, 4096, 1, 64]cos, sin: [4096, 32], f32interleaved=trueinplace=trueflash- kv- tail
x: [B, S, H, D]cos, sin: [P, Rh]
llama3-x: [4, 2048, 32, 128]cos, sin: [4096, 64]dtype=bf16/bf16/bf168b- prefill
x: [Tt, H, D]cos, sin: [P, Rh]cu_seqlens: [B + 1], i32
varlen-x: [5120, 32, 128]cos, sin: [4096, 64]cu_seqlens: [4], i32seq_lens=[1000,3000,1120]max_seqlen=3000inplace=truedtype=bf16/bf16/bf16/i32inplace
x: [Tt, H, D]cos, sin: [P, Rh]cu_seqlens: [B + 1], i64
varlen-x: [5120, 32, 128]cos, sin: [4096, 64]cu_seqlens: [4], i64seq_lens=[1000,3000,1120]max_seqlen=3000inplace=truedtype=f32/f32/f32/i64inplace
x: [B, S, H, D]cos, sin: [P, Rh], f32seqlen_offsets: [B], i32
llama3-x: [64, 1, 32, 128]cos, sin: [8192, 64], f32seqlen_offsets: [64], i32dtype=bf16/f32/f32/i328b- decode
x: [B, S, H, D]cos, sin: [P, Rh], f32seqlen_offsets: [B], i64
llama3-x: [64, 1, 32, 128]cos, sin: [8192, 64], f32seqlen_offsets: [64], i64dtype=bf16/f32/f32/i648b- decode
x: [Tt, H, D]cos, sin: [P, Rh]cu_seqlens: [B + 1], i32seqlen_offsets: [B], i32
varlen-x: [5120, 32, 128]cos, sin: [8192, 64]cu_seqlens: [4], i32seqlen_offsets: [3], i32seq_lens=[1000,3000,1120]max_seqlen=3000dtype=bf16/bf16/bf16/i32/i32offsets
| Workload | dtype | Ratio | Device time | Alternatives | Throughput | SOL | Bound | |
|---|---|---|---|---|---|---|---|---|
| alt / ours | ms | name | ms | TFLOP/s | of ceiling | by | ||
qwen3.6- | bf16/f32/f32 | 1.44× | 0.00646 | flash-attntorch-compiletorch-ref | 0.00931 0.0109 0.1015 | 2.19 | · | · |
qwen3.6- | bf16/f32/f32 | 1.50× | 0.0203 | flash-attntorch-compiletorch-ref | 0.0304 0.0505 0.4078 | 2.8 | · | · |
glm- | bf16/f32/f32 | 1.79× | 0.1069 | flash-attntorch-compiletorch-ref | 0.1911 0.3643 1.2387 | 1.41 | · | · |
glm- | bf16/f32/f32 | 1.05× | 0.00541 | flash-attntorch-compiletorch-ref | 0.00566 0.00762 0.0887 | 2.33 | · | · |
qwen3.8- | bf16/f32/f32 | 1.85× | 0.00394 | flash-attntorch-compiletorch-ref | 0.00726 0.00726 0.0468 | 0.799 | · | · |
dsv4- | bf16/f32/f32 | 1.04× | 0.0158 | flash-attntorch-compiletorch-ref | 0.0165 0.0576 0.3659 | 3.18 | · | · |
dsv4- | bf16/f32/f32 | 0.97× | 0.00202 | flash-attntorch-compiletorch-ref | 0.00195 0.00359 0.0333 | 0.39 | · | · |
llama3- | bf16/bf16/bf16 | 0.99× | 0.0313 | flash-attntorch-compiletorch-ref | 0.0309 0.0469 0.6250 | 3.22 | · | · |
varlen- | bf16/bf16/bf16/i32 | 1.00× | 0.0206 | flash-attntorch-compiletorch-ref | 0.0205 0.0776 0.4008 | 3.05 | · | · |
varlen- | f32/f32/f32/i64 | 1.02× | 0.0402 | flash-attntorch-compiletorch-ref | 0.0409 0.0925 0.2871 | 1.57 | · | · |
llama3- | bf16/f32/f32/i32 | 1.03× | 0.00221 | torch-compileflash-attntorch-ref | 0.00227 0.00301 0.0306 | 0.356 | · | · |
llama3- | bf16/f32/f32/i64 | 1.07× | 0.00224 | torch-compileflash-attntorch-ref | 0.0024 0.00301 0.0302 | 0.351 | · | · |
varlen- | bf16/bf16/bf16/i32/i32 | 1.02× | 0.0205 | flash-attntorch-compiletorch-ref | 0.0208 0.0468 0.4077 | 3.07 | · | · |