Skip to content

[Triton/Gluon] Take the autotuning search out of the unit tests - #5590

Merged
brunomazzottiamd merged 3 commits into
mainfrom
satya/ci/fix-ut-autotuning
Sep 17, 2026
Merged

brunomazzottiamd merged 3 commits into
mainfrom
satya/ci/fix-ut-autotuning

Conversation

@Boss2002n

Copy link
Copy Markdown
Contributor

The CI gate for runtime autotuning fired on three tests -- test_moe_wgrad, test_flash_kda and test_fast_launch.

Every @triton.autotune now takes its config list from autotune_config

op_tests/triton_tests/init.py already switched one family off for pytest; it now pins one config for all of them, by rebinding prune_configs on the Autotuner class this process imported.

The rule is written down in .github/instructions/aiter-ops-triton.instructions.md and in aiter/ops/triton/README.md.

Worth stating: searching several configs gave the suite incidental coverage of more than one schedule. That coverage was accidental and nondeterministic -- which config ran depended on load.

@Boss2002n
Boss2002n requested review from a team and a lite review from Copilot September 16, 2026 13:17
@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 5590 --add-label <label>

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 opt this PR out.

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

Unresolved findings remain regarding the attn_res opt-in path, hardcoded MoE fallback values, and public documentation.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR removes nondeterministic Triton autotuning from unit tests while preserving explicit runtime opt-ins.

Changes:

  • Adds centralized, environment-aware autotune configuration.
  • Pins one configuration during pytest runs.
  • Updates affected kernels and autotuning documentation.
File summaries
File Summary
op_tests/triton_tests/__init__.py Pins autotuner configurations during tests.
aiter/ops/triton/utils/tuned_config_utils.py Adds environment-aware configuration selection.
aiter/ops/triton/README.md Documents the policy. Moderate (3 votes): the opt-in attn_res path still bypasses autotune_configs(), contrary to the documented claim.
aiter/ops/triton/_triton_kernels/moe/moe_wgrad.py Routes MoE tuning through the helper. Moderate (2 votes): hardcoded fallback configuration values should move to the JSON/loader path. Nit (1 vote): update the public docstring to describe pinned defaults and the opt-in variable.
aiter/ops/triton/_triton_kernels/flash_attn_triton_amd/fwd_prefill.py Routes prefill tuning through the helper.
aiter/ops/triton/_triton_kernels/flash_attn_triton_amd/fwd_decode.py Routes decode tuning through the helper.
aiter/ops/triton/_triton_kernels/flash_attn_triton_amd/bwd.py Routes backward tuning through the helper.
aiter/ops/triton/_triton_kernels/chunk_delta_attn/flash_kda.py Routes KDA tuning through the helper.
aiter/ops/triton/_triton_kernels/attention/sparse_attention_dsv4.py Routes sparse-attention tuning through the helper.
.github/instructions/aiter-ops-triton.instructions.md Records the autotuning convention.
Review details

Suppressed comments (1)

aiter/ops/triton/_triton_kernels/moe/moe_wgrad.py:69

  • [verified] autotune_configs is off by default for MOE_WGRAD, so this change stops the public moe_wgrad path from searching on first launch unless MOE_WGRAD_TRITON_AUTOTUNE=1. However, aiter/ops/triton/moe/moe_wgrad.py:28-29 still documents that it searches for the optimal tile on first launch, which is now misleading for callers. Author must update that public docstring to describe the pinned default and the opt-in environment variable.
    configs=autotune_configs(
        "MOE_WGRAD",
        _get_autotune_configs(),
        default_config=get_tuned_kernel_config(
            "moe",
            "MOE_WGRAD",
            "_moe_wgrad_kernel",
            triton.Config(
                {"BLOCK_SIZE_N": 128, "BLOCK_SIZE_K": 128},
                num_warps=8,
                num_stages=2,
            ),
        ),
    ),
  • Files reviewed: 10/10 changed files
  • Comments generated: 2
  • Review effort level: Lite

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

Comment thread aiter/ops/triton/README.md Resolved
Copilot AI review requested due to automatic review settings September 16, 2026 13:24

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.

🔵 Needs a closer look

Resolve the remaining autotune exemption, move the WGRAD fallback into configuration data, remove the new torch dependency, and add coverage for configuration defaults and opt-in behavior.

Review details

Suppressed comments (5)

.github/instructions/aiter-ops-triton.instructions.md:234

  • attn_res.py remains an exemption here: its opt-in branch directly passes _ATTN_RES_AUTOTUNE_CONFIGS to triton.autotune instead of autotune_configs. Please include that call in this migration (or explicitly document why it is excluded), otherwise the new “no exemptions” rule is not enforced by the tree.
  There are no exemptions. A family that already published its own variable
  name keeps it by passing `env=`, as `flash_attn_triton_amd/` does with
  `FLASH_ATTENTION_TRITON_AMD_AUTOTUNE` — it still goes through this helper.

aiter/ops/triton/README.md:268

  • [verified] The tree still has an active raw config list outside this helper: aiter/ops/triton/_triton_kernels/fusions/attn_res.py:376-389 passes _ATTN_RES_AUTOTUNE_CONFIGS directly to triton.autotune when ATTN_RES_TRITON_AUTOTUNE=1. That path can still benchmark multiple configs and contradicts the documented “There are no kernels outside this helper” contract. Author must route that call through autotune_configs as well, or remove/update this claim.
family is off. There are no kernels outside this helper.

aiter/ops/triton/_triton_kernels/moe/moe_wgrad.py:67

  • [verified] This new fallback embeds the tuned tile (BLOCK_SIZE_N/K, num_warps, and num_stages) in Python even though tuning values are required to live in the JSON config tree. On an architecture without a MOE_WGRAD entry, this literal becomes the schedule actually registered, so the behavior cannot be retuned through config data alone. Author must move this fallback schedule into the appropriate configs/<arch>/triton/moe/moe_wgrad/DEFAULT.json path and avoid adding a Python tuning literal.
            triton.Config(
                {"BLOCK_SIZE_N": 128, "BLOCK_SIZE_K": 128},
                num_warps=8,
                num_stages=2,
            ),

aiter/ops/triton/_triton_kernels/moe/moe_wgrad.py:17

  • Importing tuned_config_utils here also executes its top-level import torch (aiter/ops/triton/utils/tuned_config_utils.py:4), so this previously torch-free _triton_kernels module now requires PyTorch just to import the kernel. The kernel only needs config-selection helpers; Author must move the autotune helper to a torch-free module or remove that dependency before wiring it into this kernel.
from aiter.ops.triton.utils.tuned_config_utils import (
    autotune_configs,
    get_tuned_kernel_config,
)

aiter/ops/triton/utils/tuned_config_utils.py:56

  • [verified] The new env/default behavior controls whether Flash Attention keeps its historical opt-in default while generic families remain off, but no test exercises those import-time branches or the one-config fallback. A regression here can silently re-enable runtime benchmarking across the kernel suite while the GPU tests still pass. Author must add a focused unit test for autotune_enabled/autotune_configs covering both default values and explicit opt-in.
    if autotune_enabled(family, env, default):
        return configs
    return [default_config if default_config is not None else configs[0]]
  • Files reviewed: 10/10 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@Boss2002n
Boss2002n force-pushed the satya/ci/fix-ut-autotuning branch from 1a95ecf to 744339d Compare September 16, 2026 13:43
Copilot AI review requested due to automatic review settings September 16, 2026 13:43

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

Unresolved kernel default-configuration issues and missing focused helper tests must be addressed before approval.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (3)

aiter/ops/triton/_triton_kernels/attention/sparse_attention_dsv4.py:279

  • [verified] With SPARSE_ATTENTION_DSV4_TRITON_AUTOTUNE unset, this helper pins the prefill kernel to the first generated candidate (BLOCK_H=32, BLOCK_K=16, num_warps=4, num_stages=1) after pruning; before this change the raw list was searched at each new key. There is no tuned JSON/default for this family, so production now silently uses an arbitrary first schedule rather than a measured one. Author must add a JSON-backed pinned default or keep this family explicitly opt-in to runtime search.
    configs=autotune_configs("SPARSE_ATTENTION_DSV4", _get_prefill_autotune_configs()),

aiter/ops/triton/_triton_kernels/moe/moe_wgrad.py:67

  • [verified] The public wrapper docstring at aiter/ops/triton/moe/moe_wgrad.py:28 still says this kernel searches on its first launch, but this decorator now receives one config by default and only searches when MOE_WGRAD_TRITON_AUTOTUNE is enabled. That leaves the public performance/configuration contract inaccurate. Author must update the wrapper documentation to describe the opt-in search and pinned default.
        default_config=get_tuned_kernel_config(
            "moe", "MOE_WGRAD", "_moe_wgrad_kernel", _MOE_WGRAD_FALLBACK_CONFIG
        ),
    ),

aiter/ops/triton/utils/tuned_config_utils.py:31

  • [verified] The new env/default branches define the behavior for every autotuned Triton kernel, including the published Flash Attention variable, but no tests exercise unset, false, and true values or verify that exactly one candidate is returned. A regression here can silently re-enable launch-time benchmarking or pin the wrong family default without a focused failure. Author must add isolated tests for the helper's environment selection and list cardinality.
def autotune_enabled(family: str, env: str | None = None, default: str = "0") -> bool:
    """``<FAMILY>_TRITON_AUTOTUNE=1`` opts a kernel family into runtime tuning; off by default.

    ``env`` names the variable instead, for a family that already had one before
    this convention existed and whose name is published elsewhere. ``default``
  • Files reviewed: 11/11 changed files
  • Comments generated: 2
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 16, 2026 16:33

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 MoE wgrad fallback violates the config convention, and its public documentation describes outdated autotuning behavior.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (1)

aiter/ops/triton/_triton_kernels/moe/moe_wgrad.py:57

  • This adds a new Python-owned tuning fallback (BLOCK_SIZE_N/K, num_warps, and num_stages). The config convention in aiter/ops/triton/configs/CLAUDE.md:410-411 forbids hardcoded fallback configs, so this schedule is not represented in the config tree and can drift from retuned values. Put the MOE_WGRAD default behind the existing nested JSON/config path instead of defining it here.
_MOE_WGRAD_FALLBACK_CONFIG = triton.Config(
    {"BLOCK_SIZE_N": 128, "BLOCK_SIZE_K": 128}, num_warps=8, num_stages=2
)
  • Files reviewed: 11/11 changed files
  • Comments generated: 1
  • Review effort level: Lite

The CI gate for runtime autotuning fired on three tests -- test_moe_wgrad,
test_flash_kda and test_fast_launch. Fixing them turned into one rule and one
missing guard.

Every @triton.autotune now takes its config list from autotune_configs, with no
carve-outs. Two kernels were handing it a raw list with no family and no flag,
so Triton searched on every new key in production as much as in CI:
_moe_wgrad_kernel over six configs, and _sparse_attn_prefill_kernel over 48.
autotune_configs returns all candidates only while <FAMILY>_TRITON_AUTOTUNE=1
and a single config otherwise, so nothing benchmarks at launch.

Two more were already equivalent under their own conventions, and rather than
document them as exemptions the helper grew env= and default= so they route
through it unchanged. flash_attn_triton_amd/ keeps
FLASH_ATTENTION_TRITON_AMD_AUTOTUNE, which is upstream's name and is exported
in five places by flash_attention_integration.yaml, and keeps meaning "on" when
unset. Its production behaviour is byte-identical: unset and =1 give the full
grid, =0 gives the port's arch-specific config, exactly as before.
chunk_delta_attn's _K2_CONFIGS is deliberately left alone. Its six candidates
come from the config JSON and are selected on an autotune key carrying
NUM_SEGS_CLASS, because the best BW moves with the segment count -- the kernel
records a 2.3x penalty for choosing wrong. That is a validated per-shape
dispatch, not a search, so pinning one candidate for every segment class would
be a regression rather than a cleanup. What the rule forbids is an unbounded
list handed straight to @triton.autotune with nothing keyed and nothing
published; a published, key-dispatched shortlist is a different mechanism. The
unit tests do not need it collapsed either -- the pin in
op_tests/triton_tests/__init__.py already gives them one config per kernel.

Routing it would not be a silent no-op. Triton consults its autotune cache only
when the config list holds more than one entry; with one entry it takes
configs[0] and never reads the key. Collapsing this one therefore stops
NUM_SEGS_CLASS from being consulted, leaves the kernel's cache empty, and fails
test_tuner_keeps_the_two_schedules_apart -- the test that exists to prove the
segmented and unsegmented schedules do not share a config.

The pinned default for _moe_wgrad_kernel comes from get_tuned_kernel_config, so
retuning it is a JSON edit under configs/<arch>/triton/moe/moe_wgrad/ rather
than a code change. Nothing is published there yet, so it takes the fallback:
128x128 / num_warps=8, the largest tile at the higher warp count, which is
where a weight-gradient GEMM over a full expert belongs.

op_tests/triton_tests/__init__.py already switched one family off for pytest;
it now pins one config for all of them, by rebinding prune_configs on the
Autotuner class this process imported. Nothing in Triton is modified and
nothing outside pytest is affected. Each kernel's own early_config_prune still
runs first, so a config that cannot fit in LDS or registers is still discarded;
only the timing search goes, which puts Triton on its single-config path where
it caches that config, skips the benchmark and prints nothing. With every
kernel routed this is a backstop rather than the mechanism, and it earns its
place: it holds even if a family's flag reaches the environment or a new kernel
lands unrouted. AITER_UT_TRITON_AUTOTUNE=1 restores the search.

attn_res.py applies triton.autotune() as a call rather than a decorator, so a
grep for the decorator misses it; its opt-in search under
ATTN_RES_TRITON_AUTOTUNE=1 is routed too. aiter/ops/triton has 41 such sites;
this takes the unrouted count from ten to one, and that one is the keyed
shortlist described above.

The rule is written down in .github/instructions/aiter-ops-triton.instructions.md
and in aiter/ops/triton/README.md.

Worth stating: searching several configs gave the suite incidental coverage of
more than one schedule. That coverage was accidental and nondeterministic --
which config ran depended on load, and a different BLOCK size changes reduction
order and so the floating-point error. Where several schedules need covering, a
parametrize says so on purpose.
Copilot AI review requested due to automatic review settings September 16, 2026 16:48
@Boss2002n
Boss2002n force-pushed the satya/ci/fix-ut-autotuning branch from ecb2136 to ed7f6bd Compare September 16, 2026 16:48

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

Critical test breakage and a moderate configuration-placement issue remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (2)

aiter/ops/triton/README.md:246

  • The unconditional wording here contradicts the documented flash_kda_segment_kernel exception below, which still passes a published multi-config shortlist directly to @triton.autotune. As written, a future reviewer cannot tell whether that intentional key-dispatched shortlist violates the rule or is allowed. Author must scope this sentence to unbounded search lists or state the published-shortlist exception inline.
Every `@triton.autotune` takes its config list from
`utils/tuned_config_utils.py::autotune_configs(family, configs,
default_config=None, env=None, default="0")`. Never hand it a raw list:

aiter/ops/triton/_triton_kernels/moe/moe_wgrad.py:57

  • [verified] This newly added fallback hardcodes BLOCK_SIZE_N, BLOCK_SIZE_K, num_warps, and num_stages in the kernel module. Since no MOE_WGRAD JSON entry is added, get_tuned_kernel_config() always falls back to these Python literals, so changing the pinned default still requires editing code and cannot be represented by the tuning table. Author must move the default/fallback definition into the appropriate configs/<arch>/triton/moe/.../DEFAULT.json entries and keep tuning values out of this module.
_MOE_WGRAD_FALLBACK_CONFIG = triton.Config(
    {"BLOCK_SIZE_N": 128, "BLOCK_SIZE_K": 128}, num_warps=8, num_stages=2
)
  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread op_tests/triton_tests/__init__.py Resolved

@brunomazzottiamd brunomazzottiamd 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!

@brunomazzottiamd

Copy link
Copy Markdown
Contributor

Added ci:triton-300x label to trigger gfx942 runners. I want to see how this autotuning stuff is behaving in gfx942.

Related to #5594.

The previous commit left _flash_kda_segment_kernel out, on the grounds that its
six candidates come from the config JSON and are dispatched on an autotune key
carrying NUM_SEGS_CLASS, so collapsing them would cost the 2.3x the kernel
records. Both halves of that were wrong.

A published candidate list is a search space for a tuning build, not a
launch-time list: handed to @triton.autotune it still benchmarks all six on
every new key. test_flash_kda was one of the three tests the CI gate fired on,
so exempting it left the original finding unfixed.

And the 2.3x is asymmetric -- it is the cost of taking BW=64 where 16 is right,
not the reverse. default_config= pins _K2_FALLBACK_CONFIG, BW=16 / num_warps=2
/ num_stages=2, which is both the module's own declared fallback and the first
published candidate, so what launches does not change.
CHUNK_DELTA_ATTN_TRITON_AUTOTUNE=1 still searches the full grid.

That leaves test_tuner_keeps_the_two_schedules_apart, which asserts that the
segmented and unsegmented schedules get different autotune cache keys. Triton
consults that cache only when the config list holds more than one entry; with
one config it takes configs[0] at autotuner.py:283 and never reads the key, so
the cache stays empty and the assertion has nothing to compare. The property is
about the key, and a key only decides anything where there is a choice, so the
test now hands the autotuner its candidate list for the duration instead of
relying on the launch path to carry one. Under the suite-wide pin it still
benchmarks nothing, and it skips where the arch publishes no candidates.

aiter/ops/triton has 41 @triton.autotune sites, counting decorator and call
forms. This takes the unrouted count from one to zero, and the README and the
instructions file now state the rule without an exemption list.

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

Unresolved critical and moderate issues affect K2 test coverage and MoE tuning configuration/documentation.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (3)

aiter/ops/triton/_triton_kernels/moe/moe_wgrad.py:57

  • This newly added fallback hardcodes BLOCK_SIZE_N, BLOCK_SIZE_K, num_warps, and num_stages in a kernel module. That creates a second tuning source outside the JSON-backed config path, so retuning the pinned schedule requires a code change and can diverge from per-arch data. Author must move the default/fallback schedule into the appropriate JSON-backed config entry and keep Python free of tuning values.
_MOE_WGRAD_FALLBACK_CONFIG = triton.Config(
    {"BLOCK_SIZE_N": 128, "BLOCK_SIZE_K": 128}, num_warps=8, num_stages=2
)

aiter/ops/triton/_triton_kernels/moe/moe_wgrad.py:67

  • [verified] The public moe_wgrad wrapper still documents @triton.autotune searching for the optimum on first launch (aiter/ops/triton/moe/moe_wgrad.py:28-29), but this new helper returns one pinned config unless MOE_WGRAD_TRITON_AUTOTUNE=1. Users are now given deterministic dispatch while the API documentation promises a benchmark/search. Author must update the public docstring to describe the pinned default and the opt-in environment variable.
    configs=autotune_configs(
        "MOE_WGRAD",
        _get_autotune_configs(),
        default_config=get_tuned_kernel_config(
            "moe", "MOE_WGRAD", "_moe_wgrad_kernel", _MOE_WGRAD_FALLBACK_CONFIG
        ),
    ),

op_tests/triton_tests/init.py:30

  • [verified] This process-wide wrapper still slices every pruned config list to one. test_flash_kda._k2_tuner_search_space() assigns the published multi-config space to the same Autotuner, but this method reduces it back to one, so Triton never records separate cache entries for the segmented and unsegmented keys and test_tuner_keeps_the_two_schedules_apart cannot pass on a device with published K2 candidates. Author must provide a scoped opt-out/restore for key-specific tests while retaining the pin for normal tests.
        return prune(self, kwargs)[:1]
  • Files reviewed: 12/12 changed files
  • Comments generated: 1
  • Review effort level: Lite

… published

test_published_k2_schedules_can_split_their_tile asserts that more than one
(BW, num_warps) pair is reachable through _k2_gluon_schedule. Only gfx950
publishes k2_ab_fused_gluon_wide and k2_ab_fused_gluon_narrow. Everywhere else
both lookups return _K2_GLUON_FALLBACK, whose MIN_BLOCKS_PER_CU of 0 makes the
occupancy comparison vacuous, so with every W in the sweep divisible by its
BW=32 the wide branch is taken unconditionally and exactly one pair comes back.
The test then fails by construction rather than because anything is wrong,
which is what it does on gfx942 today.

The reachability assertion is a coverage guard for an arch that publishes both
schedules; an arch that publishes neither has nothing to cover, and the pair it
does reach is a constant in the source. The skip goes before the sweep rather
than after, which also drops the sixty "No tuned Triton config" warnings the
run emits, one per cached (W, num_segs, H).

get_tuned_kernel_config returns the fallback object itself when nothing is
published, so the probe is an identity check rather than a comparison against
values a published entry could coincidentally match.

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.

🔵 Needs a closer look

Four moderate issues remain in configuration defaults, opt-in behavior, and KDA test setup.

Review details

Suppressed comments (4)

aiter/ops/triton/_triton_kernels/attention/sparse_attention_dsv4.py:279

  • [verified] With SPARSE_ATTENTION_DSV4_TRITON_AUTOTUNE unset, this now passes one config to Triton and autotune_configs() selects configs[0]. That is the first arbitrary Cartesian entry (BLOCK_H=32, BLOCK_K=16, matrix_instr_nonkdim=16, four warps, one stage), with no JSON-backed default supplied, so every new key on the portable sparse-prefill path stops benchmarking and uses that tile instead of a tuned choice. Author must provide an arch-tuned default_config/JSON entry or demonstrate that this first candidate is the intended portable default.
@triton.autotune(
    configs=autotune_configs("SPARSE_ATTENTION_DSV4", _get_prefill_autotune_configs()),

aiter/ops/triton/_triton_kernels/moe/moe_wgrad.py:57

  • [verified] The new fallback hardcodes BLOCK_SIZE_N, BLOCK_SIZE_K, num_warps, and num_stages in a kernel module. This is a tuning configuration, and the Triton convention requires such values to live in the JSON config hierarchy; get_tuned_kernel_config() cannot change the fact that this inline fallback is used whenever no entry is published. Author must move the pinned fallback/tuned entry to the appropriate JSON config and keep Python free of a second tuning source.
_MOE_WGRAD_FALLBACK_CONFIG = triton.Config(
    {"BLOCK_SIZE_N": 128, "BLOCK_SIZE_K": 128}, num_warps=8, num_stages=2
)

op_tests/triton_tests/init.py:45

  • [verified] AITER_UT_TRITON_AUTOTUNE=1 only skips _pin_triton_configs; the autotune_configs() calls still default each family to one config, and the existing setdefault keeps FlashAttention at 0 unless its separate flag is also set. Therefore the new suite-wide escape hatch does not actually re-enable autotuning by itself and its behavior is undocumented. Author must either remove this partial switch or make it consistently preserve/enable the family search-space flags and document the required overrides.
    if os.getenv("AITER_UT_TRITON_AUTOTUNE", "0").lower() not in ("1", "true", "on"):
        _pin_triton_configs()

op_tests/triton_tests/chunk_delta_attn/test_flash_kda.py:400

  • [verified] The suite-level _pin_triton_configs() has already replaced Autotuner.prune_configs with prune(...)[ :1 ] before this test runs. Replacing kern.configs here therefore still leaves Triton with one pruned candidate, so it never populates the multi-config cache and the assertion cannot observe distinct keys. Author must temporarily bypass or restore the suite prune override while this context is active.
    with _k2_tuner_search_space() as kern, _route(k2=False):
        kern.cache.clear()
        run_flash(*args, chunks_per_seg=4, **kw)
        segmented_keys = set(kern.cache)
        run_flash(*args, chunks_per_seg=0, **kw)
  • Files reviewed: 12/12 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@zufayu
zufayu requested review from a team and vgokhale September 17, 2026 01:11

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

op_tests/triton_tests/chunk_delta_attn/test_flash_kda.py is fixed on gfx942, so far so good.

I'll merge this, but Flash Attention Integration is broken - all jobs failing in a fundamental way, unable to perform some sort of installation...

  • Flash Attention Integration / Flash Attention - Triton / MI35X (1 GPU)
  • Flash Attention Integration / Flash Attention - Triton / RDNA3 (1 GPU)
  • Flash Attention Integration / Windows Smoke Test

@Boss2002n, can you please feed the logs to an AI agent and brainstorm a solution?

@brunomazzottiamd
brunomazzottiamd merged commit e44c1d0 into main Sep 17, 2026
85 of 88 checks passed
@brunomazzottiamd
brunomazzottiamd deleted the satya/ci/fix-ut-autotuning branch September 17, 2026 13:04
@0xDELUXA 0xDELUXA mentioned this pull request Sep 18, 2026
1 task done
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.

4 participants