pack_weight_sfb

Function pack_weight_sfb 

Source
pub fn pack_weight_sfb(
    scale_in: u64,
    scale_out: u64,
    n: u32,
    k: u32,
    src_n_major: bool,
    stream: u64,
) -> Result<()>
Expand description

2026-09-25: Swizzle an E4M3 weight scale into the CUTLASS SFB layout (tile_atom_to_shape_SFB, ue4m3) that the grouped GEMM reads. The layout depends only on n and k, so it is built once per expert at load (MoeLayer::build_cutlass_grouped_sfb). scale_out must hold the whole swizzled region.

src_n_major selects the source layout: false reads [K/16,N], true reads [N,K/16]. The output is the same either way.