From 63855ab4822eea6fec4e488f23b62bc976469c8c Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Thu, 29 Oct 2026 17:15:11 -0500 Subject: [PATCH 1/2] coldstart: predeclare the cold-start study (PROTOCOL A7) coldstart/PROTOCOL.md predeclares a chip-level study of process cold start to first verified result on GB10: CUDApp's own ioctl path (CUDAPP) against NVIDIA's run-time compile paths (PTXC, NVRTC). It fixes pins, arms, phases, metrics, schedule, controls, validity and verdict rules before any measured GPU run. The harness (build.sh, cs_cuda.c, cs_cudapp.c, run.py, vecadd.ptx, analysis.wl) is measurement tooling. run.py gains one control: PTXC's cubin must be byte-identical to NVRTC's. PROTOCOL.md A7 records the study as separate from the main results table (section 1). It is A7 because A6 is d3426b2 on results/2026-10-27-a6. Evidence: build.sh rebuild OK at CUDApp cc0908bd (arm shas in coldstart/PROTOCOL.md section 3); host --build-only --emit-code gave an identical 5600 B cubin for NVRTC and PTXC (691edc87) and CUDAPP code 9e28bd9c; host --dry-run DRY_RUN with no control failures. No GPU run yet. --- PROTOCOL.md | 10 ++ README.md | 1 + coldstart/PROTOCOL.md | 201 ++++++++++++++++++++++++++++++ coldstart/analysis.wl | 35 ++++++ coldstart/build.sh | 47 +++++++ coldstart/cs_cuda.c | 232 +++++++++++++++++++++++++++++++++++ coldstart/cs_cudapp.c | 165 +++++++++++++++++++++++++ coldstart/run.py | 278 ++++++++++++++++++++++++++++++++++++++++++ coldstart/vecadd.ptx | 51 ++++++++ 9 files changed, 1020 insertions(+) create mode 100644 coldstart/PROTOCOL.md create mode 100644 coldstart/analysis.wl create mode 100755 coldstart/build.sh create mode 100644 coldstart/cs_cuda.c create mode 100644 coldstart/cs_cudapp.c create mode 100755 coldstart/run.py create mode 100644 coldstart/vecadd.ptx diff --git a/PROTOCOL.md b/PROTOCOL.md index 18f1ea2..37c90d2 100644 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -281,3 +281,13 @@ on this one Spark, on the stated date and load. line ` HeadToHead: ... FINAL IDLE`, posted even if the campaign ends early or aborts; queued chip jobs wait on that anchored line. If HeadToHead is about to stop mid-run it posts `HeadToHead: ABORTED, not FINAL IDLE` instead. +- **A7 (2026-10-29, cold-start study; numbered A7 because A6 is the llama.cpp methodology amendment + d3426b2 on branch `results/2026-10-27-a6`, not yet on main):** a separate study, predeclared in + [coldstart/PROTOCOL.md](coldstart/PROTOCOL.md) and committed before its GPU window opens, measures + process cold start to first verified result on GB10 for CUDApp's own ioctl path (arm CUDAPP) against + NVIDIA's run-time compile paths (arms PTXC and NVRTC), with its harness in `coldstart/` and its results + in `results/coldstart/`. It is a chip-level microbenchmark, so section 1 still holds: none of its + numbers enters the main results table `results/RESULTS.md`, and none of this protocol's end-to-end + numbers is mixed into it. No `HeadToHead: ... FINAL IDLE` line (A5(h)) is on the BOARD as of + 2026-10-29 22:15Z; the study takes `/tmp/aien-gb10.lock` only inside its own spark-window, under + Drake's GPU authorization for this lane given on 2026-10-29. diff --git a/README.md b/README.md index 0de5fa7..0167176 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ the GPU-stack plan: prove the numbers before claiming them, and publish them eve - Protocol (predeclared, committed before the first run): [PROTOCOL.md](PROTOCOL.md) - Results table: planned at `results/RESULTS.md`, not present in this tree. +- Cold-start study (separate, chip-level, amendment A7): [coldstart/PROTOCOL.md](coldstart/PROTOCOL.md), results in `results/coldstart/` - Raw request rows, server logs, memory samples, versions: [results/](results/) - Client and scripts: [bench/](bench/) diff --git a/coldstart/PROTOCOL.md b/coldstart/PROTOCOL.md new file mode 100644 index 0000000..eaa2671 --- /dev/null +++ b/coldstart/PROTOCOL.md @@ -0,0 +1,201 @@ +# PROTOCOL: cold start to first verified result, CUDApp vs NVIDIA user-space compile paths (GB10) + +Predeclared before any measured GPU run. This file, the harness in `coldstart/` and amendment A7 of the +repo's [PROTOCOL.md](../PROTOCOL.md) are committed and pushed before the GPU window opens. Any later change +is a separate, dated commit listed in section 11, and results name the protocol commit they ran under. + +This is a chip-level microbenchmark. The repo's PROTOCOL.md section 1 still holds: none of these numbers +enters the main results table (`results/RESULTS.md`). They live in `results/coldstart/` only. + +## 1. Question + +On one DGX Spark (GB10, sm_121), how long does a fresh process take from `exec` to its first verified +GPU result when the kernel reaches the GPU through CUDApp's own path (its kernel builder and encoder, +then its own `ioctl`/`mmap` calls on `/dev/nvidiactl` and `/dev/nvidia0`, no NVIDIA user-space library), +compared with the NVIDIA user-space paths that compile a kernel at run time (NVRTC, or the PTX compiler +library) and then load and launch it through `libcuda`? + +## 2. Arms + +| Arm | Binary | Kernel description in the process | Build step (timed as `build`) | GPU path | +|-----|--------|-----------------------------------|-------------------------------|----------| +| CUDAPP | `cs_cudapp` | CUDApp `examples/hello_gpu/hello_gpu.c` `build_vecadd` (IR program) | `build_vecadd` + `omega_blackwell_kernel_encode_into`: 512 B of machine code | CUDApp `libomega_gpu.a` session API (own nvrm ioctls) | +| PTXC | `cs_ptxc` | `coldstart/vecadd.ptx`, read into memory during prep | static `nvPTXCompiler` (`--gpu-name=sm_121`): 5600 B cubin | CUDA driver API, `libcuda` | +| NVRTC | `cs_nvrtc` | the CUDA C++ string in `cs_cuda.c` | `nvrtcCompileProgram` (`--gpu-architecture=sm_121`): 5600 B cubin | CUDA driver API, `libcuda` | + +PTXC is the like-for-like arm against CUDAPP: both start from a device-level description and stop at +loadable machine code. `vecadd.ptx` is NVRTC's own `compute_121` PTX for the NVRTC source (build.sh checks +that it is still byte-identical to what NVRTC emits), and PTXC's cubin is byte-identical to NVRTC's +(sha256 `691edc87423da8a86c5403d332bb980aa20f8808c84a0ffbf79481081c7dd6e8`, 5600 B, observed with +`--build-only --emit-code` after the section 3 build). So PTXC and NVRTC load and run the same code; +they differ in the build step and in what the process links. + +## 3. Pins and build + +- CUDApp `cc0908bdc0a0377f2166e9328dcf1d985457e27f` (cloned by `coldstart/build.sh` into `OUTDIR/cudapp`, + checked clean and at the pin; library and `hello_gpu` built with CUDApp's own Makefile and flags). +- gcc 13.3.0. NVIDIA arms: `-std=gnu11 -Wall -Wextra -Werror -O2`. +- CUDA 13.0 (`/usr/local/cuda-13.0`, `version.json` cuda 13.0.3): NVRTC `libnvrtc.so.13.0.88` + (`nvrtcVersion` 13.0), PTX compiler `libnvptxcompiler_static.a` (`nvPTXCompilerGetVersion` 13.0). +- Driver 580.173.02 (`/proc/driver/nvidia/version`, `libcuda.so.580.173.02`), `cuDriverGetVersion` 13000. +- Build: `taskset -c 10-14 nice -n 19 ionice -c3 coldstart/build.sh /tmp/csb/out` printed `build: OK + /tmp/csb/out` on 2026-10-29 (binaries written 22:08:17Z). `build.txt` sha256: + + | File | sha256 | + |------|--------| + | `cs_cudapp` | `ba4496b361a6f53ec65ccec1b8c999509e392bce7f439d2e4d1e86aa4d7d31cd` | + | `cs_nvrtc` | `878bc185cd7a28f52d33253f217efd4a1773cdd1c5bf92669ed0168195e8f14e` | + | `cs_ptxc` | `27ae182fe36dda55813ba96f89b7f416505010c2bb3d40805fc263d17c3a28e4` | + | `cudapp/build/hello_gpu` | `af5e9f6640445cb4d02a857c63ca568f4da48d6c15212dab98631ad9ea6ce3aa` | + | `cudapp/build/libomega_gpu.a` | `3c626939a7f599d929d30bc8c9f9f37e08a6bc02bdcd9755c98504bda9e06724` | + | `coldstart/vecadd.ptx` | `9abb51a8a751ec3e2483ba7a57effbe6a387f282f5ffa1bf4a485048e66669a2` | + + The three arm shas equal those of the earlier build from 16:53Z, although the header comments of both + C files changed in between: comments do not reach object code, and nothing is built with `-g`. +- Emitted code: CUDAPP `--emit-code` sha256 `9e28bd9c46f80584d77238a752e99cecddbc8d622ffbe320885ed2f499e1f075` + (512 B), equal to the "machine code sha256" that `hello_gpu --sim` prints at the pin; PTXC and NVRTC as + in section 2. + +## 4. Job, phases, metrics + +The job is `hello_gpu`'s job at the pin: `c = a + b` over 1,048,576 floats, `a[i] = i * 0.25`, +`b[i] = 1 / (1 + i % 7)`, `c` poisoned with `0xFFC0FFEE`, eight launches of 1024 blocks x 128 threads, +then every element compared bit for bit with the CPU's own `a[i] + b[i]`. A process is correct only with +`wrong == 0` and `unwritten == 0` (exit 0). + +Phases, each closed by a `CLOCK_MONOTONIC` stamp inside the process: + +| Phase | CUDAPP | PTXC / NVRTC | +|-------|--------|--------------| +| prep | host inputs | host inputs (PTXC: also reads `vecadd.ptx`) | +| build | kernel description to machine code in host memory | PTX or C++ to cubin in host memory | +| open | `omega_gpu_session_open` | `cuInit`, `cuDeviceGet`, `cuDevicePrimaryCtxRetain`, `cuCtxSetCurrent` | +| load | code buffer allocated, words copied, synced to GPU | `cuModuleLoadData`, `cuModuleGetFunction` | +| data | three buffers allocated, inputs and poison copied in and synced | `cuMemAlloc` x3, `cuMemcpyHtoD` x3 | +| run | eight launches, each waits for its completion marker | eight `cuLaunchKernel`, `cuCtxSynchronize` | +| check | output synced to CPU, bit-exact check | `cuMemcpyDtoH`, bit-exact check | +| close | buffers freed, session closed | `cuMemFree` x3, `cuModuleUnload`, `cuDevicePrimaryCtxRelease` | + +The driver (`run.py`) stamps `t0` just before `Popen` and `t1` when the child has exited and its pipes +are drained, on the same clock. + +| ID | Metric | Definition (ns, reported in us) | Role | +|----|--------|---------------------------------|------| +| H1 | build | build phase | headline | +| H2 | ready | build + open + load | descriptive: CUDA 13 defaults to lazy module loading (`CUDA_MODULE_LOADING` unset), so part of the NVIDIA arms' load work can move into run | +| H3 | firstResult | exec + prep + build + open + load + data + run + check | headline: spawn to verified result | +| H4 | proc | `t1 - t0` | headline: spawn to process exit, close and teardown included | +| E | exec | `t_main - t0`: spawn, `exec`, dynamic linking, constructors | descriptive | +| W | warm build | per process, median of 10 further builds in a `--build-only` process | descriptive | + +## 5. Schedule (`coldstart/run.py`) + +1. Pre-checks (section 6), then the control processes of section 6, one per arm per control. +2. 2 warmup rounds (each arm once per round, order CUDAPP, PTXC, NVRTC), not analysed. +3. 30 measured rounds. Round `r` runs the arms in permutation `r mod 6` of the 6 orders, so every order + runs 5 times. 1 s sleep before every measured spawn. Measured processes run with `--warm 0`, so no + per-process warm build sits inside their proc time. +4. Warm phase W: 10 rounds under the same permutation rule and gap, each process `--build-only` + (no GPU opened) with its 10 warm builds. +5. Cap: 15 minutes from driver start. When it is reached the driver stops, writes what it has and the + session verdict is `INCOMPLETE_CAP`. + +Output: `results/coldstart//{raw.jsonl,session.json,rows.wl}`, plus the control artefacts +`code..bin` and `maps..txt`. Every spawned process gets `CUDA_CACHE_DISABLE=1`. + +Pinning: the driver runs on core 12 (Cortex-A725). Every arm process runs on one core, the first of +9, 8, 7 (Cortex-X925, A2) that hosts no nvidia-modeset kthread at driver start (field 39 of +`/proc//stat`); the core and the kthread cpus go into `session.json`. + +## 6. Pre-checks, controls, validity + +The driver refuses to start, before any process runs, when any of these fails: + +- not inside a spark-window that holds the chip lock (`SPARK_WINDOW` set and `AIEN_GB10_LOCK_HELD=1`); +- an arm binary or `vecadd.ptx` does not match its sha256 in `build.txt`; +- every candidate arm core hosts an nvidia-modeset kthread; +- `bench/quiet.py --window 60 --max-load 6` fails (a foreign process above 20% of one CPU over 60 s, or + `load1 >= 6`; the omp harness is recorded, not gated, as in A2); +- `nvidia-smi --query-compute-apps` lists any compute process. + +Controls, all before the first measured process. Any failure makes the session verdict +`CONTROLS_FAILED` and no measured process runs: + +- code: each arm `--build-only --emit-code`; CUDAPP's code sha256 must be `9e28bd9c...` (section 3); + PTXC's cubin must be byte-identical to NVRTC's. +- skip-run (negative control): each arm `--skip-run` must exit 1 with `unwritten == wrong == 1048576`. +- maps: each arm runs the full job and copies `/proc/self/maps`. CUDAPP's map must hold no + `libcuda`, `libcudart`, `libnvrtc`, `libnvptx` or `libnvidia` mapping and at least one `/dev/nvidia` + mapping; each NVIDIA arm's map must hold `libcuda` (the positive control of the library check). +- output: the maps runs must all be correct and give the same output FNV-1a hash across the three arms. + +Validity of rows and arms (in `coldstart/analysis.wl`): a measured row is valid when its process was +correct and `load1 < 6` at its spawn. An arm is valid with at least 28 of its 30 measured rows valid. + +Session validity: a session is VOID when its verdict is not `MEASURED` (`CONTROLS_FAILED`, +`INCOMPLETE_CAP`, a refused pre-check), when the spark-window lease ran out before close (spark-window +verdict NO VERDICT), or when the window's holder lost the chip lock during the run (for example a +chip-watchdog kill posted on the BOARD). A void session is never retried inside the same window. It is +re-run in a new window, and both sessions are published. + +## 7. Statistics and verdicts + +Computed by `coldstart/analysis.wl` (`csAnalyse`, with `h2hStats` of `results/wolfram/analysis.wl`) in the +Wolfram MCP kernel on the run's `rows.wl`; query and output are kept beside the rows. Per arm and metric: +n, median, Q1, Q3, IQR (Wolfram `Median`, `Quantile` with its default definition, `InterquartileRange`), +p99 as a descriptive figure, in microseconds over valid rows. W is reported as the statistics of the +10 per-process medians. + +For each headline (H1, H3, H4) and each comparison CUDAPP vs PTXC, CUDAPP vs NVRTC: + +- `CUDAPP_LOWER`: CUDAPP Q3 < other arm Q1; +- `CUDAPP_HIGHER`: other arm Q3 < CUDAPP Q1; +- `OVERLAPPING`: otherwise; +- `NO_VERDICT`: either arm is invalid (section 6), or the session is void. + +No significance tests. Median ratios (other over CUDAPP) are descriptive. The same calls are printed for +H2, E and W, labelled descriptive. Results are published whichever way they come out, including every +case where CUDApp is higher. + +## 8. Caveats and disclosures + +- Different builds: `ptxas` (inside NVRTC and nvPTXCompiler) runs an optimizing assembler and register + allocator over a general kernel description; CUDApp's builder lowers one fixed IR program for this one + kernel to 32 instructions (512 B). H1 compares those two build steps as each stack does them, not two + compilers of equal scope. +- Process spawn (`fork`/`exec` from Python, page-in) is in exec, firstResult and proc for every arm. The + binaries differ in size (`cs_ptxc` links the static PTX compiler, 38,394,840 B; `cs_cudapp` + 1,405,168 B; `cs_nvrtc` 72,496 B plus the shared `libnvrtc` and `libcuda`), and that difference is part + of what E measures. +- PTXC and NVRTC load and run an identical cubin, so differences between them after build come from the + process (linked libraries), not from the code. +- The data and check phases are each stack's own transfers: CUDApp syncs host-mapped buffers, the + NVIDIA arms copy with `cuMemcpyHtoD`/`cuMemcpyDtoH`. firstResult includes them for all arms. +- One session, one machine, one date. The study measures GB10 under the stated load only. +- Pre-protocol pilot (before this file existed; the numbers came with the lane assignment, no raw rows + are filed): NVRTC fresh compile 290,679 / 138,026 / 137,686 us in three pilot runs, warm NVRTC builds + about 10.8 to 11.9 ms; CUDApp `hello_gpu --sim` kernel build 145 / 62 / 74 us (host, niced core; see + CUDApp branch `docs/hello-sim-receipt-date` aa7b8771, README section 9). They shaped the schedule + and are not results. +- Host build-only dry run (`run.py --dry-run`, 2026-10-29 21:57:16Z to 21:57:31Z, gap 0.02 s, no GPU + opened, scratch `/tmp/csb/dry`): EXERCISED, not results. Wolfram `csAnalyse[csRows, csWarm]` on its + `rows.wl` gave build medians CUDAPP 72.6085 us, PTXC 5919.412 us, NVRTC 139870.6725 us and warm-build + medians 5.184 / 3156.583 / 16345.90225 us. Its firstResult and proc stop at build (no GPU phases). + +## 9. Publication + +`results/coldstart//`: `raw.jsonl` (every process, controls and warmups included), `session.json` +(pins, build.txt, controls, kthread cpus, quiet output, GPU apps before and after), `rows.wl`, +`code.*.bin`, `maps.*.txt`, the Wolfram query and output, and `RESULTS.md` with window id and times, +pins, controls, valid row counts, per arm median and IQR per metric, verdicts and void status. Evidence +label: MEASURED on this Spark in that window. Chip-only; never copied into `results/RESULTS.md`. + +## 10. Tooling + +`cs_cuda.c`, `cs_cudapp.c`, `build.sh` and `run.py` are C, shell and Python measurement tooling, not +product code: the NVIDIA arms must call NVIDIA's C APIs, and `cs_cudapp.c` wraps CUDApp's own C example. +The Omega successor of the CUDApp arm is the native `.om` hello tracked in aien-dev/CUDApp#79. + +## 11. Amendments + +None yet. diff --git a/coldstart/analysis.wl b/coldstart/analysis.wl new file mode 100644 index 0000000..d2affaa --- /dev/null +++ b/coldstart/analysis.wl @@ -0,0 +1,35 @@ +(* coldstart/PROTOCOL.md section 7. Evaluated in the Wolfram MCP kernel with results/coldstart//rows.wl + (coldstart/run.py) prepended. csRows row: {arm, round, ok, load1, build, ready, firstResult, proc, exec}, ns. + csWarm row: {arm, round, ok, {10 warm build times, ns}}. Statistics are h2hStats of results/wolfram/analysis.wl, + in microseconds. A comparison is a WIN or LOSS only when the two IQRs [q1, q3] do not overlap; otherwise + OVERLAPPING. No significance tests. Output: RawJSON. *) +h2hStats[v_List] := If[Length[v] == 0, <|"n" -> 0|>, + <|"n" -> Length[v], "median" -> N[Median[v]], "q1" -> N[Quantile[v, 1/4]], "q3" -> N[Quantile[v, 3/4]], + "iqr" -> N[InterquartileRange[v]], "p50" -> N[Quantile[v, 1/2]], "p99" -> N[Quantile[v, 99/100]]|>]; +csArms = {"CUDAPP", "PTXC", "NVRTC"}; +csMetrics = {"build" -> 5, "ready" -> 6, "firstResult" -> 7, "proc" -> 8, "exec" -> 9}; +(* valid rows: process ok and load1 < 6 at spawn (section 6) *) +csValid[rows_] := Select[rows, #[[3]] === True && #[[4]] < 6 &]; +csCall[a_Association, b_Association] := Which[ + a["q3"] < b["q1"], "CUDAPP_LOWER", b["q3"] < a["q1"], "CUDAPP_HIGHER", True, "OVERLAPPING"]; +csAnalyse[rows_, warm_] := Module[{valid, per, warmPer, out = <||>, cmp = <||>}, + valid = csValid[rows]; + per = AssociationMap[Function[arm, Module[{rs = Select[valid, #[[1]] == arm &]}, + Join[<|"rows_measured" -> Count[rows, r_ /; r[[1]] == arm], + "rows_valid" -> Length[rs], + "rows_failed" -> Count[rows, r_ /; r[[1]] == arm && r[[3]] =!= True], + "rows_load_excluded" -> Count[rows, r_ /; r[[1]] == arm && r[[3]] === True && r[[4]] >= 6], + "arm_valid" -> Length[rs] >= 28|>, + Association[(First[#] -> h2hStats[N[rs[[All, Last[#]]]/1000]]) & /@ csMetrics]]]], csArms]; + warmPer = AssociationMap[Function[arm, + h2hStats[N[Median[#[[4]]]/1000] & /@ Select[warm, #[[1]] == arm && #[[3]] === True && Length[#[[4]]] > 0 &]]], csArms]; + Do[cmp[other] = Association[Function[m, m -> <| + "call" -> If[per["CUDAPP"]["arm_valid"] && per[other]["arm_valid"], + csCall[per["CUDAPP"][m], per[other][m]], "NO_VERDICT"], + "median_ratio_other_over_cudapp" -> N[per[other][m]["median"]/per["CUDAPP"][m]["median"]]|>] /@ Keys[csMetrics]], + {other, {"PTXC", "NVRTC"}}]; + out["unit"] = "microseconds"; + out["arms"] = per; + out["warm_build_per_process_median"] = warmPer; + out["cudapp_vs"] = cmp; + ExportString[out, "RawJSON", "Compact" -> True]]; diff --git a/coldstart/build.sh b/coldstart/build.sh new file mode 100755 index 0000000..9ce1a52 --- /dev/null +++ b/coldstart/build.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +# coldstart/build.sh: build the three cold-start arms from pinned sources (coldstart/PROTOCOL.md section 3). +# CPU only, no GPU. Usage: coldstart/build.sh OUTDIR (default /tmp/h2h-coldstart-build) +# Env: CUDAPP_REF=path of an existing CUDApp clone to borrow objects from (optional), CUDA=/usr/local/cuda-13.0. +set -euo pipefail +here=$(cd "$(dirname "$0")" && pwd) +out=${1:-/tmp/h2h-coldstart-build} +pin=cc0908bdc0a0377f2166e9328dcf1d985457e27f +cuda=${CUDA:-/usr/local/cuda-13.0} +mkdir -p "$out" +out=$(cd "$out" && pwd) + +if [ ! -d "$out/cudapp/.git" ]; then + ref=() + [ -n "${CUDAPP_REF:-}" ] && ref=(--reference-if-able "$CUDAPP_REF") + git clone --quiet "${ref[@]}" https://github.com/aien-dev/CUDApp "$out/cudapp" +fi +git -C "$out/cudapp" -c advice.detachedHead=false checkout --quiet "$pin" +[ "$(git -C "$out/cudapp" rev-parse HEAD)" = "$pin" ] || { echo "build: CUDApp is not at $pin" >&2; exit 1; } +[ -z "$(git -C "$out/cudapp" status --porcelain)" ] || { echo "build: CUDApp tree is dirty" >&2; exit 1; } + +# CUDApp's library and its own hello_gpu, with CUDApp's own Makefile and flags (default encoder: om). +make -C "$out/cudapp" -s -j5 build/libomega_gpu.a build/hello_gpu +# cs_cudapp with CUDApp's exact CFLAGS (including -Werror), linked like build/hello_gpu. +make -C "$out/cudapp" -s --eval "cs_cudapp: ; \$(CC) \$(CFLAGS) -I. -o $out/cs_cudapp $here/cs_cudapp.c \$(OUT_DIR)/libomega_gpu.a -lpthread -lm" cs_cudapp +rm -f "$out/cudapp/build/cs_cudapp.d" "$out/cs_cudapp.d" + +common=(-std=gnu11 -Wall -Wextra -Werror -O2 -D_GNU_SOURCE -I"$cuda/include") +gcc "${common[@]}" -DCS_NVRTC -o "$out/cs_nvrtc" "$here/cs_cuda.c" -L"$cuda/lib64" -Wl,-rpath,"$cuda/lib64" -lnvrtc -lcuda +gcc "${common[@]}" -DCS_PTXC -o "$out/cs_ptxc" "$here/cs_cuda.c" "$cuda/lib64/libnvptxcompiler_static.a" -lcuda -lpthread -lm -ldl -lrt + +# The committed PTX must be what NVRTC emits for the same source today (drift check). +"$out/cs_nvrtc" --emit-ptx "$out/vecadd.ptx" +cmp -s "$out/vecadd.ptx" "$here/vecadd.ptx" || { echo "build: coldstart/vecadd.ptx differs from NVRTC output ($out/vecadd.ptx)" >&2; exit 1; } + +{ + echo "cudapp_pin $pin" + echo "gcc $(gcc -dumpfullversion)" + for f in cs_cudapp cs_nvrtc cs_ptxc cudapp/build/hello_gpu cudapp/build/libomega_gpu.a; do + echo "sha256 $f $(sha256sum "$out/$f" | cut -d' ' -f1)" + done + echo "sha256 vecadd.ptx $(sha256sum "$here/vecadd.ptx" | cut -d' ' -f1)" + echo "versions $("$out/cs_nvrtc" --versions)" + echo "versions $("$out/cs_ptxc" --versions)" +} > "$out/build.txt" +cat "$out/build.txt" +echo "build: OK $out" diff --git a/coldstart/cs_cuda.c b/coldstart/cs_cuda.c new file mode 100644 index 0000000..c132891 --- /dev/null +++ b/coldstart/cs_cuda.c @@ -0,0 +1,232 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* coldstart/cs_cuda.c: the two NVIDIA arms of the cold-start study (coldstart/PROTOCOL.md). + * + * Built twice by coldstart/build.sh: + * -DCS_NVRTC arm NVRTC: the CUDA C++ source below -> sm_121 cubin with NVRTC (CUDA 13.0.88) + * -DCS_PTXC arm PTXC: the committed coldstart/vecadd.ptx -> sm_121 cubin with the static nvPTXCompiler + * Both then open the GPU, load the cubin and launch through the CUDA driver API (libcuda 580.173.02). + * + * The job is the job of CUDApp's examples/hello_gpu at the pinned commit: c = a + b over 1048576 floats, + * eight launches of 1024 blocks x 128 threads, inputs a[i] = i * 0.25, b[i] = 1 / (1 + i % 7), c poisoned + * with 0xFFC0FFEE, every element checked bit for bit against the CPU's own a + b. + * + * Measurement tool (a referee for the NVIDIA side), not product code: it has to call NVIDIA's C APIs. + * + * Output: one JSON line on stdout. Exit 0 = every element right, 1 = check failed, 2 = setup failed. + * Options: --skip-run (negative control: no launch, the check must fail), --emit-code FILE (write the + * cubin), --maps FILE (copy /proc/self/maps after the run), --ptx FILE (PTXC: the PTX to compile), + * --emit-ptx FILE (NVRTC: write compute_121 PTX for the same source and exit), --versions, --build-only (build and + * time the warm builds, no GPU opened), --warm N (0..10 warm builds after the cold path; run.py passes 0 to + * measured cold processes). */ +#include +#include +#include +#include +#include +#include +#if defined(CS_NVRTC) +#include +#define ARM "NVRTC" +#elif defined(CS_PTXC) +#include +#define ARM "PTXC" +#else +#error "build with -DCS_NVRTC or -DCS_PTXC" +#endif + +#define N_TOTAL (1u << 20) +#define THREADS 128u +#define CHUNK (THREADS * 1024u) +#define POISON 0xFFC0FFEEu +#define WARM 10 + +/* The CUDA C++ source of the NVRTC arm. coldstart/vecadd.ptx is NVRTC's compute_121 PTX for this same string. */ +#if defined(CS_NVRTC) +static const char src[] = + "extern \"C\" __global__ void vecadd(const float*a,const float*b,float*c,unsigned n)" + "{unsigned i=blockIdx.x*blockDim.x+threadIdx.x;if(i 0) fwrite(buf, 1, k, out); + fclose(in); return fclose(out); +} + +#if defined(CS_NVRTC) +static int compile(const char *opt, int want_ptx, char **out, size_t *n) { + nvrtcProgram p; + if (nvrtcCreateProgram(&p, src, "vecadd.cu", 0, NULL, NULL) != NVRTC_SUCCESS) return -1; + nvrtcResult e = nvrtcCompileProgram(p, 1, &opt); + if (e != NVRTC_SUCCESS) { fprintf(stderr, "cs: nvrtcCompileProgram: %s\n", nvrtcGetErrorString(e)); nvrtcDestroyProgram(&p); return -1; } + if ((want_ptx ? nvrtcGetPTXSize(p, n) : nvrtcGetCUBINSize(p, n)) != NVRTC_SUCCESS || *n == 0) { nvrtcDestroyProgram(&p); return -1; } + *out = malloc(*n); + if (!*out || (want_ptx ? nvrtcGetPTX(p, *out) : nvrtcGetCUBIN(p, *out)) != NVRTC_SUCCESS) { nvrtcDestroyProgram(&p); return -1; } + nvrtcDestroyProgram(&p); + return 0; +} +static int build(const char *ptx, char **out, size_t *n) { (void)ptx; return compile("--gpu-architecture=sm_121", 0, out, n); } +#else +static int build(const char *ptx, char **out, size_t *n) { + nvPTXCompilerHandle h; + const char *opt[] = { "--gpu-name=sm_121" }; + if (nvPTXCompilerCreate(&h, strlen(ptx), ptx) != NVPTXCOMPILE_SUCCESS) return -1; + if (nvPTXCompilerCompile(h, 1, opt) != NVPTXCOMPILE_SUCCESS) { nvPTXCompilerDestroy(&h); return -1; } + if (nvPTXCompilerGetCompiledProgramSize(h, n) != NVPTXCOMPILE_SUCCESS || *n == 0) { nvPTXCompilerDestroy(&h); return -1; } + *out = malloc(*n); + if (!*out || nvPTXCompilerGetCompiledProgram(h, *out) != NVPTXCOMPILE_SUCCESS) { nvPTXCompilerDestroy(&h); return -1; } + nvPTXCompilerDestroy(&h); + return 0; +} +static char *slurp(const char *path) { + FILE *f = fopen(path, "rb"); if (!f) return NULL; + fseek(f, 0, SEEK_END); long n = ftell(f); fseek(f, 0, SEEK_SET); + char *b = malloc((size_t)n + 1); if (!b || fread(b, 1, (size_t)n, f) != (size_t)n) { fclose(f); return NULL; } + b[n] = 0; fclose(f); return b; +} +#endif + +#define CK(x) do { CUresult r_ = (x); if (r_ != CUDA_SUCCESS) { const char *s_ = NULL; cuGetErrorName(r_, &s_); \ + fprintf(stderr, "cs: %s: %s\n", #x, s_ ? s_ : "?"); return 2; } } while (0) + +static int versions(void) { + int drv = 0; cuDriverGetVersion(&drv); +#if defined(CS_NVRTC) + int ma = 0, mi = 0; nvrtcVersion(&ma, &mi); + printf("{\"arm\":\"%s\",\"cuDriverGetVersion\":%d,\"nvrtcVersion\":\"%d.%d\"}\n", ARM, drv, ma, mi); +#else + unsigned ma = 0, mi = 0; nvPTXCompilerGetVersion(&ma, &mi); + printf("{\"arm\":\"%s\",\"cuDriverGetVersion\":%d,\"nvPTXCompilerGetVersion\":\"%u.%u\"}\n", ARM, drv, ma, mi); +#endif + return 0; +} + +static int nwarm = WARM; /* --warm N (0..WARM): measured cold processes use 0 so process time holds the cold path only */ +static int warm_builds(const char *ptx, uint64_t *warm) { + for (int r = 0; r < nwarm; r++) { + char *w = NULL; size_t wn = 0; uint64_t s = now_ns(); + if (build(ptx, &w, &wn)) return -1; + warm[r] = now_ns() - s; free(w); + } + return 0; +} +static void print_warm(const uint64_t *warm) { for (int r = 0; r < nwarm; r++) printf("%s%llu", r ? "," : "", (unsigned long long)warm[r]); } + +int main(int argc, char **argv) { + const uint64_t t_main = now_ns(); + int skip_run = 0, build_only = 0; + const char *emit_code = NULL, *maps = NULL, *ptx_path = "coldstart/vecadd.ptx"; + for (int i = 1; i < argc; i++) { + if (!strcmp(argv[i], "--skip-run")) skip_run = 1; + else if (!strcmp(argv[i], "--build-only")) build_only = 1; + else if (!strcmp(argv[i], "--warm") && i + 1 < argc) { nwarm = atoi(argv[++i]); if (nwarm < 0 || nwarm > WARM) return 2; } + else if (!strcmp(argv[i], "--emit-code") && i + 1 < argc) emit_code = argv[++i]; + else if (!strcmp(argv[i], "--maps") && i + 1 < argc) maps = argv[++i]; + else if (!strcmp(argv[i], "--ptx") && i + 1 < argc) ptx_path = argv[++i]; + else if (!strcmp(argv[i], "--versions")) return versions(); +#if defined(CS_NVRTC) + else if (!strcmp(argv[i], "--emit-ptx") && i + 1 < argc) { + char *p; size_t n; + if (compile("--gpu-architecture=compute_121", 1, &p, &n)) return 2; + return write_file(argv[i + 1], p, strlen(p)) ? 2 : 0; + } +#endif + else { fprintf(stderr, "usage: cs_%s [--skip-run|--build-only] [--warm N] [--emit-code FILE] [--maps FILE] [--ptx FILE] [--versions]\n", ARM); return 2; } + } + (void)ptx_path; + + /* prep: host inputs (and, for PTXC, the PTX text) in memory. Not compared between arms. */ + const size_t bytes = (size_t)N_TOTAL * sizeof(float); + float *fa = aligned_alloc(64, bytes), *fb = aligned_alloc(64, bytes); + uint32_t *wc0 = aligned_alloc(64, bytes), *wc = aligned_alloc(64, bytes); + if (!fa || !fb || !wc0 || !wc) return 2; + for (uint32_t i = 0; i < N_TOTAL; i++) { fa[i] = (float)i * 0.25f; fb[i] = 1.0f / (float)(1 + i % 7); wc0[i] = POISON; } +#if defined(CS_PTXC) + char *ptx = slurp(ptx_path); + if (!ptx) { fprintf(stderr, "cs: cannot read %s\n", ptx_path); return 2; } +#else + const char *ptx = NULL; +#endif + const uint64_t t_prep = now_ns(); + + /* build: kernel description in memory -> loadable device code in host memory */ + char *cubin = NULL; size_t cubin_n = 0; + if (build(ptx, &cubin, &cubin_n)) { fprintf(stderr, "cs: build failed\n"); return 2; } + const uint64_t t_build = now_ns(); + + /* --build-only: no GPU is opened; the build, WARM more builds, the code written if asked */ + if (build_only) { + uint64_t warm[WARM]; + if (warm_builds(ptx, warm)) return 2; + if (emit_code && write_file(emit_code, cubin, cubin_n)) return 2; + printf("{\"arm\":\"%s\",\"build_only\":1,\"t_main_ns\":%llu,\"prep_ns\":%llu,\"build_ns\":%llu,\"warm_build_ns\":[", ARM, + (unsigned long long)t_main, (unsigned long long)(t_prep - t_main), (unsigned long long)(t_build - t_prep)); + print_warm(warm); + printf("],\"code_bytes\":%zu,\"code_fnv\":\"%016llx\"}\n", cubin_n, (unsigned long long)fnv(cubin, cubin_n)); + return 0; + } + + /* open: no GPU state in this process -> a current context */ + CUdevice dev; CUcontext ctx; + CK(cuInit(0)); CK(cuDeviceGet(&dev, 0)); CK(cuDevicePrimaryCtxRetain(&ctx, dev)); CK(cuCtxSetCurrent(ctx)); + const uint64_t t_open = now_ns(); + + /* load: device code in host memory -> a launchable function */ + CUmodule mod; CUfunction fn; + CK(cuModuleLoadData(&mod, cubin)); CK(cuModuleGetFunction(&fn, mod, "vecadd")); + const uint64_t t_load = now_ns(); + + /* data: three device buffers, inputs and the poisoned output copied in */ + CUdeviceptr a, b, c; + CK(cuMemAlloc(&a, bytes)); CK(cuMemAlloc(&b, bytes)); CK(cuMemAlloc(&c, bytes)); + CK(cuMemcpyHtoD(a, fa, bytes)); CK(cuMemcpyHtoD(b, fb, bytes)); CK(cuMemcpyHtoD(c, wc0, bytes)); + const uint64_t t_data = now_ns(); + + /* run: eight launches on the default stream, then wait for all of them */ + if (!skip_run) { + for (uint32_t base = 0; base < N_TOTAL; base += CHUNK) { + uint64_t off = (uint64_t)base * sizeof(float); + CUdeviceptr pa = a + off, pb = b + off, pc = c + off; + unsigned n = N_TOTAL - base < CHUNK ? N_TOTAL - base : CHUNK; + void *params[] = { &pa, &pb, &pc, &n }; + CK(cuLaunchKernel(fn, (n + THREADS - 1) / THREADS, 1, 1, THREADS, 1, 1, 0, NULL, params, NULL)); + } + } + CK(cuCtxSynchronize()); + const uint64_t t_run = now_ns(); + + /* readback: the output to host memory, every element checked bit for bit */ + CK(cuMemcpyDtoH(wc, c, bytes)); + uint32_t wrong = 0, unwritten = 0; + for (uint32_t i = 0; i < N_TOTAL; i++) { + float want = fa[i] + fb[i]; + if (wc[i] == POISON) unwritten++; + if (memcmp(&want, &wc[i], sizeof want) != 0) wrong++; + } + const uint64_t t_check = now_ns(); + + /* after the cold path: WARM more builds in the same process */ + uint64_t warm[WARM]; + if (warm_builds(ptx, warm)) return 2; + if (maps && copy_maps(maps)) return 2; + if (emit_code && write_file(emit_code, cubin, cubin_n)) return 2; + const uint64_t code_fnv = fnv(cubin, cubin_n), out_fnv = fnv(wc, bytes); + + const uint64_t t_close0 = now_ns(); + CK(cuMemFree(a)); CK(cuMemFree(b)); CK(cuMemFree(c)); CK(cuModuleUnload(mod)); CK(cuDevicePrimaryCtxRelease(dev)); + const uint64_t t_close = now_ns(); + + printf("{\"arm\":\"%s\",\"t_main_ns\":%llu,\"prep_ns\":%llu,\"build_ns\":%llu,\"open_ns\":%llu,\"load_ns\":%llu," + "\"data_ns\":%llu,\"run_ns\":%llu,\"check_ns\":%llu,\"close_ns\":%llu,\"warm_build_ns\":[", + ARM, (unsigned long long)t_main, (unsigned long long)(t_prep - t_main), (unsigned long long)(t_build - t_prep), + (unsigned long long)(t_open - t_build), (unsigned long long)(t_load - t_open), (unsigned long long)(t_data - t_load), + (unsigned long long)(t_run - t_data), (unsigned long long)(t_check - t_run), (unsigned long long)(t_close - t_close0)); + print_warm(warm); + printf("],\"code_bytes\":%zu,\"code_fnv\":\"%016llx\",\"out_fnv\":\"%016llx\",\"wrong\":%u,\"unwritten\":%u,\"skip_run\":%d}\n", + cubin_n, (unsigned long long)code_fnv, (unsigned long long)out_fnv, wrong, unwritten, skip_run); + return wrong ? 1 : 0; +} diff --git a/coldstart/cs_cudapp.c b/coldstart/cs_cudapp.c new file mode 100644 index 0000000..7a8dedb --- /dev/null +++ b/coldstart/cs_cudapp.c @@ -0,0 +1,165 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* coldstart/cs_cudapp.c: the CUDAPP arm of the cold-start study (coldstart/PROTOCOL.md). + * + * It compiles CUDApp's own examples/hello_gpu/hello_gpu.c from the pinned commit into this file, with that + * file's main renamed, so the kernel builder (build_vecadd), the inputs and the job are the ones hello_gpu + * runs, byte for byte. Only the timing points and the JSON line are added here. The machine-code sha256 of + * --emit-code must equal the "machine code sha256" hello_gpu prints at the same commit. + * + * Measurement tool, not product code. Its .om successor is the native .om hello of aien-dev/CUDApp#79. + * + * Output: one JSON line on stdout. Exit 0 = every element right, 1 = check failed, 2 = setup failed or no GPU. + * Options: --skip-run (negative control: no launch, the check must fail), --emit-code FILE (write the + * instruction words), --maps FILE (copy /proc/self/maps after the run), --build-only (build and time the warm + * builds, no GPU opened), --warm N (0..10 warm builds after the cold path; run.py passes 0 to measured cold + * processes). */ +#define main cudapp_hello_main +#include "examples/hello_gpu/hello_gpu.c" +#undef main + +#define WARM 10 + +static uint64_t cs_now_ns(void) { struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); return (uint64_t)t.tv_sec * 1000000000ull + (uint64_t)t.tv_nsec; } +static uint64_t cs_fnv(const void *p, size_t n) { const uint8_t *q = p; uint64_t h = 0xcbf29ce484222325ull; for (size_t i = 0; i < n; i++) { h ^= q[i]; h *= 0x100000001b3ull; } return h; } +static int cs_write(const char *path, const void *p, size_t n) { FILE *f = fopen(path, "wb"); if (!f) return -1; size_t w = fwrite(p, 1, n, f); return (fclose(f) == 0 && w == n) ? 0 : -1; } +static int cs_maps(const char *path) { + FILE *in = fopen("/proc/self/maps", "r"), *out = fopen(path, "w"); char buf[4096]; size_t k; + if (!in || !out) return -1; + while ((k = fread(buf, 1, sizeof buf, in)) > 0) fwrite(buf, 1, k, out); + fclose(in); return fclose(out); +} +static int cs_fail(const char *what) { fprintf(stderr, "cs: %s (stage: %s)\n", what, omega_gpu_session_last_error()); return 2; } + +static BlackwellIRProgram cs_prog; + +/* build: kernel description -> machine code in host memory (what hello_gpu times as "kernel built in") */ +static int cs_build(uint8_t **words, size_t *need, OmegaBlackwellKernel *k) { + if (build_vecadd(&cs_prog) != 0) return -1; + *need = omega_bw_program_code_bytes(&cs_prog); + *words = calloc(1, *need); + if (!*words || omega_blackwell_kernel_encode_into(&cs_prog, *words, *need, k) != 0) return -1; + return 0; +} +static int nwarm = WARM; /* --warm N (0..WARM): measured cold processes use 0 so process time holds the cold path only */ +static int cs_warm(uint64_t *warm) { + for (int r = 0; r < nwarm; r++) { + uint8_t *w = NULL; size_t wn = 0; OmegaBlackwellKernel wk; uint64_t s = cs_now_ns(); + if (cs_build(&w, &wn, &wk)) return -1; + warm[r] = cs_now_ns() - s; free(w); + } + return 0; +} +static void cs_print_warm(const uint64_t *warm) { for (int r = 0; r < nwarm; r++) printf("%s%llu", r ? "," : "", (unsigned long long)warm[r]); } + + +int main(int argc, char **argv) { + const uint64_t t_main = cs_now_ns(); + int skip_run = 0, build_only = 0; + const char *emit_code = NULL, *maps = NULL; + for (int i = 1; i < argc; i++) { + if (!strcmp(argv[i], "--skip-run")) skip_run = 1; + else if (!strcmp(argv[i], "--build-only")) build_only = 1; + else if (!strcmp(argv[i], "--warm") && i + 1 < argc) { nwarm = atoi(argv[++i]); if (nwarm < 0 || nwarm > WARM) return 2; } + else if (!strcmp(argv[i], "--emit-code") && i + 1 < argc) emit_code = argv[++i]; + else if (!strcmp(argv[i], "--maps") && i + 1 < argc) maps = argv[++i]; + else { fprintf(stderr, "usage: cs_cudapp [--skip-run|--build-only] [--warm N] [--emit-code FILE] [--maps FILE]\n"); return 2; } + } + + /* prep: host inputs in memory. Not compared between arms. */ + const size_t bytes = (size_t)N_TOTAL * sizeof(float); + float *fa = aligned_alloc(64, bytes), *fb = aligned_alloc(64, bytes); + uint32_t *wc0 = aligned_alloc(64, bytes); + if (!fa || !fb || !wc0) return 2; + inputs(fa, fb, wc0); + const uint64_t t_prep = cs_now_ns(); + + /* build */ + uint8_t *words = NULL; size_t need = 0; OmegaBlackwellKernel k; + if (cs_build(&words, &need, &k)) { fprintf(stderr, "cs: build failed\n"); return 2; } + const uint64_t t_build = cs_now_ns(); + + /* --build-only: no GPU is opened; the build, WARM more builds, the code written if asked */ + if (build_only) { + uint64_t warm[WARM]; + if (cs_warm(warm)) return 2; + if (emit_code && cs_write(emit_code, words, k.insn_count * 16u)) return 2; + printf("{\"arm\":\"CUDAPP\",\"build_only\":1,\"t_main_ns\":%llu,\"prep_ns\":%llu,\"build_ns\":%llu,\"warm_build_ns\":[", + (unsigned long long)t_main, (unsigned long long)(t_prep - t_main), (unsigned long long)(t_build - t_prep)); + cs_print_warm(warm); + printf("],\"code_bytes\":%zu,\"code_fnv\":\"%016llx\"}\n", k.insn_count * 16u, (unsigned long long)cs_fnv(words, k.insn_count * 16u)); + return 0; + } + + /* open */ + omega_gpu_session_lock(); + if (!omega_gpu_session_open()) { fprintf(stderr, "cs: GPU not available (stage: %s)\nNOT_RUN\n", omega_gpu_session_last_error()); return 2; } + const uint64_t t_open = cs_now_ns(); + + /* load: the code buffer, the built words copied in and made visible to the GPU */ + OmegaGpuMem code = { 0 }, a = { 0 }, b = { 0 }, c = { 0 }; + if (omega_gpu_session_alloc_code(need, &code) != 0) return cs_fail("alloc_code"); + memcpy(code.cpu, words, need); + if (omega_gpu_session_sync_to_gpu(&code) != 0) return cs_fail("sync code"); + const uint64_t t_load = cs_now_ns(); + + /* data: three buffers, inputs and the poisoned output copied in */ + if (omega_gpu_session_alloc(bytes, &a) != 0 || omega_gpu_session_alloc(bytes, &b) != 0 || omega_gpu_session_alloc(bytes, &c) != 0) + return cs_fail("alloc"); + memcpy(a.cpu, fa, bytes); memcpy(b.cpu, fb, bytes); memcpy(c.cpu, wc0, bytes); + if (omega_gpu_session_sync_to_gpu(&a) || omega_gpu_session_sync_to_gpu(&b) || omega_gpu_session_sync_to_gpu(&c)) return cs_fail("sync data"); + const uint64_t t_data = cs_now_ns(); + + /* run: the same eight launches hello_gpu makes; each returns when its completion marker is seen */ + uint32_t declared = omega_bw_gpr_declared(cs_prog.regalloc.peak_gpr_usage); + uint64_t gpu_ns = 0; + if (!skip_run) { + for (uint32_t base = 0; base < N_TOTAL; base += CHUNK) { + uint64_t off = (uint64_t)base * sizeof(float); + uint32_t n = N_TOTAL - base < CHUNK ? N_TOTAL - base : CHUNK; + uint32_t args[OMEGA_BW_CBANK_MATMUL_ARGS_WORDS] = { (uint32_t)(a.va + off), (uint32_t)((a.va + off) >> 32), + (uint32_t)(b.va + off), (uint32_t)((b.va + off) >> 32), (uint32_t)(c.va + off), (uint32_t)((c.va + off) >> 32), n }; + OmegaGpuLaunch L = { .code_va = code.va, .gpr_count = declared < 64 ? 64 : declared, .threads_x = THREADS, .threads_y = 1, + .grid_x = (n + THREADS - 1) / THREADS, .grid_y = 1, .num_elements = n, + .args = args, .n_args = OMEGA_BW_CBANK_MATMUL_ARGS_WORDS, .timeout_ms = 10000 }; + uint64_t el = 0; + if (omega_gpu_session_launch(&L, &el, NULL) != 0) return cs_fail("launch"); + gpu_ns += el; + } + } + const uint64_t t_run = cs_now_ns(); + + /* readback: the output made visible to the CPU, every element checked bit for bit */ + if (omega_gpu_session_sync_to_cpu(&c) != 0) return cs_fail("sync to cpu"); + const uint32_t *wc = c.cpu; + uint32_t wrong = 0, unwritten = 0; + for (uint32_t i = 0; i < N_TOTAL; i++) { + float want = fa[i] + fb[i]; + if (wc[i] == POISON) unwritten++; + if (memcmp(&want, &wc[i], sizeof want) != 0) wrong++; + } + const uint64_t t_check = cs_now_ns(); + + /* after the cold path: WARM more builds in the same process */ + uint64_t warm[WARM]; + if (cs_warm(warm)) return 2; + if (maps && cs_maps(maps)) return 2; + if (emit_code && cs_write(emit_code, words, k.insn_count * 16u)) return 2; + const uint64_t code_fnv = cs_fnv(words, k.insn_count * 16u), out_fnv = cs_fnv(wc, bytes); + + const uint64_t t_close0 = cs_now_ns(); + omega_gpu_session_free(&code); omega_gpu_session_free(&a); omega_gpu_session_free(&b); omega_gpu_session_free(&c); + omega_gpu_session_unlock(); + omega_gpu_session_close(); + const uint64_t t_close = cs_now_ns(); + + printf("{\"arm\":\"CUDAPP\",\"t_main_ns\":%llu,\"prep_ns\":%llu,\"build_ns\":%llu,\"open_ns\":%llu,\"load_ns\":%llu," + "\"data_ns\":%llu,\"run_ns\":%llu,\"check_ns\":%llu,\"close_ns\":%llu,\"warm_build_ns\":[", + (unsigned long long)t_main, (unsigned long long)(t_prep - t_main), (unsigned long long)(t_build - t_prep), + (unsigned long long)(t_open - t_build), (unsigned long long)(t_load - t_open), (unsigned long long)(t_data - t_load), + (unsigned long long)(t_run - t_data), (unsigned long long)(t_check - t_run), (unsigned long long)(t_close - t_close0)); + cs_print_warm(warm); + printf("],\"code_bytes\":%zu,\"code_fnv\":\"%016llx\",\"out_fnv\":\"%016llx\",\"wrong\":%u,\"unwritten\":%u,\"skip_run\":%d," + "\"gpu_ns\":%llu}\n", k.insn_count * 16u, (unsigned long long)code_fnv, (unsigned long long)out_fnv, wrong, unwritten, + skip_run, (unsigned long long)gpu_ns); + return wrong ? 1 : 0; +} diff --git a/coldstart/run.py b/coldstart/run.py new file mode 100755 index 0000000..a621c67 --- /dev/null +++ b/coldstart/run.py @@ -0,0 +1,278 @@ +#!/usr/bin/env python3 +"""coldstart/run.py: driver of the cold-start chip microbenchmark (coldstart/PROTOCOL.md section 5). + +Measurement tooling, not first-party product code. It runs inside one spark-window and writes +results/coldstart/{raw.jsonl,session.json,rows.wl}. --dry-run runs the same schedule on the host with +--build-only (no GPU opened) into a scratch directory; dry-run output is never a result. +""" +import argparse, datetime, hashlib, itertools, json, os, subprocess, sys, time + +ARMS = ("CUDAPP", "PTXC", "NVRTC") +BIN = {"CUDAPP": "cs_cudapp", "PTXC": "cs_ptxc", "NVRTC": "cs_nvrtc"} +ORDERS = list(itertools.permutations(ARMS)) # the 6 orders, round r uses ORDERS[r % 6] +ARM_CORES = (9, 8, 7) # X925 (A2), first one free of the nvidia-modeset kthreads +DRIVER_CORE = 12 # A725 (A2) +N_TOTAL = 1 << 20 +CUDAPP_CODE_SHA = "9e28bd9c46f80584d77238a752e99cecddbc8d622ffbe320885ed2f499e1f075" # hello_gpu --sim at cc0908bd +FORBIDDEN = ("libcuda", "libcudart", "libnvrtc", "libnvptx", "libnvidia") +CAP_S = 15 * 60 + +here = os.path.dirname(os.path.abspath(__file__)) +repo = os.path.dirname(here) + + +def mono(): + return time.clock_gettime_ns(time.CLOCK_MONOTONIC) + + +def utc(): + return datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") + + +def sha256(path): + h = hashlib.sha256() + with open(path, "rb") as f: + for b in iter(lambda: f.read(1 << 20), b""): + h.update(b) + return h.hexdigest() + + +def load1(): + with open("/proc/loadavg") as f: + return float(f.read().split()[0]) + + +def kthread_cpus(): + """CPU (stat field 39) of every nvidia-modeset kernel thread.""" + cpus = {} + for d in os.listdir("/proc"): + if not d.isdigit(): + continue + try: + with open(f"/proc/{d}/comm") as f: + comm = f.read().strip() + if not comm.startswith("nvidia-modeset"): + continue + with open(f"/proc/{d}/stat") as f: + rest = f.read().rsplit(")", 1)[1].split() + cpus[f"{d}:{comm}"] = int(rest[36]) + except (OSError, IndexError, ValueError): + continue + return cpus + + +def gpu_apps(): + r = subprocess.run(["nvidia-smi", "--query-compute-apps=pid,process_name,used_memory", "--format=csv,noheader"], + capture_output=True, text=True, timeout=30) + return {"rc": r.returncode, "apps": [l.strip() for l in r.stdout.splitlines() if l.strip()]} + + +def spawn(path, args, core, cwd): + env = dict(os.environ, CUDA_CACHE_DISABLE="1") + l1 = load1() + t0 = mono() + p = subprocess.Popen([path] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd, env=env, + preexec_fn=lambda: os.sched_setaffinity(0, {core})) + out, err = p.communicate(timeout=120) + t1 = mono() + row = {"exit": p.returncode, "load1": l1, "spawn_ns": t0, "proc_ns": t1 - t0} + try: + rep = json.loads(out.decode().strip().splitlines()[-1]) + row.update(rep) + row["exec_ns"] = rep["t_main_ns"] - t0 + except (ValueError, IndexError, KeyError): + row["stdout"] = out.decode(errors="replace")[-400:] + if p.returncode != 0: + row["stderr"] = err.decode(errors="replace")[-400:] + return row + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument("--build", default="/tmp/h2h-coldstart-build", help="output directory of coldstart/build.sh") + ap.add_argument("--out", default=os.path.join(repo, "results", "coldstart")) + ap.add_argument("--rounds", type=int, default=30) + ap.add_argument("--warmup", type=int, default=2) + ap.add_argument("--warm-rounds", type=int, default=10) + ap.add_argument("--gap", type=float, default=1.0) + ap.add_argument("--dry-run", action="store_true", help="host only: --build-only, scratch output, no GPU") + a = ap.parse_args() + + t_start = mono() + if a.dry_run: + if a.out == os.path.join(repo, "results", "coldstart"): + sys.exit("run: --dry-run needs --out outside results/") + elif os.environ.get("AIEN_GB10_LOCK_HELD") != "1" or not os.environ.get("SPARK_WINDOW"): + sys.exit("run: not inside a spark-window holding the chip lock (spark-window run coldstart/run.py ...)") + os.makedirs(a.out, exist_ok=True) + os.sched_setaffinity(0, {DRIVER_CORE}) + + session = {"started_utc": utc(), "dry_run": a.dry_run, "spark_window": os.environ.get("SPARK_WINDOW"), + "rounds": a.rounds, "warmup": a.warmup, "warm_rounds": a.warm_rounds, "gap_s": a.gap, "driver_core": DRIVER_CORE, + "uname": " ".join(os.uname()), "CUDA_CACHE_DISABLE": "1"} + with open(os.path.join(a.build, "build.txt")) as f: + build = f.read() + session["build_txt"] = build + want = {l.split()[1]: l.split()[2] for l in build.splitlines() if l.startswith("sha256 ")} + paths = {arm: os.path.join(a.build, BIN[arm]) for arm in ARMS} + for arm, p in paths.items(): + got = sha256(p) + if got != want.get(BIN[arm]): + sys.exit(f"run: {p} sha256 {got} is not the one in build.txt") + ptx = os.path.join(here, "vecadd.ptx") + if sha256(ptx) != want.get("vecadd.ptx"): + sys.exit("run: coldstart/vecadd.ptx is not the one in build.txt") + extra = {"CUDAPP": [], "PTXC": ["--ptx", ptx], "NVRTC": []} + + kt = kthread_cpus() + session["nvidia_modeset_kthread_cpus"] = kt + core = next((c for c in ARM_CORES if c not in kt.values()), None) + if core is None: + sys.exit(f"run: every arm core {ARM_CORES} hosts an nvidia-modeset kthread {kt}") + session["arm_core"] = core + + if not a.dry_run: + q = subprocess.run([sys.executable, os.path.join(repo, "bench", "quiet.py"), "--window", "60", "--max-load", "6", + "--exclude-tree", str(os.getpid())], capture_output=True, text=True) + session["quiet"] = {"rc": q.returncode, "out": q.stdout.strip()} + if q.returncode != 0: + sys.exit(f"run: machine not quiet: {q.stdout.strip()}") + session["gpu_apps_before"] = gpu_apps() + if session["gpu_apps_before"]["apps"]: + sys.exit(f"run: GPU compute apps present: {session['gpu_apps_before']}") + + raw = open(os.path.join(a.out, "raw.jsonl"), "w") + + def record(row): + raw.write(json.dumps(row, sort_keys=True) + "\n") + raw.flush() + + # Section 6 controls. Any failure stops the study before a measured process runs. + fails = [] + codes = {} + for arm in ARMS: + cf = os.path.join(a.out, f"code.{arm}.bin") + r = spawn(paths[arm], extra[arm] + ["--build-only", "--emit-code", cf], core, repo) + r.update(arm=arm, phase="control_code") + record(r) + codes[arm] = sha256(cf) if r["exit"] == 0 else None + if r["exit"] != 0: + fails.append(f"{arm} --build-only exit {r['exit']}") + session["code_sha256"] = codes + if codes["CUDAPP"] != CUDAPP_CODE_SHA: + fails.append(f"CUDAPP code sha {codes['CUDAPP']} != hello_gpu --sim {CUDAPP_CODE_SHA}") + if codes["PTXC"] is None or codes["PTXC"] != codes["NVRTC"]: + fails.append(f"PTXC cubin {codes['PTXC']} != NVRTC cubin {codes['NVRTC']} (like-for-like broken)") + if not a.dry_run: + outs = {} + for arm in ARMS: + r = spawn(paths[arm], extra[arm] + ["--skip-run"], core, repo) + r.update(arm=arm, phase="control_skip_run") + record(r) + if not (r["exit"] == 1 and r.get("unwritten") == N_TOTAL and r.get("wrong") == N_TOTAL): + fails.append(f"{arm} --skip-run not caught: exit {r['exit']} unwritten {r.get('unwritten')}") + mf = os.path.join(a.out, f"maps.{arm}.txt") + r = spawn(paths[arm], extra[arm] + ["--maps", mf], core, repo) + r.update(arm=arm, phase="control_maps") + record(r) + if r["exit"] != 0 or r.get("wrong") != 0 or r.get("unwritten") != 0: + fails.append(f"{arm} maps run exit {r['exit']}") + outs[arm] = r.get("out_fnv") + maps = "" + if os.path.exists(mf): + with open(mf) as f: + maps = f.read() + libs = sorted({l.split()[-1] for l in maps.splitlines() if any(x in l.split()[-1] for x in FORBIDDEN)} if maps else []) + dev = [l for l in maps.splitlines() if "/dev/nvidia" in l] + if arm == "CUDAPP" and (libs or not dev): + fails.append(f"CUDAPP maps: NVIDIA user libraries {libs}, /dev/nvidia mappings {len(dev)}") + if arm != "CUDAPP" and not any("libcuda" in l for l in libs): + fails.append(f"{arm} maps: libcuda absent, the library check checks nothing") + session["out_fnv"] = outs + if len(set(outs.values())) != 1 or None in outs.values(): + fails.append(f"output differs between arms {outs}") + session["control_failures"] = fails + if fails: + session["verdict"] = "CONTROLS_FAILED" + _finish(a, session, raw) + sys.exit("run: controls failed: " + "; ".join(fails)) + + # Cold processes run the cold path only (--warm 0), so proc_ns holds no warm builds. + mode = (["--build-only"] if a.dry_run else []) + ["--warm", "0"] + n = 0 + for w in range(a.warmup): + for arm in ARMS: + r = spawn(paths[arm], extra[arm] + mode, core, repo) + r.update(arm=arm, phase="warmup", round=w) + record(r) + complete = True + + def timed_out(): + return (mono() - t_start) / 1e9 > CAP_S + + for rnd in range(a.rounds): + order = ORDERS[rnd % len(ORDERS)] + for slot, arm in enumerate(order): + if timed_out(): + complete = False + break + time.sleep(a.gap) + r = spawn(paths[arm], extra[arm] + mode, core, repo) + r.update(arm=arm, phase="measured", round=rnd, slot=slot, order="".join(x[0] for x in order)) + record(r) + n += 1 + if not complete: + break + # Warm builds (descriptive W): separate --build-only processes, 10 builds each after the cold one. + for rnd in range(a.warm_rounds if complete else 0): + order = ORDERS[rnd % len(ORDERS)] + for slot, arm in enumerate(order): + if timed_out(): + complete = False + break + time.sleep(a.gap) + r = spawn(paths[arm], extra[arm] + ["--build-only"], core, repo) + r.update(arm=arm, phase="warm", round=rnd, slot=slot, order="".join(x[0] for x in order)) + record(r) + if not complete: + break + session["measured_processes"] = n + session["complete"] = complete + session["verdict"] = "DRY_RUN" if a.dry_run else ("MEASURED" if complete else "INCOMPLETE_CAP") + if not a.dry_run: + session["gpu_apps_after"] = gpu_apps() + _finish(a, session, raw) + print(json.dumps({"verdict": session["verdict"], "measured": n, "out": a.out})) + + +def _finish(a, session, raw): + raw.close() + session["finished_utc"] = utc() + with open(os.path.join(a.out, "session.json"), "w") as f: + json.dump(session, f, indent=1, sort_keys=True) + # Wolfram input (coldstart/analysis.wl), every time in ns. csRows: one row per measured cold process. + # csWarm: one row per warm-phase process with its 10 warm build times; analysis.wl takes each one's median. + rows, warm = [], [] + with open(os.path.join(a.out, "raw.jsonl")) as f: + for l in f: + r = json.loads(l) + g = lambda k: r.get(k, 0) + if r.get("phase") == "warm": + warm.append('{"%s",%d,%s,{%s}}' % (r["arm"], r["round"], "True" if r["exit"] == 0 else "False", + ",".join(str(x) for x in r.get("warm_build_ns", [])))) + if r.get("phase") != "measured": + continue + ok = r["exit"] == 0 and (r.get("build_only") == 1 or (r.get("wrong") == 0 and r.get("unwritten") == 0)) + first = g("exec_ns") + g("prep_ns") + g("build_ns") + g("open_ns") + g("load_ns") + g("data_ns") + g("run_ns") + g("check_ns") + rows.append('{"%s",%d,%s,%s,%d,%d,%d,%d,%d}' % ( + r["arm"], r["round"], "True" if ok else "False", repr(r["load1"]), g("build_ns"), + g("build_ns") + g("open_ns") + g("load_ns"), first, r["proc_ns"], g("exec_ns"))) + with open(os.path.join(a.out, "rows.wl"), "w") as f: + f.write("(* csRows: {arm, round, ok, load1, build, ready, firstResult, proc, exec}; ns *)\n") + f.write("csRows = {" + ",\n ".join(rows) + "};\n") + f.write("(* csWarm: {arm, round, ok, {warm build ns ...}} *)\n") + f.write("csWarm = {" + ",\n ".join(warm) + "};\n") + + +if __name__ == "__main__": + main() diff --git a/coldstart/vecadd.ptx b/coldstart/vecadd.ptx new file mode 100644 index 0000000..36ca9aa --- /dev/null +++ b/coldstart/vecadd.ptx @@ -0,0 +1,51 @@ +// +// Generated by NVIDIA NVVM Compiler +// +// Compiler Build ID: CL-36424714 +// Cuda compilation tools, release 13.0, V13.0.88 +// Based on NVVM 20.0.0 +// + +.version 9.0 +.target sm_121 +.address_size 64 + + // .globl vecadd + +.visible .entry vecadd( + .param .u64 .ptr .align 1 vecadd_param_0, + .param .u64 .ptr .align 1 vecadd_param_1, + .param .u64 .ptr .align 1 vecadd_param_2, + .param .u32 vecadd_param_3 +) +{ + .reg .pred %p<2>; + .reg .b32 %r<6>; + .reg .b32 %f<4>; + .reg .b64 %rd<11>; + + ld.param.u64 %rd1, [vecadd_param_0]; + ld.param.u64 %rd2, [vecadd_param_1]; + ld.param.u64 %rd3, [vecadd_param_2]; + ld.param.u32 %r2, [vecadd_param_3]; + mov.u32 %r3, %ctaid.x; + mov.u32 %r4, %ntid.x; + mov.u32 %r5, %tid.x; + mad.lo.s32 %r1, %r3, %r4, %r5; + setp.ge.u32 %p1, %r1, %r2; + @%p1 bra $L__BB0_2; + cvta.to.global.u64 %rd4, %rd1; + cvta.to.global.u64 %rd5, %rd2; + cvta.to.global.u64 %rd6, %rd3; + mul.wide.u32 %rd7, %r1, 4; + add.s64 %rd8, %rd4, %rd7; + ld.global.f32 %f1, [%rd8]; + add.s64 %rd9, %rd5, %rd7; + ld.global.f32 %f2, [%rd9]; + add.f32 %f3, %f1, %f2; + add.s64 %rd10, %rd6, %rd7; + st.global.f32 [%rd10], %f3; +$L__BB0_2: + ret; + +} From d46cf8d23f19c050cbe590a4df8761226331ed8b Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Thu, 29 Oct 2026 17:23:48 -0500 Subject: [PATCH 2/2] results/coldstart: session 20261029T221603Z (MEASURED, controls pass) One spark-window (20261029T221538Z-ed5493, 22:15:41Z to 22:19:51Z) under predeclaration 63855ab4. run.py verdict MEASURED, 30/30 valid rows per arm, all controls passed. Wolfram csAnalyse: CUDAPP_LOWER on H1 build, H3 firstResult and H4 proc against PTXC and NVRTC. Raw rows, controls, Wolfram queries and outputs, RESULTS.md. --- results/coldstart/20261029T221603Z/RESULTS.md | 114 +++++++++ .../20261029T221603Z/code.CUDAPP.bin | Bin 0 -> 512 bytes .../coldstart/20261029T221603Z/code.NVRTC.bin | Bin 0 -> 5600 bytes .../coldstart/20261029T221603Z/code.PTXC.bin | Bin 0 -> 5600 bytes .../20261029T221603Z/maps.CUDAPP.txt | 36 +++ .../coldstart/20261029T221603Z/maps.NVRTC.txt | 120 +++++++++ .../coldstart/20261029T221603Z/maps.PTXC.txt | 104 ++++++++ results/coldstart/20261029T221603Z/raw.jsonl | 135 ++++++++++ results/coldstart/20261029T221603Z/rows.wl | 122 +++++++++ .../coldstart/20261029T221603Z/session.json | 45 ++++ .../wolfram.nvrtc-build-sorted.out.txt | 1 + .../wolfram.nvrtc-build-sorted.query.wl | 124 +++++++++ .../20261029T221603Z/wolfram.out.json | 236 ++++++++++++++++++ .../20261029T221603Z/wolfram.phases.out.txt | 1 + .../20261029T221603Z/wolfram.phases.query.wl | 92 +++++++ .../20261029T221603Z/wolfram.query.wl | 160 ++++++++++++ .../20261029T221603Z/wolfram.table.out.txt | 1 + .../20261029T221603Z/wolfram.table.query.wl | 165 ++++++++++++ .../wolfram.warm-call.out.txt | 1 + .../wolfram.warm-call.query.wl | 162 ++++++++++++ 20 files changed, 1619 insertions(+) create mode 100644 results/coldstart/20261029T221603Z/RESULTS.md create mode 100644 results/coldstart/20261029T221603Z/code.CUDAPP.bin create mode 100644 results/coldstart/20261029T221603Z/code.NVRTC.bin create mode 100644 results/coldstart/20261029T221603Z/code.PTXC.bin create mode 100644 results/coldstart/20261029T221603Z/maps.CUDAPP.txt create mode 100644 results/coldstart/20261029T221603Z/maps.NVRTC.txt create mode 100644 results/coldstart/20261029T221603Z/maps.PTXC.txt create mode 100644 results/coldstart/20261029T221603Z/raw.jsonl create mode 100644 results/coldstart/20261029T221603Z/rows.wl create mode 100644 results/coldstart/20261029T221603Z/session.json create mode 100644 results/coldstart/20261029T221603Z/wolfram.nvrtc-build-sorted.out.txt create mode 100644 results/coldstart/20261029T221603Z/wolfram.nvrtc-build-sorted.query.wl create mode 100644 results/coldstart/20261029T221603Z/wolfram.out.json create mode 100644 results/coldstart/20261029T221603Z/wolfram.phases.out.txt create mode 100644 results/coldstart/20261029T221603Z/wolfram.phases.query.wl create mode 100644 results/coldstart/20261029T221603Z/wolfram.query.wl create mode 100644 results/coldstart/20261029T221603Z/wolfram.table.out.txt create mode 100644 results/coldstart/20261029T221603Z/wolfram.table.query.wl create mode 100644 results/coldstart/20261029T221603Z/wolfram.warm-call.out.txt create mode 100644 results/coldstart/20261029T221603Z/wolfram.warm-call.query.wl diff --git a/results/coldstart/20261029T221603Z/RESULTS.md b/results/coldstart/20261029T221603Z/RESULTS.md new file mode 100644 index 0000000..eb10fb3 --- /dev/null +++ b/results/coldstart/20261029T221603Z/RESULTS.md @@ -0,0 +1,114 @@ +# Cold-start study, session 20261029T221603Z: RESULTS + +Evidence label: MEASURED on this DGX Spark (GB10) in one spark-window. Chip-level microbenchmark under +[coldstart/PROTOCOL.md](../../../coldstart/PROTOCOL.md) (PROTOCOL.md amendment A7). Not part of the main +results table `results/RESULTS.md`. + +## Session + +| Item | Value | +|------|-------| +| Protocol commit (predeclaration) | `63855ab4822eea6fec4e488f23b62bc976469c8c`, pushed to `protocol/a6-cold-start` 2026-10-29T22:15:13Z | +| spark-window | `20261029T221538Z-ed5493`, `--gb10 exclusive --quiet exclusive --lease 20`; opened 22:15:41Z (waited 3 s), closed 22:19:51Z, held 253 s, spark-window verdict `quiet machine` | +| run.py | started 22:16:03Z, finished 22:19:46Z, verdict `MEASURED`, `complete: true`, 90 measured processes | +| Quiet gate | `bench/quiet.py` 60 s ending 22:17:03Z: `quiet: true`, load1 1.2, busy `[]` | +| GPU compute apps | none before, none after | +| Cores | arm core 9; driver core 12; nvidia-modeset kthreads on cpu 4 | +| Measured load1 range | 0.92 to 3.38 (Wolfram `MinMax[csRows[[All, 4]]] -> {0.92, 3.38}`) | +| Environment | `CUDA_CACHE_DISABLE=1`, `CUDA_MODULE_LOADING` unset | + +Pins as predeclared (coldstart/PROTOCOL.md section 3): CUDApp `cc0908bdc0a0377f2166e9328dcf1d985457e27f`, +gcc 13.3.0, CUDA 13.0 (NVRTC 13.0.88, nvPTXCompiler 13.0), driver 580.173.02 (`cuDriverGetVersion` +13000). `session.json` carries `build.txt` verbatim; the driver's sha256 check of all three arm binaries +and `vecadd.ptx` against it passed. + +## Controls (all passed, `control_failures: []`) + +| Control | CUDAPP | PTXC | NVRTC | +|---------|--------|------|-------| +| code sha256 (`code..bin`) | `9e28bd9c...` (512 B), equals `hello_gpu --sim` | `691edc87...` (5600 B) | `691edc87...` (5600 B), identical to PTXC | +| `--skip-run` (negative) | exit 1, wrong = unwritten = 1048576 | exit 1, 1048576 / 1048576 | exit 1, 1048576 / 1048576 | +| maps (`maps..txt`) | no NVIDIA user library, 12 `/dev/nvidia` mappings | `libcuda` present | `libcuda` present | +| output FNV-1a (maps runs) | `e8aa66742b796a3d` | `e8aa66742b796a3d` | `e8aa66742b796a3d` | + +## Validity + +Every arm: 30 measured rows, 30 valid, 0 failed, 0 excluded for load (`rows_valid` in +`wolfram.out.json`). All arms valid (at least 28 of 30 required). Session not void: verdict `MEASURED`, +lease not exceeded, no chip-watchdog action during the window. + +## Headline metrics (microseconds, valid rows, n = 30 per arm) + +Median (Q1 to Q3), IQR. Source: `wolfram.table.out.txt` (rounded to 0.1 us by Wolfram); unrounded in +`wolfram.out.json`. + +| Metric | CUDAPP | PTXC | NVRTC | +|--------|--------|------|-------| +| H1 build | 77.7 (75.0 to 85.4), IQR 10.4 | 7029.6 (6027.1 to 7143.9), IQR 1116.8 | 119047.8 (98378.3 to 141661.8), IQR 43283.5 | +| H3 firstResult | 96774.1 (95517.6 to 102370.2), IQR 6852.6 | 263653.7 (259361.2 to 305322.0), IQR 45960.8 | 302786.4 (278044.6 to 325938.8), IQR 47894.3 | +| H4 proc | 154374.2 (144943.3 to 189373.1), IQR 44429.9 | 423561.1 (418338.3 to 466366.7), IQR 48028.4 | 481722.4 (441550.3 to 487635.4), IQR 46085.2 | + +Verdicts (section 7, non-overlapping IQRs): + +| Headline | CUDAPP vs PTXC | CUDAPP vs NVRTC | +|----------|----------------|-----------------| +| H1 build | CUDAPP_LOWER, median ratio 90.45 | CUDAPP_LOWER, median ratio 1531.74 | +| H3 firstResult | CUDAPP_LOWER, 2.72 | CUDAPP_LOWER, 3.13 | +| H4 proc | CUDAPP_LOWER, 2.74 | CUDAPP_LOWER, 3.12 | + +Ratios are other arm median over CUDAPP median, descriptive only. + +## Descriptive metrics + +| Metric | CUDAPP | PTXC | NVRTC | Calls (vs PTXC / vs NVRTC) | +|--------|--------|------|-------|----------------------------| +| H2 ready | 87150.7 (85946.8 to 93097.3) | 249194.6 (245828.0 to 290059.2) | 284483.7 (261889.2 to 307408.3) | CUDAPP_LOWER 2.86 / CUDAPP_LOWER 3.26 | +| E exec | 2609.7 (2524.7 to 2801.1) | 3878.2 (3649.3 to 4012.7) | 6611.2 (6328.0 to 6828.9) | CUDAPP_LOWER 1.49 / CUDAPP_LOWER 2.53 | +| W warm build (10 per-process medians) | 5.16 (5.144 to 5.192) | 3162.57 (3137.27 to 3176.66) | 16353.48 (16296.44 to 16385.04) | CUDAPP_LOWER 612.90 / CUDAPP_LOWER 3169.28 | + +W calls: `wolfram.warm-call.out.txt` (`{"PTXC" -> {"CUDAPP_LOWER", 612.9013081395348}, "NVRTC" -> +{"CUDAPP_LOWER", 3169.279360465116}}`). + +Phase medians, not predeclared, added as a description of where each arm spends its time +(`wolfram.phases.out.txt`, Wolfram `Median` per phase over the 30 measured rows, us): + +| Phase | CUDAPP | PTXC | NVRTC | +|-------|--------|------|-------| +| prep | 3537.2 | 3601.5 | 4670.8 | +| build | 77.7 | 7029.6 | 119047.8 | +| open | 86983.2 | 242130.8 | 163547.1 | +| load | 68.1 | 23.9 | 23.5 | +| data | 1675.8 | 900.6 | 898.3 | +| run | 844.7 | 60.1 | 61.7 | +| check | 519.8 | 5726.2 | 5480.1 | +| close | 50298.2 | 87451.5 | 87378.1 | + +## Reading + +- Every headline is CUDAPP_LOWER against both arms with non-overlapping IQRs, in this one session. +- The build gap is the largest; after build, opening the GPU dominates every arm. CUDApp's + `omega_gpu_session_open` has a median of 86983.2 us, nearly all of its firstResult. The NVIDIA arms' + open covers `cuInit` and primary context creation. +- Per phase, the NVIDIA arms are faster where the GPU itself works: run 60.1 and 61.7 us against + CUDApp's 844.7 us, and data 900.6 and 898.3 us against 1675.8 us. Their load (23.9, 23.5 us) is + near zero because CUDA 13 loads modules lazily; check holds their device to host copy. +- NVRTC's build median 119047.8 us sits between two groups (`wolfram.nvrtc-build-sorted.out.txt`): + 15 builds from 96662 to 101962 us and 15 from 136134 to 145481 us. Its IQR (43283.5) reflects that split. +- PTXC and NVRTC loaded the same cubin; their open medians differ (242130.8 against 163547.1 us). The + phase table does not explain that difference. + +## Caveats + +As predeclared (coldstart/PROTOCOL.md section 8): the builds differ in scope (`ptxas` optimizes a +general description; CUDApp lowers one fixed IR program to 32 instructions); process spawn and binary +size are inside exec, firstResult and proc for every arm; one session, one machine, one date. The +pre-protocol pilot and the host dry run are disclosed there and are not results. + +## Files + +`raw.jsonl` (every process, controls and warmups included), `session.json`, `rows.wl`, `code.*.bin`, +`maps.*.txt`, `wolfram.query.wl` with `wolfram.out.json` (csAnalyse), `wolfram.table.*`, +`wolfram.warm-call.*`, `wolfram.phases.*`. + +Zero-CUDA proof of `hello_gpu` taken in the same window before run.py (not part of the protocol): +`/home/drakestapleton/handoffs/cudapp-video-20261029/{hello.stdout,maps.txt,openat.txt,ldd.txt}`. diff --git a/results/coldstart/20261029T221603Z/code.CUDAPP.bin b/results/coldstart/20261029T221603Z/code.CUDAPP.bin new file mode 100644 index 0000000000000000000000000000000000000000..ae865012ec725ffb533344fddc826fa427b90610 GIT binary patch literal 512 zcmdswv1$TA5QaZ?7hUfTFQwO<2nyHbF|5op*ry3Ly4YMISmrrW_z>2TM@SJu5KA9G z*v#&!#8+@&U_QQoW;S!D&pz3VG_1Z%kD9NX$$1@W%`RuOu&EKR2>F~>r)*$~GNbBV zy@|drUf=k^%qSi5q2%A?Uh8~s?TC3(JY*a+6W2tW|BsB_iIWet(rj~jS1-9c;6Gz= BM0o%J literal 0 HcmV?d00001 diff --git a/results/coldstart/20261029T221603Z/code.NVRTC.bin b/results/coldstart/20261029T221603Z/code.NVRTC.bin new file mode 100644 index 0000000000000000000000000000000000000000..0000f48020fe513a1e6686f074294722c4558e70 GIT binary patch literal 5600 zcmeHLUx-vy82|2{ot^#TjGCF7l6RMpG;MY@vGpOitGm_4{zFA9i0L|W*Ik`|%)Ptq z;6md{1|nAAqe6ubKJ-xFLllJ2i%5a=qC}J|Jwy+&5R!;Bec!p?nYnZC{2?EuuwK6fISE$k4ALqSNMAsddxVSphWNl_=hV4 zI9?UJvfbnPkQGr5XK&8VB@2_2j_qO{abV%$rc(LYRLy^MXf);dr}|P>cG`0O)$;pR zVrUiIV}>`OUBkB~NIQi-5>&(MLf;wEpF&MH{!F&$%)dZxe6XyhXEl6}4GpB1)B<$k ztE)kKUBRu5s9(9<7gzNRy}~~h@~JWm}GIY<(`-x5d~`EZN@=yJn`d8N(?%uAMV-GmdLy?8)i8ZR{H# zAK9DQKeT7>@c3A2=)k_AvB9B1c-AVVrwk{T+PZD40hA-{qd#lG9LunPdc8L)?Bu7f z@Y>h}ePz9^wgITB0%}VOXswE(Vqa=R0lh=+(CGiX?)CQs^+a`C1F*CLbe2_E4sf%( zCMy)xCkqhD+5}?PRzXW)oL8{lbx|myv5#uqwGQ<5C}28J(XhRvzJ{oV)W@I9|6qOx z`5+mPs4n%4g{tXe;iyuDAK7^^4qat->qef8!B=IDy8-2%7<~L@OBEd9ABB7j7LK-6 z;ku9k5-~{3x3vj`dO8kQ)25 z(EmWjEFaOM8F(}U59tih7Y08EmmWuc1GiA6LvOz&&JzQ;DWR<`(29MQ*_!v>b<^KcSS481_#)q^9g_@Yh29 z)Az^MU&xMMNl^P^+irom0-La);734JOia5*6A{{56D(7kNCV}rC!Fmyd}HGVP9>2} zq4f$r_?Tm|0X1m2k8?up4Di}^IC-w;{HNzu<>2Bozx{qdJKfpZzIO44lh^j7-|4)z zxfQD+b81^5#*hZ`7-OXd*@>+M)a z;ahky4+a1M5gtRlf8BFfnBY#ASV2B?RFXBNcbMoS`~~|Yy~zcbBEd&NU#dTy-;o;9 zxWM@Ho~`zjb(IRbM-ko(q%p#WDFbapBvS4{{4g2unCP+kGt2k{tK=L9@w8)|Xo7z) zfR{Z7@rOM_(UcC%FEW0fWr{EE4*|b#QN}q9<=@9wON0G``O7+9LObPT;?GYLjF)vL zJo!nS)YE;HYRc}|@~9#eTvfsow&Iy@V8a4xioRRQKCWyX+lv0Be%4^ZiE)AxhWdar|4EuUUeA1okc$4^N7@uHI zicdr}@Y4X}%|L3OG5#z&6P|XjApTXvFJSy2{s3S3Wt|C61LU&M%~Ozrc(fI9nj6Mn z4F6>y{L#IE-bcmTO~x{2?EuuwK6fISE$k4ALqSNMAsddxVSphWNl_=hV4 zI9?UJvfbnPkQGr5XK&8VB@2_2j_qO{abV%$rc(LYRLy^MXf);dr}|P>cG`0O)$;pR zVrUiIV}>`OUBkB~NIQi-5>&(MLf;wEpF&MH{!F&$%)dZxe6XyhXEl6}4GpB1)B<$k ztE)kKUBRu5s9(9<7gzNRy}~~h@~JWm}GIY<(`-x5d~`EZN@=yJn`d8N(?%uAMV-GmdLy?8)i8ZR{H# zAK9DQKeT7>@c3A2=)k_AvB9B1c-AVVrwk{T+PZD40hA-{qd#lG9LunPdc8L)?Bu7f z@Y>h}ePz9^wgITB0%}VOXswE(Vqa=R0lh=+(CGiX?)CQs^+a`C1F*CLbe2_E4sf%( zCMy)xCkqhD+5}?PRzXW)oL8{lbx|myv5#uqwGQ<5C}28J(XhRvzJ{oV)W@I9|6qOx z`5+mPs4n%4g{tXe;iyuDAK7^^4qat->qef8!B=IDy8-2%7<~L@OBEd9ABB7j7LK-6 z;ku9k5-~{3x3vj`dO8kQ)25 z(EmWjEFaOM8F(}U59tih7Y08EmmWuc1GiA6LvOz&&JzQ;DWR<`(29MQ*_!v>b<^KcSS481_#)q^9g_@Yh29 z)Az^MU&xMMNl^P^+irom0-La);734JOia5*6A{{56D(7kNCV}rC!Fmyd}HGVP9>2} zq4f$r_?Tm|0X1m2k8?up4Di}^IC-w;{HNzu<>2Bozx{qdJKfpZzIO44lh^j7-|4)z zxfQD+b81^5#*hZ`7-OXd*@>+M)a z;ahky4+a1M5gtRlf8BFfnBY#ASV2B?RFXBNcbMoS`~~|Yy~zcbBEd&NU#dTy-;o;9 zxWM@Ho~`zjb(IRbM-ko(q%p#WDFbapBvS4{{4g2unCP+kGt2k{tK=L9@w8)|Xo7z) zfR{Z7@rOM_(UcC%FEW0fWr{EE4*|b#QN}q9<=@9wON0G``O7+9LObPT;?GYLjF)vL zJo!nS)YE;HYRc}|@~9#eTvfsow&Iy@V8a4xioRRQKCWyX+lv0Be%4^ZiE)AxhWdar|4EuUUeA1okc$4^N7@uHI zicdr}@Y4X}%|L3OG5#z&6P|XjApTXvFJSy2{s3S3Wt|C61LU&M%~Ozrc(fI9nj6Mn z4F6>y{L#IE-bcmTO~x= 120000]} \ No newline at end of file diff --git a/results/coldstart/20261029T221603Z/wolfram.out.json b/results/coldstart/20261029T221603Z/wolfram.out.json new file mode 100644 index 0000000..2fc301f --- /dev/null +++ b/results/coldstart/20261029T221603Z/wolfram.out.json @@ -0,0 +1,236 @@ +{ + "arms": { + "CUDAPP": { + "arm_valid": true, + "build": { + "iqr": 10.430999999999997, + "median": 77.7205, + "n": 30, + "p50": 77.536, + "p99": 120.096, + "q1": 75.009, + "q3": 85.44 + }, + "exec": { + "iqr": 276.3829999999998, + "median": 2609.735, + "n": 30, + "p50": 2608.32, + "p99": 3010.738, + "q1": 2524.735, + "q3": 2801.118 + }, + "firstResult": { + "iqr": 6852.562999999995, + "median": 96774.13399999999, + "n": 30, + "p50": 96709.313, + "p99": 143533.257, + "q1": 95517.626, + "q3": 102370.189 + }, + "proc": { + "iqr": 44429.850000000006, + "median": 154374.1935, + "n": 30, + "p50": 153066.945, + "p99": 213566.3, + "q1": 144943.297, + "q3": 189373.147 + }, + "ready": { + "iqr": 7150.468000000008, + "median": 87150.67850000001, + "n": 30, + "p50": 87011.076, + "p99": 134897.333, + "q1": 85946.817, + "q3": 93097.285 + }, + "rows_failed": 0, + "rows_load_excluded": 0, + "rows_measured": 30, + "rows_valid": 30 + }, + "NVRTC": { + "arm_valid": true, + "build": { + "iqr": 43283.484, + "median": 119047.78950000001, + "n": 30, + "p50": 101962.015, + "p99": 145480.564, + "q1": 98378.283, + "q3": 141661.767 + }, + "exec": { + "iqr": 500.8690000000006, + "median": 6611.25, + "n": 30, + "p50": 6608.94, + "p99": 8343.73, + "q1": 6328.038, + "q3": 6828.907 + }, + "firstResult": { + "iqr": 47894.27999999997, + "median": 302786.3995, + "n": 30, + "p50": 286710.161, + "p99": 330318.497, + "q1": 278044.554, + "q3": 325938.834 + }, + "proc": { + "iqr": 46085.152, + "median": 481722.407, + "n": 30, + "p50": 480538.151, + "p99": 586790.539, + "q1": 441550.271, + "q3": 487635.423 + }, + "ready": { + "iqr": 45519.18400000001, + "median": 284483.691, + "n": 30, + "p50": 268657.525, + "p99": 311311.78, + "q1": 261889.162, + "q3": 307408.346 + }, + "rows_failed": 0, + "rows_load_excluded": 0, + "rows_measured": 30, + "rows_valid": 30 + }, + "PTXC": { + "arm_valid": true, + "build": { + "iqr": 1116.759, + "median": 7029.618, + "n": 30, + "p50": 7029.322, + "p99": 10612.79, + "q1": 6027.14, + "q3": 7143.899 + }, + "exec": { + "iqr": 363.395, + "median": 3878.1645, + "n": 30, + "p50": 3860.396, + "p99": 4369.21, + "q1": 3649.349, + "q3": 4012.744 + }, + "firstResult": { + "iqr": 45960.80000000002, + "median": 263653.7235, + "n": 30, + "p50": 263554.112, + "p99": 324107.887, + "q1": 259361.198, + "q3": 305321.998 + }, + "proc": { + "iqr": 48028.350999999966, + "median": 423561.1385, + "n": 30, + "p50": 423042.831, + "p99": 522634.925, + "q1": 418338.309, + "q3": 466366.66 + }, + "ready": { + "iqr": 44231.20199999999, + "median": 249194.581, + "n": 30, + "p50": 249146.521, + "p99": 311604.037, + "q1": 245828.026, + "q3": 290059.228 + }, + "rows_failed": 0, + "rows_load_excluded": 0, + "rows_measured": 30, + "rows_valid": 30 + } + }, + "cudapp_vs": { + "NVRTC": { + "build": { + "call": "CUDAPP_LOWER", + "median_ratio_other_over_cudapp": 1531.7424553367518 + }, + "exec": { + "call": "CUDAPP_LOWER", + "median_ratio_other_over_cudapp": 2.533303189787469 + }, + "firstResult": { + "call": "CUDAPP_LOWER", + "median_ratio_other_over_cudapp": 3.128794720085018 + }, + "proc": { + "call": "CUDAPP_LOWER", + "median_ratio_other_over_cudapp": 3.1204853355233886 + }, + "ready": { + "call": "CUDAPP_LOWER", + "median_ratio_other_over_cudapp": 3.264273966610598 + } + }, + "PTXC": { + "build": { + "call": "CUDAPP_LOWER", + "median_ratio_other_over_cudapp": 90.44741091475223 + }, + "exec": { + "call": "CUDAPP_LOWER", + "median_ratio_other_over_cudapp": 1.486037662827835 + }, + "firstResult": { + "call": "CUDAPP_LOWER", + "median_ratio_other_over_cudapp": 2.7244234859285856 + }, + "proc": { + "call": "CUDAPP_LOWER", + "median_ratio_other_over_cudapp": 2.743730210969491 + }, + "ready": { + "call": "CUDAPP_LOWER", + "median_ratio_other_over_cudapp": 2.859353309567177 + } + } + }, + "unit": "microseconds", + "warm_build_per_process_median": { + "CUDAPP": { + "iqr": 0.04800000000000004, + "median": 5.16, + "n": 10, + "p50": 5.16, + "p99": 5.216, + "q1": 5.144, + "q3": 5.192 + }, + "NVRTC": { + "iqr": 88.59800000000178, + "median": 16353.4815, + "n": 10, + "p50": 16342.6075, + "p99": 16534.152, + "q1": 16296.444, + "q3": 16385.042 + }, + "PTXC": { + "iqr": 39.39149999999972, + "median": 3162.57075, + "n": 10, + "p50": 3160.807, + "p99": 3287.0065, + "q1": 3137.271, + "q3": 3176.6625 + } + } +} \ No newline at end of file diff --git a/results/coldstart/20261029T221603Z/wolfram.phases.out.txt b/results/coldstart/20261029T221603Z/wolfram.phases.out.txt new file mode 100644 index 0000000..0b59acc --- /dev/null +++ b/results/coldstart/20261029T221603Z/wolfram.phases.out.txt @@ -0,0 +1 @@ +Out[1]= {"CUDAPP" -> {"prep_ns" -> 3537.2000000000003, "build_ns" -> 77.7, "open_ns" -> 86983.20000000001, "load_ns" -> 68.10000000000001, "data_ns" -> 1675.8000000000002, "run_ns" -> 844.7, "check_ns" -> 519.8000000000001, "close_ns" -> 50298.200000000004}, "PTXC" -> {"prep_ns" -> 3601.5, "build_ns" -> 7029.6, "open_ns" -> 242130.80000000002, "load_ns" -> 23.900000000000002, "data_ns" -> 900.6, "run_ns" -> 60.1, "check_ns" -> 5726.200000000001, "close_ns" -> 87451.5}, "NVRTC" -> {"prep_ns" -> 4670.8, "build_ns" -> 119047.8, "open_ns" -> 163547.1, "load_ns" -> 23.5, "data_ns" -> 898.3000000000001, "run_ns" -> 61.7, "check_ns" -> 5480.1, "close_ns" -> 87378.1}} \ No newline at end of file diff --git a/results/coldstart/20261029T221603Z/wolfram.phases.query.wl b/results/coldstart/20261029T221603Z/wolfram.phases.query.wl new file mode 100644 index 0000000..d7ed99d --- /dev/null +++ b/results/coldstart/20261029T221603Z/wolfram.phases.query.wl @@ -0,0 +1,92 @@ +phRows = {{"CUDAPP",3048130,82832,87754156,62544,1651562,839013,525939,46706071}, +{"PTXC",3946152,9533385,283913276,30928,893221,64321,5692258,87167432}, +{"NVRTC",4448986,100952314,162798650,23488,883110,60192,4774508,87363705}, +{"CUDAPP",3038498,84929,86820597,67809,1689978,846165,514579,36715115}, +{"NVRTC",5650721,143748921,167437318,20352,899590,65936,5597954,87604922}, +{"PTXC",3462309,7027930,238252556,21904,892165,59409,5301487,87777131}, +{"PTXC",3995320,6850809,240108200,27104,900613,69040,5447089,87468762}, +{"CUDAPP",3790615,75248,86363603,65153,1711434,845285,515843,102980118}, +{"NVRTC",6815449,139035549,165039256,21008,894390,62752,5475105,90236858}, +{"PTXC",3487044,7033914,238760864,33248,905174,63520,5077454,87434201}, +{"NVRTC",3868183,98263354,163599344,26464,912006,58512,4872493,87089319}, +{"CUDAPP",3201843,84976,85660159,64704,1707627,842597,507523,104155805}, +{"NVRTC",5330160,136133564,164211779,24192,912422,61648,5603474,86755494}, +{"CUDAPP",3062163,78800,87926540,63377,1679626,843317,515715,49416071}, +{"PTXC",6183557,10523535,286600894,20448,914789,57985,5796482,87717115}, +{"NVRTC",4593803,97687015,162976508,24896,913158,56752,4411914,88272142}, +{"PTXC",3023618,6894937,238369437,20352,898646,58448,6483623,85178908}, +{"CUDAPP",3990344,73344,87252792,67185,1657818,830677,516003,37030877}, +{"CUDAPP",2776593,76160,134629796,59344,1744650,953462,524387,61902034}, +{"PTXC",2836705,6027140,285612296,31472,926070,61152,6381974,87187481}, +{"NVRTC",4714572,99380625,162686603,24176,890101,61553,5830419,87316377}, +{"CUDAPP",3573894,98848,86034642,67808,1656090,843829,529315,52151784}, +{"NVRTC",3989047,145480564,165018488,21297,887845,64416,4672428,87392457}, +{"PTXC",3739047,7197627,239833927,21136,905429,60129,6102324,87364153}, +{"PTXC",4244761,6715016,243433693,26192,893669,57953,4923773,86655845}, +{"CUDAPP",3997416,68848,85809136,68833,1721050,842213,532035,86868647}, +{"NVRTC",6600952,144006363,163376383,25600,914182,62240,5529633,87195736}, +{"PTXC",3550725,7143899,243775391,20896,899430,59232,6178405,89705352}, +{"NVRTC",4573243,96662433,161163522,26192,881510,57792,5206559,87415082}, +{"CUDAPP",3124259,88481,86628613,68736,1665530,843829,517619,37444495}, +{"NVRTC",6192773,145358132,163700689,19552,891173,60001,6137316,87856124}, +{"CUDAPP",4340298,75009,86797062,71488,1687674,847701,520404,42113051}, +{"PTXC",2844257,5948436,281606913,20977,901877,58368,6212261,87241113}, +{"NVRTC",4743244,98378283,161874727,23248,886677,62833,5760306,89908681}, +{"PTXC",3628870,7063274,238477920,21344,897942,59296,5607777,86836006}, +{"CUDAPP",3908744,77488,88098542,72785,1660234,849125,523635,39245771}, +{"CUDAPP",2840097,76048,134760693,60592,1719227,948021,520259,65281574}, +{"PTXC",3077090,10224525,301348632,30880,882086,62928,4903725,86242211}, +{"NVRTC",4578251,97817993,161205667,23856,875413,57952,5289552,91000096}, +{"CUDAPP",3821031,85440,85718512,74641,1663994,843605,521379,44585515}, +{"NVRTC",2766768,136468016,174819860,23904,1015382,64912,6587416,86856727}, +{"PTXC",3580437,7029914,242186903,25824,904549,60129,6157317,86675910}, +{"PTXC",4710252,6103380,243380270,31008,883814,58864,4746332,86593317}, +{"CUDAPP",3824519,74592,101990402,59360,1621754,844069,518915,73210358}, +{"NVRTC",2775216,139595026,164716233,24464,882741,60816,4353418,88174511}, +{"PTXC",3446244,7076730,241334658,23473,884677,62928,5921876,89245109}, +{"NVRTC",4314330,97935161,170698188,24176,883253,63169,5772834,85762032}, +{"CUDAPP",3092930,97169,97291125,87697,1638362,852181,519971,45095918}, +{"NVRTC",5917140,143963372,165283884,20064,927718,58176,4421834,86935175}, +{"CUDAPP",3047747,84656,87137161,68464,1672138,851093,511027,70611030}, +{"PTXC",4003304,9888283,281459154,27600,887846,61248,6137781,87647596}, +{"NVRTC",4627019,98898575,165223004,21776,880405,61409,5289871,86902887}, +{"PTXC",3490485,7044842,257718821,20256,900581,57729,5698946,90346668}, +{"CUDAPP",3873639,69504,85299182,63216,1657322,845349,524179,73434199}, +{"CUDAPP",2808797,77905,132658386,59360,1744232,930293,519250,61828171}, +{"PTXC",2884028,10519364,283709185,26320,907647,60640,5555834,89842683}, +{"NVRTC",5021706,101962015,162142413,19808,897087,63360,5545449,87901214}, +{"CUDAPP",3045693,78976,88459023,68304,1680718,844079,515951,43289841}, +{"NVRTC",5777113,143676070,163346497,20864,889279,61664,5485194,86719027}, +{"PTXC",3684892,7140296,238724291,24368,897087,61184,4980539,87790706}, +{"PTXC",3667548,6994505,239672901,22432,938351,60352,8172184,90004722}, +{"CUDAPP",4090620,71520,96969372,69536,1672542,851728,520975,51180299}, +{"NVRTC",6637545,138371316,165628968,28688,882576,61104,4467195,87431367}, +{"PTXC",2794989,5943594,239743394,25072,881871,59168,5548618,86775754}, +{"NVRTC",4835484,99713774,162981297,19520,893919,63520,5544474,104824106}, +{"CUDAPP",3040445,87072,84952014,82336,1666638,838559,519680,97602305}, +{"NVRTC",8822408,139543308,165384724,23568,913663,60352,4644540,89136828}, +{"CUDAPP",2992781,77440,84886625,76112,1678974,842335,520384,58006538}, +{"PTXC",5995387,10612790,282976651,20704,927216,62704,5935098,90179197}, +{"NVRTC",2737934,98593991,163494813,19776,962976,61312,5613978,86248882}, +{"PTXC",3509613,7029322,237567694,20896,899503,56640,5753483,87837874}, +{"CUDAPP",4302685,115519,86829301,66256,1670798,852576,514991,37467088}, +{"CUDAPP",3974204,67808,132575519,62640,1780319,948959,517952,47127576}, +{"PTXC",2656734,5933787,284098545,26896,927711,59984,5279852,87814246}, +{"NVRTC",4368140,98914143,161232602,25408,910399,62944,5561291,86319449}, +{"CUDAPP",3552877,75136,92944485,77664,1688639,943151,528831,54579124}, +{"NVRTC",6661691,138126194,162162287,21376,906063,58912,5647436,86027020}, +{"PTXC",4609036,5802812,238085382,22704,903679,64752,5637372,90589482}, +{"PTXC",3984861,5852124,238597722,27568,915967,59872,6048443,86085198}, +{"CUDAPP",2497135,69760,85401263,72416,1653327,841584,523983,48087836}, +{"NVRTC",2620831,141661767,166434742,31024,944463,67552,4906813,87999232}, +{"PTXC",2887102,5875915,240404740,27888,917711,57360,5448476,86517506}, +{"NVRTC",3470014,97749355,159420143,22512,939600,63872,5272908,86930835}, +{"CUDAPP",3521550,120096,89869938,83536,1686271,842639,514960,48274831}, +{"NVRTC",5733356,144889855,166275616,25488,910319,63552,5591404,86104070}, +{"CUDAPP",3769341,117216,85780487,70304,1692559,841280,513615,38583927}, +{"PTXC",5271709,5599052,283983754,23248,932304,62320,7170107,89533223}, +{"NVRTC",3362925,97339523,162905002,19552,908575,70016,5275101,87488473}, +{"PTXC",3622606,7048668,242074717,23136,892479,58432,6248732,84777149}, +{"CUDAPP",3782926,77536,84874701,66448,1651135,845376,523087,51348050}}; +phNames = {"prep_ns","build_ns","open_ns","load_ns","data_ns","run_ns","check_ns","close_ns"}; +Table[arm -> Table[phNames[[k]] -> Round[N[Median[Select[phRows, #[[1]] == arm &][[All, k + 1]]]/1000], 0.1], {k, Length[phNames]}], {arm, {"CUDAPP", "PTXC", "NVRTC"}}] \ No newline at end of file diff --git a/results/coldstart/20261029T221603Z/wolfram.query.wl b/results/coldstart/20261029T221603Z/wolfram.query.wl new file mode 100644 index 0000000..aa90679 --- /dev/null +++ b/results/coldstart/20261029T221603Z/wolfram.query.wl @@ -0,0 +1,160 @@ +(* csRows: {arm, round, ok, load1, build, ready, firstResult, proc, exec}; ns *) +csRows = {{"CUDAPP",0,True,1.26,82832,87899532,96897410,148599526,2933234}, + {"PTXC",0,True,1.26,9533385,293477589,308054812,465542870,3981271}, + {"NVRTC",0,True,1.24,100952314,263774452,280174886,441528296,6233638}, + {"CUDAPP",1,True,1.24,84929,86973335,95665786,137218130,2603231}, + {"NVRTC",1,True,1.24,143748921,311206591,329974768,540715080,6553976}, + {"PTXC",1,True,1.14,7027930,245302390,259254697,467249506,4236937}, + {"PTXC",2,True,1.14,6850809,246986113,261044949,468852604,3646774}, + {"CUDAPP",2,True,1.14,75248,86504004,95558522,203488190,2191341}, + {"NVRTC",2,True,1.14,139035549,304095813,323437497,586790539,6093988}, + {"PTXC",3,True,1.29,7033914,245828026,258986600,416434579,3625382}, + {"NVRTC",3,True,1.29,98263354,261889162,278044554,488189455,6444198}, + {"CUDAPP",3,True,1.29,84976,85809839,94343283,202793753,2273854}, + {"NVRTC",4,True,1.35,136133564,300369535,318862638,478790296,6585399}, + {"CUDAPP",4,True,1.35,78800,88068717,96709313,151290614,2539775}, + {"PTXC",4,True,1.35,10523535,297144877,313747039,522634925,3649349}, + {"NVRTC",5,True,1.35,97687015,260688419,277277606,438873242,6613560}, + {"PTXC",5,True,1.24,6894937,245284726,259986111,384161156,4237050}, + {"CUDAPP",5,True,1.24,73344,87393321,97279620,139180414,2891457}, + {"CUDAPP",6,True,1.24,76160,134765300,143308359,209754404,2543967}, + {"PTXC",6,True,1.24,6027140,291670908,305321998,462827450,3445189}, + {"NVRTC",6,True,1.22,99380625,262091404,279916087,440129091,6328038}, + {"CUDAPP",7,True,1.22,98848,86201298,95517626,153066945,2713200}, + {"NVRTC",7,True,1.22,145480564,310520349,326477899,487656541,6343814}, + {"PTXC",7,True,1.22,7197627,247052690,261872363,420714559,4012744}, + {"PTXC",8,True,1.2,6715016,250174901,264664267,421641764,4369210}, + {"CUDAPP",8,True,1.2,68848,85946817,95564266,187043276,2524735}, + {"NVRTC",8,True,1.2,144006363,307408346,327258657,487635423,6743304}, + {"PTXC",9,True,1.1,7143899,250940186,265424032,425314682,3796054}, + {"NVRTC",9,True,1.1,96662433,257852147,276914981,437436947,8343730}, + {"CUDAPP",9,True,1.1,88481,86785830,95947805,137899752,3010738}, + {"NVRTC",10,True,1.1,145358132,309078373,328740810,490136014,6381174}, + {"CUDAPP",10,True,1.02,75009,86943559,97253413,144135981,2913777}, + {"PTXC",10,True,1.02,5948436,287576326,301530840,427769402,3937751}, + {"NVRTC",11,True,1.02,98378283,260276258,278633936,441314364,6904618}, + {"PTXC",11,True,1.1,7063274,245562538,259286956,416822009,3530533}, + {"CUDAPP",11,True,1.1,77488,88248815,97783576,141795487,2593023}, + {"CUDAPP",12,True,1.1,76048,134897333,143533257,213566300,2608320}, + {"PTXC",12,True,1.1,10224525,311604037,324107887,480839575,3578021}, + {"NVRTC",12,True,1.09,97817993,259047516,276519620,441856719,6670936}, + {"CUDAPP",13,True,1.09,85440,85878593,95649323,144943297,2920721}, + {"NVRTC",13,True,1.09,136468016,311311780,327671798,487217711,5925540}, + {"PTXC",13,True,1.09,7029914,249242641,263909689,421649383,3964616}, + {"PTXC",14,True,1.0,6103380,249514658,263753335,421384053,3839415}, + {"CUDAPP",14,True,1.0,74592,102124354,111638235,189373147,2704624}, + {"NVRTC",14,True,1.0,139595026,304335723,319204643,480538151,6796729}, + {"PTXC",15,True,1.0,7076730,248434861,262558993,423042831,3808407}, + {"NVRTC",15,True,1.0,97935161,268657525,286710161,445744519,7019050}, + {"CUDAPP",15,True,1.0,97169,97475991,106214571,155681442,2635136}, + {"NVRTC",16,True,1.0,143963372,309267320,327515013,487062335,6922825}, + {"CUDAPP",16,True,1.0,84656,87290281,96269583,171299168,2897297}, + {"PTXC",16,True,1.0,9888283,291375037,306740202,466366660,4274986}, + {"NVRTC",17,True,1.0,98898575,264143355,282114358,441550271,7112299}, + {"PTXC",17,True,1.0,7044842,264783919,278887571,440642490,3955911}, + {"CUDAPP",17,True,0.92,69504,85431902,95067864,172950042,2735473}, + {"CUDAPP",18,True,0.92,77905,132795651,141599341,208344560,2801118}, + {"PTXC",18,True,0.92,10519364,294254869,307619414,518105050,3956396}, + {"NVRTC",18,True,0.92,101962015,264124236,282515527,443179158,6863689}, + {"CUDAPP",19,True,1.01,78976,88606303,97426517,145259553,2733773}, + {"NVRTC",19,True,1.01,143676070,307043431,325938834,485746775,6682153}, + {"PTXC",19,True,1.01,7140296,245888955,259846877,418338309,4334220}, + {"PTXC",20,True,1.01,6994505,246689838,263200381,424079446,3672108}, + {"CUDAPP",20,True,1.01,71520,97110428,107076850,162815273,2830557}, + {"NVRTC",20,True,1.01,138371316,304028972,322353354,482906663,6275962}, + {"PTXC",21,True,1.01,5943594,245712060,259361198,416930994,4364492}, + {"NVRTC",21,True,0.93,99713774,262714591,281004925,458182624,6952937}, + {"CUDAPP",21,True,0.93,87072,85121422,93923605,196133986,2736861}, + {"NVRTC",22,True,0.93,139543308,304951600,325687853,487173397,6295290}, + {"CUDAPP",22,True,0.93,77440,85040177,93507609,155911391,2432958}, + {"PTXC",22,True,1.41,10612790,293610145,310668338,471351391,4137788}, + {"NVRTC",23,True,1.41,98593991,262108580,277685014,436753896,6200234}, + {"PTXC",23,True,1.41,7029322,244617912,258697547,417107118,3860396}, + {"CUDAPP",23,True,1.94,115519,87011076,96838955,139069543,2486829}, + {"CUDAPP",24,True,1.94,67808,132705967,142429271,194627290,2501870}, + {"PTXC",24,True,1.94,5933787,290059228,302973585,461958939,3990076}, + {"NVRTC",24,True,1.94,98914143,260172153,277735929,436438840,6661002}, + {"CUDAPP",25,True,2.35,75136,93097285,102370189,161761374,2559406}, + {"NVRTC",25,True,2.35,138126194,300309857,319853442,478247828,6269483}, + {"PTXC",25,True,2.35,5802812,243910898,259021670,419554250,3895933}, + {"PTXC",26,True,2.35,5852124,244477414,259324330,415773283,3837773}, + {"CUDAPP",26,True,2.64,69760,85543439,93407114,145967379,2347646}, + {"NVRTC",26,True,2.64,141661767,308127533,323385955,534904073,6718763}, + {"PTXC",27,True,2.64,5875915,246308543,259236278,416011398,3617086}, + {"NVRTC",27,True,3.07,97749355,257192010,273278303,483492381,6339899}, + {"CUDAPP",27,True,3.07,120096,90073570,99159532,151880504,2520542}, + {"NVRTC",28,True,3.07,144889855,311190959,330318497,489061942,6828907}, + {"CUDAPP",28,True,3.07,117216,85968007,95348257,138559973,2563455}, + {"PTXC",28,True,3.38,5599052,289606054,306715932,516848085,3673438}, + {"NVRTC",29,True,3.38,97339523,260264077,276489634,487166221,6608940}, + {"PTXC",29,True,3.38,7048668,249146521,263554112,419894337,3585342}, + {"CUDAPP",29,True,3.38,77536,85018685,94432359,150610886,2611150}}; +(* csWarm: {arm, round, ok, {warm build ns ...}} *) +csWarm = {{"CUDAPP",0,True,{6256,5376,5296,5184,5152,6272,5168,5104,5216,5120}}, + {"PTXC",0,True,{3877054,3598782,3227870,3137310,3103599,3118494,3106686,3084702,3080990,3051487}}, + {"NVRTC",0,True,{16051783,16218311,16330870,16215111,16259575,16213799,16165207,16030439,16270535,16237334}}, + {"CUDAPP",1,True,{6144,5232,5216,5120,5072,6080,5072,5072,5136,5088}}, + {"NVRTC",1,True,{16024120,16349367,16440823,16388647,16344824,16297239,16340391,16296520,16261559,16486055}}, + {"PTXC",1,True,{3886414,3538286,3255887,3152958,3139038,3085951,3101230,3094863,3096782,3074014}}, + {"PTXC",2,True,{3903550,3555487,3241966,3147886,3151055,3139278,3074927,3092174,3108942,3086719}}, + {"CUDAPP",2,True,{5904,5296,5264,5104,5104,5968,5136,5088,5072,5152}}, + {"NVRTC",2,True,{16064696,16562088,16532280,16536024,16660824,16573511,16546680,16523896,16498904,16405992}}, + {"PTXC",3,True,{3921470,3586831,3225726,3177998,3141951,3169871,3158798,3140511,3104526,3103967}}, + {"NVRTC",3,True,{15876281,16133193,16322136,16279545,16434616,16300601,16135049,16293048,16231049,16217784}}, + {"CUDAPP",3,True,{6256,5360,5216,5168,5104,6112,5104,5120,5104,5072}}, + {"NVRTC",4,True,{15915769,16239049,16307320,16316057,16299641,16189241,16322601,16344681,16312137,16347609}}, + {"CUDAPP",4,True,{6208,5264,5104,5104,5072,6080,5152,5104,5040,5008}}, + {"PTXC",4,True,{4012527,3681262,3350127,3312623,3268718,3275487,3218718,3203023,3282447,3291566}}, + {"NVRTC",5,True,{16086521,16239530,16358330,16344873,16377162,16378537,16418218,16374569,16447418,16433673}}, + {"PTXC",5,True,{3936974,3626799,3284447,3215838,3188495,3178975,3130047,3114014,3093967,3133151}}, + {"CUDAPP",5,True,{6048,5280,5152,5104,5184,6128,5088,5072,5168,5152}}, + {"CUDAPP",6,True,{5904,5488,5264,5200,5136,6176,5088,5104,5232,5168}}, + {"PTXC",6,True,{3893198,3595407,3251775,3185311,3168014,3135935,3090639,3150959,3189215,3105375}}, + {"NVRTC",6,True,{16223258,16169483,16426794,16386714,16271515,16279882,16393947,16528042,16383370,16445067}}, + {"CUDAPP",7,True,{5856,5392,5184,5184,5184,6208,5136,5120,5008,5104}}, + {"NVRTC",7,True,{16088683,16503883,16384634,16480875,16439291,16516571,16436315,16547178,16410555,16558315}}, + {"PTXC",7,True,{3904207,3559407,3259839,3138207,3136335,3120671,3065615,3081104,3088895,3176399}}, + {"PTXC",8,True,{3857423,3639775,3210319,3161935,3216127,3159679,3099328,3078255,3054159,3062255}}, + {"CUDAPP",8,True,{7200,5360,5200,5152,5136,5856,5184,5232,5184,5088}}, + {"NVRTC",8,True,{16079884,16407323,16399196,16329515,16246380,16592540,16496427,16439052,16290123,16309980}}, + {"PTXC",9,True,{3872031,3561823,3218623,3182607,3167504,3192111,3135023,3098415,3120831,3121824}}, + {"NVRTC",9,True,{15936940,16333115,16198380,16422572,16304508,16379772,16288380,16349100,16268204,16031484}}, + {"CUDAPP",9,True,{6304,5232,5184,5168,5088,6096,5136,5152,5136,5136}}}; + +(* coldstart/PROTOCOL.md section 7. Evaluated in the Wolfram MCP kernel with results/coldstart//rows.wl + (coldstart/run.py) prepended. csRows row: {arm, round, ok, load1, build, ready, firstResult, proc, exec}, ns. + csWarm row: {arm, round, ok, {10 warm build times, ns}}. Statistics are h2hStats of results/wolfram/analysis.wl, + in microseconds. A comparison is a WIN or LOSS only when the two IQRs [q1, q3] do not overlap; otherwise + OVERLAPPING. No significance tests. Output: RawJSON. *) +h2hStats[v_List] := If[Length[v] == 0, <|"n" -> 0|>, + <|"n" -> Length[v], "median" -> N[Median[v]], "q1" -> N[Quantile[v, 1/4]], "q3" -> N[Quantile[v, 3/4]], + "iqr" -> N[InterquartileRange[v]], "p50" -> N[Quantile[v, 1/2]], "p99" -> N[Quantile[v, 99/100]]|>]; +csArms = {"CUDAPP", "PTXC", "NVRTC"}; +csMetrics = {"build" -> 5, "ready" -> 6, "firstResult" -> 7, "proc" -> 8, "exec" -> 9}; +(* valid rows: process ok and load1 < 6 at spawn (section 6) *) +csValid[rows_] := Select[rows, #[[3]] === True && #[[4]] < 6 &]; +csCall[a_Association, b_Association] := Which[ + a["q3"] < b["q1"], "CUDAPP_LOWER", b["q3"] < a["q1"], "CUDAPP_HIGHER", True, "OVERLAPPING"]; +csAnalyse[rows_, warm_] := Module[{valid, per, warmPer, out = <||>, cmp = <||>}, + valid = csValid[rows]; + per = AssociationMap[Function[arm, Module[{rs = Select[valid, #[[1]] == arm &]}, + Join[<|"rows_measured" -> Count[rows, r_ /; r[[1]] == arm], + "rows_valid" -> Length[rs], + "rows_failed" -> Count[rows, r_ /; r[[1]] == arm && r[[3]] =!= True], + "rows_load_excluded" -> Count[rows, r_ /; r[[1]] == arm && r[[3]] === True && r[[4]] >= 6], + "arm_valid" -> Length[rs] >= 28|>, + Association[(First[#] -> h2hStats[N[rs[[All, Last[#]]]/1000]]) & /@ csMetrics]]]], csArms]; + warmPer = AssociationMap[Function[arm, + h2hStats[N[Median[#[[4]]]/1000] & /@ Select[warm, #[[1]] == arm && #[[3]] === True && Length[#[[4]]] > 0 &]]], csArms]; + Do[cmp[other] = Association[Function[m, m -> <| + "call" -> If[per["CUDAPP"]["arm_valid"] && per[other]["arm_valid"], + csCall[per["CUDAPP"][m], per[other][m]], "NO_VERDICT"], + "median_ratio_other_over_cudapp" -> N[per[other][m]["median"]/per["CUDAPP"][m]["median"]]|>] /@ Keys[csMetrics]], + {other, {"PTXC", "NVRTC"}}]; + out["unit"] = "microseconds"; + out["arms"] = per; + out["warm_build_per_process_median"] = warmPer; + out["cudapp_vs"] = cmp; + ExportString[out, "RawJSON", "Compact" -> True]]; + +csAnalyse[csRows, csWarm] \ No newline at end of file diff --git a/results/coldstart/20261029T221603Z/wolfram.table.out.txt b/results/coldstart/20261029T221603Z/wolfram.table.out.txt new file mode 100644 index 0000000..69b32a4 --- /dev/null +++ b/results/coldstart/20261029T221603Z/wolfram.table.out.txt @@ -0,0 +1 @@ +Out[1]= {{"CUDAPP" -> {"build" -> {77.7, 75., 85.4, 10.4}, "ready" -> {87150.70000000001, 85946.8, 93097.3, 7150.5}, "firstResult" -> {96774.1, 95517.6, 102370.20000000001, 6852.6}, "proc" -> {154374.2, 144943.30000000002, 189373.1, 44429.9}, "exec" -> {2609.7000000000003, 2524.7000000000003, 2801.1000000000004, 276.40000000000003}}, "PTXC" -> {"build" -> {7029.6, 6027.1, 7143.900000000001, 1116.8}, "ready" -> {249194.6, 245828., 290059.2, 44231.200000000004}, "firstResult" -> {263653.7, 259361.2, 305322., 45960.8}, "proc" -> {423561.10000000003, 418338.30000000005, 466366.7, 48028.4}, "exec" -> {3878.2000000000003, 3649.3, 4012.7000000000003, 363.40000000000003}}, "NVRTC" -> {"build" -> {119047.8, 98378.3, 141661.80000000002, 43283.5}, "ready" -> {284483.7, 261889.2, 307408.3, 45519.200000000004}, "firstResult" -> {302786.4, 278044.60000000003, 325938.80000000005, 47894.3}, "proc" -> {481722.4, 441550.30000000005, 487635.4, 46085.200000000004}, "exec" -> {6611.200000000001, 6328., 6828.900000000001, 500.90000000000003}}}, {"CUDAPP" -> {5.2, 5.1000000000000005, 5.2, 0.}, "PTXC" -> {3162.6000000000004, 3137.3, 3176.7000000000003, 39.400000000000006}, "NVRTC" -> {16353.5, 16296.400000000001, 16385., 88.60000000000001}}, {"PTXC" -> {"build" -> {"CUDAPP_LOWER", 90.45}, "ready" -> {"CUDAPP_LOWER", 2.86}, "firstResult" -> {"CUDAPP_LOWER", 2.72}, "proc" -> {"CUDAPP_LOWER", 2.74}, "exec" -> {"CUDAPP_LOWER", 1.49}}, "NVRTC" -> {"build" -> {"CUDAPP_LOWER", 1531.74}, "ready" -> {"CUDAPP_LOWER", 3.2600000000000002}, "firstResult" -> {"CUDAPP_LOWER", 3.13}, "proc" -> {"CUDAPP_LOWER", 3.12}, "exec" -> {"CUDAPP_LOWER", 2.5300000000000002}}}, {0.92, 3.38}, {5008, 16660824}} \ No newline at end of file diff --git a/results/coldstart/20261029T221603Z/wolfram.table.query.wl b/results/coldstart/20261029T221603Z/wolfram.table.query.wl new file mode 100644 index 0000000..26766c1 --- /dev/null +++ b/results/coldstart/20261029T221603Z/wolfram.table.query.wl @@ -0,0 +1,165 @@ +(* csRows: {arm, round, ok, load1, build, ready, firstResult, proc, exec}; ns *) +csRows = {{"CUDAPP",0,True,1.26,82832,87899532,96897410,148599526,2933234}, + {"PTXC",0,True,1.26,9533385,293477589,308054812,465542870,3981271}, + {"NVRTC",0,True,1.24,100952314,263774452,280174886,441528296,6233638}, + {"CUDAPP",1,True,1.24,84929,86973335,95665786,137218130,2603231}, + {"NVRTC",1,True,1.24,143748921,311206591,329974768,540715080,6553976}, + {"PTXC",1,True,1.14,7027930,245302390,259254697,467249506,4236937}, + {"PTXC",2,True,1.14,6850809,246986113,261044949,468852604,3646774}, + {"CUDAPP",2,True,1.14,75248,86504004,95558522,203488190,2191341}, + {"NVRTC",2,True,1.14,139035549,304095813,323437497,586790539,6093988}, + {"PTXC",3,True,1.29,7033914,245828026,258986600,416434579,3625382}, + {"NVRTC",3,True,1.29,98263354,261889162,278044554,488189455,6444198}, + {"CUDAPP",3,True,1.29,84976,85809839,94343283,202793753,2273854}, + {"NVRTC",4,True,1.35,136133564,300369535,318862638,478790296,6585399}, + {"CUDAPP",4,True,1.35,78800,88068717,96709313,151290614,2539775}, + {"PTXC",4,True,1.35,10523535,297144877,313747039,522634925,3649349}, + {"NVRTC",5,True,1.35,97687015,260688419,277277606,438873242,6613560}, + {"PTXC",5,True,1.24,6894937,245284726,259986111,384161156,4237050}, + {"CUDAPP",5,True,1.24,73344,87393321,97279620,139180414,2891457}, + {"CUDAPP",6,True,1.24,76160,134765300,143308359,209754404,2543967}, + {"PTXC",6,True,1.24,6027140,291670908,305321998,462827450,3445189}, + {"NVRTC",6,True,1.22,99380625,262091404,279916087,440129091,6328038}, + {"CUDAPP",7,True,1.22,98848,86201298,95517626,153066945,2713200}, + {"NVRTC",7,True,1.22,145480564,310520349,326477899,487656541,6343814}, + {"PTXC",7,True,1.22,7197627,247052690,261872363,420714559,4012744}, + {"PTXC",8,True,1.2,6715016,250174901,264664267,421641764,4369210}, + {"CUDAPP",8,True,1.2,68848,85946817,95564266,187043276,2524735}, + {"NVRTC",8,True,1.2,144006363,307408346,327258657,487635423,6743304}, + {"PTXC",9,True,1.1,7143899,250940186,265424032,425314682,3796054}, + {"NVRTC",9,True,1.1,96662433,257852147,276914981,437436947,8343730}, + {"CUDAPP",9,True,1.1,88481,86785830,95947805,137899752,3010738}, + {"NVRTC",10,True,1.1,145358132,309078373,328740810,490136014,6381174}, + {"CUDAPP",10,True,1.02,75009,86943559,97253413,144135981,2913777}, + {"PTXC",10,True,1.02,5948436,287576326,301530840,427769402,3937751}, + {"NVRTC",11,True,1.02,98378283,260276258,278633936,441314364,6904618}, + {"PTXC",11,True,1.1,7063274,245562538,259286956,416822009,3530533}, + {"CUDAPP",11,True,1.1,77488,88248815,97783576,141795487,2593023}, + {"CUDAPP",12,True,1.1,76048,134897333,143533257,213566300,2608320}, + {"PTXC",12,True,1.1,10224525,311604037,324107887,480839575,3578021}, + {"NVRTC",12,True,1.09,97817993,259047516,276519620,441856719,6670936}, + {"CUDAPP",13,True,1.09,85440,85878593,95649323,144943297,2920721}, + {"NVRTC",13,True,1.09,136468016,311311780,327671798,487217711,5925540}, + {"PTXC",13,True,1.09,7029914,249242641,263909689,421649383,3964616}, + {"PTXC",14,True,1.0,6103380,249514658,263753335,421384053,3839415}, + {"CUDAPP",14,True,1.0,74592,102124354,111638235,189373147,2704624}, + {"NVRTC",14,True,1.0,139595026,304335723,319204643,480538151,6796729}, + {"PTXC",15,True,1.0,7076730,248434861,262558993,423042831,3808407}, + {"NVRTC",15,True,1.0,97935161,268657525,286710161,445744519,7019050}, + {"CUDAPP",15,True,1.0,97169,97475991,106214571,155681442,2635136}, + {"NVRTC",16,True,1.0,143963372,309267320,327515013,487062335,6922825}, + {"CUDAPP",16,True,1.0,84656,87290281,96269583,171299168,2897297}, + {"PTXC",16,True,1.0,9888283,291375037,306740202,466366660,4274986}, + {"NVRTC",17,True,1.0,98898575,264143355,282114358,441550271,7112299}, + {"PTXC",17,True,1.0,7044842,264783919,278887571,440642490,3955911}, + {"CUDAPP",17,True,0.92,69504,85431902,95067864,172950042,2735473}, + {"CUDAPP",18,True,0.92,77905,132795651,141599341,208344560,2801118}, + {"PTXC",18,True,0.92,10519364,294254869,307619414,518105050,3956396}, + {"NVRTC",18,True,0.92,101962015,264124236,282515527,443179158,6863689}, + {"CUDAPP",19,True,1.01,78976,88606303,97426517,145259553,2733773}, + {"NVRTC",19,True,1.01,143676070,307043431,325938834,485746775,6682153}, + {"PTXC",19,True,1.01,7140296,245888955,259846877,418338309,4334220}, + {"PTXC",20,True,1.01,6994505,246689838,263200381,424079446,3672108}, + {"CUDAPP",20,True,1.01,71520,97110428,107076850,162815273,2830557}, + {"NVRTC",20,True,1.01,138371316,304028972,322353354,482906663,6275962}, + {"PTXC",21,True,1.01,5943594,245712060,259361198,416930994,4364492}, + {"NVRTC",21,True,0.93,99713774,262714591,281004925,458182624,6952937}, + {"CUDAPP",21,True,0.93,87072,85121422,93923605,196133986,2736861}, + {"NVRTC",22,True,0.93,139543308,304951600,325687853,487173397,6295290}, + {"CUDAPP",22,True,0.93,77440,85040177,93507609,155911391,2432958}, + {"PTXC",22,True,1.41,10612790,293610145,310668338,471351391,4137788}, + {"NVRTC",23,True,1.41,98593991,262108580,277685014,436753896,6200234}, + {"PTXC",23,True,1.41,7029322,244617912,258697547,417107118,3860396}, + {"CUDAPP",23,True,1.94,115519,87011076,96838955,139069543,2486829}, + {"CUDAPP",24,True,1.94,67808,132705967,142429271,194627290,2501870}, + {"PTXC",24,True,1.94,5933787,290059228,302973585,461958939,3990076}, + {"NVRTC",24,True,1.94,98914143,260172153,277735929,436438840,6661002}, + {"CUDAPP",25,True,2.35,75136,93097285,102370189,161761374,2559406}, + {"NVRTC",25,True,2.35,138126194,300309857,319853442,478247828,6269483}, + {"PTXC",25,True,2.35,5802812,243910898,259021670,419554250,3895933}, + {"PTXC",26,True,2.35,5852124,244477414,259324330,415773283,3837773}, + {"CUDAPP",26,True,2.64,69760,85543439,93407114,145967379,2347646}, + {"NVRTC",26,True,2.64,141661767,308127533,323385955,534904073,6718763}, + {"PTXC",27,True,2.64,5875915,246308543,259236278,416011398,3617086}, + {"NVRTC",27,True,3.07,97749355,257192010,273278303,483492381,6339899}, + {"CUDAPP",27,True,3.07,120096,90073570,99159532,151880504,2520542}, + {"NVRTC",28,True,3.07,144889855,311190959,330318497,489061942,6828907}, + {"CUDAPP",28,True,3.07,117216,85968007,95348257,138559973,2563455}, + {"PTXC",28,True,3.38,5599052,289606054,306715932,516848085,3673438}, + {"NVRTC",29,True,3.38,97339523,260264077,276489634,487166221,6608940}, + {"PTXC",29,True,3.38,7048668,249146521,263554112,419894337,3585342}, + {"CUDAPP",29,True,3.38,77536,85018685,94432359,150610886,2611150}}; +(* csWarm: {arm, round, ok, {warm build ns ...}} *) +csWarm = {{"CUDAPP",0,True,{6256,5376,5296,5184,5152,6272,5168,5104,5216,5120}}, + {"PTXC",0,True,{3877054,3598782,3227870,3137310,3103599,3118494,3106686,3084702,3080990,3051487}}, + {"NVRTC",0,True,{16051783,16218311,16330870,16215111,16259575,16213799,16165207,16030439,16270535,16237334}}, + {"CUDAPP",1,True,{6144,5232,5216,5120,5072,6080,5072,5072,5136,5088}}, + {"NVRTC",1,True,{16024120,16349367,16440823,16388647,16344824,16297239,16340391,16296520,16261559,16486055}}, + {"PTXC",1,True,{3886414,3538286,3255887,3152958,3139038,3085951,3101230,3094863,3096782,3074014}}, + {"PTXC",2,True,{3903550,3555487,3241966,3147886,3151055,3139278,3074927,3092174,3108942,3086719}}, + {"CUDAPP",2,True,{5904,5296,5264,5104,5104,5968,5136,5088,5072,5152}}, + {"NVRTC",2,True,{16064696,16562088,16532280,16536024,16660824,16573511,16546680,16523896,16498904,16405992}}, + {"PTXC",3,True,{3921470,3586831,3225726,3177998,3141951,3169871,3158798,3140511,3104526,3103967}}, + {"NVRTC",3,True,{15876281,16133193,16322136,16279545,16434616,16300601,16135049,16293048,16231049,16217784}}, + {"CUDAPP",3,True,{6256,5360,5216,5168,5104,6112,5104,5120,5104,5072}}, + {"NVRTC",4,True,{15915769,16239049,16307320,16316057,16299641,16189241,16322601,16344681,16312137,16347609}}, + {"CUDAPP",4,True,{6208,5264,5104,5104,5072,6080,5152,5104,5040,5008}}, + {"PTXC",4,True,{4012527,3681262,3350127,3312623,3268718,3275487,3218718,3203023,3282447,3291566}}, + {"NVRTC",5,True,{16086521,16239530,16358330,16344873,16377162,16378537,16418218,16374569,16447418,16433673}}, + {"PTXC",5,True,{3936974,3626799,3284447,3215838,3188495,3178975,3130047,3114014,3093967,3133151}}, + {"CUDAPP",5,True,{6048,5280,5152,5104,5184,6128,5088,5072,5168,5152}}, + {"CUDAPP",6,True,{5904,5488,5264,5200,5136,6176,5088,5104,5232,5168}}, + {"PTXC",6,True,{3893198,3595407,3251775,3185311,3168014,3135935,3090639,3150959,3189215,3105375}}, + {"NVRTC",6,True,{16223258,16169483,16426794,16386714,16271515,16279882,16393947,16528042,16383370,16445067}}, + {"CUDAPP",7,True,{5856,5392,5184,5184,5184,6208,5136,5120,5008,5104}}, + {"NVRTC",7,True,{16088683,16503883,16384634,16480875,16439291,16516571,16436315,16547178,16410555,16558315}}, + {"PTXC",7,True,{3904207,3559407,3259839,3138207,3136335,3120671,3065615,3081104,3088895,3176399}}, + {"PTXC",8,True,{3857423,3639775,3210319,3161935,3216127,3159679,3099328,3078255,3054159,3062255}}, + {"CUDAPP",8,True,{7200,5360,5200,5152,5136,5856,5184,5232,5184,5088}}, + {"NVRTC",8,True,{16079884,16407323,16399196,16329515,16246380,16592540,16496427,16439052,16290123,16309980}}, + {"PTXC",9,True,{3872031,3561823,3218623,3182607,3167504,3192111,3135023,3098415,3120831,3121824}}, + {"NVRTC",9,True,{15936940,16333115,16198380,16422572,16304508,16379772,16288380,16349100,16268204,16031484}}, + {"CUDAPP",9,True,{6304,5232,5184,5168,5088,6096,5136,5152,5136,5136}}}; + +(* coldstart/PROTOCOL.md section 7. Evaluated in the Wolfram MCP kernel with results/coldstart//rows.wl + (coldstart/run.py) prepended. csRows row: {arm, round, ok, load1, build, ready, firstResult, proc, exec}, ns. + csWarm row: {arm, round, ok, {10 warm build times, ns}}. Statistics are h2hStats of results/wolfram/analysis.wl, + in microseconds. A comparison is a WIN or LOSS only when the two IQRs [q1, q3] do not overlap; otherwise + OVERLAPPING. No significance tests. Output: RawJSON. *) +h2hStats[v_List] := If[Length[v] == 0, <|"n" -> 0|>, + <|"n" -> Length[v], "median" -> N[Median[v]], "q1" -> N[Quantile[v, 1/4]], "q3" -> N[Quantile[v, 3/4]], + "iqr" -> N[InterquartileRange[v]], "p50" -> N[Quantile[v, 1/2]], "p99" -> N[Quantile[v, 99/100]]|>]; +csArms = {"CUDAPP", "PTXC", "NVRTC"}; +csMetrics = {"build" -> 5, "ready" -> 6, "firstResult" -> 7, "proc" -> 8, "exec" -> 9}; +(* valid rows: process ok and load1 < 6 at spawn (section 6) *) +csValid[rows_] := Select[rows, #[[3]] === True && #[[4]] < 6 &]; +csCall[a_Association, b_Association] := Which[ + a["q3"] < b["q1"], "CUDAPP_LOWER", b["q3"] < a["q1"], "CUDAPP_HIGHER", True, "OVERLAPPING"]; +csAnalyse[rows_, warm_] := Module[{valid, per, warmPer, out = <||>, cmp = <||>}, + valid = csValid[rows]; + per = AssociationMap[Function[arm, Module[{rs = Select[valid, #[[1]] == arm &]}, + Join[<|"rows_measured" -> Count[rows, r_ /; r[[1]] == arm], + "rows_valid" -> Length[rs], + "rows_failed" -> Count[rows, r_ /; r[[1]] == arm && r[[3]] =!= True], + "rows_load_excluded" -> Count[rows, r_ /; r[[1]] == arm && r[[3]] === True && r[[4]] >= 6], + "arm_valid" -> Length[rs] >= 28|>, + Association[(First[#] -> h2hStats[N[rs[[All, Last[#]]]/1000]]) & /@ csMetrics]]]], csArms]; + warmPer = AssociationMap[Function[arm, + h2hStats[N[Median[#[[4]]]/1000] & /@ Select[warm, #[[1]] == arm && #[[3]] === True && Length[#[[4]]] > 0 &]]], csArms]; + Do[cmp[other] = Association[Function[m, m -> <| + "call" -> If[per["CUDAPP"]["arm_valid"] && per[other]["arm_valid"], + csCall[per["CUDAPP"][m], per[other][m]], "NO_VERDICT"], + "median_ratio_other_over_cudapp" -> N[per[other][m]["median"]/per["CUDAPP"][m]["median"]]|>] /@ Keys[csMetrics]], + {other, {"PTXC", "NVRTC"}}]; + out["unit"] = "microseconds"; + out["arms"] = per; + out["warm_build_per_process_median"] = warmPer; + out["cudapp_vs"] = cmp; + ExportString[out, "RawJSON", "Compact" -> True]]; + +a = ImportString[csAnalyse[csRows, csWarm], "RawJSON"]; +fmt[s_] := Round[{s["median"], s["q1"], s["q3"], s["iqr"]}, 0.1]; +{Table[arm -> Table[m -> fmt[a["arms"][arm][m]], {m, {"build", "ready", "firstResult", "proc", "exec"}}], {arm, {"CUDAPP", "PTXC", "NVRTC"}}], + Table[arm -> fmt[a["warm_build_per_process_median"][arm]], {arm, {"CUDAPP", "PTXC", "NVRTC"}}], + Table[o -> Table[m -> {a["cudapp_vs"][o][m]["call"], Round[a["cudapp_vs"][o][m]["median_ratio_other_over_cudapp"], 0.01]}, {m, {"build", "ready", "firstResult", "proc", "exec"}}], {o, {"PTXC", "NVRTC"}}], + MinMax[csRows[[All, 4]]], MinMax[csWarm[[All, 4]] /. {} -> Nothing]} \ No newline at end of file diff --git a/results/coldstart/20261029T221603Z/wolfram.warm-call.out.txt b/results/coldstart/20261029T221603Z/wolfram.warm-call.out.txt new file mode 100644 index 0000000..16cbad1 --- /dev/null +++ b/results/coldstart/20261029T221603Z/wolfram.warm-call.out.txt @@ -0,0 +1 @@ +Out[1]= {"PTXC" -> {"CUDAPP_LOWER", 612.9013081395348}, "NVRTC" -> {"CUDAPP_LOWER", 3169.279360465116}} \ No newline at end of file diff --git a/results/coldstart/20261029T221603Z/wolfram.warm-call.query.wl b/results/coldstart/20261029T221603Z/wolfram.warm-call.query.wl new file mode 100644 index 0000000..c4ff170 --- /dev/null +++ b/results/coldstart/20261029T221603Z/wolfram.warm-call.query.wl @@ -0,0 +1,162 @@ +(* csRows: {arm, round, ok, load1, build, ready, firstResult, proc, exec}; ns *) +csRows = {{"CUDAPP",0,True,1.26,82832,87899532,96897410,148599526,2933234}, + {"PTXC",0,True,1.26,9533385,293477589,308054812,465542870,3981271}, + {"NVRTC",0,True,1.24,100952314,263774452,280174886,441528296,6233638}, + {"CUDAPP",1,True,1.24,84929,86973335,95665786,137218130,2603231}, + {"NVRTC",1,True,1.24,143748921,311206591,329974768,540715080,6553976}, + {"PTXC",1,True,1.14,7027930,245302390,259254697,467249506,4236937}, + {"PTXC",2,True,1.14,6850809,246986113,261044949,468852604,3646774}, + {"CUDAPP",2,True,1.14,75248,86504004,95558522,203488190,2191341}, + {"NVRTC",2,True,1.14,139035549,304095813,323437497,586790539,6093988}, + {"PTXC",3,True,1.29,7033914,245828026,258986600,416434579,3625382}, + {"NVRTC",3,True,1.29,98263354,261889162,278044554,488189455,6444198}, + {"CUDAPP",3,True,1.29,84976,85809839,94343283,202793753,2273854}, + {"NVRTC",4,True,1.35,136133564,300369535,318862638,478790296,6585399}, + {"CUDAPP",4,True,1.35,78800,88068717,96709313,151290614,2539775}, + {"PTXC",4,True,1.35,10523535,297144877,313747039,522634925,3649349}, + {"NVRTC",5,True,1.35,97687015,260688419,277277606,438873242,6613560}, + {"PTXC",5,True,1.24,6894937,245284726,259986111,384161156,4237050}, + {"CUDAPP",5,True,1.24,73344,87393321,97279620,139180414,2891457}, + {"CUDAPP",6,True,1.24,76160,134765300,143308359,209754404,2543967}, + {"PTXC",6,True,1.24,6027140,291670908,305321998,462827450,3445189}, + {"NVRTC",6,True,1.22,99380625,262091404,279916087,440129091,6328038}, + {"CUDAPP",7,True,1.22,98848,86201298,95517626,153066945,2713200}, + {"NVRTC",7,True,1.22,145480564,310520349,326477899,487656541,6343814}, + {"PTXC",7,True,1.22,7197627,247052690,261872363,420714559,4012744}, + {"PTXC",8,True,1.2,6715016,250174901,264664267,421641764,4369210}, + {"CUDAPP",8,True,1.2,68848,85946817,95564266,187043276,2524735}, + {"NVRTC",8,True,1.2,144006363,307408346,327258657,487635423,6743304}, + {"PTXC",9,True,1.1,7143899,250940186,265424032,425314682,3796054}, + {"NVRTC",9,True,1.1,96662433,257852147,276914981,437436947,8343730}, + {"CUDAPP",9,True,1.1,88481,86785830,95947805,137899752,3010738}, + {"NVRTC",10,True,1.1,145358132,309078373,328740810,490136014,6381174}, + {"CUDAPP",10,True,1.02,75009,86943559,97253413,144135981,2913777}, + {"PTXC",10,True,1.02,5948436,287576326,301530840,427769402,3937751}, + {"NVRTC",11,True,1.02,98378283,260276258,278633936,441314364,6904618}, + {"PTXC",11,True,1.1,7063274,245562538,259286956,416822009,3530533}, + {"CUDAPP",11,True,1.1,77488,88248815,97783576,141795487,2593023}, + {"CUDAPP",12,True,1.1,76048,134897333,143533257,213566300,2608320}, + {"PTXC",12,True,1.1,10224525,311604037,324107887,480839575,3578021}, + {"NVRTC",12,True,1.09,97817993,259047516,276519620,441856719,6670936}, + {"CUDAPP",13,True,1.09,85440,85878593,95649323,144943297,2920721}, + {"NVRTC",13,True,1.09,136468016,311311780,327671798,487217711,5925540}, + {"PTXC",13,True,1.09,7029914,249242641,263909689,421649383,3964616}, + {"PTXC",14,True,1.0,6103380,249514658,263753335,421384053,3839415}, + {"CUDAPP",14,True,1.0,74592,102124354,111638235,189373147,2704624}, + {"NVRTC",14,True,1.0,139595026,304335723,319204643,480538151,6796729}, + {"PTXC",15,True,1.0,7076730,248434861,262558993,423042831,3808407}, + {"NVRTC",15,True,1.0,97935161,268657525,286710161,445744519,7019050}, + {"CUDAPP",15,True,1.0,97169,97475991,106214571,155681442,2635136}, + {"NVRTC",16,True,1.0,143963372,309267320,327515013,487062335,6922825}, + {"CUDAPP",16,True,1.0,84656,87290281,96269583,171299168,2897297}, + {"PTXC",16,True,1.0,9888283,291375037,306740202,466366660,4274986}, + {"NVRTC",17,True,1.0,98898575,264143355,282114358,441550271,7112299}, + {"PTXC",17,True,1.0,7044842,264783919,278887571,440642490,3955911}, + {"CUDAPP",17,True,0.92,69504,85431902,95067864,172950042,2735473}, + {"CUDAPP",18,True,0.92,77905,132795651,141599341,208344560,2801118}, + {"PTXC",18,True,0.92,10519364,294254869,307619414,518105050,3956396}, + {"NVRTC",18,True,0.92,101962015,264124236,282515527,443179158,6863689}, + {"CUDAPP",19,True,1.01,78976,88606303,97426517,145259553,2733773}, + {"NVRTC",19,True,1.01,143676070,307043431,325938834,485746775,6682153}, + {"PTXC",19,True,1.01,7140296,245888955,259846877,418338309,4334220}, + {"PTXC",20,True,1.01,6994505,246689838,263200381,424079446,3672108}, + {"CUDAPP",20,True,1.01,71520,97110428,107076850,162815273,2830557}, + {"NVRTC",20,True,1.01,138371316,304028972,322353354,482906663,6275962}, + {"PTXC",21,True,1.01,5943594,245712060,259361198,416930994,4364492}, + {"NVRTC",21,True,0.93,99713774,262714591,281004925,458182624,6952937}, + {"CUDAPP",21,True,0.93,87072,85121422,93923605,196133986,2736861}, + {"NVRTC",22,True,0.93,139543308,304951600,325687853,487173397,6295290}, + {"CUDAPP",22,True,0.93,77440,85040177,93507609,155911391,2432958}, + {"PTXC",22,True,1.41,10612790,293610145,310668338,471351391,4137788}, + {"NVRTC",23,True,1.41,98593991,262108580,277685014,436753896,6200234}, + {"PTXC",23,True,1.41,7029322,244617912,258697547,417107118,3860396}, + {"CUDAPP",23,True,1.94,115519,87011076,96838955,139069543,2486829}, + {"CUDAPP",24,True,1.94,67808,132705967,142429271,194627290,2501870}, + {"PTXC",24,True,1.94,5933787,290059228,302973585,461958939,3990076}, + {"NVRTC",24,True,1.94,98914143,260172153,277735929,436438840,6661002}, + {"CUDAPP",25,True,2.35,75136,93097285,102370189,161761374,2559406}, + {"NVRTC",25,True,2.35,138126194,300309857,319853442,478247828,6269483}, + {"PTXC",25,True,2.35,5802812,243910898,259021670,419554250,3895933}, + {"PTXC",26,True,2.35,5852124,244477414,259324330,415773283,3837773}, + {"CUDAPP",26,True,2.64,69760,85543439,93407114,145967379,2347646}, + {"NVRTC",26,True,2.64,141661767,308127533,323385955,534904073,6718763}, + {"PTXC",27,True,2.64,5875915,246308543,259236278,416011398,3617086}, + {"NVRTC",27,True,3.07,97749355,257192010,273278303,483492381,6339899}, + {"CUDAPP",27,True,3.07,120096,90073570,99159532,151880504,2520542}, + {"NVRTC",28,True,3.07,144889855,311190959,330318497,489061942,6828907}, + {"CUDAPP",28,True,3.07,117216,85968007,95348257,138559973,2563455}, + {"PTXC",28,True,3.38,5599052,289606054,306715932,516848085,3673438}, + {"NVRTC",29,True,3.38,97339523,260264077,276489634,487166221,6608940}, + {"PTXC",29,True,3.38,7048668,249146521,263554112,419894337,3585342}, + {"CUDAPP",29,True,3.38,77536,85018685,94432359,150610886,2611150}}; +(* csWarm: {arm, round, ok, {warm build ns ...}} *) +csWarm = {{"CUDAPP",0,True,{6256,5376,5296,5184,5152,6272,5168,5104,5216,5120}}, + {"PTXC",0,True,{3877054,3598782,3227870,3137310,3103599,3118494,3106686,3084702,3080990,3051487}}, + {"NVRTC",0,True,{16051783,16218311,16330870,16215111,16259575,16213799,16165207,16030439,16270535,16237334}}, + {"CUDAPP",1,True,{6144,5232,5216,5120,5072,6080,5072,5072,5136,5088}}, + {"NVRTC",1,True,{16024120,16349367,16440823,16388647,16344824,16297239,16340391,16296520,16261559,16486055}}, + {"PTXC",1,True,{3886414,3538286,3255887,3152958,3139038,3085951,3101230,3094863,3096782,3074014}}, + {"PTXC",2,True,{3903550,3555487,3241966,3147886,3151055,3139278,3074927,3092174,3108942,3086719}}, + {"CUDAPP",2,True,{5904,5296,5264,5104,5104,5968,5136,5088,5072,5152}}, + {"NVRTC",2,True,{16064696,16562088,16532280,16536024,16660824,16573511,16546680,16523896,16498904,16405992}}, + {"PTXC",3,True,{3921470,3586831,3225726,3177998,3141951,3169871,3158798,3140511,3104526,3103967}}, + {"NVRTC",3,True,{15876281,16133193,16322136,16279545,16434616,16300601,16135049,16293048,16231049,16217784}}, + {"CUDAPP",3,True,{6256,5360,5216,5168,5104,6112,5104,5120,5104,5072}}, + {"NVRTC",4,True,{15915769,16239049,16307320,16316057,16299641,16189241,16322601,16344681,16312137,16347609}}, + {"CUDAPP",4,True,{6208,5264,5104,5104,5072,6080,5152,5104,5040,5008}}, + {"PTXC",4,True,{4012527,3681262,3350127,3312623,3268718,3275487,3218718,3203023,3282447,3291566}}, + {"NVRTC",5,True,{16086521,16239530,16358330,16344873,16377162,16378537,16418218,16374569,16447418,16433673}}, + {"PTXC",5,True,{3936974,3626799,3284447,3215838,3188495,3178975,3130047,3114014,3093967,3133151}}, + {"CUDAPP",5,True,{6048,5280,5152,5104,5184,6128,5088,5072,5168,5152}}, + {"CUDAPP",6,True,{5904,5488,5264,5200,5136,6176,5088,5104,5232,5168}}, + {"PTXC",6,True,{3893198,3595407,3251775,3185311,3168014,3135935,3090639,3150959,3189215,3105375}}, + {"NVRTC",6,True,{16223258,16169483,16426794,16386714,16271515,16279882,16393947,16528042,16383370,16445067}}, + {"CUDAPP",7,True,{5856,5392,5184,5184,5184,6208,5136,5120,5008,5104}}, + {"NVRTC",7,True,{16088683,16503883,16384634,16480875,16439291,16516571,16436315,16547178,16410555,16558315}}, + {"PTXC",7,True,{3904207,3559407,3259839,3138207,3136335,3120671,3065615,3081104,3088895,3176399}}, + {"PTXC",8,True,{3857423,3639775,3210319,3161935,3216127,3159679,3099328,3078255,3054159,3062255}}, + {"CUDAPP",8,True,{7200,5360,5200,5152,5136,5856,5184,5232,5184,5088}}, + {"NVRTC",8,True,{16079884,16407323,16399196,16329515,16246380,16592540,16496427,16439052,16290123,16309980}}, + {"PTXC",9,True,{3872031,3561823,3218623,3182607,3167504,3192111,3135023,3098415,3120831,3121824}}, + {"NVRTC",9,True,{15936940,16333115,16198380,16422572,16304508,16379772,16288380,16349100,16268204,16031484}}, + {"CUDAPP",9,True,{6304,5232,5184,5168,5088,6096,5136,5152,5136,5136}}}; + +(* coldstart/PROTOCOL.md section 7. Evaluated in the Wolfram MCP kernel with results/coldstart//rows.wl + (coldstart/run.py) prepended. csRows row: {arm, round, ok, load1, build, ready, firstResult, proc, exec}, ns. + csWarm row: {arm, round, ok, {10 warm build times, ns}}. Statistics are h2hStats of results/wolfram/analysis.wl, + in microseconds. A comparison is a WIN or LOSS only when the two IQRs [q1, q3] do not overlap; otherwise + OVERLAPPING. No significance tests. Output: RawJSON. *) +h2hStats[v_List] := If[Length[v] == 0, <|"n" -> 0|>, + <|"n" -> Length[v], "median" -> N[Median[v]], "q1" -> N[Quantile[v, 1/4]], "q3" -> N[Quantile[v, 3/4]], + "iqr" -> N[InterquartileRange[v]], "p50" -> N[Quantile[v, 1/2]], "p99" -> N[Quantile[v, 99/100]]|>]; +csArms = {"CUDAPP", "PTXC", "NVRTC"}; +csMetrics = {"build" -> 5, "ready" -> 6, "firstResult" -> 7, "proc" -> 8, "exec" -> 9}; +(* valid rows: process ok and load1 < 6 at spawn (section 6) *) +csValid[rows_] := Select[rows, #[[3]] === True && #[[4]] < 6 &]; +csCall[a_Association, b_Association] := Which[ + a["q3"] < b["q1"], "CUDAPP_LOWER", b["q3"] < a["q1"], "CUDAPP_HIGHER", True, "OVERLAPPING"]; +csAnalyse[rows_, warm_] := Module[{valid, per, warmPer, out = <||>, cmp = <||>}, + valid = csValid[rows]; + per = AssociationMap[Function[arm, Module[{rs = Select[valid, #[[1]] == arm &]}, + Join[<|"rows_measured" -> Count[rows, r_ /; r[[1]] == arm], + "rows_valid" -> Length[rs], + "rows_failed" -> Count[rows, r_ /; r[[1]] == arm && r[[3]] =!= True], + "rows_load_excluded" -> Count[rows, r_ /; r[[1]] == arm && r[[3]] === True && r[[4]] >= 6], + "arm_valid" -> Length[rs] >= 28|>, + Association[(First[#] -> h2hStats[N[rs[[All, Last[#]]]/1000]]) & /@ csMetrics]]]], csArms]; + warmPer = AssociationMap[Function[arm, + h2hStats[N[Median[#[[4]]]/1000] & /@ Select[warm, #[[1]] == arm && #[[3]] === True && Length[#[[4]]] > 0 &]]], csArms]; + Do[cmp[other] = Association[Function[m, m -> <| + "call" -> If[per["CUDAPP"]["arm_valid"] && per[other]["arm_valid"], + csCall[per["CUDAPP"][m], per[other][m]], "NO_VERDICT"], + "median_ratio_other_over_cudapp" -> N[per[other][m]["median"]/per["CUDAPP"][m]["median"]]|>] /@ Keys[csMetrics]], + {other, {"PTXC", "NVRTC"}}]; + out["unit"] = "microseconds"; + out["arms"] = per; + out["warm_build_per_process_median"] = warmPer; + out["cudapp_vs"] = cmp; + ExportString[out, "RawJSON", "Compact" -> True]]; + +w = Association[ImportString[csAnalyse[csRows, csWarm], "RawJSON"]]["warm_build_per_process_median"]; +c = w["CUDAPP"]; +Table[o -> {Which[c["q3"] < w[o]["q1"], "CUDAPP_LOWER", w[o]["q3"] < c["q1"], "CUDAPP_HIGHER", True, "OVERLAPPING"], w[o]["median"]/c["median"]}, {o, {"PTXC", "NVRTC"}}] \ No newline at end of file