pub fn glm_hc_pre(
gpu: &dyn GpuBackend,
kernels: &Glm5NextMhcKernels,
streams: DevicePtr,
w: &Glm5NextMhcSiteWeights,
y_out: DevicePtr,
post_out: DevicePtr,
comb_out: DevicePtr,
num_tokens: u32,
hidden_size: u32,
hc_mult: u32,
sinkhorn_iters: u32,
norm_eps: f32,
hc_eps: f32,
stream: u64,
) -> Result<()>Expand description
hc_pre: collapse the hc_mult FP32 streams to one BF16 sequence and emit this site’s
post / comb mixing coefficients.
🪤 Named glm_hc_pre, not hc_pre: ops already exports DeepSeek-V4’s hc_pre/hc_post
through a glob, and the two are NOT interchangeable — V4’s reads hc_head.{fn,base,scale}
and uses a different mixing law. The rename is the compiler-enforced version of this
module’s “never silently fall back onto the DeepSeek variant” rule; a glob collision here
resolved the wrong way would be a silent architecture swap.
The residual that glm_hc_post mixes is the stream tensor as it entered here — snapshot it
before calling, which is the skeleton’s ResidualStep::SaveResidual. Overwriting the streams
in place before hc_post runs silently changes what the residual means.