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 / GEMM-GENERAL-AB-20261027 / AB-PLAN.md
| 1 | # GemmGeneral served-shape A/B: gemm_ex against the existing C3 entry (predeclared) |
| 2 | |
| 3 | Written 2026-10-27 by GemmGeneral2 before any timed run. Committed to CUDApp branch `gemm-general/gemm-ex` and announced |
| 4 | on BOARD (with this file's sha256) before the hold starts. Nothing below is changed after the run. |
| 5 | |
| 6 | ## Question |
| 7 | |
| 8 | At the nine served 35B GEMM shapes, does the general entry `omega_gpu_gemm_ex` (CUDApp#139) cost more wall time than the |
| 9 | existing entry `omega_gpu_gemm_ld` it calls, for the same host-memory inputs and outputs? |
| 10 | |
| 11 | ## Arms (one process, one build) |
| 12 | |
| 13 | - Code under test: CUDApp `gemm-general/gemm-ex` at 90c3f89 (library code identical to fba0384, the commit of the chip |
| 14 | receipts `evidence/GEMM-GENERAL-fba0384/`). `libomega_gpu.a` built with the Makefile CFLAGS |
| 15 | (`-DCUDAPP_MIGRATION_PENDING_GEMM_EX=1`), sha256 6057d8ee13cb4d503e2edd92812af3a341e6c0ca043abb94bc418445dfeeb4be. |
| 16 | - Driver `gemm_ex_ab.c` sha256 eaec1adacd64eb718862cf4af5d835ba60a8a3120a684c27e76d03472d33f6bb, binary sha256 |
| 17 | 3f1e9fe1ca0039f25c27a7b09d32b29747abde83d8f56faf825eda4a1dc1f8d6 |
| 18 | (`cc -std=gnu11 -Wall -Wextra -Werror -D_GNU_SOURCE -O2 -Isrc -DCUDAPP_MIGRATION_PENDING_GEMM_EX=1 -ffp-contract=off`). |
| 19 | - Arm A: `omega_gpu_gemm_ld(type, OMEGA_GPU_GEMM_B_COL, M, N, K, A, K, B, K, C, NULL)`. |
| 20 | - Arm B: `omega_gpu_gemm_ex` with op_a N, op_b T, the same type for A and B, C f32, alpha 1, beta 0, batch 1. |
| 21 | - Same host buffers, same input bits. A is M x K row-major, B is N rows of K (weights [out][in]). |
| 22 | |
| 23 | ## Cells (18) |
| 24 | |
| 25 | Types bf16 and e4m3, times these shapes (M x N x K): 1x8192x2048 q+gate decode, 16x12288x2048 gdn in_proj b16, |
| 26 | 512x8192x2048 q+gate p512, 512x2048x4096 o_proj p512, 2048x12288x2048 gdn in_proj p2048, 2048x2048x4096 out_proj p2048, |
| 27 | 64x1024x2048 expert gate+up, 64x2048x512 expert down, 2048x16384x2048 lm_head slice. These are the nine GemmTune measured |
| 28 | (`handoffs/GemmTune/AB-PLAN.md`). Inputs: bf16 values k/128 for integer k in [-256, 256), e4m3 any non-NaN code, seeded |
| 29 | per shape. |
| 30 | |
| 31 | ## Run |
| 32 | |
| 33 | - `hold.sh ab-1 <logdir> taskset -c 10-14 /tmp/gex2ab/gemm_ex_ab --rounds 20 --seed 20261027 --spin-us 300000`, |
| 34 | one process, one hold (flock /tmp/aien-gb10.lock, at most 14 minutes, BOARD GPU-START/GPU-END, 18091 /health before and |
| 35 | after, no hold while Main's last WINDOW line is WINDOW-START). Default nice. |
| 36 | - Round 0 is warm (labelled `warm=True`) and is not counted. Rounds 1..20 are timed (`warm=False`). |
| 37 | - Interleaving: each round runs all 18 cells in a seeded shuffled order; inside a cell the arm order is a seeded coin. |
| 38 | - One run. No re-run is chosen over another: if the run is cut short (timeout, hold refused), the rounds it finished are |
| 39 | reported as they are and the missing ones are NOT_RUN. |
| 40 | |
| 41 | ## Correctness gate (any failure voids the run) |
| 42 | |
| 43 | Every pair, warm included: both rc OK; C_B equal to C_A bit for bit; 64 sampled elements of C_A (the last element plus 63 |
| 44 | seeded ones) within K 2^-22 sum|a b| of a double host reference; arm B's route NATIVE with host_fixed 0. Negative control |
| 45 | after the timed rounds: gemm_ex mutant 1 (drops the last k) on 64x2048x512 bf16 must be RED (bitwise differs and the |
| 46 | reference check fails on C_B while C_A passes). A green control fails the run. |
| 47 | |
| 48 | ## Kept pairs |
| 49 | |
| 50 | A `warm=False` pair is kept unless its in_flight (the live 35B's /health) before or after the pair is non-zero or |
| 51 | unreadable (-1). A cell with fewer than 10 kept pairs is INCONCLUSIVE. |
| 52 | |
| 53 | ## Statistics (Wolfram, quoted with the query) |
| 54 | |
| 55 | Per cell over kept pairs: median wall_a_ns, median wall_b_ns, r = median_B / median_A, min and max of each arm, the median |
| 56 | of the per-pair ratios wall_b / wall_a. Information only: Wilcoxon signed-rank test (`SignedRankTest`) of the per-pair |
| 57 | log ratios. |
| 58 | |
| 59 | ## Verdict per cell (fixed now) |
| 60 | |
| 61 | - FASTER: r <= 0.95 and max_B < min_A. |
| 62 | - REGRESSION: r >= 1.05 and min_B > max_A. Reported as REGRESSION, whatever the cause. |
| 63 | - NO CHANGE: anything else. |
| 64 | |
| 65 | ## Lane gate |
| 66 | |
| 67 | PASS if the correctness gate passes and every cell has r <= 1.10 (gemm_ex costs at most 10 % over the call it wraps at the |
| 68 | served shapes). Otherwise FAIL, with the failing cells listed; the measured overhead then goes into API.md section 9.8. |
| 69 | |
| 70 | ## NOT_RUN by design |
| 71 | |
| 72 | - The tuned device-resident paths (fp8 GEMV `omega_gpu_fp8_gemv*`, grouped fp8 GEMM `omega_gpu_fp8gemm_*`, the prefill |
| 73 | GEMMs `omega_gpu_pf_*`): they take device addresses and resident weights, so a host-memory arm against them would time |
| 74 | uploads, not the GEMM. gemm_ex is not a serving path (API.md 9.8). |
| 75 | - Any served-model end-to-end timing: gemm_ex has no served caller. |