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/68ea69d6d233558f # 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 # Separate ragged-attention planning from execution with bounded reusable workspaces Open · #21 · open 2026-10-22 17:08 UTC Imported from GitHub aien-dev/CUDApp#21, by drakestapleton drakestapleton wrote on 2026-10-22 17:08 UTC ## Problem Request lengths change during serving. Existing split decode, paged attention and reservations should be reused while assigning uneven attention work efficiently. ## Scope Add a bounded plan containing per-CTA work, split/reduction maps, stable workspace addresses and explicit shape/capacity limits. Reuse plans across compatible layers. Keep serving admission and request policy in the model-serving consumer. ## Acceptance - Plan and execute batches with heterogeneous query/KV lengths without padding all work to the longest request. - Preserve fixed workspace capacities and detect overflow/stale plan/changed page table before submission. - Reuse existing reservation/seal behavior; no hidden allocation during sealed execution. - Document deterministic assignment and reduction order, with comparisons to the current attention path. - Exercise empty requests, maximum limits, changed lengths, reused pages and plan-generation mutants. - Benchmark CPU planning, plan upload, GPU execution and end-to-end latency separately; establish when cross-layer reuse amortizes planning. Research: FlashInfer (https://doi.org/10.48550/arXiv.2501.01005 ), especially plan/run separation and deterministic ragged scheduling. Reimplement transferable mechanisms in the native stack; no CUDA JIT dependency in deployment. ## Evidence and closure Review baseline: `232332422bfdc31c8918085b50f13c1e18ab702e`; re-inspect the current tree and reuse existing work before editing. Coordinate with #5 and #6 and the serving/chip-window owner; host work can proceed independently of hardware scheduling. This issue does not authorize interrupting the live motor or switching kernel drivers. Publish exact source/pin SHAs, build and binary hashes, commands, exit codes, hardware/driver identity, raw logs and relevant negative controls under evidence/. Separate host, simulator and GB10 results. Hardware acceptance needs a real coordinated GB10 run on the final integrated artifact. Keep CUDA userspace dependencies out of the deployed runtime. Do not close on a branch push, simulator-only hardware result or PR merge alone. Experimental issues may close with a reproducible negative result and explicit decision; do not claim an optimization shipped unless its integration gates pass. drakestapleton wrote on 2026-10-24 17:49 UTC ### Keep paged split reduction with its producer — source audit, 2026-10-24 At `22e9d9bad9b9238996b05b68dfd73e4036ed354f`, generic paged attention returns all GPU split states to a host allocation and folds them on the CPU, including when KV is already resident: partial allocation/resident path L1268–1319 , staged path L1368–1377 . Native launch performs a literal `memcpy` of every partial into `L->out` (L914–949 ); combine_splits L1213–1229 computes max-rescaled weights and the normalized result. This is the generic paged path, not a claim that specialized 30B graph decode performs this host round-trip. Let R be sequence-query-head rows, S the splits, and D head dimension. Partial payload is `P=4RS(D+2)` bytes; final attention payload is `O=4RD`. A device merge with the same host-output API replaces a P-byte copy with an O-byte copy: explicit logical memcpy read+write reduction is `2(P-O)`, while ownership-crossing payload falls by factor `S(D+2)/D`. Example R=32,S=16,D=128: P=266,240 B, O=16,384 B, copied read+write delta=499,712 B, an ideal nominal 273 GB/s service term of 1.830 microseconds. A device-output consumer can avoid the final host copy too. This does not eliminate GPU partial stores/reloads automatically; those remain until a separately proved residency/fusion change. Do not label requested sync lengths as copies: platform sync L290–313 is range validation plus an ordering barrier on uncached memory. Fold the bounded merge map/workspace into #21's existing plan/run contract and #20's stable-state semantics. Reuse specialized decode's device partial/counter design as evidence, not as a drop-in for all shapes: record API L191–249 . Its last-CTA protocol already exists. First use a separately ordered native merge kernel; do not introduce inter-CTA spinning or claim universal progress from the specialized implementation. Acceptance: retain original CPU fold as an independently implemented oracle/comparison algorithm; define numerical differences from host_exp2 polynomial versus GPU transcendental before testing. Cover S=1, empty/all-empty slices, ragged contexts, masks, GQA mapping, extreme logits, stale/reused pages, exact plan bounds, and alias/lifetime failures. Missing rescale/LSE, wrong split map, premature scratch reuse and removed-ordering mutants must fail. Verify no hidden allocation under sealed execution, no host partial-copy on the intended path, and final output consumed at its declared location. Compare full generic model/prefill/attention consumer latency, launch count, host time and all copies, with ordinary path and specialized graph reported separately. The lower-bound reference includes unavoidable KV bytes `2*T*Hkv*D*element_bytes` for a full uncached dense scan, plus actual repeated head-group reads and partial traffic; do not confuse copying fewer partials with eliminating KV reads. New merge alone may lose at S=1 or tiny shapes, so freeze measured selection rules. Final active implementation remains seeded .om and within existing #5/#16/#17/#19/#21 owners. Status: read-only source evidence; native merge and model gain NOT_RUN. Sign in to comment