Skip to content

Router fp32 kernels run ~30x off bandwidth-bound at D=3072 #44

Closed

Description

@feitreim

Router fp32 kernels run ~30× off bandwidth-bound at D=3072

Profile (B200, L=12 B=8 T=2048 D=3072 E=8 K=2, §10.1; 12-block sums):

span ms ideal (HBM-bound) gap
forward.router.logits 12.69 ≈ 0.4 ms (reads N·D fp32 ×12 ≈ 2.4 GB) ~30×
backward.router.weight 11.29 ≈ 0.4 ms (same X traffic) ~28×
backward.router.input 5.03 ≈ 0.15 ms (writes N·D ×12) ~33×

Combined ≈ 29 ms of the ~410 ms non-attention step (7%) for GEMMs that are, by FLOPs, a rounding error ([N,3072]×[3072,8]).

The routing-stays-fp32 rule (8b) is correct and not in question — the problem is kernel shape:

  • router_logits launches grid=(N,1,1), block=(E,1,1) — eight threads per CTA, each striding the full D=3072 row. Occupancy and coalescing are both wrecked; the cost is pure launch geometry, not precision.
  • router_backward_input is one thread per (token, d) doing an E-wide dot; same per-thread serial-stride pattern over router[D,E].
  • router_backward_weight_tiled was already rescued once (8d follow-up, 4.89 → 0.92 ms/block at D=1536) but its fixed 2×8-tile/16-partition geometry hasn't been re-sized for D=3072; it's back to ~0.94 ms/block.

Sketch

  • router_logits: warp (or CTA tile) per token — coalesced D-row loads, warp-reduce the 8 dots; or simply route it through the existing fp32 register-tiled GEMM (gemm_into) which already handles skinny-N shapes far better than 8-thread blocks.
  • router_backward_input: vectorized thread-per-(token,d) with the E=8 dlogits row staged in shared/registers per CTA (it's 32 bytes — broadcast, don't re-read).
  • router_backward_weight_tiled: re-derive tile/partition constants for D=3072 (SWEEP harness), or fold into the same skinny-GEMM path as logits.

All three stay fp32 end-to-end.

Gates

  • Router parity in the MoE model gate (exact fp32 comparisons on logits/top-k unchanged — routing decisions must not move).
  • §10.1 same-container profile: the three spans combined from ≈ 29 ms to low single digits.
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions