Skip to content

An fp32 band cannot reach a shared staging tile, so an fp32 epilogue is stuck on the pre-#116 drain #174

Closed

Description

@feitreim

store_shared_rows and accumulate_shared_rows are generic over their element and would take a
SharedTile<F32, …> happily. Nothing can fill one: ldst::store_tile and store_tile_x4 both
bound E: Element<Unpacked = [f32; 2]> because they are stmatrix, which moves b16 matrices and
nothing else. So an fp32 accumulator band has no route into shared memory, and an fp32 epilogue is
stuck on store_rows' per-value scattered stores — the shape #116 measured at 20.43 µs/tile
against the staged route's 6.68.

What it costs, measured

feitreim/oxide-train's tcgen05 GEMM has bf16-C and fp32-C entry points over one compute
pipeline, so the difference between them is the epilogue and nothing else. B200, mean of 20
launches after 5 warm-ups, both divided by cuBLASLt in the same process on the same stream:

shape bf16 C (staged drain) fp32 C (register drain)
4096³ 1291.8 TFLOP/s, 0.783 of cuBLASLt 1050.6, 0.636
8192³ 1744.6 TFLOP/s, 0.914 of cuBLASLt 1356.1, 0.710
16384³ 1662.5 TFLOP/s, 0.910 of cuBLASLt 1527.0, 0.836

An fp32 C is twice the bytes, so some of that is real traffic — but #114's HotStore result says
the epilogue is not bandwidth-bound (deleting a gigabyte of streaming HBM writes is worth ≤1.2%),
which puts the gap on the store's shape: st.global.v2.f32 on 8 discontiguous runs against
st.global.v4.b32 on 4 contiguous ones.

Proposed

A plain, non-stmatrix store_tile over SwizzledChunks, generic in E: each lane writes its own
values at the coordinates RegTile::coordinate gives it, into the swizzled tile rather than into
global memory. It is global::store_rows' loop with a SwizzledChunks::at where the GlobalRows::at
is, and it needs no new instruction — an fp32 element's shared-memory write is an ordinary
st.shared.b32.

That would let an fp32 epilogue be the same two calls the bf16 one is
(store_tile → store_shared_rows / accumulate_shared_rows), trading 64 scattered global
stores a thread for 64 scattered shared ones plus 16 contiguous 16-byte global accesses — which is
exactly the trade #116 measured at −19% on the epilogue for bf16.

Unmeasured, so the number above is a bound on the prize and not a prediction. The honest version of
the claim is that the fp32 rows are on the drain shape the bf16 rows stopped using in #116, and
nothing in the library lets them off it.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions