Repository navigation
test(bench): benchmark cuda-oxide RMSNorm on GB10 and record the result - #3477
Conversation
Issue #2834 requires the checkpoint, prompts, tolerances, timing method, repetitions and acceptance thresholds to be fixed before any result is collected. This commit holds the protocol alone so the order is auditable: arms and their route-counter signatures, the artifact and checkpoint digests, the prompts, the seven measurements (end to end with a null arm, logit traces, standalone and through-MLX kernel time under one profiler, op level, cold start, static resources), the three gates with their baselines and noise-floor rule, and the rule that maps the outcome to one disposition. Only functional checks of the instruments ran before it, listed in the document; no timing from them is recorded or used. Results follow in later commits. Refs #2834
The #2834 protocol needs four things the tree did not have. None of them joins the default build or changes what a default-build binary does. - A standalone launch benchmark that needs only the CUDA driver API (`spike/cuda-oxide-fused-norm/standalone`, `scripts/standalone-bench.sh`): the #2832 harness needs the cuda-oxide compiler, which this host does not have. It checks the committed PTX against the five manifests, loads it with `cuModuleLoadData`, launches with the manifest ABI and launch rule, and times with CUDA events. - `mlxcel-core` example `oxide_fused_norm_bench`: graph path, existing fused kernel and cuda-oxide node through MLX on the same shapes, in `iso`, `pipe` and `cold` modes, each block checked against the route counters. - `mlxcel_core::fused_norm_route::fused_norm_route_snapshot()`: the adapter's counters behind a cfg-independent reader (`None` without the adapter), because the cfg is set by the core crate's build script and the root crate cannot test it. `logit_trace` prints the route with it in an opted-in build. - Root example `oxide_fused_norm_checkpoint_bench` and `scripts/oxide_fused_norm_rounds.py`: the engine probes `mlxcel-bench-engine` runs, plus per-arm environment, route counters and MLX peak memory per pass, token ids, concurrent requests, rotated rounds with a null arm and the frozen gate rule. `scripts/nsys_kernel_table.py` turns an Nsight Systems capture into per-kernel and per-API tables. Only functional probes have run. rustfmt is clean; clippy was not run because it starts a cold MLX build under its own build-script hash on this host. Refs #2834
The first attempt at the measurement batch never started: main-branch CI jobs occupied this host's runner back to back for more than the 30 minutes the script waits, and its 10-second poll missed the gaps between jobs. The wait is now configurable (`RUNNER_WAIT`) and polls every 2 seconds, and each stage appends its start and end time, the load average and whether a CI job was running at its end to `host-state.csv`, since a job can start in the middle of a stage. No timing had been taken; the only protocol item run so far is the adapter test suite with the 130-case matrix (M2c), which is not time sensitive. Refs #2834
docs/benchmarks.md gains a section on the three tools the #2834 comparison added: the route snapshot and the checkpoint bench that records it per pass, the rounds driver for arms that differ by process environment, and the pairing of the through-MLX op bench with the standalone driver-API launcher under one profiler, including why the MLX capture needs CUDA graphs off and what must not be read from it. Refs #2834
First results of the protocol frozen in 9318238, taken on spark-101 at b45ce7a with the opted-in release build: standalone CUDA-event timings (M3), kernel and CUDA API tables from nsys for the standalone program and for MLX with graphs off (M4), op-level timings through MLX with graphs on (M5), cold start (M6), kernel resource usage (M7), seven interleaved end-to-end rounds with a null arm (M1), and the logit trace comparison (M2), with the environment in provenance.json and the per-stage host state in host-state.csv. The host was shared: a CI job was running when M4 and M5 ended, which host-state.csv records. Those two stages are repeated in a later commit; this set is kept as taken. The m7 CSV's constant-bank column is empty because of a parser mistake fixed with the repeat. Refs #2834
…g them The first result set raised three things the frozen protocol did not cover. No gate, threshold, baseline or repetition count changes; the additions are dated and committed here before any of them runs. - The standalone module load took under a millisecond because the CUDA driver's own PTX compile cache was warm, so the cold-start state for the cuda-oxide arm measured a cache hit. Cold start and the standalone program are also run with CUDA_CACHE_DISABLE=1. - A CI job was running when the nsys and op-level stages ended, so both are repeated into separate files and both sets are kept. - The op-level pipe mode shows a host-side per-op difference that the shared-process API table cannot attribute, so an exploratory per-arm API profile is added. The run script gains the matching stages, a repeat-set suffix, the corrected constant-bank parser for the resource table, and LF line endings in the CSV writers. Refs #2834
Results of the three additions recorded in bc1e47f: the repeated nsys and op-level stages (`*-repeat.csv`), cold start and the standalone program with the driver's PTX compile cache disabled (`m6b-*`), the resource table with its constant-bank column filled, and the per-arm CUDA API counts (`m8`). The per-arm profile shows the same CUDA API calls per op for the existing kernel and the cuda-oxide node, so the per-op difference in pipe mode is host work before the launch. A fourth addition, recorded in the evidence document here before it runs, times that directly: a `build` mode in the op bench that constructs the lazy node without evaluating it. The CI-job check matched a monitoring shell by command line and recorded one false positive, noted in the document; the scripts now match the process name. Refs #2834
The evidence document now holds the results under the frozen protocol, the gate evaluation and the recorded result. On GB10 with Llama 3.2 1B Instruct bf16 the cuda-oxide route is correct (logit traces byte-identical to the existing fused kernel in three shapes, greedy output identical in six cells over seven rounds, every run on the intended route) and has no end-to-end effect (paired deltas of -0.31 % to +1.65 % against null floors of 0.3 to 2.1 %, one cell unable to resolve 2 %). No benefit passes a gate. The two kernels take the same time, within 3 % on four of five shapes, because the operator is launch-bound at decode and memory-bound at prefill. First use is slower with warm caches (11.8 ms against 5.25 ms) and faster only on a machine's first run. The route adds a compiler toolchain and an artifact contract and removes nothing. The recommendation is to stop expanding cuda-oxide kernels; the maintainer makes the call, and no default changes. Also recorded: the per-op gap between the generic custom-kernel launcher and a dedicated primitive (node-build timings in m9), what could not be measured (hardware counters, a CPU profile, an idle host), and the pointers in the feasibility review, the result index, the environment-variable page and the changelog. Refs #2834
…e op bench
Two statements in the report went beyond the data. The kernels do not tie because the operator is memory-bound at prefill: at 128 and 512 rows the graph path's two kernels do the same arithmetic in 55 % and 35 % of either fused kernel's time. They tie because the port has the existing kernel's structure and geometry, which bit identity required, so only code generation could differ. The report now says that, and states as a limit that no restructured kernel was measured. The recommendation is unchanged.
The host-state account now follows the runner's job logs instead of the per-stage flag: jobs ran back to back from 02:51:40 to 03:48:54 UTC and once more from 03:53:12 to 03:54:40, so only the end of the first op-level set overlapped a job, and the flag at the end of the first nsys stage was a false positive of the command-line match like the later one.
`oxide_fused_norm_bench.rs` was past 500 lines; its argument parsing and its recorder move to `oxide_fused_norm_bench/{args,record}.rs` with no change in behavior (a routes-only pass was rerun; every committed number predates the split). Narrow clippy with `-D warnings` is clean on the core lib, that example and the two root examples.
Refs #2834
…izer A cell missing the fused-null arm, or with fewer oxide pairs than rounds, gave a NaN null floor or median, and every NaN comparison is false, so `summarize` printed `no regression` for any slowdown. Removing the null arm from the committed M1 data and doubling oxide TTFT reproduced it. Cells now need one finite oxide and one finite null pair for every round in the cell before a verdict; otherwise they read `unresolved (incomplete or non-finite pairs)`. Validated without a GPU: the summary of the committed `m1-end-to-end.csv` is unchanged, and the same file with the null arm removed reports all 12 cell-metrics as unresolved. Refs #2834
Implementation Review SummaryIntent
Findings Addressed
Remaining Items
Verification
Checked: the protocol commit 9318238 was pushed at 11:55 KST, before the first stage started (03:37 UTC); gates, thresholds, baselines and repetition counts are identical between 9318238 and HEAD, and each addition was pushed before its stage ran. Recomputed from the CSVs: the M1 summary, 168 of 168 and 4,365 of 4,365 valid route signatures, identical greedy ids, peak memory, M3, M4 (both sets), M5 |
Security and Performance ReviewNo CRITICAL or HIGH findings, so no fixes were committed. The scope was the standalone bench (C++ and wrapper), Verified
Remaining (not fixed)
|
Review and security passes on the cuda-oxide fused-norm benchmark left MEDIUM and LOW items. No measurement was rerun, and no gate, threshold, baseline, conclusion or disposition changed. Evidence docs: the report now cites a committed log for the 130-case matrix through the adapter (new run.sh stage m2c, a correctness rerun of the 31 cuda_oxide tests, 31 passed, saved as m2c-adapter-matrix-test.log). The graph-path column uses the median of three captures (8.5 and 144 us derived). The 11.2 ms first-use cost is described as the whole select step, not broken down. The M1 one-process-per-arm-and-cell deviation is listed under the protocol adjustments with its commit time. The 4.1 us floor is attributed to a back-to-back launch rate of 2.048 us multiples, not timer resolution. Smaller wording fixes: decode traffic 24/96 KiB, the pipe-mode graph claim narrowed, the 698 to 757 ms control and the cold-start subtraction noise noted, over-broad launcher and cost-free claims narrowed, 0.023 points, the missing comma in docs/README.md. The logit_trace digest is recorded as recomputed after capture. Scripts: summarize reports a cell with no rows for an arm as unresolved and still writes --out (unit test added; the committed M1 summary reproduces up to line endings). run.sh uses pgrep -x, writes provenance.json atomically, refuses a WORK path with whitespace or inside the checkout, stages m6 and m6b output so a failed run leaves nothing to append to, fails loudly on a missing M2 route line or an empty m7 glob, and unsets MLXCEL_CUDA_OXIDE_FUSED_NORM_DIR for the traces. The standalone bench rejects negative, non-numeric and out-of-range arguments, and keeps the row newline for a long --label. The digest check is documented as consistency with the in-tree manifests, not authenticity. Validation: - gpu-lock run -- mlxcel_core lib test binary cuda_oxide --test-threads=1: 31 passed - python3 -m unittest tests/test_oxide_fused_norm_rounds.py: 2 passed - shellcheck on both scripts, g++ -Wall -Wextra on the bench: clean - cargo fmt --all -- --check: clean; no Rust source changed Refs #2834
The results tree keeps no raw captures (check_benchmark_raw_logs.py), so the m2c test-binary output committed in review failed the binary-assets job. The capture now stays in the run work directory and scripts/oxide_fused_norm_m2c_summarize.py reduces it to m2c-adapter-matrix.csv: command, commit, binary SHA-256, each test outcome, every field of the 130-case RESULT line and the libtest totals. The CSV was derived from the same capture, so the cited result is unchanged. Refs #2834
The maintainer adopted the stop recommendation for the default and kept the #2833 adapter in the tree as an opt-in route, off by default at build and run time, for a possible later rewrite of the kernels on cuda-oxide. The evidence report, the feasibility review and the changelog now state the decision instead of leaving it open.
Summary
Benchmarks the cuda-oxide fused residual-add + RMSNorm kernel (#2832 artifact, #2833 adapter) against the existing fused CUDA kernel on GB10 under a protocol frozen before measurement, and records the result. Recommendation: stop, do not expand cuda-oxide kernels on this evidence. Maintainer decision: stop is adopted for the default, and the #2833 adapter stays in the tree as an opt-in route (not removed), for a possible later rewrite of the kernels on cuda-oxide. No default changes and nothing joins the default build.
llama-3.2-1b-instruct-bf16: logit traces byte-identical to the existing kernel in three shapes, greedy output identical in 6 cells over 7 rounds, all 168 runs on the intended route, 130 of 130 at the op boundary.Order, for the audit: protocol
93182387, harness0a5968fa, first raw results37ac8922; four additions to the protocol were each committed before they ran (bc1e47ff,70fa4f9a). A fifth adjustment, added in review, records that M1 ran both prompt lengths in one process per path, batch and arm rather than one process per cell; that choice was committed in the harness (0a5968fa) before any stage ran and applies to every arm equally.What changed
docs/mlxcelverse/cuda-oxide-benchmark-evidence.md: protocol, results, what could not be measured, gate evaluation, recorded result. The feasibility review, the result index, the environment-variable page and the changelog point to it.docs/benchmark_results/cuda-oxide-fused-norm-gb10-2026-11-27/: raw rows,run.shwith every command, provenance, per-stage host state.spike/cuda-oxide-fused-norm/standalone), themlxcel-coreexampleoxide_fused_norm_bench, the root exampleoxide_fused_norm_checkpoint_bench,scripts/oxide_fused_norm_rounds.py,scripts/nsys_kernel_table.py, andmlxcel_core::fused_norm_route::fused_norm_route_snapshot()(Nonewithout the adapter), whichlogit_traceprints in an opted-in build.Changes during review
Recorded the maintainer decision (keep the route opt-in, do not remove it) in the evidence report, the feasibility review and the changelog.
scripts/oxide_fused_norm_rounds.py summarizeno longer reports "no regression" for a cell with missing or non-finite pairs (NaN compared false against every threshold), and no longer crashes when an arm has no rows for a cell; both now read "unresolved". Covered bytests/test_oxide_fused_norm_rounds.py. Re-summarizing the committed M1 rows reproduces the committed summary, so no reported verdict changed.The G1 matrix result is now committed as
m2c-adapter-matrix.csv(rerun at5939da7fundergpu-lockthrough a newm2cstage inrun.sh, reduced from the test binary's capture byscripts/oxide_fused_norm_m2c_summarize.py; the results tree keeps no raw logs).Report corrections against the raw data: graph-path kernel column as the median of three captures, the 11.2 ms first-use cost described as validation plus device query plus install (not broken down), the 4.1 µs event floor explained as the back-to-back launch rate, decode traffic 24/96 KiB, and narrower wording where a claim went past what was measured. No gate, threshold, baseline, conclusion or recommendation changed.
run.shand the standalone launcher hardened: staged writes for provenance and cold-start CSVs, refusal of a work directory inside the checkout, strict numeric argument parsing, and the digest check documented as consistency with the in-tree manifests rather than authenticity.Not measured
Hardware counters (
ncuis refused for this user), a CPU profile of the host path (perf_event_paranoidis 4), per-kernel time with CUDA graphs on, a second checkpoint, and an idle host: the host is a CI runner and was shared, and the runner's job logs show one stage partly overlapped by a job (it was repeated, both sets are reported).Test plan
run.shstages m1 to m9 on GB10 undergpu-lock, results committedcuda_oxidesuite in the release profile,--test-threads=1: 31 passed, including the 130-case matrix (recorded inm2c-adapter-matrix.csv)tests/test_oxide_fused_norm_rounds.py(summarizer on complete and incomplete input);shellcheckonrun.shandstandalone-bench.sh;g++ -Wall -Wextraon the standalone launcherfused_norm_routeunit tests: 2 passedrustfmt --checkon the new Rust files;check_used_by,check_env_var_docs,check_binary_assets,check_benchmark_raw_logs,check_windows_reserved_paths,check_native_env_writescargo clippy --release --features cuda -- -D warningsonmlxcel-core --lib --example oxide_fused_norm_benchand on the two root examples, with the opt-in build variable, after the measurements (it cold-builds MLX under its own build-script hash, so it could not run alongside them)Closes #2834