CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / evidence / amd-speed-20261114 / raw / amd-kernel-speed / model / RANKING.md
| 1 | # Rung 2, step 1: bytes, floors and ranking per dispatch class (MODELED) |
| 2 | |
| 3 | Subject: CUDApp `dc536882c06a692991be97dc65cd2d037d82b129`, the native plan `real2.plan` |
| 4 | (sha256 `2a292dadc236f224005ed4e2d8ac2ba8b33dc71d79dabcc8497d177561f9c012`, 1,126 dispatches per step), |
| 5 | Qwen/Qwen3.8-27B-FP8 revision `017b9c7af6b5689d5dd426a76e0bc077eb5ca20a`, one MI300X, 5.3 TB/s (AMD's figure). |
| 6 | |
| 7 | ## How the numbers were made |
| 8 | |
| 9 | - `classes.py` rebuilds the step's dispatch list from `oracle/driver-real2.py` `Card.emit` and the checkpoint's own |
| 10 | safetensors headers (fetched by HTTP range, `headers/FETCHED.json`; no weight bytes read). It asserts the per-kernel |
| 11 | dispatch counts equal the published `real2.plan.json` `by_kernel` and the total equals 1,126. Output: `classes.tsv`. |
| 12 | - The same plan was re-emitted on the Mac from header-only stub files with the repository's own `emit-plan.py`; |
| 13 | its sha256 equals the plan the card ran (`2a292dad…`). So the measurement plans below derive from the exact plan. |
| 14 | - Every division below is Wolfram (`WolframLanguageEvaluator`, queries in `wolfram-queries.md`). |
| 15 | |
| 16 | ## Correction to the stated floor |
| 17 | |
| 18 | The task gives the floor as 24.38 GB per step and 4.6 ms. That number omits the output head. Wolfram on `classes.tsv`: |
| 19 | |
| 20 | | What is read per step | Bytes | Floor at 5.3 TB/s | |
| 21 | |---|---|---| |
| 22 | | all FP8 projections (with block scales) + BF16 `in_proj_a/b` + one 10,240 B embedding row | 24,377,128,960 | 4.5995 ms | |
| 23 | | plus the BF16 output head `lm_head` 248320x5120 (read in full every step) | 26,919,925,760 | 5.0792 ms | |
| 24 | | plus delta-net recurrent state (305,154,240 B) and key/value rows at 286 positions | 27,243,823,296 | 5.1403 ms | |
| 25 | |
| 26 | The checkpoint's `lm_head.weight` is BF16 (2,542,796,800 B, header of `outside.safetensors`). Reading it as FP8 would |
| 27 | change logits, so it is not output-preserving. **The output-identical floor for this plan is 5.08 ms (MODELED); 4.6 ms |
| 28 | needs a smaller output head and is a different, non-identical rung.** The 26.721 ms baseline moves 1.007 TB/s, |
| 29 | 19.0 percent of 5.3 TB/s (MODELED from MEASURED 26.721 ms). |
| 30 | |
| 31 | ## Weight bytes and floor per class |
| 32 | |
| 33 | | Class | Dispatches | Bytes per dispatch | Floor per dispatch | Floor per step | |
| 34 | |---|---|---|---|---| |
| 35 | | fp8 mlp gate/up 17408x5120 | 128 | 89,139,840 | 16.82 us | 2.153 ms | |
| 36 | | fp8 mlp down 5120x17408 | 64 | 89,139,840 | 16.82 us | 1.076 ms | |
| 37 | | bf16 lm_head 248320x5120 | 1 | 2,542,796,800 | 479.8 us | 0.480 ms | |
| 38 | | fp8 gdn in_proj_qkv 10240x5120 | 48 | 52,435,200 | 9.89 us | 0.475 ms | |
| 39 | | fp8 gdn in_proj_z 6144x5120 | 48 | 31,461,120 | 5.94 us | 0.285 ms | |
| 40 | | fp8 out_proj / o_proj 5120x6144 | 48+16 | 31,461,120 | 5.94 us | 0.380 ms | |
| 41 | | fp8 attn q_proj 12288x5120 | 16 | 62,922,240 | 11.87 us | 0.190 ms | |
| 42 | | fp8 attn k/v 1024x5120 | 32 | 5,243,520 | 0.99 us | 0.032 ms | |
| 43 | | bf16 gdn in_proj_a/b 48x5120 | 96 | 491,520 | 0.093 us | 0.009 ms | |
| 44 | | gdnstate_step | 48 | 6.36 MB state in+out | 1.20 us | 0.058 ms | |
| 45 | | 15 other small classes (norms, residual, SiLU, conv, attention, argmax) | 581 | under 1 MB, except attention part: 1.17 MB at 286 positions | under 0.25 us | under 0.01 ms | |
| 46 | |
| 47 | ## Gap ranking from earlier card measurements (apportioned, not a model run) |
| 48 | |
| 49 | Kernel times from `~/handoffs/amd-omega-numbers/LIVE.md` (MEASURED earlier on MI300X through AMD's HIP launch, cold |
| 50 | wall clock over 200 launches; the kernel versions of those sessions are not re-confirmed against the dc536882 objects, |
| 51 | so this ranking only orders the work; the step-2 card measurement replaces it): |
| 52 | |
| 53 | | Class | Earlier ms per dispatch | Percent of bandwidth | ms per step | Gap to floor per step | |
| 54 | |---|---|---|---|---| |
| 55 | | rmsnorm5120 (one workgroup, 129 per step) | 0.0179 | 0.06 | 2.309 | **2.308** | |
| 56 | | fp8 17408x5120 | 0.0324 | 51.9 | 4.147 | **1.994** | |
| 57 | | fp8 5120x17408 | 0.0367 | 45.8 | 2.349 | **1.272** | |
| 58 | | mlpsilu | 0.0034 | 1.2 | 0.218 | 0.215 | |
| 59 | | bf16 lm_head | 0.6866 | 69.9 | 0.687 | 0.207 | |
| 60 | | gdnconv4 | 0.0030 | 2.1 | 0.144 | 0.141 | |
| 61 | | sum of these six | | | 9.853 | | |
| 62 | | **not yet apportioned** (other 22 classes, and the cost of 1,126 serialized dispatches) | | | **16.868** | | |
| 63 | |
| 64 | [INFERENCE] The unapportioned 16.9 ms is spread across 1,126 barrier-ordered dispatches (about 15 us each). Per-dispatch |
| 65 | fixed cost, small one-workgroup kernels (rmsnorm, gdnparams, argmax_final, merge) and the attention part grid |
| 66 | (2048x24 = 49,152 workgroups per layer, sized for 131,072 positions while 286 are used) are the candidates. The step-2 |
| 67 | measurement separates them: an empty-dispatch control gives the fixed cost, and per-class insertion gives each class. |
| 68 | |
| 69 | ## Order of work (superseded 2026-11-14 by the card table in ../RESULT.md) |
| 70 | |
| 71 | The card measurement in the real plan puts FP8 17408x5120 at 49.6 us (33.9 percent of bandwidth), 1.53x the earlier |
| 72 | isolated 32.4 us (Wolfram). [INFERENCE] The most direct candidate: the earlier figure was measured on the session-v5 "tuned" FP8 kernel, which is |
| 73 | not confirmed to be the dc536882 `fp8gemv_b128f` object. A second candidate: it came from a HIP benchmark that launched the same shape back |
| 74 | to back. There, each launch overlapped the previous one and the x vector stayed cached. In the plan, every dispatch |
| 75 | waits on its predecessor (barrier bit) and reads a freshly written x. The list below is the pre-measurement order. |
| 76 | |
| 77 | 1. Per-dispatch fixed cost and small kernels: fuse rmsnorm into its neighbours, multi-workgroup norm, fewer dispatches. |
| 78 | 2. FP8 matrix-vector at 46 to 52 percent of bandwidth: the 192 MLP dispatches per step carry 3.27 ms of gap. |
| 79 | 3. Attention part grid sized from the live position, not the capacity. |
| 80 | 4. BF16 output head (70 percent), delta-net state and convolution. |