Skip to content

[Triton/Gluon] Tuning based on Default config json - #6128

Merged
vgokhale merged 14 commits into
mainfrom
satya/tuning_refactor_claude
Oct 13, 2026
Merged

vgokhale merged 14 commits into
mainfrom
satya/tuning_refactor_claude

Conversation

@Boss2002n

@Boss2002n Boss2002n commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Refactor entire tuning to support gluon kernels

Triton gemm_afp4wfp4 on gfx1250, M=64, N=2112, K=7168 (the M_LEQ_64 bucket).

branch | 64×128, 8 warps, waves_per_eu 1
main (rocprof) | 64×128, 8 warps, waves_per_eu 1

Both configs generated are identical taking 9.19 µs and 9.07 µs

@github-actions

github-actions Bot commented Oct 3, 2026

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 (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
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 6128 --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.

Reverse 0e375bd to restore the multicast cherry-picks and their tuning integration after the main merge.
@Boss2002n
Boss2002n requested a balanced review from Copilot October 4, 2026 12:20
@Boss2002n Boss2002n self-assigned this Oct 4, 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.

Copilot review overview

🟡 Changes recommended

Confirmed installation and cleanup defects can invalidate unswept shapes or delete unrelated tuning results.

Review effort: Balanced
Findings: 3 High severity · 5 Medium severity

Open (8)
What changed in this PR

Refactors AITER’s GEMM tuning tools around DEFAULT.json, adding a shared Triton/Gluon workflow.

Changes:

  • Adds kernel registration and default-derived search spaces.
  • Introduces resumable multi-GPU sweeps and CUDA-graph timing.
  • Installs partial specialized configs with default fallback.
File Description
aiter/​ops/​triton/​utils/​gemm_config_utils.py Adds partial-config fallback and bucket-level tuned status.
aiter/​ops/​triton/​utils/​_triton/​tuning/​write_best_configs.py Selects, installs, and checks winning configs.
aiter/​ops/​triton/​utils/​_triton/​tuning/​verify_configs.py Resolves and times installed configs.
aiter/​ops/​triton/​utils/​_triton/​tuning/​sweep_configs.py Coordinates planning, workers, resume, and installation.
aiter/​ops/​triton/​utils/​_triton/​tuning/​space.py Defines candidate generation and pruning.
aiter/​ops/​triton/​utils/​_triton/​tuning/​README.md Documents the new workflow.
aiter/​ops/​triton/​utils/​_triton/​tuning/​parse_kernel_trace.py Removes the legacy profiler parser.
aiter/​ops/​triton/​utils/​_triton/​tuning/​kernels.py Registers kernel adapters and constraints.
aiter/​ops/​triton/​utils/​_triton/​tuning/​harness.py Plans sweeps and records graph timings.
aiter/​ops/​triton/​utils/​_triton/​tuning/​CLAUDE.md Adds tuning maintenance guidance.
aiter/​ops/​triton/​utils/​_triton/​tuning/​.gitignore Ignores new tuning artifacts.
aiter/​ops/​triton/​utils/​_triton/​tuning/​_utils.py Provides shared record, filename, and argument helpers.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Boss2002n
Boss2002n removed this pull request from stack #6135 October 5, 2026 00:31
@Boss2002n
Boss2002n marked this pull request as ready for review October 5, 2026 14:43
@Boss2002n
Boss2002n requested review from a team and a balanced review from Copilot October 5, 2026 14:43
@github-actions github-actions Bot changed the title Tuning based on Default config json [Triton/Gluon] Tuning based on Default config json Oct 5, 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.

Copilot review overview

🔵 Needs a closer look

Benchmark-to-install inconsistencies and resume/watchdog defects remain unresolved.

Review effort: Balanced
Findings: None

Resolved since last review (8)
Previously missed (5)

In code that hasn't changed since last review

Medium severity Preserve installed baseline parameters during filtering

aiter/​ops/​triton/​utils/​_triton/​tuning/​harness.py:172

Filtering the baseline by DEFAULT.json keys changes an already supported installed config. For gfx1250 GEMM-A8W8 at M=64, N=2112, K=7168, the specialized entry uses cache_modifier='.cg', but DEFAULT.json omits that key. This code drops it, and compute_splitk_params() backfills None, so the benchmark no longer measures the installed baseline. Benchmark the unmodified installed config and preserve its supported parameters if it wins, or include those parameters in DEFAULT.json before filtering.

Medium severity Prune tile combinations before expanding launch options

aiter/​ops/​triton/​utils/​_triton/​tuning/​space.py:235

For the existing gfx1250 Gluon AFP8WFP8 preshuffle defaults at M=8192, N=7168, K=16384, the shape-filtered product contains 248,832,000 combinations. This loop constructs a dictionary for every combination before resource pruning, making planning itself a substantial bottleneck; --all-buckets repeats it across M values. Please prune tile/resource combinations before expanding independent launch options, preserving the exhaustive set of valid candidates without traversing the rejected Cartesian product.

Medium severity Update stall deadline only on worker progress markers

aiter/​ops/​triton/​utils/​_triton/​tuning/​sweep_configs.py:248

Any log output resets t_last, not just completed candidates. A worker that prints compiler diagnostics without finishing a candidate can therefore exceed --stall indefinitely. A diagnostic-only subprocess reproduces this behavior. Advance the deadline only for the worker's ready and completed-result markers, retaining incomplete log lines for the next read.

Medium severity Refresh installed baseline before resumed winner selection

aiter/​ops/​triton/​utils/​_triton/​tuning/​sweep_configs.py:433

On a single-GPU resume without a final-round file, sweep_shard() skips the baseline once its old record is final. If installation or a manual edit has changed the installed config, load_winners() still lets the old baseline win—even outside the current plan—without measuring the current installed config. Refresh the baseline before selection. Running the existing final round for single-GPU sweeps as well fixes this, at the cost of re-timing up to ten finalists.

Medium severity Preserve winning supported kpack values during installation

aiter/​ops/​triton/​utils/​_triton/​tuning/​write_best_configs.py:126

On gfx1250, GEMM-A8W8 includes kpack in DEFAULT.json, so the Triton search benchmarks both 1 and 2. If kpack=2 wins, this filter removes it before installation. The loader check compares against the filtered table, so it cannot detect that the installed options differ from the measured winner. Preserve supported kpack values when installing, or enforce the intended omission policy before benchmarking; do not change the winning options only after timing.

@zufayu
zufayu requested a review from Dewei-Wang-sh October 6, 2026 00:32
@zufayu
zufayu requested a review from a team October 6, 2026 00:32

@vgokhale vgokhale 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.

Can you confirm this produces the same config before / after? Can you run a local test and put it in the description?

@Boss2002n

Copy link
Copy Markdown
Contributor Author

Can you confirm this produces the same config before / after? Can you run a local test and put it in the description?

Done

@vgokhale
vgokhale merged commit 354f51a into main Oct 13, 2026
@vgokhale
vgokhale deleted the satya/tuning_refactor_claude branch October 13, 2026 23:23
Boss2002n added a commit that referenced this pull request Oct 14, 2026
Conflicts:
- aiter/ops/triton/README.md and the Copilot review rules: kept the
  short versions from this branch and added the changes of #6505. The
  shared @triton.jit device helpers are now in _triton_kernels/common/,
  and activation.py is not a flat wrapper any more.
- aiter/ops/triton/utils/_triton/tuning/README.md: took the new version
  from #6128.
Boss2002n added a commit that referenced this pull request Oct 14, 2026
#6128 added the tuning rules as a CLAUDE.md. Only Claude Code reads that
name. This commit only renames the file. The next commit links to it.
Boss2002n added a commit that referenced this pull request Oct 14, 2026
#6128 changed the GEMM loader and the tuning scripts. The config rules,
the Copilot review rules and the README now agree with it:

- A specialized file with "DEFAULT_FALLBACK": true gets its missing
  buckets from DEFAULT.json. Copilot does not flag such a file.
- is_tuned is True only for a bucket from the specialized file, not for
  "any" or a bucket from DEFAULT.json.
- DEFAULT.json sets the keys of a family, and the tuning scripts tune
  only these keys. Entries must have the keys of DEFAULT.json. The fixed
  list of ten keys is now an example: 25 of the 106 Triton GEMM
  DEFAULT.json files do not have all ten.
- For GEMM, the tuning scripts write the specialized file, and
  verify_configs.py --expect-tuned checks is_tuned.
Boss2002n added a commit that referenced this pull request Oct 14, 2026
* [Docs] Make the Triton docs short and simple

Rewrite the Triton README, the Copilot review rules, the config rules
(configs/CLAUDE.md), the Triton test README and the Triton part of
CONTRIBUTE.md. Each one starts with a short list of rules. The text uses
ASD-STE100 (Simplified Technical English).

The rules stay the same, with two additions: comments are one or two
sentences, and docs, comments and PR descriptions use ASD-STE100. The
old Triton tips in CONTRIBUTE.md (block sizes, pipelining, cache
modifiers) are removed. The kpack rule in configs/CLAUDE.md now agrees
with the README: only gfx942 configs can have kpack.

* [Docs] Use only M_LEQ keys for M buckets

The Triton docs now tell contributors to use only M_LEQ_<x> keys and
"any" for the M buckets of a GEMM config. The README has a new rule for
this. The config rules and the Copilot review rules agree with it.

The config rules and the Copilot review rules also say that you can use
cache_modifier on all archs, also on gfx1250. Copilot must not flag it
in a gfx1250 config.

* [Docs] Rename configs/CLAUDE.md to configs/AGENTS.md

Codex, Copilot and Claude Code all read AGENTS.md. This commit only
renames the file. The next commit adds the files that point to it.

* [Docs] Add AGENTS.md entry points for coding agents

Claude Code, Codex and Copilot now read the Triton rules from the same
files. No rule is written twice.

- aiter/ops/triton/AGENTS.md lists the rule files: the README, the
  config rules, the test README and the Copilot review checks. Claude
  Code imports the two README files from it.
- op_tests/triton_tests/AGENTS.md and
  op_tests/op_benchmarks/triton/AGENTS.md point to it.
- aiter/ops/triton/CLAUDE.md only imports the four AGENTS.md files.
  Claude Code does not read AGENTS.md files when the repository root
  has a CLAUDE.md, or in versions before v2.1.277. The imports work in
  all cases.
- The links to configs/CLAUDE.md now go to configs/AGENTS.md. This
  includes three code comments.
- Copilot flags a new CLAUDE.md file, and a new AGENTS.md file that
  aiter/ops/triton/CLAUDE.md does not import.
- Copilot code review does not read nested AGENTS.md files. The review
  checks stay in .github/instructions/aiter-ops-triton.instructions.md.

* [Docs] Fix the config file name pattern and the CLAUDE.md rule

The README showed only <CONFIG_NAME>-N=<N>-K=<K>.json for specialized
config files. That pattern excludes valid names, such as batched
B=..-N=..-K=.. files, custom suffixes and MHC C=.. files. The README now
uses <CONFIG_NAME>-<suffix>.json, as configs/AGENTS.md does.

The CLAUDE.md rule could be read as "remove aiter/ops/triton/CLAUDE.md".
The docs now say that this file is the only CLAUDE.md, that it must
stay, and that Copilot must not flag it.

* [Docs] Rename tuning/CLAUDE.md to tuning/AGENTS.md

#6128 added the tuning rules as a CLAUDE.md. Only Claude Code reads that
name. This commit only renames the file. The next commit links to it.

* [Docs] Link the tuning AGENTS.md like the other rule files

aiter/ops/triton/CLAUDE.md now imports the tuning rules, and the index
in aiter/ops/triton/AGENTS.md lists them. The tuning rules now link to
configs/AGENTS.md. They also say "only M_LEQ_* buckets are tuned" in
place of the M_GEQ sentence.

* [Docs] Describe DEFAULT_FALLBACK and the new GEMM tuning flow

#6128 changed the GEMM loader and the tuning scripts. The config rules,
the Copilot review rules and the README now agree with it:

- A specialized file with "DEFAULT_FALLBACK": true gets its missing
  buckets from DEFAULT.json. Copilot does not flag such a file.
- is_tuned is True only for a bucket from the specialized file, not for
  "any" or a bucket from DEFAULT.json.
- DEFAULT.json sets the keys of a family, and the tuning scripts tune
  only these keys. Entries must have the keys of DEFAULT.json. The fixed
  list of ten keys is now an example: 25 of the 106 Triton GEMM
  DEFAULT.json files do not have all ten.
- For GEMM, the tuning scripts write the specialized file, and
  verify_configs.py --expect-tuned checks is_tuned.

* [Docs] Name the right logger for library code and for tests

The README said to log with "from aiter import logger". No library file
under aiter/ops/triton/ does that: 88 files use AiterTritonLogger() from
aiter/ops/triton/utils/logger.py, which reads AITER_TRITON_LOG_LEVEL.
Tests and benchmarks use "from aiter import logger", which reads
AITER_LOG_LEVEL.

The README, the test README and the Copilot review rules now say which
logger to use where. The test README also says how to see the debug
output of the library: AITER_TRITON_LOG_LEVEL=DEBUG with pytest
--log-cli-level=DEBUG. This logger has no handler of its own, so -s does
not show it.
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.

3 participants