pub struct MuonNsStep {
pub name: &'static str,
pub id: String,
pub transpose: bool,
pub block_m: i32,
pub block_n: i32,
pub block_k: i32,
pub group_m: i32,
pub kernel_source: String,
pub entry_point_source: String,
pub source: String,
}Expand description
One Newton-Schulz step (in-place): X ← a·X + b·(T·X) or X ← a·X + b·(X·T).
Both cases are expressed as A @ B (no explicit transpose on B) with unit
inner strides so TMA descriptors remain valid:
!TRANSPOSE(T·X): A = T[M, K], B = X[K, N], K = M.TRANSPOSE(X·T): A = X[M, K], B = T[K, N], K = N.
The GEMM result is fused with the elementwise update in one store.
stride_tm: row stride of T (= M for !TRANSPOSE, = N for TRANSPOSE).stride_xm = N(row-major X, always[M, N]).
Grid: [ceil(M/BLOCK_M) × ceil(N/BLOCK_N) grouped by GROUP_M, 1, 1].
Fields§
§name: &'static strThe kernel function’s name (e.g. "flash_attention2_forward").
id: StringUnique kernel identifier: fn_name + dtype(s) + const values joined by “__”.
transpose: boolCompile-time kernel constant, from the annotated fn’s const generics.
block_m: i32Compile-time kernel constant, from the annotated fn’s const generics.
block_n: i32Compile-time kernel constant, from the annotated fn’s const generics.
block_k: i32Compile-time kernel constant, from the annotated fn’s const generics.
group_m: i32Compile-time kernel constant, from the annotated fn’s const generics.
kernel_source: StringThe original kernel function source.
entry_point_source: StringThe Rust source of the generated C-ABI entry-point wrapper function.
source: StringCombined source (kernel_source + "\n\n" + entry_point_source); used by the Kernel trait.
Implementations§
Trait Implementations§
Source§impl Kernel for MuonNsStep
impl Kernel for MuonNsStep
Source§type Args<'__a> = (*mut f32, *mut f32, i32, i32, i32, i32, f32, f32)
type Args<'__a> = (*mut f32, *mut f32, i32, i32, i32, i32, f32, f32)
Source§fn kernel_source(&self) -> &str
fn kernel_source(&self) -> &str
Source§fn entry_point_source(&self) -> &str
fn entry_point_source(&self) -> &str
Source§fn entry_point_name(&self) -> String
fn entry_point_name(&self) -> String
"{name}_entry_point".