Repository navigation
attention: general fallback kernel (head_dim 1..256, any GQA/MQA, causal/non-causal, window, any length); runtime API 0.6.0 - #145
Merged
Conversation
… causal/non-causal, sliding window, any length); runtime API 0.6.0 Adds omega_gpu_attention_general (EXPERIMENTAL) and routes shapes the tuned hd64/hd128 power-of-two-GQA kernels refused onto it. Tuned kernels unchanged. Seeded 318-config sweep vs f64 host oracle, refusals, 5 general mutants, routing proof. C because device kernels stay on the encoder until Track C1; .om successor: GpuStack PLAN C1 attention lowering.
…eep, A/B), README and portability row
fopen "w" creates the receipt 0666 & ~umask; open(O_CREAT,0600)+fdopen clears the new high alert at tests/gpu_attention_test.c:1386. Host EXERCISED: gpu_attention_test --general --sim --out under umask 0: PASS 348 checks, 0 failed; receipt mode 600, 318 configs; an unwritable --out path returns rc 2 "cannot open".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft. Review pending; do not add ready-to-merge.
Drake asked whether the CUDA++ attention library only takes the model shapes Aien runs. It did. This PR adds a general fallback kernel. The tuned kernels stay as the fast path, byte for byte.
Domain before and after (
src/omega_gpu_attention_api.{c,h})2·kv·nkv·hd·elem ≤ 0xffffffffomega_gpu_attention_general: causal or non-causal, left/right sliding window, q_pos0 offset, empty range writes zerosThe existing entries (
gqa_attention_f32,gqa_attention_rows_f32,paged_attention_bf16,_batch_bf16,reserve,reserve_rows) keep the tuned kernel for shapes it took before. Shapes it refused now run on the general kernel. The new entryomega_gpu_attention_general(EXPERIMENTAL) exposes the full domain.Unchanged and still model-shaped:
omega_gpu_decode_attn(hd 128, 32/4),decode_attn256(the live 35B),prefill_attnandprefill_attn256. This PR does not touch them.Evidence (labels: EXERCISED on the host, chip-EXERCISED on GB10; nothing here is qualified)
Receipts are in
evidence/ATTN-GENERAL-20261027-4d51f91f/(SUMMARY.md).rel·|want| + 2e-5, with rel 2e-4 (kv ≤ 2048) or 4e-4 (above).N[4096*2^-24]-> 2.44e-4N[5000*2^-24]-> 2.98e-4--host-only):make testreportsCUDA++ HOST TESTS PASS (46 targets).make test-gpu-attentionnow also runs--general --sim.Served shapes: no slower
omega_gpu_attention_codegen_hd, hd 64/128 × f32/bf16 × log2bs 0..8 × log2gqa 0..6). The hd 64 digest pins in the test still pass.Median[b]/Median[a]-> 0.9990, MannWhitneyTest p 0.960. Within the band.Why C, and the .om successor
The kernels are emitted through the existing Blackwell IR builder inside the existing C file
src/omega_gpu_attention_api.c. Device kernels stay on the encoder until GpuStack PLAN Track C1 (Rules lines 43-73), and this PR adds no new C file.OMEGA_GPU_ATTENTION_GENERAL_V1.API
Runtime API 0.5.0 → 0.6.0 (MINOR, per API.md semver item 4):
OmegaGpuAttnGeneralDesc(64 B);omega_gpu_attention_general(EXPERIMENTAL);GENERAL_MAX_HEAD_DIM,GENERAL_MAX_Q_HEADSandWINDOW_NONE;make test-runtime-apipasses: 0.6.0, 192 INTERNAL.#139 (GEMM) also bumps to 0.6.0. Whichever merges second takes 0.7.0, and it also rebases the README §10 line.
Not run: