Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/cuda-crack/blob/main/FIELD-MANUAL.md # cuda-crack I broke CUDA: GB10 sm_121 machine code without the CUDA toolkit - method, encoder tables, receipts Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `cuda-crack / FIELD-MANUAL.md` 343 lines · 17760 bytes Raw Blame History Rendered 1 # Field manual: running the DGX Spark (GB10) without the CUDA stack 2 3 Each finding gives the symptom, what the documents say, what I measured and with which label, the fix, and where to reproduce it. These are the findings that cost me the most time. 4 5 **Repositories:** 6 - **CUDApp** is `rad:`z4RxD8vXigmWg61nM8miQ8DVPAXEP`` at ``b774723f``. Clone it with `rad clone`, or with `git clone https://www.aienos.com/rad/`z4RxD8vXigmWg61nM8miQ8DVPAXEP`.git`. 7 - **omega-mv** is `rad:z6do9WDBhuSnvopDkgFdFr1yWA62`. 8 - **here** is this repository. 9 10 **Labels** say where the evidence came from: 11 - CHIP_TESTED: ran on the GB10. 12 - HOST_TESTED: ran on a CPU host. 13 - DEPLOYED: served live on the given date. 14 - MEASURED-TOOL: a system tool reported it, not my own kernel. 15 - DOCUMENTED: a vendor document or open source says it. 16 17 Lifecycle words are separate from labels: IMPLEMENTED means written, EXERCISED means run. A label is not a production qualification. 18 19 **RECEIPT PENDING** means the finding is real in my notes, but its receipt is not public yet. Treat it as unverified until the receipt is attached. 20 21 NVIDIA documents are linked, never copied: 22 - [GB10 Superchip Whitepaper WP-12718-001_v02](https://www.nvidia.com/content/dam/en-zz/Solutions/dgx-spark/nvidia-gb10-superchip-whitepaper.pdf) ("whitepaper") 23 - [DGX Spark User Guide](https://docs.nvidia.com/dgx/dgx-spark/) ("user guide") 24 - [NVIDIA/open-gpu-kernel-modules at tag 580.173.02](https://github.com/NVIDIA/open-gpu-kernel-modules/tree/580.173.02) ("open module") 25 26 --- 27 28 ## 1. The machine 29 30 ### F1. The GB10 is sm_121, not datacenter Blackwell 31 - **Symptom:** Kernels and images built for datacenter Blackwell do not match this chip. 32 - **Docs:** See the whitepaper. The GB10 is a Blackwell GPU with compute capability 12.1, plus a 20-core Arm CPU: 10 Cortex-X925 and 10 Cortex-A725. 33 - **Measured:** DOCUMENTED. The chip identity is confirmed in F10. 34 - **Fix:** Target sm_121. This repository's tables are sm_121 only (`isa/`). 35 - **Reproduce:** Read the whitepaper. See F10 for the chip's own report. 36 37 ### F2. One 128 GB memory pool; "Memory-Usage: Not Supported" is normal 38 - **Symptom:** `nvidia-smi` shows "Memory-Usage: Not Supported". 39 - **Docs:** The user guide lists this as a known issue. The machine has 128 GB of LPDDR5x at 273 GB/s, shared by the CPU and GPU. There is no separate GPU memory. 40 - **Measured:** DOCUMENTED. 41 - **Fix:** Nothing is broken. Plan memory as one pool shared with the CPU. 42 - **Reproduce:** User guide, known issues. 43 44 ### F3. Every GPU DRAM byte crosses NVLink-C2C 45 - **Symptom:** GPU bandwidth behaves like a link-attached device, not like local HBM. 46 - **Docs:** Whitepaper Figs. 3 and 6, described here rather than copied. The memory controllers sit on the CPU die (S-die). The GPU die (G-die) holds the compute units and the 24 MiB L2. 47 - **Measured:** DOCUMENTED. 48 - **Fix:** Budget DRAM traffic as crossing C2C. See F4. 49 - **Reproduce:** Whitepaper figures. 50 51 ### F4. C2C (345 GB/s per direction) is wider than DRAM (273 GB/s) 52 - **Symptom:** It is unclear whether the link or DRAM is the ceiling. 53 - **Docs:** No NVIDIA document gives the per-link figure. The tool reports it. 54 - **Measured:** MEASURED-TOOL. `nvidia-smi c2c -s` on 2026-10-24 reported 8 links × 43.125 GB/s = 345 GB/s per direction. This was a CPU-side STREAM measurement only. **The GPU-side measurement is pending.** 55 - **Fix:** For bulk traffic, treat DRAM, not the link, as the ceiling. This is a working assumption until the GPU-side measurement exists. 56 - **Reproduce:** Run `nvidia-smi c2c -s` on your Spark. RECEIPT PENDING: my 2026-10-24 log is not public yet. 57 58 ### F5. NVIDIA's own documents disagree 59 - **Symptom:** Different documents give different numbers for the same machine. 60 - **Docs:** 61 - Coherency: the whitepaper p.3 says CHI-G; the Hot Chips 2025 deck says CHI-E. 62 - Memory bandwidth: 273 GB/s versus "~301GB/s raw". 63 - Aggregate C2C: "~600GB/s" versus the 690 GB/s that `nvidia-smi` reports. 64 - **Measured:** DOCUMENTED. These are short quotes from the two sources. 65 - **Fix:** Trust what the machine reports, and say which source each number came from. 66 - **Reproduce:** Whitepaper, the Hot Chips 2025 GB10 deck, and `nvidia-smi c2c -s`. 67 68 ### F6. No C2C performance counter is exposed 69 - **Symptom:** No perf event measures link traffic. 70 - **Docs:** None. 71 - **Measured:** MEASURED-TOOL on 2026-10-24. `/sys/bus/event_source` lists only smmuv3_pmcg, armv8_pmuv3 and arm_spe. 72 - **Fix:** Infer link load from timing, or from DRAM-side counters where they exist. 73 - **Reproduce:** Run `ls /sys/bus/event_source/devices`. 74 75 ### F7. The GPU's PCIe link shows Gen1 x1, and that is fine 76 - **Symptom:** `lspci` or `nvidia-smi` shows a Gen1 x1 link. 77 - **Docs:** None found. 78 - **Measured:** MEASURED-TOOL. The PCIe link carries control only. Data goes over C2C. 79 - **Fix:** None needed. 80 - **Reproduce:** Run `lspci -vv -d 10de:2e12`, then look at LnkSta. RECEIPT PENDING: my log is not public yet. 81 82 ### F8. CPU first-touch latency ladder 83 - **Symptom:** Latency-bound host code waiting on GPU results. 84 - **Docs:** None. 85 - **Measured:** HOST_TESTED. This was a CPU measurement on core 7, 2026-10-24: 86 87 | Level | Latency | 88 |---|---| 89 | L2 | ~8 ns | 90 | L3 | ~40–57 ns | 91 | Point of coherency, after DC CIVAC | ~60–85 ns | 92 | DRAM | ~130–155 ns | 93 - **Fix:** Poll only words that are allocated uncached (F19). Expect DRAM-class latency on them. 94 - **Reproduce:** RECEIPT PENDING: my measurement log is not public yet. 95 96 ### F9. `cudaMemGetInfo` can under-report free memory 97 - **Symptom:** The free-memory figure looks too small. 98 - **Docs:** The user guide lists this as a known issue: the CPU can swap pages. 99 - **Measured:** DOCUMENTED. 100 - **Fix:** Do not size allocations from this figure alone. 101 - **Reproduce:** User guide, known issues. 102 103 ### F10. The GPU identifies as PCI `10de:2e12` "NVIDIA GB10", sm_121 104 - **Symptom:** You need the exact ID to gate code to this chip. 105 - **Docs:** None needed. 106 - **Measured:** CHIP_TESTED, by the doctor on the E2 run. 107 - **Fix:** Gate on `10de:2e12`. 108 - **Reproduce:** 109 - CUDApp `src/omega_gpu_chip.c:15`. 110 - Here: `receipts/cudapp/evidence/CUDAPP-OM-ENCODER/chip-20261027T080240Z/om-doctor.log`. 111 - Run `make doctor` in CUDApp. 112 113 ## 2. Driving the GPU without libcuda 114 115 ### F11. Everything goes through ioctls on three device files 116 - **Symptom:** libcuda looks like the only way in. 117 - **Docs:** NVIDIA's open module defines every call in public MIT headers. 118 - **Measured:** CHIP_TESTED, and DEPLOYED on 2026-10-21 (E1). The three device files are: 119 - `/dev/nvidiactl`, the resource manager; 120 - `/dev/nvidia`, for CPU mappings; 121 - `/dev/nvidia-uvm`, opened twice, which owns the GPU page tables. 122 - **Fix:** Speak the ioctl ABI directly. 123 - **Reproduce:** 124 - CUDApp `docs/DRIVER.md:7-13` and `docs/HOW_I_DID_IT.md:20`. 125 - Here: `receipts/omega-mv/evidence/WHAT-OMEGA-IS-`20261021`/live-serve-no-cuda.txt`. 126 127 ### F12. The open sequence is 11 steps 128 - **Symptom:** Device setup fails partway through. 129 - **Docs:** Open-module headers. 130 - **Measured:** CHIP_TESTED. The 11 steps, in order: 131 1. root client; 132 2. UVM init; 133 3. card info; 134 4. device object; 135 5. subdevice object; 136 6. virtual memory object; 137 7. class list; 138 8. usermode page; 139 9. SM version; 140 10. FERMI_VASPACE_A; 141 11. UVM GPU registration. 142 - **Fix:** Follow that order. 143 - **Reproduce:** CUDApp `docs/DRIVER.md:15-30`, and `nvrm/nvrm.c` `nvrm_open()`. 144 145 ### F13. Three classes, and a one-store doorbell 146 - **Symptom:** You do not know which classes to allocate, or how to kick work off. 147 - **Docs:** Open-module class headers, starting with `clcec0.h`. 148 - **Measured:** CHIP_TESTED. The three classes are: 149 - `BLACKWELL_COMPUTE_B` (clcec0); 150 - `BLACKWELL_CHANNEL_GPFIFO_A`; 151 - `HOPPER_USERMODE_A`. 152 153 The doorbell is one user-space store to `NVC361_NOTIFY_CHANNEL_PENDING` in the mapped 64 KiB usermode page. 154 - **Fix:** As measured. 155 - **Reproduce:** CUDApp `docs/DRIVER.md:23-24` and `nvrm/nvrm.c:45,66`. 156 157 ### F14. The driver ABI is pinned to open module 580.173.02 158 - **Symptom:** A different module version breaks the ioctl ABI. 159 - **Docs:** Open module, tag 580.173.02. 160 - **Measured:** 161 - HOST_TESTED: the doctor's version logic. 162 - CHIP_TESTED: the doctor ran on the E2 run. 163 - **Fix:** `make doctor` and `make hello-gpu` refuse other versions. This is a check in the wrapper only. Binaries run directly have no such guard. 164 - **Reproduce:** 165 - CUDApp README, "You need" row. 166 - Here: `.../chip-20261027T080240Z/om-doctor.log`. 167 168 ### F15. The driver client is about 900 lines of C 169 - **Symptom:** None. This is the size of the job. 170 - **Docs:** It is written against 67 unchanged MIT headers from the open module. They are linked, not re-hosted. 171 - **Measured:** IMPLEMENTED, and CHIP_TESTED through E1 and E2. 172 - **Fix:** None needed. 173 - **Reproduce:** CUDApp `nvrm/nvrm.c`, `docs/DRIVER.md:3` and `docs/HOW_I_DID_IT.md:20`. 174 175 ### F16. The launch order comes from Mesa NVK 176 - **Symptom:** A launch goes nowhere, or runs stale code. 177 - **Docs:** 178 - Mesa NVK, MIT: `src/nouveau/vulkan/nvk_cmd_dispatch.c` and `nvk_cmd_buffer.c`. 179 - The open class headers. 180 - **Measured:** CHIP_TESTED. The order is: code pointer, launch descriptor (QMD), cache invalidates, fire. Credit to Mesa. 181 - **Fix:** Follow that order. 182 - **Reproduce:** CUDApp `docs/HOW_I_DID_IT.md:45` and `src/omega_gpu_cmdlist.c`. 183 184 ### F17. The cost of an extra dependent launch 185 - **Symptom:** Chains of small launches are slow. 186 - **Docs:** None. 187 - **Measured:** CHIP_TESTED on 2026-10-14, in a PASS run with n 16384, k 2048 and 20 reps. 188 - With a wait-for-idle barrier: 25.09 to 31.97 µs. 189 - Without one: 2.68 to 9.68 µs. 190 191 These figures are specific to this workload. They are not a ceiling. 192 - **Fix:** Drop barriers that the data dependencies do not need. 193 - **Reproduce:** Here: `receipts/cudapp/evidence/OWN30B-LAUNCH-COST-20261014T0120Z/r2/receipt.json`. Run r2 only; r1 was a FAIL run. 194 195 ## 3. Memory and cache: the trap that cost two days 196 197 ### F18. GPU-cached system memory is not coherent with CPU mappings 198 - **Symptom:** The CPU does not see what the GPU wrote. 199 - **Docs:** Open module, `src/common/sdk/nvidia/inc/nvos.h`, lines 1116–1118 at tag 580.173.02 (MIT). The default is "gpu uncached for system memory", and with caching enabled, "For system memory this will not be coherent with direct CPU mappings." 200 - **Measured:** DOCUMENTED. 201 - **Fix:** See F19. 202 - **Reproduce:** [nvos.h at 580.173.02](https://github.com/NVIDIA/open-gpu-kernel-modules/blob/580.173.02/src/common/sdk/nvidia/inc/nvos.h#L1116-L1118). 203 204 ### F19. Words the CPU polls must be GPU-uncached 205 - **Symptom:** The CPU sees a done flag about 1 s late, or never. Launches took 1066 ms each, with a rare 600 s stall. 206 - **Docs:** F18. 207 - **Measured:** CHIP_TESTED, observed 2026-10-01/02. **RECEIPT PENDING:** the stall receipt is not attached yet. 208 - **Fix:** Allocate every host-polled word with `nvrm_alloc_gpu_uncached`. The source comment says: "a resident chip program polling the buffer keeps reading its own L2 copy and never sees the store." 209 - **Reproduce:** CUDApp `nvrm/nvrm.c:620-621` and `src/omega_gpu_platform.h:27`. 210 211 ### F20. The proven release sequence 212 - **Symptom:** Making the marker uncached only moves the stall somewhere else. 213 - **Docs:** None. 214 - **Measured:** CHIP_TESTED per my notes, chip PASS at `fb36109`. **RECEIPT PENDING:** the `fb36109` receipt is not attached yet. 215 - **Fix:** 216 1. Issue an `L2_FLUSH_DIRTY` mem-op. 217 2. Write a second marker to uncached memory. 218 3. Have the host wait on both. 219 - **Reproduce:** CUDApp `src/omega_blackwell_submit.c:374,622` and `src/omega_blackwell_engine.c:518`. 220 221 ### F21. Stale L2 after the CPU rewrites a buffer (open hypothesis) 222 - **Symptom:** Results are wrong only under load, or only on the second dispatch. 223 - **Docs:** None. 224 - **Measured:** **Hypothesis, not proven.** When the CPU rewrites a buffer the chip may still read, the chip may read its own stale L2 copy. 225 - **Fix:** Suspect this first for that symptom. The test is still to be run. 226 - **Reproduce:** None yet. 227 228 ### F22. "Full cache coherency" means the fabric, not GPU L2 (interpretation) 229 - **Symptom:** The whitepaper and F18 seem to contradict each other. 230 - **Docs:** The whitepaper p.1 says "Full cache coherency between CPU and GPU". The other side is the nvos.h comment in F18. 231 - **Measured:** **Interpretation**, inferred from F18 and F20. Both statements are true at once. 232 - **Fix:** Keep the F20 flush. 233 - **Reproduce:** Read F18 and F20. 234 235 ### F23. My runtime refuses a cached host-polled buffer 236 - **Symptom:** None. This is a guard against F19. 237 - **Docs:** None. 238 - **Measured:** HOST_TESTED. 239 - **Fix:** The runtime refuses such a buffer with `OMEGA_GPU_PLAT_REFUSED_CACHE_POLICY`. 240 - **Reproduce:** CUDApp `docs/runtime/PORTABILITY.md:125-126`. 241 242 ### F24. After one uncertain completion, stop submitting 243 - **Symptom:** Retrying after a stall makes things worse. 244 - **Docs:** None. 245 - **Measured:** IMPLEMENTED. After one uncertain completion, the session refuses further submissions by design. 246 - **Fix:** Address the first stall. Do not retry. 247 - **Reproduce:** CUDApp `src/omega_gpu_session.c`, the uncertain-state handling. 248 249 ## 4. Machine code 250 251 ### F25. SASS encodings are not published, so I recovered them 252 - **Symptom:** No public encoding for sm_121 exists. 253 - **Docs:** NVIDIA does not publish SASS encodings. 254 - **Measured:** CHIP_TESTED as a method; see E2 and E10. I used three methods: 255 1. Offline, I compiled my own probe kernels with nvcc 13.0.88, changing one detail at a time, and read them with `cuobjdump -sass`. 256 2. I read the Mesa NAK sources (MIT). No code was copied. 257 3. I accepted an encoding only after the chip ran it correctly. 258 - **Fix:** The derived tables are in `isa/`. The raw dumps are not published (`LEGAL.md`). 259 - **Reproduce:** 260 - CUDApp `docs/HOW_I_DID_IT.md:31-41` and `THIRD_PARTY.md`. 261 - Here: `gen/run.sh` and `check/check.sh`. 262 263 ### F26. Instruction size and encoder scope 264 - **Symptom:** None. These are planning facts. 265 - **Docs:** None. 266 - **Measured:** CHIP_TESTED (E2): 267 - Every instruction is 128 bits. 268 - The vector add is 32 instructions, 512 bytes. 269 - The C builder has 59 IR instruction kinds. 270 - The Omega encoder handles IR ops up to 63. Ops 60–63 include SHFL.BFLY and F2FP.BF16. It refuses programs longer than 1024 instructions. 271 - **Fix:** None needed. 272 - **Reproduce:** 273 - Here: `gen/bw_enc_sm121.om` lines 8, 17 and 471, and `isa/sm121-forms.txt`. 274 - Paper: https://doi.org/10.5281/zenodo.`23677465`. 275 276 ### F27. Reconvergence: BSSY/BSYNC 277 - **Symptom:** Divergent code hangs, or produces wrong lanes. 278 - **Docs:** None. 279 - **Measured:** CHIP_TESTED per my notes, on the T1–T4 ladder. **RECEIPT PENDING.** The rules: 280 - `BSSY.RECONVERGENT` goes right before the divergent region. 281 - Loop exits branch to the `BSYNC.RECONVERGENT`. 282 - SHFL and BAR go after the BSYNC. 283 - nvcc fully predicates short if/else diamonds. 284 - **Fix:** Follow those rules. 285 - **Reproduce:** Pending, together with the receipt. 286 287 ### F28. The tensor-core BF16 MAC model; SFU flushes subnormals 288 - **Symptom:** BF16 results differ from a naive model. 289 - **Docs:** None. 290 - **Measured:** CHIP_TESTED per my notes. I modelled the MAC bit for bit from 2,048 chip cases, chosen to separate the candidate models. **RECEIPT PENDING:** the probe receipt is not attached yet. 291 - **Fix:** Use the model in `tests/bw_hmma_model.h`. 292 - **Reproduce:** CUDApp `docs/HOW_I_DID_IT.md:37`, `tests/gpu_tc_probe_test.c` and `tests/bw_hmma_model.h`. 293 294 ### F29. FP32 transcendentals match on all 2^32 inputs 295 - **Symptom:** None. This is a parity check. 296 - **Docs:** None. 297 - **Measured:** CHIP_TESTED. Nine FP32 ops match a frozen CPU sequence with 0 mismatches. This is parity, not correct rounding. SIN and COS have a restricted domain. 298 - **Fix:** None needed. 299 - **Reproduce:** Here: `receipts/omega-mv/evidence/E1-TRANSC-GB10/`. 300 301 ### F30. The Omega encoder and the C encoder are byte-identical 302 - **Symptom:** None. This is a cross-check. 303 - **Docs:** None. 304 - **Measured:** 305 - CHIP_TESTED: the 70 kernels the chip ran. 306 - HOST_TESTED: a 243-kernel host corpus. 307 - **Fix:** None needed. 308 - **Reproduce:** 309 - Here: `receipts/cudapp/evidence/CUDAPP-OM-ENCODER/`. 310 - Here: `check/check.sh`, which rebuilds the 70 kernels from `isa/` alone. 311 312 ## 5. Limits 313 314 ### F31. The GSP firmware stays NVIDIA's 315 - **Symptom:** None. This is a limit. 316 - **Docs:** The chip checks the firmware's signature and boots nothing else. 317 - **Measured:** DOCUMENTED and observed. 318 - **Fix:** None is possible. Use NVIDIA's signed firmware; it is not included here. 319 - **Reproduce:** CUDApp `docs/HOW_I_DID_IT.md:60`. 320 321 ### F32. The GSP boot sequence and RPC table 322 - **Symptom:** None. This is research. 323 - **Docs:** Mapped from the open module source only. No device was opened. 324 - **Measured:** Source research, so it has no execution label. **RECEIPT PENDING:** the quoted volume of NVIDIA source has not been reviewed yet. 325 - **Fix:** Not applicable. 326 - **Reproduce:** CUDApp `docs/nvidia-out/GSP-RPC-TABLE.md`. Its claims are pointers to file and line, not copied source. 327 328 ### F33. My replacement for `nvidia.ko` has not run on the GB10 329 - **Symptom:** None. This is a limit. 330 - **Docs:** None. 331 - **Measured:** HOST_TESTED, emulated and simulated only. 332 - **Fix:** Not applicable. 333 - **Reproduce:** CUDApp README, the driver row. 334 335 ### F34. What other DGX Spark owners report 336 - **Symptom:** Other owners report three problems: 337 - published Docker images without sm_121a kernels; 338 - a missing environment variable that silently breaks NVFP4 MoE; 339 - hard hangs on deep-context speculative decoding. 340 - **Docs:** Third-party reports, quoted with numbered sources. 341 - **Measured:** Not by me. 342 - **Fix:** See the sources. 343 - **Reproduce:** CUDApp `docs/PAIN_POINTS.md` §2.12.