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 / REVIEW-LESSONS.md
| 1 | # Review lessons |
| 2 | |
| 3 | Before requesting review of the native AMD model path, run the launcher gate on |
| 4 | the complete release tree. Its Qwen object manifest must rebuild byte-identically |
| 5 | to the objects exercised on the card. The notebook once carried device-stepped |
| 6 | kernels that were missing from the proposed release tree; smoke tests alone did |
| 7 | not detect that gap. The enforced source-manifest check catches missing kernels, |
| 8 | changed object bytes and changed kernarg sizes before review. Update its fixture |
| 9 | only with a new corresponding hardware receipt. |
| 10 | |
| 11 | ## Packet metadata must meet an independent ABI |
| 12 | |
| 13 | AMD kernel descriptors put group then private sizes at offsets 0 and 4. HSA |
| 14 | dispatch packets put private then group at offsets 24 and 28. A test that copies |
| 15 | the launcher's offset assumptions can certify the same mistake. The launcher |
| 16 | gate now reuses the separately gated backend/amd/kfd/aql.om encoder for a byte |
| 17 | comparison with an observed published packet. Accepted nonzero-LDS ELF objects |
| 18 | exercise both generic and real plan-template paths; swapping either writer |
| 19 | must be caught. Zero-size model kernels alone cannot qualify these fields. |
| 20 | |
| 21 | ## Trace the source conversion before changing a topology formula |
| 22 | |
| 23 | ROCT topology converts sysfs array_count / simd_arrays_per_engine into |
| 24 | NumShaderBanks; queues.c divides that by NumArrays again. Both native divisions |
| 25 | are deliberate. The array-bound-dominant fixture and single-division mutant |
| 26 | exercise this mapping instead of relying only on small CU-limited fixtures. |
| 27 | |
| 28 | ## Mutation controls must reach the intended parser on every architecture |
| 29 | |
| 30 | An a64 command prefix retained the original plan path before the mutant. That |
| 31 | rejected the argument count instead of checking the malformed plan. Build the |
| 32 | executable/mode prefix separately from input paths. The malformed plan table |
| 33 | now reaches the parser on native a64 and qemu-x86_64. Do not infer a meaningful |
| 34 | negative control from an exit code alone. |
| 35 | |
| 36 | ## A measurement alarm is not an execution policy |
| 37 | |
| 38 | Plan and vadd have no automatic deadline unless the caller supplies one. Generic |
| 39 | argument-file timeout zero also means unlimited. A 10 s warning remains visible |
| 40 | during a wait, once per dispatch, without preventing a slow correct operation. |
| 41 | The gate exercises default/explicit-zero slow completion, explicit timeout |
| 42 | refusal and malformed timeout inputs; its external watchdog is unchanged. |
| 43 | Raw timing summaries are recomputed from step records before receipt acceptance. |
| 44 | |
| 45 | ## RCCA launcher round 2: independent controls and observable refusals |
| 46 | |
| 47 | The packet fix introduced an ABI reversal and its tests copied that belief. |
| 48 | Both packet writers now run through the independently gated AQL encoder with |
| 49 | private=20 and group=4096 as well as private=0. The batch publication test calls |
| 50 | plantemplate itself. Real ELF admission still refuses nonzero private segments; |
| 51 | that refusal has an explicit gate row. Do not infer scratch-memory support from |
| 52 | the synthetic ABI unit. |
| 53 | |
| 54 | The a64 plan negative table once rejected its own valid twin due to a duplicated |
| 55 | argument. Every refusal now shares the argv builder with a freshly run positive |
| 56 | twin reaching open_kfd, and asserts its specific machine-readable parser reason. |
| 57 | The row receipt retains commands, timestamps, raw logs and digests. Removing a |
| 58 | parser check must fail its reason assertion, even if a later check also exits64. |
| 59 | |
| 60 | A presence-only alarm test missed false alarms and absent re-arming. Fast native |
| 61 | generic and plan simulations now assert no alarm. Repeated slow generic dispatches |
| 62 | and three plan steps assert one alarm per dispatch. Threshold-zero and missing |
| 63 | re-arm mutations are explicitly detected. The simulated clock advances at each |
| 64 | published batch and stays monotonic across start, wait and completion reads. |
| 65 | |
| 66 | Producer-source references are vendored unmodified with their own licenses, |
| 67 | URLs and SHA256SUMS under tests/amd-kfd-launch/reference. The gate checks their |
| 68 | bytes and the cited mapping lines offline. External field derivations require |
| 69 | producer source, not an inference from field names. |
| 70 | |
| 71 | The CA6 close-out deleted each individual plan guard and found nine reachable |
| 72 | boundaries without rows. The table now covers data layout, empty names, buffer |
| 73 | size, zero/data-buffer indices, relocation buffer, grid, relocation count and |
| 74 | final dispatch end. The word-width helper guard has a separate explicit unit; |
| 75 | production plan calls use constant widths, so no fake input row claims to reach it. |
| 76 | Every malformed numeric deadline also has a fresh valid zero twin and a specific |
| 77 | reason from the existing shared unsigned parser, preserving exit2. Its six refusal |
| 78 | sites are tested, including a too-long argument that argread already refuses. |
| 79 | |
| 80 | Reference URLs, digests and raw-file ranges now have one canonical manifest, |
| 81 | reference/sources.json. The existing gate verifies each quoted range and checks |
| 82 | that SHA256SUMS and the README table are exact derived views. PROVENANCE points |
| 83 | to the manifest instead of maintaining another copy of the raw line numbers. |
| 84 | |
| 85 | The shared CLI fragment is appended after main by the original KFD seed tools. |
| 86 | New diagnostic globals broke that compiler mode, and stdout diagnostics polluted |
| 87 | binary packet output. Keep the diagnostic label local, preserve empty payload |
| 88 | stdout on refusal, and send errors to stderr through the full-write helper. |
| 89 | Before reviewing a shared CLI change, run both the pinned older KFD gate and the |
| 90 | new launcher gate. Numeric field IDs0..5 identify the six existing parser checks; |
| 91 | the plan table verifies every ID on stderr and asserts stdout stays empty. |
| 92 | |
| 93 | `make test-amd-release` is the repository's combined pre-review gate. It runs the |
| 94 | original compiler's test-amd suites before the newer launcher's gate, so a shared |
| 95 | CLI change cannot pass release readiness by testing only its newer caller. Keep |
| 96 | both pins explicit; hardware qualification remains a separate exact-binary check. |
| 97 | |
| 98 | Reference ranges are derived from unique first/last statement anchors in the |
| 99 | pinned raw files. The gate compares the generated README table with those actual |
| 100 | line positions, so merely widening a stored numeric range cannot pass. |
| 101 | |
| 102 | A defensive helper unit is still a negative-control row. Declaring its invalid |
| 103 | input unreachable from the public parser does not exempt it from a real valid |
| 104 | twin. The word-width unit once left its map handle uninitialized: invalid width9 |
| 105 | refused64, but legal width8 trapped103. Its guard-removal result therefore did |
| 106 | not establish a meaningful positive baseline. The shared word_width_unit builder |
| 107 | now initializes real mapped data for both paths; legal widths1,4,8 must read the |
| 108 | known bytes successfully before width9's specific refusal counts. The ring helper |
| 109 | has its own successful boundary table before the unrepresentable-size refusal. |
| 110 | |
| 111 | The positive-twin rule must be enforced over both launcher gate result files, |
| 112 | not inferred from labels or checked only in the plan parser. Each now declares |
| 113 | success_exits and cases, and every refusal names a fresh passing twin with a |
| 114 | verified value, matching command setup and one changed input. This also covers |
| 115 | semantic mutants that exit zero. Inventory controls reject missing twins, trap |
| 116 | exits103/104, unrelated command setups, mismatched setup hashes and wrong kinds. |
| 117 | Both files use the same object envelope; consumers read .cases. |
| 118 | |
| 119 | Search all CONTROL and non-success rows before review. That inventory exposed |
| 120 | fixtures where the valid timeout twin also failed: use the same simulated clock |
| 121 | and a deadline above one completed step, changing only the missing completion |
| 122 | fault for the refusal. Start output checks without a prior result file. The |
| 123 | argument-header pair now preserves a valid manifest except its magic, and the |
| 124 | ring helper has a separate largest-representable twin with the same single-count |
| 125 | setup. Refusal credit requires a twin from that same execution, not a compiler |
| 126 | success or an unrelated boundary table. An unexpected trap is a failed gate, |
| 127 | not a credited refusal; classify its mapping/bounds cause before a mutant claim. |
| 128 | |
| 129 | A zero private_segment_fixed_size does not prove a descriptor needs no scratch. |
| 130 | The final self-check reproduced five independently enabled scratch ABI flags |
| 131 | accepted by the older launcher. Test each request in isolation, preserving the |
| 132 | valid vadd descriptor as the same-run positive twin. The launcher's queue has no |
| 133 | scratch backing, so refuse resource2 private-enable and properties private-buffer, |
| 134 | flat-scratch-init, private-size and dynamic-stack requests before allocation. |
| 135 | Pin the producer bit definitions, not just prose field names. A runtime admission |
| 136 | change produces a new executable: prior card receipts remain historical until |
| 137 | that exact executable is qualified on the card. |
| 138 | The word-width and ring-limit composed units now use identical assertions on both |
| 139 | paths. The legal-width8/illegal-width9 sources differ only in the pw input literal; |
| 140 | the largest legal/illegal ring sources differ only in their dispatch-count literal. |
| 141 | Do not remove the value assertion from the refusing source: rejection happens |
| 142 | before it. A direct source-difference check and fresh native runs verified each |
| 143 | pair succeeds0/refuses64. |
| 144 | |
| 145 | CA12: a passing twin is necessary but a shared exit code alone cannot identify |
| 146 | the refusal site. Object guards now emit distinct stable field IDs on stderr |
| 147 | while preserving exit65 and empty payload stdout. The ELF mutation and missing |
| 148 | symbol rows assert the exact ID; manifest magic asserts its own stderr reason; |
| 149 | the ring-limit unit asserts field=ring-size. Search covered all existing exit65 |
| 150 | sites in common.om/elf.om and all check.py inspect refusals, including the new |
| 151 | scratch requests on both targets. Keep raw class exits stable and test the |
| 152 | reason too, so a later guard cannot conceal a missing earlier one. |
| 153 | |
| 154 | CA14: pinning a producer is not enough when fixture bits and production masks |
| 155 | are copied separately. The launcher gate now parses the five scratch-request |
| 156 | bits and two descriptor offsets from the pinned vendor header. It derives its |
| 157 | mutated objects and compares the production guard with those derived values. |
| 158 | A coherent edit of the header, ranges and digests must fail that relation even |
| 159 | when the pin checks themselves pass. The baseline passes with unchanged runtime |
| 160 | bytes; the earlier coherent bit-position mutant is now caught before execution. |