Repository navigation
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
bf16 full attention on the gfx1250 catch-all entry was BLOCK_M 128. 256 is faster for a few long sequences and slower when mixed chunks put many 1-token decodes in one batch, since each pads a 256-row block. Add a num_seqs (NS) lookup axis, last in the schema, and key the entry DT_bf16_bf16.NS_LEQ_8 so fp8 and NVFP4 keep the catch-all. Only the gfx1250 gluon 2D table lists NS.
c03cb7b to
a3081a9
Compare
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
There was a problem hiding this comment.
🟡 Changes recommended
The CPU test fails during import on GPU-less hosts, and stale schema caching with USE_LRU_CACHE=False can select the wrong sequence-count configuration during live tuning.
2 open issues
What changed in this PR
This PR makes gfx1250 Gluon 2D attention tuning depend on sequence count, using larger blocks for small bf16/fp16 batches while keeping existing specialized entries unchanged.
Changes:
- Adds an
NSlookup axis and selectsBLOCK_M=256for eligible batches with at most eight sequences. - Adds lookup tests for the threshold, dtype behavior, and specialized-entry precedence.
- Documents the axis and its required position in the schema.
| File | Description |
|---|---|
op_tests/triton_tests/attention/test_unified_attention_gluon_config.py |
Adds sequence-count lookup regression tests. |
aiter/ops/triton/utils/unified_attention_utils.py |
Passes sequence count into config selection and diagnostics. |
aiter/ops/triton/README.md |
Introduces the optional NS axis. |
aiter/ops/triton/configs/gfx1250/gluon/attention/unified_attention/DEFAULT.json |
Adds the small-batch bf16 tuning entry. |
aiter/ops/triton/configs/AGENTS.md |
Documents sequence-count semantics and lookup precedence. |
.github/instructions/aiter-ops-triton.instructions.md |
Adds the rule requiring NS to be the last axis. |
Review effort: Balanced
| return compute_tile_params(config, block_size) | ||
|
|
||
|
|
||
| @functools.lru_cache(maxsize=64) |
|
|
||
| import torch | ||
|
|
||
| from aiter.ops.triton.utils.types import e4m3_dtype |
Keep main's BS axis and append NS, so BLOCK_M 256 still applies only when the batch has 8 or fewer sequences.
|
Triton shard 7 on Could a maintainer re-run shard 7, or raise its step limit, or move the slow |

The gfx1250 Gluon attn_2d catch-all uses BLOCK_M 128. This change adds
DT_bf16_bf16.NS_LEQ_8with BLOCK_M 256 for eligible full-attention launches with at most eight sequence slots. Larger tiles are intended for a few long sequences; many one-token decodes waste more rows in each tile.NScounts the launch's sequence slots, including padding. It is the table's last axis, so the new row overrides onlyany. Existing decode, sliding-window, short-context and head-256-or-larger rows retain their selection. FP16 shares the BF16 tag; FP8 KV cannot match the BF16/BF16 entry. FP8 and NVFP4 selections are unchanged.Lookup and
explaininclude NS only for tables declaring it. Missingnum_seqson such a table is an explicit metadata error._uses_nsnow respectsUSE_LRU_CACHE, allowing live schema edits when tuning with caches disabled. Config and review documentation describe the new axis.This PR is independent of the unified-attention stack and merges main
ecfa616d80a17b4030feccb18da47df59dbca720.The base1130_v3 stack (MI450 gpt-oss measurements, December 1, 2026) carried an earlier version,
c30b303d7. Its config and sequence gate match this PR; the runtime difference is the schema-cache fix, with added CPU coverage. The stack's v1/v3 A/B contains the change in both arms and does not measure this PR alone. Its FP8-KV recipe cannot select this BF16/BF16 row.Earlier gpt-oss reports for D64/GQA8 gave TP1 70k +2.8%, TP1 8k +0.2%, TP2 70k c4 +2.9%, and TP2 1k c16 -2.5%. The original isolated measurement setup is unverified. Performance, including the TP2 1k c16 regression, has not been re-measured on this head.
PR Self-Review
Reviewed revision
f6d6dae17e5a71f130db4c0869ddf4e5a76d453fBehavior and intent
Use BLOCK_M 256 for eligible gfx1250 Gluon BF16/BF16 full-attention launches with NS<=8, retaining BLOCK_M 128 above that boundary and higher-priority selections. The cache fix supports live tuning; kernel arithmetic and head-size support are unchanged.
Validation and unverified scope
CPU command, with torch 2.12+ROCm 10.1 and Triton 3.8:
Seven tests pass; Black, Ruff and whitespace checks pass. These tests validate config behavior without GPU execution.
GPU setup: MI455X (gfx1250) 96-CU partition, image
rocm/sgl-dev:v1.0.0-rocm101-mi45x-20261202, torch 2.12.0+rocm10.1.0, Triton 3.9.0. Main was compared with runtime revision3397036e8f2307434fe79578995fd7b3602fb07d; the reviewed head adds only CPU-test changes and has identical runtime/config files.Public-wrapper parity against the existing test reference passes on both arms:
prefill8andmixed8(24 cases), and 128 for all 48 larger-slot cases. All 12padded9cases retain 128.The broad command
pytest -q op_tests/triton_tests/attention/test_unified_attention.py -k "gluon or bf16"aborts on both arms. Isolation identifies a shared D512/32768-block mixed case whose reference runs out of memory converting the value cache to FP32, before output comparison. The following case passes alone; running the pair without synchronization triggers an HSA memory fault and timeout. Synchronizing after each attention removes the pair's fault but leaves the reference OOM. The corresponding 2048-block controls pass. These cases use existing head-size rows outside the new tuning entry; the fault mechanism remains unverified, and the broad suite is incomplete.D192 compilation fails on both arms because
gl.arangerequires a power-of-two width. Shuffled FP16 setup is not supported by the existing BF16/FP8-only helper. Unshuffled FP16 parity is verified at D64/128; other widths/layouts and current performance remain unverified.PR-specific question
The main boundary is the actual launch slot count, including zero-length padding. CPU tests cover 8/9, dtype and head-size precedence, and tables without NS. GPU cases verify numerical parity and real wrapper selection at eight slots, nine slots including padding, and mixed sixteen-slot launches. These checks do not explain the historical mixed-chunk serving regression.
Changed op tests
test_unified_attention.py: supplies launchnum_seqsto config metadata, satisfying the new schema contract used by the production wrapper.test_unified_attention_gluon_config.py: checks selection and fallback without a GPU, scopes architecture detection during imports, and verifies live JSON edits with caches disabled and errors on missing requirednum_seqs. Output-only parity would not detect these lookup contracts.