Skip to content

[Triton/Gluon] unified_attention: public gfx950 Gluon gate predicate - #7958

Merged
vgokhale merged 4 commits into
ROCm:mainfrom
rbrugaro-amd:rbrugaro/ua-gluon-gate-predicate
Nov 20, 2026
Merged

vgokhale merged 4 commits into
ROCm:mainfrom
rbrugaro-amd:rbrugaro/ua-gluon-gate-predicate

Conversation

@rbrugaro-amd

@rbrugaro-amd rbrugaro-amd commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Expose the gfx950 Gluon gate of unified_attention as a public gfx950_gluon_supported(...) that takes only the arguments the gate reads. The private _gfx950_gluon_supported(params) delegates to it; no caller changes.

Motivation

_gfx950_gluon_supported(params) takes the private _UAParams NamedTuple (40 fields). A caller that needs the gate's answer before calling unified_attention has to build a whole _UAParams by hand. ATOM does this for its Kimi-K3 DSpark GQA draft, which casts q to the KV pool's dtype only where the gfx950 Gluon kernel serves the read. The gate reads 10 of those fields, but every new required field breaks such a caller at startup: #7100 (spec_decode) and #7421 (v_cache_dtype) each did (ROCm/ATOM#3333).

Changes

  • New public gfx950_gluon_supported(*, q_dtype, kv_cache_dtype, head_size, block_size, head_size_v=None, shuffled_kv_cache=False, k_width=None, softcap=0.0, use_alibi_slopes=False, use_qq_bias=False). head_size_v defaults to head_size; k_width, the shuffled K cache's trailing dimension, is required with shuffled_kv_cache.
  • _gfx950_gluon_supported(params) delegates to it, so the gate has one definition. No caller changes: the private function keeps its name, its _UAParams argument and its result; only its body moved (the diff shows it as removed and re-added). Its three call sites in unified_attention.py are untouched.

Testing

  • Unit tests added or updated (none: review asked to drop them; the existing suite covers the gate through unified_attention)
  • Performance benchmarks run (no kernel or routing change)
  • Tested on MI250X
  • Tested on MI300X (see "Validation and unverified scope")

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed: the new function is documented by its docstring; no guide covers the gate

Dependencies

  • No new third-party dependencies added

Breaking Changes

None.

PR Self-Review

Reviewed revision

faffc4e

Behavior and intent

No runtime behavior changes: unified_attention routes exactly as before, through _gfx950_gluon_supported, whose body is now the public function. The addition is a public predicate with the gate's real inputs, so callers outside aiter stop depending on _UAParams' field list, which changes with features that do not touch the gate.

Validation and unverified scope

On MI355X (gfx950), rocm/atom-dev:nightly_202611131540 with this change applied to its aiter:

  • python3 -m pytest -q op_tests/triton_tests/attention/test_unified_attention.py: 2,734 passed, 0 failed (2,963 skipped: other architectures' cases). Every one of these reaches the gate through _gfx950_gluon_supported, which now delegates to the public function.

That run was at 2fdc6ebd86; the code since then changed only in the function's docstring. Unverified: MI300X and gfx1250, where the gate is False before and after (DEVICE_ARCH == "gfx950").

PR-specific question

What is the most important boundary or failure mode introduced, and what evidence covers it? The risk is the public predicate answering differently from the gate unified_attention applies. It cannot: the private gate is now a one-call delegate to it, so there is one definition, and the existing unified-attention tests pass through that delegate. The only new failure path is the ValueError when shuffled_kv_cache=True is given without k_width, which no internal caller can hit (_UAParams always carries k_width).

Changed op tests

None.

…950_gluon_supported

`_gfx950_gluon_supported` takes the private `_UAParams`, so a caller that
decides something from the gate up front (ATOM's Kimi-K3 DSpark draft picks
its q dtype by it) has to build all of `_UAParams` by hand, and every new
required field breaks it (ROCm#7100, ROCm#7421). `gfx950_gluon_supported` takes only
what the gate reads; `_gfx950_gluon_supported` delegates to it, so the gate
keeps one definition and unified_attention's behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@rbrugaro-amd
rbrugaro-amd requested a review from a team November 14, 2026 05:02
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 7958 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@aiter-bot

aiter-bot commented Nov 14, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 17820e61f06a · mode shadow

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

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. What is the most important boundary or failure mode introduced by this change, and what evidence covers it?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The docstring at unified_attention.py:241 exceeds Triton’s one- or two-sentence rule and needs a shorter summary with concise argument entries.

1 open issue
What changed in this PR

Exposes the gfx950 Gluon support gate as a public predicate so external callers can check compatibility without constructing the private _UAParams tuple.

Changes:

  • Adds gfx950_gluon_supported(...) with explicit gate inputs and documented defaults.
  • Keeps the private helper as a delegate, preserving existing callers and gate logic.
  • Adds tests for public/private agreement, dtype acceptance, and missing shuffled-cache width.
File Description
op_tests/​triton_tests/​attention/​test_unified_attention.py Adds standalone predicate and compatibility tests.
aiter/​ops/​triton/​attention/​unified_attention.py Exposes the public predicate and delegates the private helper to it.

Review effort: Balanced

…docstring

A one-line summary, one entry per argument and the return value, as the
Triton ops guidelines ask for a public function.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@cagrikymk cagrikymk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you take a look at my comments about the added tests?

I would much rather to not test these behaviors. It doesnt add much value besides maintenance burden.

Besides that, revealing public API sounds good to me!

Review: the private gate delegates to the public function, so a test that
compares the two cannot fail, and the rest tests plumbing.

Co-Authored-By: Claude Code <[email protected]>

@cagrikymk cagrikymk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vgokhale
vgokhale merged commit 8b7edc6 into ROCm:main Nov 20, 2026
94 of 118 checks passed
rbrugaro-amd added a commit to rbrugaro-amd/ATOM that referenced this pull request Nov 20, 2026
…ad's q cast

ROCm/aiter#7958 exposes the gfx950 Gluon gate as a public predicate that
takes only what the gate reads. Use it instead of building aiter's private
_UAParams by hand: gluon_takes_pool_dtype_q and _UNFIXED_FIELDS are gone, and
a new _UAParams field can no longer break the Kimi-K3 DSpark GQA draft.
DSparkGQABlockAttention drops num_heads and block_rows, which only fed the
private tuple.

Co-Authored-By: Claude Code <[email protected]>
rbrugaro-amd added a commit to rbrugaro-amd/aiter that referenced this pull request Nov 23, 2026
…dicate

A caller on a shared code path should not name an architecture. Add
unified_attention_gluon_supported, which takes the gate's arguments and
dispatches on the device inside: gfx950 asks gfx950_gluon_supported (ROCm#7958);
other architectures answer False until their kernels are checked here.
Follows gather_kv_b_proj_flydsl_supported.

Co-Authored-By: Claude Code <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants