Skip to content

softmax is latency-bound, not bandwidth-bound: 362 GB/s ceiling and a flat 51us floor #47

Closed

Description

@feitreim

From #40's benchmark table (B200, 148 SMs):

softmax — rows x columns x planes
128x128x2        2 blocks    0.0508 ms      2.6 GB/s
512x128x2        8           0.0507        10.3
4096x128x2      64           0.0514        81.7
32768x128x2    512           0.1171       286.5
262144x128x2  4096           0.7749       346.4
524288x128x2  8192           1.4827       362.1

The floor is flat at ~51 us all the way out to 64 blocks. Adding 32x the work
costs nothing, which means the kernel is not doing any work worth measuring — it
is waiting. And 362 GB/s is far below what HBM3e on a B200 will do, so the
"memory-bound" label #40 was built around is wrong for this kernel as written.

Why

One tile per CTA, single-thread issue, and a blocking wait at both ends: the TMA
load completes before anything starts, and the TMA store completes before the
kernel exits. Nothing is ever in flight. Each CTA pays full memory latency
twice with no other work to hide it, and the flat floor is that latency, not
bandwidth.

This is a property of how the example is written, not of the library — the
pipeline primitives (SharedTileRing, SemaphoreRing) exist and the GEMM uses
them to good effect. Softmax simply does not.

What would fix it

  • Multiple tiles per CTA, pipelined through SharedTileRing, so a load is in
    flight while the previous tile is being reduced.
  • Overlap the store with the next tile's load rather than waiting on it — this
    is exactly tma_store_wait_read versus tma_store_wait (TMA store path #9 exposed both), and
    exactly lcsf and the rest of the prototype layer #15's lcsf motivation.

Worth doing, and worth doing carefully

The value here is not a faster softmax — it is that this is the first
performance finding this project has produced from measurement rather than from
reading ThunderKittens
, and the fix exercises the pipeline layer against a
kernel whose current numbers are known. Whatever lands should be re-measured
against the table above, and #40's harness makes that one command.

Note also that % of peak cannot be reported for GB/s today: the NVIDIA HGX B200
page states flops per GPU but not HBM bandwidth per GPU, so #40 deliberately
prints no ratio rather than an unsourced one. Sourcing a bandwidth figure would
make this issue's target concrete.

Related: #15 (lcsf), #40 (the harness and the numbers).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compute

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions