CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / evidence / FLASH-NEXT-CONTROL-FIX-20261118 / README.md
| 1 | # Why the flipped-bit control of rowrans missed 104 matrices, and a control that does not |
| 2 | |
| 3 | Date 2026-11-18. Base commit `559e3a448c8489cf62b8484e9ed230abcbbb89a7`. Machine: DGX Spark host CPU (aarch64), |
| 4 | gcc 13.3.0, `nice -n 19`, `taskset -c 10` / `-c 12` under `omega-pool-10` / `omega-pool-12` locks. No GPU opened. |
| 5 | Chip status: NOT_RUN. The historical tool and run (`../FLASH-NEXT-WEIGHT-WASTE-20261118/`, the fullcover JSONL) are |
| 6 | not changed. |
| 7 | |
| 8 | Checkpoint: local `Qwen3.8-Flash-Next-FP8` revision `7fb48d708ca6cd8eeed8f4db0433be18af96984f`. Tensors are read by |
| 9 | byte range into one file in `/dev/shm` and removed; no weights are committed. Each result row carries the tensor's |
| 10 | SHA-256. |
| 11 | |
| 12 | ## The defect |
| 13 | |
| 14 | `rowrans.c` (SHA-256 `777d3612...`, built binary `7623006d...`, same as the fullcover binary) flips bit `0x10` of |
| 15 | stream byte `w/2` and calls the flip detected only if the decoded bytes differ. Its decoder never checks the rANS end |
| 16 | conditions. A flip in the last byte or two of a row changes the low bits of the state after the last symbol that |
| 17 | depends on them, so every decoded byte is still right and only the final state is wrong. The old control reports that |
| 18 | as a miss although the stream is corrupt and is detectable. |
| 19 | |
| 20 | The fullcover run (131 shards, 75264 expert matrices, concatenated JSONL SHA-256 |
| 21 | `aa396fb8d38449e0ccf444e28a7ba37482d9c87628e685073dbad34a2c5db66b`) had `flip_detected 0` in 104 matrices and |
| 22 | `roundtrip 0` in none. |
| 23 | |
| 24 | ## The repaired measurement |
| 25 | |
| 26 | `rowrans_strict.c` (SHA-256 `6333e925929fe7722574dd51127ac8cb78d0b2a5ad5e9cbaf0fae23ce271c8cb`) keeps the encoder |
| 27 | byte for byte (same coded size on every matrix below) and decodes each row with the same arithmetic, recording: |
| 28 | decoded bytes changed; first state outside `[2^23, 2^31)` (`init_bad`); a renormalisation byte wanted after the row's |
| 29 | end (`starved`); unread bytes at the end (`leftover`); final state not `2^23` (`term_bad`). Class: |
| 30 | |
| 31 | - `decoded_bytes_changed`: some decoded byte differs. |
| 32 | - `decoded_equal_end_state_invalid`: bytes equal, an end condition fails (noncanonical terminal state or stream length). |
| 33 | - `equivalent_encoding`: bytes equal and every end condition holds on a stream that differs from the encoder's. |
| 34 | |
| 35 | Why `equivalent_encoding` should be empty: with the first state in `[2^23, 2^31)`, each decode step and each byte read |
| 36 | is the exact inverse of an encoder step, so a stream that decodes to the input, reads every byte and ends in state |
| 37 | `2^23` is the encoder's own stream. The runs below check this; they do not replace a proof. |
| 38 | |
| 39 | ``` |
| 40 | gcc -O2 -Wall -Wextra -Werror -o rowrans_strict rowrans_strict.c |
| 41 | gcc -O2 -Wall -Wextra -Werror -o rowrans_hist ../FLASH-NEXT-WEIGHT-WASTE-20261118/rowrans.c # sha256 7623006d... |
| 42 | ``` |
| 43 | |
| 44 | ## Results |
| 45 | |
| 46 | 1. `failed-control.raw` (layer 0, expert 335, `up_proj`, 640 x 2560, SHA-256 `27a23135...`; |
| 47 | `failed-control-and-mutant.log`): historical binary prints `1638400 1349463 1` with and without `flip`. Strict: |
| 48 | flip at stream byte 673195 = byte 2100 of row 319, whose stream is 2101 bytes (the last byte). Decoded bytes equal, |
| 49 | `term_bad=1`, final state 8388624 = 2^23 + 16 (the flipped bit), class `decoded_equal_end_state_invalid`, |
| 50 | `strict_detected=1`. Clean stream: `strict_ok=1`. |
| 51 | |
| 52 | 2. All 104 historical misses plus 104 clean controls (`exercise.py`, `results-midpoint.jsonl` SHA-256 |
| 53 | `e3a2286591fab9d610d74eaf80ab75ec4d6e5e9520d66ce09618ad8274a01a31`, `summary.log`, 21.5 s): |
| 54 | ``` |
| 55 | python3 -I exercise.py FULLCOVER_OUT MODEL_DIR rowrans_hist rowrans_strict results-midpoint.jsonl |
| 56 | python3 -I summarize.py results-midpoint.jsonl # exit 0 |
| 57 | ``` |
| 58 | - Historical verdict reproduced on all 208 (coded size, round trip, flip verdict); `inconsistencies 0`. |
| 59 | - Misses: 104 of 104 `decoded_equal_end_state_invalid`, all `term_bad`, 35 also `starved`, none `init_bad` or |
| 60 | `leftover`. Flip position: 103 in the last byte of a row, 1 in the second to last. |
| 61 | - Controls (next matrix in the same shard with a detected historical flip): 104 of 104 `decoded_bytes_changed`. |
| 62 | - Every clean stream (208) passes the strict check: no false alarm. Every flip (208) is strictly detected. |
| 63 | - `equivalent_encoding`: 0. |
| 64 | |
| 65 | 3. Every single-bit flip of every stream byte, two matrices (`rowrans_strict ... all`): |
| 66 | |
| 67 | | Matrix | flips | missed by old check | missed by strict check | equivalent encoding | old misses by bytes from row end (1,2,3,4,5) | |
| 68 | |---|---|---|---|---|---| |
| 69 | | L0 e335 up 640x2560 (`exhaustive-layer0-e335-up.out`, 2:49.82) | 10771128 | 5414 | 0 | 0 | 4408, 876, 119, 11, 0 | |
| 70 | | L0 e484 down 2560x640 (`exhaustive-layer0-e484-down.out`, 46.17 s, tensor `2dcf037c...`) | 10889728 | 21601 | 0 | 0 | 17720, 3481, 375, 24, 1 | |
| 71 | |
| 72 | Every old miss is `term_bad`; none is `init_bad` or `leftover`. Rates (`rates.log`, Python `Fraction`): |
| 73 | 5414/10771128 = 0.000503, 21601/10889728 = 0.00198; midpoint misses 104/75264 = 0.00138. |
| 74 | |
| 75 | 4. Mutation (`failed-control-and-mutant.log`): replacing `q.term_bad = x != RL;` with `q.term_bad = 0;` makes the |
| 76 | strict tool report the failed control as `strict_detected=0 class=equivalent_encoding`. The terminal-state check is |
| 77 | what catches these flips. |
| 78 | |
| 79 | ## What this does and does not show |
| 80 | |
| 81 | - The 104 misses were a defect of the control, not silent changes to decoded weights: in all 104 the decoded bytes |
| 82 | equal the original, and the end-state check flags the corruption. |
| 83 | - Covered: single-bit flips in the row streams. Not covered here: flips in the frequency table or row offsets, |
| 84 | truncation, multi-bit errors. A strict end-state check makes a single-bit stream error detectable; it is not an |
| 85 | integrity guarantee against arbitrary corruption. A checksum per row or per matrix is still needed for that. |
| 86 | - Host instrument only. No runtime decoder exists; chip status NOT_RUN. |