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/CUDApp/issues/4b16ac8cbf303692 # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers # [CUDA-LEARN P1] Qualify shape-aware kernel selection against complete native model workloads Open · #57 · open 2026-10-23 19:43 UTC Imported from GitHub aien-dev/CUDApp#57, by drakestapleton drakestapleton wrote on 2026-10-23 19:43 UTC Parent: #52. Research snapshot: 2026-10-23. ## Problem and code seam A faster isolated kernel can slow a model through layout conversion, workspace, dispatch or synchronization costs. CUDA++ already records entire decode paths through `src/omega_gpu_decode_graph.*` and `src/omega_gpu_cmdlist.*`. Its current native benchmark branch collects graph observations and marks unknown counters explicitly. #17 remains the benchmark owner; #5 remains canonical consumer integration; #35 remains realization identity. This issue adds bounded selection/admission of validated alternative kernels through those existing paths, with no new serving runtime. ## Dependencies Require #53, #16, #17 and independently validated candidates from #22 or #54. Reuse #24 buffer ownership, #19 dependency records and existing specialized kernels. Do not manufacture new fusion work already owned by #18/#20/#21/#23 or bypass the separate representation/quality decisions in #48/#49/#50/#51. ## Work - Define candidate applicability keys: semantic contract, dtype/layout, shape/tails, alignment, alias rights, hardware profile, resource budget, compiler/kernel identity and numerical mode. Keys must reflect actual dispatch determinants, not only tensor dimensions. - Choose among qualified candidates with a deterministic bounded rule. Unknown domains select a qualified .om baseline or explicitly refuse. Do not run optimization searches inside a production request. - Bind the selected kernel, launch profile and required transformations to a receipt. Account for conversion, packing, upload, cache invalidation, workspace, barriers and setup, including costs paid outside the timed kernel. - Freeze representative supported workloads, aggregation weights, regression limits, correctness thresholds and minimum benefit before final evaluation. Compare paired runs of complete prefill/decode/request paths and any relevant training consumer. - Report every workload and every task, including fallback/no-gain cases. Include p50/p95 latency, throughput where meaningful, memory, launches and full lifecycle cost. A large win on one workload cannot hide violation of a declared limit on another. - Keep candidate registration, qualification, selection and production activation distinct. Existing independent review and release coordinator own activation. A malformed/stale receipt must never switch the consumer. - Test invalidation after compiler, target, numerical contract or buffer-lifetime changes. Cached selection may be reused only when its entire applicability identity remains valid. ## Acceptance - At least one candidate is exercised through the actual native consuming graph, with the chosen path proven by artifact identity. - Boundary shapes, odd tails, alias mismatches, low-memory admission and stale profile cases select/refuse correctly. - Deliberately faster-but-wrong and microbenchmark-fast-but-model-slower candidates fail the relevant admission gate. - Paired full-workload results meet predeclared constraints; measured overhead and unfavorable results remain visible. - A candidate that fails qualification cannot change the selected default. - Replacing an incumbent invalidates dependent evidence correctly; rollback is to a qualified .om artifact with preserved provenance. - No hardware or model-level PASS is inferred from a host formatter fixture. ## Research interpretation KernelOPT motivates optimizing within an existing compiler/runtime structure and rechecking the assembled model. Its paper's gamma=1.03 is a tolerated slowdown bound, not a 3% speedup requirement, and must not become CUDA++ policy automatically. Its reported device is H200, with tolerance-based checks and substantial search cost. Use its structural lesson, not its CUDA/Triton stack or numerical tolerances. AReaL-TIK motivates aggregate improvement subject to individual workload limits. ## Delivery contract Final first-party implementation, tests, build and automation for this work must be seeded `.om`, following aien-dev/omega-mv#599. Existing C, Rust, Python, JavaScript and `.osc` implementations are migration inputs and comparison evidence, not permanent wrappers or fallbacks. Qualify each .om replacement, cut its consumers over, remove the replaced active implementation and dependency, and retain immutable history/receipts. A qualified baseline can remain an algorithm choice implemented in .om. Missing seed-language, host-service or compiler features go to their existing owners; do not invent a second compiler/runtime. Reuse #5's canonical backend, #10's independent decoding, #15/#16/#17's test/numerical/measurement work, and existing memory/session/driver boundaries. Reconcile current main and active branches before coding. No NVIDIA userspace dependency in the final execution path. This finite research workstream does not supersede release priorities or authorize live-service replacement. Publish exact source/compiler/runtime/model/target/config identities, candidate code and launch digests, commands, raw outcomes and expected-failure controls. Distinguish host, simulator, compiled native host, GB10 and integrated-consumer evidence. Missing hardware is NOT_RUN. Use existing reservations/quietlock and bounded memory; leave active GPU jobs alone. Closing requires the issue's stated gates on the final artifact plus independent review, or an explicit reproducible NO-GO for an experiment. Never close solely on generated code, a branch push, or a merged PR. ## 2026-10-28 dual-pipeline specialization (extends this existing selector) New issue dependencies: #156 quant descriptor/physical layout; #157 verified composable kernels; #158 content-keyed cache and prewarm; #159 indexed MoE work. Keep selector owner here: do not create another dispatch implementation. Add a deterministic, prequalified dispatch among: - small M: current direct GEMV/warp-level register-fed MMA or verified overlapped-load realization, minimize packing/setup and register pressure; - large M: tiled/packed GEMM with staged loads/reuse and verified warp-level MMA; use TMA only if supported by the exact device target and independently CHIP_EXERCISED. - Baseline fallback for unsupported tails/layouts/scale modes/resources. SM121 `sm_121a` warp-level block-scaled FP4 is a possible separately gated experiment; SM100 `tcgen05`/TMEM assumptions must not be projected onto GB10. No assumed TMA availability. Policy keys include M/N/K, batch/token routing, dtype/quant scale/zero-point layout, memory residency, workspace budget, pack amortization, stages, warps, tile, alignment/tails, numerical mode, machine feature profile, encoder identity and validated artifact hash. A fixed M cutoff is only a candidate, not the final selector. Source evidence: merged Tilelab PR #154 observed both wins and losses by shape. Existing #54 supplies qualified candidates, not a new tuner in the live request. Additional acceptance: - Predeclare representative M=1/small decode, mixed batch and large prefill/GEMM shape families using real Q36 contracts. Measure preprocessing, repack, compile, upload, dispatch, barriers and execution; warm and cold. - At least one small-M and one large-M approved realization have independent tensor/logit tests and native GB10 source-to-code receipts; unsupported TMA/tcgen05 variants refuse. - Schedule/solver selects identical candidate on replay for same contract and profile; wrong-feature, false cache hit, stale code, resource-limit, packing-cost and faster-microbenchmark/slower-model mutants are rejected. - Default changes only after paired full-model performance/correctness under #17 ; report inconclusive and regressions; fallback remains qualified. did:key:`z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd` wrote on 2026-11-18 17:09 UTC Recovered GitHub comment by @aien-spark on 2026-10-28T12:11:10Z. Original comment `6468631169` Draft #163 clarification: signed docs commit `76d3358` (head `5789a43` includes generated crumb refresh) defines selector row16 as actual charged resident allocation bytes, including existing allocator padding—not raw instruction length. KernelCache and NativeIntegrate agree to retain strict cache request-size equality. Actual code length remains independently bound by kc_validate sizes1/codeSHA. Native .om source hashes and exercised source commit `cee9a54` are unchanged; no test rerun or new qualification claim for this documentation-only correction. did:key:`z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd` wrote on 2026-11-18 17:13 UTC Recovered GitHub comment by @aien-spark on 2026-10-28T12:03:51Z. Original comment `6468486472` Native host-policy work is in draft #163, signed source `cee9a54d16ebe981a879d06bad6c988fc2417bc7` (baseline `b759afc3f5e46f152ffb06b39882ffa28cacaf96`), related to #26. This does NOT close #57. IMPLEMENTED / EXERCISED_HOST_ONLY: bounded deterministic direct/warp/staged-family policy over trusted validated records, complete packing/upload/preparation/dispatch/synchronization/execution costs, exact qualification/applicability/resource/pin identities, stable replay/ties, canonical Quant/Composer binding and cache-generation/revision/recorded-list pin. No M threshold or SM121 TMA/tcgen05 inference. Existing production graph/incumbent unchanged; PR139's failed small-cell performance evidence retained. Pinned compiler SHA256 `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`; final native policy, cache-caller and graph-caller all compiled/executed exit0. Five successfully compiled guard mutants were caught with nonzero exits3/6/1/10/9. Synthetic policy controls, not measured timings. Independent Wolfram query/result and exact source/binary receipts: `tests/pipeline/host-evidence.json`, append-only `pin-invalidation-evidence.json`, final-source `final-source-evidence.json`. Exact dependencies: Quant `fe25929ce71b11703eafa72395df2dd495aa61f2`, Composer `2e93f998b70852abcd425f8865d842a05dad76ea`, Cache `693464cfcff678a9278fe4586f8a24b07ce45fb2` (content pins in dependencies.lock). NOT_RUN / unsupported: canonical staged-family3 composition (current pinned Composer refuses it), exact selected code+launch binding into actual rec_fp8/rec_gemm/prefill recording, GB10 physical correctness, complete model numerical/quality/performance against filed baseline, activation. Main/NativeIntegrate own graph resolver/shared registration and exact selected-artifact recording. Native `consume.om` supplies actual admission caller, not fabricated device-launch evidence. Predeclared workload/lifecycle cells are in docs/pipeline/CONTRACT.md. No performance win, GPU/model/service operation, merge or deployment claimed. did:key:`z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd` wrote on 2026-11-18 17:13 UTC Recovered GitHub comment by @aien-spark on 2026-10-28T13:25:56Z. Original comment `6470204206` Draft #163 adds signed pure Omega context lookup `1c5368a06dd6c9813ba9a16f29eacdb77dcda198` for the shared graph owner: native_context(keys128,count,actual4)->long. Exact operation/layer/window-start/window-rows tuple returns unique1-based context, absent0, invalidcount or duplicate-match -1; no new artifact schema or qualification authority. Pinned Omega MCP compile/run exits0; successfully compiled ignored-window-row and ignored-duplicate guards are caught with exits7/8. Exact source/tool receipts are tests/pipeline/context-evidence.json. Registration/bridge/callers remain NativeIntegrate-owned. Production context count0/refusal remains until accepted receipt-authority construction exists; joint MoE semantics and physical/full-model acceptance remain NOT_RUN. did:key:`z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd` wrote on 2026-11-18 17:13 UTC Recovered GitHub comment by @aien-spark on 2026-10-28T14:59:10Z. Original comment `6472454413` PR #163 signed source `e2fafb11f8e843a9d6cdbe8f0886beaec7445310` corrects private native_context to full32 tuples in unchanged keys128/stride4. Pinned compiler `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f` via Omega MCP run: focused all32 ordinal and count33/max refusal/finalduplicate/absence control exit0. Four compiled guard mutants caught: oldcap16 exit4, ignoredwindowrows exit7, ignoredduplicate exit8, missingcountguard bounds trap3/exit103. Exact source/test/compiler/binary results in tests/pipeline/context32-evidence.json; original16-context receipt untouched. NativeIntegrate owns bridge/current-dependency import and actual caller verification; Q36Graph owns arena/release bound32. No GPU/full-model qualification or activation; #57 remains open. Merge remains under current Main hold. Sign in to comment