nemo_automodel.components.models.minimax_m3_vl.kernels.msa_backward_postprocess_sm100
nemo_automodel.components.models.minimax_m3_vl.kernels.msa_backward_postprocess_sm100
Gradient finalize for the MiniMax M3 MSA SM100 backward (one launch).
- dQ: the main kernel accumulates dQ with packed 16-bit atomics (
DQ_ACCUM_DTYPE) either into a head-pair interleaved pool[T, Hq/2, D, 2]— de-interleaved here: pool row(t, hp)of 256 elements becomes rows2hpand2hp + 1of the BF16[T, Hq, D]gradient (16-byte loads, 8-byte stores) — or into a plain[T, Hq, D]pool, which is cast in place (16-byte loads and stores). One warp per 256-element pool row. - dK/dV: the FP32 pool is cast to BF16 (2048 elements per CTA, 16-byte loads/stores).
Grid [max(dq_blocks, kv_blocks), 2]: blockIdx.y == 0 does 8 dQ rows, 1 does one
2048-element dK/dV chunk; both roles are predicated on their own extents.
Module Contents
Classes
Functions
Data
API
rows_per_cta
vals_per_thread
Compile the finalize once per dQ pool dtype and layout.
Cast the accumulation pools to the BF16 gradients in one launch.
Parameters:
dq_pool
Contiguous 16-bit [T, Hq/2, D, 2] head-pair pool, or a plain [T, Hq, D] pool.
dq_out
Contiguous BF16 [T, Hq, D] written in place.
kv_pool
Contiguous FP32 [N] dK/dV pool, N a multiple of 2048.
kv_out
Contiguous BF16 [N] written in place.