| matmul |
✓ |
✓ |
✓ |
plain row-major A @ B (no bias); dtype-dispatched FP32 + FP16 (FP32 accumulation); backward returns dA/dB (caller zeros, op accumulates; FP16 uses FP32 scratch + fold) |
| matmul_int8w_fp16 |
— |
— |
✓ |
W8A16 weight-only matmul; INT8 weights + per-row FP32 scales, FP16 acts, FP32 accum |
| linear_batched_int8w_fp16 |
— |
— |
✓ |
W8A16 batched linear in (B,in)→(B,out) layout; fused FP16 bias add; mirrors linear_forward_batched_fp16 shape contract; WMMA fast path for K%8==0 (FP16 tensor cores with INT8→FP16 dequant on shared-mem load), tiled fallback otherwise |
| linear |
✓ |
✓ |
✓ |
dense; FP32 single + batched (fwd/bwd), FP16 batched-inference and batched-train backward (dtype-dispatched, FP32 scratch + fold) |
| relu / tanh / sigmoid |
✓ |
✓ |
— |
elementwise; relu/tanh also have batched fwd+bwd |
| silu / gelu |
✓ |
✓ |
✓ |
tanh-approx GELU; dtype-dispatched (FP16 bwd accumulates in FP32) |
| gelu_exact |
✓ |
✓ |
✓ |
0.5*x*(1+erf(x/√2)), exact PyTorch/diffusers default |
| quick_gelu |
✓ |
✓ |
✓ |
x * sigmoid(1.702*x), OpenAI CLIP activation |
| geglu |
✓ |
✓ |
✓ |
gated GELU (SD FFN); FP32+FP16 fwd/bwd, dtype-dispatched |
| geglu_exact |
✓ |
✓ |
✓ |
gated exact-GELU FFN, matches diffusers GEGLU |
| swiglu |
✓ |
✓ |
✓ |
gated SiLU FFN (Llama-style); dtype-dispatched FP32 + FP16 |
| add / scale / mul_inplace |
✓ |
n/a |
✓ |
dtype-dispatched |
| clamp |
✓ |
n/a |
✓ |
in-place min/max, dtype-dispatched (VAE epilogue) |
| sin / cos / rsqrt |
✓ |
✓ |
✓ |
elementwise (Fourier features, demod/pixel-norm reciprocal-sqrt); GPU dtype-dispatched FP32/FP16/BF16 (FP32 math) |
| threshold_u8 |
✓ |
n/a |
✓ |
binary threshold → INT8 byte mask (SAM AMG mask binarization); FP32/FP16 input; CPU + CUDA (Metal slot null) |
| build_slot_mask |
✓ |
n/a |
— |
device-side validity mask construction |
| softmax |
✓ |
✓ |
— |
masked, numerically stable |
| layernorm |
✓ |
✓ |
✓ |
FP32 single + batched-infer; FP16 batched-infer + backward (dtype-dispatched, FP32 scratch + fold for dGamma/dBeta) |
| rms_norm |
✓ |
✓ |
✓ |
y = x * gamma / sqrt(mean(x²) + eps); dtype-dispatched FP32 + FP16 (FP16 bwd uses FP32 scratch + fold for dGamma) |
| group_norm |
✓ |
✓ |
✓ |
NCHW, per-group stats; dtype-dispatched fwd+bwd (FP16 bwd accumulates in FP32) |
| pixel_norm |
✓ |
✓ |
✓ |
StyleGAN normalize_2nd_moment row normalize; GPU dtype-dispatched FP32/FP16/BF16 |
| attention (single-head) |
✓ |
✓ |
— |
|
| mha (multi-head) |
✓ |
✓ |
— |
|
| self_attention |
✓ |
✓ |
✓ |
FP32 = training (caches exposed via _train); FP16 = flash inference |
| cross_attention |
✓ |
✓ |
✓ |
FP32 = training (caches exposed via _train, rectangular Wk/Wv); FP16 = flash inference |
| flash_attention |
— |
✓ |
✓ |
tiled online-softmax, Lk-unbounded, optional causal; FP16 backward via recompute returns dQ/dK/dV (no fwd-time caches). Bare-core bwd enables LoRA training when projections live outside the attention call. |
| flash_attention_qkvo |
— |
— |
✓ (fwd) / ✓ (bwd) |
fused Q/K/V/O projections + biases; rectangular Wk/Wv for cross-attn; optional causal; verified at SD1.5 U-Net head_dims (40/80/160) and CLIP head_dim 64. FP16 backward via recompute (no fwd-time caches); registered on CUDA and Metal (and the FP32 path on CPU). W8A16 variant (flash_attention_qkvo_int8w_fp16) routes all four projections through linear_forward_batched_int8w_fp16; attention core stays FP16 |
| flash_attention_varlen |
— |
✓ (bwd) |
✓ |
packed variable-length MHA (Qwen-VL window attn); per-sequence boundaries from cu_seqlens INT32 prefix-sum buffers; optional per-sequence causal; recompute-based backward returns dQ/dK/dV |
| flash_attention_windowed |
✓ |
— |
— |
sliding-window causal self-attention (streaming codecs / decode); window ≤ 0 is unbounded causal; FP32 (CPU + GPU) |
| flash_attention_project_kv |
— |
— |
✓ |
pre-project ctx → K/V for cached cross-attention (SD timesteps reuse). W8A16 variant available |
| flash_attention_q_with_kv_cached |
— |
— |
✓ |
forward against pre-projected K/V; bitwise-equivalent to flash_attention_qkvo's cached path. W8A16 variant available |
| flash_attention_decode |
— |
— |
✓ |
causal-aware decode against a partially-filled K/V cache; supports L_q ≥ 1 (token-by-token or chunked). Masked variant flash_attention_decode_masked (per-key FP32 validity mask) on CPU + CUDA |
| kv_cache_append |
— |
— |
✓ |
append L_new projected K/V rows into a pre-allocated L_max cache at cur_len |
| rope |
✓ |
✓ |
✓ |
rotary position embedding; pair-wise rotation per head_dim chunk, seq_offset for KV-cache decode |
| resblock |
— |
✓ (bwd) |
✓ |
fused diffusion ResBlock (GN→SiLU→conv ×2 + skip); FP16 backward via composition of public ops (recomputes h1/h2/h3; no fwd-time caches) |
| conv2d |
✓ |
✓ |
✓ |
NCHW, stride/pad/dil; groups ≥ 1 (depthwise supported); backward (dX, dW, dB) dtype-dispatched (FP32+FP16; FP16 dW/dB use FP32 scratch + fold) |
| conv2d_int8w_fp16 |
— |
— |
✓ |
W8A16 weight-only conv2d; INT8 OIHW filter + per-output-channel FP32 scales, FP16 acts; CUDA WMMA fast path for 3x3 s1, 1x1 s1, 3x3 s2 (groups=1, dil=1) — naive fallback otherwise (incl. low-CTA long-K shapes) |
| deform_conv2d |
✓ |
— |
✓ |
torchvision deform_conv2d v2 (modulated deformable, bilinear per-tap offsets), forward-only; FP32/FP16, FP32 accumulation |
| modulated_conv2d |
✓ |
✓ |
✓ |
StyleGAN synthesis core: per-sample style modulation + optional demodulation + conv2d; dW optional (skippable for inversion); GPU dtype-dispatched FP32/FP16/BF16, FP32 reductions |
| upfirdn2d |
✓ |
✓ |
✓ |
upsample → pad/crop → 2D FIR → downsample (StyleGAN3, incl. non-separable config-R radial filters); backward is upfirdn2d with up/down swapped; GPU FP32/FP16/BF16, FP32 filter math |
| bias_act |
✓ |
✓ |
✓ |
fused per-channel bias + activation (linear/lrelu) + gain + clamp; GPU FP32/FP16/BF16 (FP32 math, FP32-scratch dB) |
| filtered_lrelu |
✓ |
✓ |
✓ |
alias-free nonlinearity (bias → upsample → lrelu → downsample); fused CUDA kernel + device-agnostic composite over bias_act/upfirdn2d (the path on CPU/Metal and for uncovered CUDA configs) |
| lstm |
✓ |
✓ |
— |
single-layer training LSTM + full BPTT (PyTorch nn.LSTM weight layout, gate order i|f|g|o); FP32 on all three backends |
| upsample_nearest_2x |
✓ |
✓ |
✓ |
backward dtype-dispatched (FP32+FP16) |
| upsample_bilinear_2x |
✓ |
✓ |
✓ |
align_corners=False; backward dtype-dispatched (FP32+FP16; FP16 uses FP32 scratch + fold) |
| downsample_avg_2x |
✓ |
✓ |
✓ |
stride 2, kernel 2; backward dtype-dispatched (FP32+FP16) |
| nchw ↔ sequence transpose |
✓ |
n/a |
✓ |
gather/scatter between NCHW and (L,D) layouts |
| embedding lookup |
✓ |
✓ |
✓ |
FP32/FP16 table dispatch; backward dtype-dispatched (FP16 uses FP32 scratch + fold for atomic-add safety) |
| concat_rows / split_rows |
✓ |
✓ |
✓ |
flat byte-aware concat (FP16 supported) |
| concat_batched_rows |
✓ |
n/a |
✓ |
per-row column-block concat via 2D memcpy |
| concat_nchw_channels |
✓ |
✓ |
✓ |
channel-axis concat for U-Net skip merges (N≥1); backward is per-part scatter (overwrites parts) |
| masked_mean_pool |
✓ |
✓ |
— |
row-wise mean over valid mask |
| sum_rows / sum_cols |
✓ |
n/a |
✓ |
reductions along rows/cols; dtype-dispatched FP32 + FP16 |
| argmax_rows |
✓ |
n/a |
✓ |
per-row argmax; FP32/FP16 input, FP32 indices |
| rows_count_above |
✓ |
n/a |
✓ |
per-row above-threshold counts at two thresholds in one pass → (R,2) INT32 (SAM AMG stability score); FP32/FP16 input; CPU + CUDA (Metal slot null) |
| ddim_step |
— |
n/a |
✓ |
fused DDIM sampler step over FP16 latents; FP32 internal math |
| euler_step |
— |
n/a |
✓ |
fused Euler-discrete step (ε-prediction, σ convention; matches diffusers EulerDiscreteScheduler) |
| dpmpp_2m_step |
— |
n/a |
✓ |
fused DPM-Solver++ 2M multistep update; caller supplies linear-combo coefficients and x0 cache. First step falls back to euler_step |
| timestep_embedding |
✓ |
n/a |
— |
sinusoidal embedding (FP32) for diffusion timesteps and SDXL added-cond micro-conditioning; diffusers default (flip_sin_to_cos=True) |
| copy_d2d |
✓ |
n/a |
✓ |
flat-buffer device-to-device chunk copy. Strided variant copy_d2d_strided (pitched 2D copy, e.g. NCHW W-axis pad/unpad) on CPU + CUDA |
| build_causal_mask_row |
n/a |
n/a |
✓ |
length-L FP32 mask, CLIP text |
| sgd / adam |
✓ |
n/a |
— |
optimizer steps |
| mse / softmax-xent / bce |
✓ |
✓ |
— |
per-sample + batched (BCE-with-logits fused-batched added) |
| conv3d |
✓ |
— |
✓ |
NCTHW (forward only), grouped, FP32/FP16/BF16; W8A16 conv3d_int8w_fp16 for Qwen-VL patch-embed (GPU-only) |
| conv_transpose1d / 2d |
✓ |
✓ |
— |
learned upsample (vocoders, SAM mask decoder, DPT heads); FP32 on CPU+CUDA |
| batch_norm |
✓ |
✓ |
✓ (inference) |
NCHW train/infer/bwd, running stats (pretrained ResNet/DETR backbones); training fwd + bwd FP32-only; inference fwd dtype-dispatched FP32/FP16/BF16 (FP32 math per element) |
| l2_norm / l2_normalize_nchw |
✓ |
✓ (l2_norm) |
✓ |
per-head q/k L2 (Gated DeltaNet) + channel-axis NCHW normalize (DSINE normals); FP32/FP16/BF16 |
| gated_delta_rule |
✓ |
n/a |
✓ |
chunked prefill + streaming step (linear-attention text decoders); FP32/FP16, FP32 accumulators |
| rope_apply / rope_apply_perhead / rope_apply_mrope |
✓ |
✓ (apply) |
✓ |
explicit cos/sin tables (2D axial RoPE), head-shared or per-head; + Qwen-VL three-axis M-RoPE; FP32/FP16/BF16 (perhead/mrope are inference-only, no bwd) |
| self_attention_bias |
✓ |
n/a |
✓ |
additive pre-softmax bias (T5 rel-pos / ALiBi); FP32/FP16/BF16; W8A16 variant GPU-only |
| decomposed_rel_pos (± windowed) |
✓ |
n/a |
✓ |
SAM/ViTDet data-dependent 2D rel-pos attention; FP32/FP16/BF16 |
| modulate / broadcast_mul |
✓ |
n/a |
✓ |
AdaLN affine + per-channel gate (DiT/SD3/Flux); FP32/FP16/BF16 |
| pad2d / slice2d / unfold2d |
✓ |
✓ (pad/slice) |
✓ |
image pad (zero/reflect/replicate), crop, neighborhood im2col |
| window_partition / spatial_merge |
✓ |
n/a |
✓ |
SAM window tiling (+ reverse) and 2×2 patch merge (Qwen-VL block-major / pixel_unshuffle channel-major, e.g. Flux.2 VAE) |
| interp2d / convex_upsample |
✓ |
✓ (interp) |
✓ |
arbitrary-scale resize (nearest/bilinear/bicubic, half-pixel + align-corners) + RAFT convex upsample |
| max_pool2d / adaptive_avg_pool2d |
✓ |
✓ |
— |
indexed max-pool bwd + PyTorch adaptive avg pool; FP32 (CPU+CUDA) |
| gather_rows / scatter_rows / scatter_rows_add |
✓ |
✓ |
— |
index-driven row gather + scatter (overwrite / accumulate) (SAM prompt encoder, DETR queries); FP32 |
| top_k_rows |
✓ |
n/a |
— |
per-row top-k values + indices; FP32 |
| randn / rand_uniform / rand_bernoulli / randn_truncated |
✓ |
n/a |
— |
Philox 4×32-10 RNG, PyTorch/JAX-compatible, FP32, all three backends |
| GGUF Q4_K / Q6_K / Q8_0 |
— |
— |
✓ |
block-quant dequant + fused GEMV + batched matmul (W4/6/8-A16); CUDA WMMA fast paths, GEMV fallback; registered on CUDA and Metal |