test: add block-level GPT-OSS attention test (real OAIAttention) - #1402
Open
carlushuang wants to merge 3 commits into
Open
carlushuang wants to merge 3 commits into
carlushuang wants to merge 3 commits into
Conversation
Add tests/block/test_attention_block_gptoss.py: a standalone block-level test that drives the real OAIAttention module end to end (qkv_proj -> RoPE + paged KV write -> attention with per-head sinks + alternating sliding window + GQA -> o_proj), validated against a pure-torch reference. Runs without a ModelRunner: inits TP=1, sets a minimal current atom config, instantiates OAIAttention, allocates the paged KV cache, builds the ForwardContext (attn metadata + kv_cache_data + Context) by hand, and calls forward. Covers prefill + decode, sliding-window (even) and causal (odd) layers, bf16 and fp8 KV, and both arch backends: asm (flash_attn_varlen + pa_decode_gluon, gfx942/gfx950) and triton (unified_attention, portable). --backend auto picks triton on gfx1250, else asm. Validated on gfx950 (asm + triton, bf16 + fp8).
Add a --sweep mode to the GPT-OSS attention block test: prefill (batch 1,
latency + correctness) plus a real per-step decode at each --conc (default
1,16,64,128,256,512) over a pre-filled ctx=input+output cache (latency only),
at --sweep-io input/output (default 8192/1024). Drives the real OAIAttention
module; works for both --backend {asm,triton} and bf16/fp8 KV.
This branch has not been deployed
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.
Adds
tests/block/test_attention_block_gptoss.py: a block-level test that drives the realOAIAttentionmodule end to end (qkv_proj→ RoPE + paged KV write → attention with per-head sinks + alternating sliding window + GQA →o_proj), checked against a pure-torch reference.Unlike a per-kernel op test, this exercises ATOM's actual attention module and its arch dispatch (
PagedAttentionImpl). It runs without a ModelRunner: it inits TP=1, sets a minimal current atom config, instantiatesOAIAttention, allocates the paged KV cache, builds theForwardContext(attn metadata +kv_cache_data+Context) by hand, then callsforward.Coverage: prefill + decode, sliding-window (even) and causal (odd) layers, bf16 and fp8 KV, and both arch backends via
--backend {auto,asm,triton}—asm(flash_attn_varlen+pa_decode_gluon, gfx942/gfx950) andtriton(unified_attention, portable).autoselectstritonon gfx1250, elseasm.Test
Standalone runner (not pytest; it needs the real
atom.*modules and a GPU, which the unit-test conftest stubs out):Validated on MI355X (gfx950), asm + triton backends, bf16 + fp8 KV — all prefill/decode × sliding-window/causal configs pass; black + ruff clean.