Skip to content

When a tile walk loses: the occupancy pole of the idiom, measured #222

Closed

Description

@feitreim

oxide-train PR #124 (the first kittens conversion pass over its ops kernels) produced a clean negative worth owning in the library: rms_norm_forward_tile_bf16 — a faithful tile-walk rewrite of a block-per-row norm — measured +7–14% worse across six runs, one sign, and was reverted.

The mechanism: at 24 registers the block-per-row form holds 8×256 threads/SM; the tile form's natural 128-thread shape holds 8×128. Both arms issue identical bytes (the kernel runs at 1.8 TB/s, 23% of peak — latency-bound, not bandwidth- or barrier-bound), so the rewrite halved the latency-hiding threads to buy wider per-lane loads and had nothing to pay for it with. An oxide-train doc comment predicted exactly this and was vindicated by the measurement.

This is the opposite pole from this repo's own groupnorm result (#181-era: 594→5,996 GB/s, 10×), where the kernel was frame/spill-bound and chunked tile streaming was the cure. Together the two measurements define the boundary:

  • frame/spill/depot-bound → tile walk / chunked streaming wins (groupnorm, layernorm_rows)
  • latency-bound at low achieved GB/s with identical bytes → occupancy wins; the tile form's thread shape is the cost (rms forward)
  • decide by computing achieved GB/s and threads/SM before rewriting — idiom is not a cause

Two possible dispositions, either or both:

  1. Docs: record the boundary in the library docs where the walk idiom is taught, with both measured poles.
  2. API: investigate whether the walk machinery can express a narrow-per-lane, high-occupancy form (256+ threads/block, fewer elements per lane), which would make the idiom occupancy-neutral and dissolve the trade instead of documenting it.

Full numbers and the reverted kernel are in oxide-train PR #124; the same pass also shipped a successful tile conversion (the fused RMSNorm backward, neutral-on-speed, large code-quality win) — the idiom is fine, the thread-shape coupling is the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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