vllm.model_executor.kernels.mhc.triton
¶
Functions:
-
hc_collapse_triton–Collapse BF16 residual streams with FP32 pre-mix coefficients.
-
mhc_post_collapse_rms_norm_triton–The layer-input half of a delayed mHC seam, without the gate projection.
-
mhc_pre_mix_triton–Pre-mix gate for the delayed mHC pre, from AITER's split-k GEMM output.
-
rmsnorm_nw–Weight-free RMSNorm over the last dimension.
_hc_head_triton(hs_flat, fn, hc_scale, hc_base, out, hidden_size, rms_eps, hc_eps, hc_mult)
¶
Fill pre-allocated out (T, H) in-place with the hc_head result.
Source code in vllm/model_executor/kernels/mhc/triton.py
_mhc_post_collapse_rms_norm_kernel(residual_ptr, x_ptr, post_mix_ptr, comb_mix_ptr, pre_mix_ptr, weight_ptr, residual_out_ptr, out_ptr, norm_eps, H, BLOCK_H)
¶
The post-mix and collapse keep the expression order of aiter's
_mhc_fused_post_pre_delayed_rmsnorm_main_kernel, so the new residual is
bit-identical to it.
Source code in vllm/model_executor/kernels/mhc/triton.py
_mhc_pre_mix_kernel(gemm_ptr, sqrsum_ptr, hc_scale_ptr, hc_base_ptr, out_ptr, splitk, hc_mult, gemm_stride_k, gemm_stride_t, gemm_stride_j, sqrsum_stride_k, sqrsum_stride_t, out_stride_t, out_stride_j, inv_hc_hidden, rms_eps, hc_pre_eps, SPLITK_BLOCK, HC_BLOCK)
¶
Recover the pre-mix gate from a split-k mHC pre GEMM output.
Source code in vllm/model_executor/kernels/mhc/triton.py
_rmsnorm_nw_kernel(x_ptr, out_ptr, stride_row, D, eps, RBLOCK)
¶
Weight-free RMSNorm Triton kernel: out = x * rsqrt(mean(x², -1) + eps).
Source code in vllm/model_executor/kernels/mhc/triton.py
hc_collapse_triton(x, pre_mix)
¶
Collapse BF16 residual streams with FP32 pre-mix coefficients.
Source code in vllm/model_executor/kernels/mhc/triton.py
mhc_post_collapse_rms_norm_triton(residual, sublayer_out, post_layer_mix, comb_res_mix, pre_mix, norm_weight, norm_eps)
¶
The layer-input half of a delayed mHC seam, without the gate projection.
Applies the post block and returns the new residual and the RMSNorm of its
collapse with the carried pre_mix, which is what
mhc_fused_post_pre_delayed_rms_norm_aiter returns besides the gates.
Parameters:
-
(residual¶Tensor) –[T, 4, H] bf16 residual streams entering the seam.
-
(sublayer_out¶Tensor) –[T, H] bf16 output of the sublayer before the seam.
-
(post_layer_mix¶Tensor) –[T, 4, 1] fp32 post gate of the previous seam.
-
(comb_res_mix¶Tensor) –[T, 4, 4] fp32 residual comb of the previous seam.
-
(pre_mix¶Tensor) –[T, 4] fp32 pre gate carried from the previous seam.
-
(norm_weight¶Tensor) –[H] RMSNorm weight.
-
(norm_eps¶float) –RMSNorm epsilon.
Returns:
Source code in vllm/model_executor/kernels/mhc/triton.py
mhc_pre_mix_triton(gemm_out, sqrsum, hc_scale, hc_base, hc_mult, hc_hidden_size, rms_eps, hc_pre_eps)
¶
Pre-mix gate for the delayed mHC pre, from AITER's split-k GEMM output.
AITER's mhc_pre_big_fuse consumes the unreduced [splitk, tokens,
hc_mult3] GEMM output and the matching row square-sums, but only returns
the post and comb gates. The delayed formulation also needs the pre gate,
to carry into the next sublayer seam. It is the same slice of the same
numbers, so recover it here rather than repeating the projection.
Source code in vllm/model_executor/kernels/mhc/triton.py
rmsnorm_nw(x, eps)
¶
Weight-free RMSNorm over the last dimension.
Treats x as [num_rows, D] where num_rows = product(shape[:-1]).
Returns a contiguous tensor with the same shape and dtype as x.