interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / REVIEW-LESSONS.md

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