Skip to content

[Triton/Gluon] Move the sage-attention launch params into the config tree - #5106

Open
Boss2002n wants to merge 3 commits into
mainfrom
satya/triton-sage-config-to-json
Open

[Triton/Gluon] Move the sage-attention launch params into the config tree#5106
Boss2002n wants to merge 3 commits into
mainfrom
satya/triton-sage-config-to-json

Conversation

@Boss2002n

Copy link
Copy Markdown
Contributor

No description provided.

@Boss2002n
Boss2002n requested review from a team and a lite review from Copilot August 29, 2026 04:44
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
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; main branch always runs both MI35X and MI300X
multigpu 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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 5106 --add-label <label>

PR title tags:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf] and op tags like [MLA] are left untouched. Add the no-auto-title label to opt this PR out of title tagging.

@github-actions github-actions Bot changed the title [Triton] Move the sage-attention launch params into the config tree [Triton/Gluon] Move the sage-attention launch params into the config tree Aug 29, 2026

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.

Pull request overview

Moves Sage-attention (fav3_sage) forward launch parameters out of Python and into the nested Triton config tree, so launch tuning is data-driven and consistent with the rest of the config-loading machinery.

Changes:

  • Add nested-layout DEFAULT.json config tables for fav3_sage on gfx942 and gfx950, and for fav3_sage_mxfp4 on gfx950.
  • Update fav3_sage to load per-arch configs via resolve_config_dir()/load_config_json(), with a deterministic gfx942 fallback when the running arch has no table.
  • Update the MXFP4 wrapper to load its forward launch config from the config tree (gfx950-only).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
aiter/ops/triton/configs/gfx950/triton/attention/fav3_sage/DEFAULT.json Adds gfx950 default + optional fwd_a3_tuned preset for fav3_sage forward launch params.
aiter/ops/triton/configs/gfx950/triton/attention/fav3_sage_mxfp4/DEFAULT.json Adds gfx950 default forward launch params for the MXFP4 variant.
aiter/ops/triton/configs/gfx942/triton/attention/fav3_sage/DEFAULT.json Adds gfx942 default + optional fwd_a3_tuned preset for fav3_sage forward launch params.
aiter/ops/triton/attention/fav3_sage.py Replaces hardcoded arch-specific dicts with config-tree loading + gfx942 fallback.
aiter/ops/triton/attention/fav3_sage_attention_mxfp4_wrapper.py Replaces hardcoded launch dict with config-tree loading for gfx950.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@zufayu
zufayu requested review from a team and Dewei-Wang-sh August 31, 2026 01:17
"Tuning values live in JSON, never in Python" -- two sage config selectors
still returned hardcoded dicts:

  attention/fav3_sage.py                         three arch branches, one dict each
  attention/fav3_sage_attention_mxfp4_wrapper.py one dict behind an arch guard

Both now read <arch>/triton/attention/{fav3_sage,fav3_sage_mxfp4}/DEFAULT.json
through resolve_config_dir() + load_config_json(). The a3_tuned preset moves
into the JSON as a `fwd_a3_tuned` overlay on `fwd`; the `if a3_tuned:` branch
and the mxfp4 wrapper's non-gfx950 guard are control flow and stay in Python.

The JSON carries exactly the numbers the Python returned. Verified by
extracting both versions of the function and comparing their output for every
architecture across the full block_m x block_n x a3_tuned matrix -- equal in
value, key order and value type (PRE_LOAD_V stays a bool, not 0).

Two things a reviewer should weigh in on:

- The old `else:` branch was byte-identical to gfx942, so arches with no tuned
  table of their own read the gfx942 file through an explicit
  `arch=_FALLBACK_ARCH` retry. That preserves today's behaviour exactly, but it
  is a second instance of the arch-fallback pattern that so far only MHC uses.
  Tuning those arches and dropping the fallback is the better end state.
- Both functions copy before returning. load_config_json hands back the shared
  cached dict and get_sage_fwd_configs mutates what it returns, so without the
  copy an a3_tuned=True call would poison the cache for every later caller.
Copilot AI review requested due to automatic review settings August 31, 2026 06:05
@Boss2002n
Boss2002n force-pushed the satya/triton-sage-config-to-json branch from 60081ea to 9c09646 Compare August 31, 2026 06:05

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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread aiter/ops/triton/attention/fav3_sage.py
Copilot AI review requested due to automatic review settings August 31, 2026 14:35
Removed comments regarding import behavior and tracing paths.

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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (1)

aiter/ops/triton/attention/fav3_sage.py:44

  • os.scandir() returns an iterator that holds an open directory handle; relying on implicit closure after sorted() can leave the fd open longer than intended (especially on non-CPython runtimes). Use a context manager to deterministically close the scandir handle once the entries are consumed.
    for entry in sorted(os.scandir(AITER_TRITON_CONFIGS_PATH), key=lambda e: e.name):

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.

2 participants