Skip to content

Intermittent dropped K contributions in the memory-mma microkernel after #508/#512 (Metal, quantized staged mma, wide lines) #515

Description

@louisfd

Intermittent dropped contributions in the memory-mma microkernel after #508/#512 (Metal)

Between 331f9c0 and 12de0a3 (#508 "Optimize memory MMA register leaf" + #512
"Read a spanning operand at the accumulator cell", which land as one buildable
unit), a staged quantized mma on a memory leaf started returning wrong results
intermittently on Metal (wgpu/MSL, M2 Pro).

Shape: x[64, 512] @ W_q4[512, 8192] — W packed-u32 Q4F, per-block [32]
f32 scales, DequantAt::Read, one staged level (K walked in tiles), an N plane
level below. Line width on the weight > 1 (the narrow-line rows=1 decode
shape does NOT reproduce).

Symptom: ~60% of runs, large contiguous output regions come out low by a
large factor (partial K accumulation), e.g. 75.83 != 124.17 from one position
onward, 300k+ elements. The other ~40% of runs are exactly correct.

Ruled out: MemoryMmaConfig knobs (unroll 1 vs 16, edge split, lane
fanout — no effect); operand residence (fails with [Smem] and with all
in-place); the caller's scheme (unchanged across the regression window).
cubek's own quant copy/matmul tests stay green — they don't cover this shape.

Stable before: the same caller code (modulo the mechanical
Leaf/arg/residence port) was repeatedly green against 331f9c0.

Repro lives in metabolic: cargo test -p metabolic-extension --features metal --test correctness gemv_quantized_vectorized (currently #[ignore]d with this
regression named; flip it back on to reproduce).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions