Skip to content

[Triton/Gluon] Fix flash_kda test in gfx942 - #5594

Closed
brunomazzottiamd wants to merge 1 commit into
mainfrom
bmazzott/fix-test-flash-kda-in-gfx942
Closed

brunomazzottiamd wants to merge 1 commit into
mainfrom
bmazzott/fix-test-flash-kda-in-gfx942

Conversation

@brunomazzottiamd

@brunomazzottiamd brunomazzottiamd commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

op_tests/triton_tests/chunk_delta_attn/test_flash_kda.py was failing in gfx942:

=================================== FAILURES ===================================
___________________ test_tuner_keeps_the_two_schedules_apart ___________________

    def test_tuner_keeps_the_two_schedules_apart():
        """A segmented run must not hand its config to a later unsegmented one.
    
        K2's grid is ``cdiv(W, BW) * num_segs * H``, so the wide BW that suits a
        segmented sweep leaves the unsegmented scan a quarter of the blocks: at
        H=12 that pick costs 2.3x. The two collide unless the segment count reaches
        the autotune key, and `cache_results` then persists whichever won.
        """
        kern = _flash_kda._flash_kda_segment_kernel
        args = make_inputs(1, 1024, 4)
        # An incoming state is what makes the two output passes otherwise identical:
        # without it the unsegmented one passes h_in=None and the key picks up the
        # difference through the dtypes it appends, hiding the collision.
        kw = {"initial_state": torch.zeros(1, 4, K_DIM, K_DIM, device=device)}
        # This is about the Triton kernel's autotuner, which never runs -- and whose
        # cache therefore stays empty -- when K2 is routed to Gluon.
        with _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)
>       assert set(kern.cache) - segmented_keys, "unsegmented reused a segmented config"
E       AssertionError: unsegmented reused a segmented config
E       assert (set() - set())
E        +  where set() = set({})
E        +    where {} = <triton.runtime.autotuner.Autotuner object at 0x727a14a4daf0>.cache

op_tests/triton_tests/chunk_delta_attn/test_flash_kda.py:381: AssertionError
_______________ test_published_k2_schedules_can_split_their_tile _______________

    def test_published_k2_schedules_can_split_their_tile():
        """Every published (BW, num_warps) must let the warps divide the state.
    
        Above BW // 16 the extra warps recompute columns their neighbours already
        hold -- still correct, which is why nothing downstream catches it, and the
        pairs are now editable from a config file rather than derived.
        """
        reached = set()
        for W in (64, 128, 256):
            for num_segs in (1, 2, 8, 64, 512):
                for H in (1, 4, 12, 64):
                    reached.add(_flash_kda._k2_gluon_schedule(W, num_segs, H))
>       assert len(reached) > 1, f"only one schedule reachable: {reached}"
E       AssertionError: only one schedule reachable: {(32, 2)}
E       assert 1 > 1
E        +  where 1 = len({(32, 2)})

op_tests/triton_tests/chunk_delta_attn/test_flash_kda.py:396: AssertionError

=========================== short test summary info ============================
FAILED op_tests/triton_tests/chunk_delta_attn/test_flash_kda.py::test_tuner_keeps_the_two_schedules_apart
FAILED op_tests/triton_tests/chunk_delta_attn/test_flash_kda.py::test_published_k2_schedules_can_split_their_tile
=== 2 failed, 3985 passed, 4187 skipped, 1404 warnings in 1146.78s (0:19:06) ===

This PR fixes it.

Technical Details

  • Skip tuner validation when only one schedule is available.
  • Skip Gluon K2 checks on unsupported architectures.

Test Plan

Execute op_tests/triton_tests/chunk_delta_attn/test_flash_kda.py in gfx942 through AITER CI runners.

Test Result

op_tests/triton_tests/chunk_delta_attn/test_flash_kda.py passed in gfx942. ✅

Submission Checklist

…config

Both tests assumed the running arch ships a tuned config table, which
gfx942 does not, so they failed there while passing on gfx950.

test_tuner_keeps_the_two_schedules_apart read the autotuner cache to
prove the segment count separates the two schedules. Without a published
shortlist K2 gets a single config, and Triton only builds a key and
fills `cache` when it has more than one, so the cache stayed empty and
the test read that as a collision. Assert the invariant it names -- that
NUM_SEGS_CLASS is in the autotune key -- on every arch, and skip the
cache check where there is nothing to tune.

test_published_k2_schedules_can_split_their_tile called
_k2_gluon_schedule directly, bypassing the arch gate. gfx942 ships no
gluon configs, so both lookups return the fallback and every shape
resolves to the same pair. Skip behind _gluon_k2_usable, as
test_cases_reach_the_gluon_k2 already does. This also drops the ~120
missing-gluon-config warnings from the log, which were test-induced:
production never reaches that function off gfx950.

No production change. gfx942 still runs K2 on the BW=16 fallback for
every shape; publishing a measured shortlist is left to a follow-up.
@brunomazzottiamd brunomazzottiamd self-assigned this Sep 16, 2026
@brunomazzottiamd
brunomazzottiamd requested a review from a team September 16, 2026 15:36
@brunomazzottiamd brunomazzottiamd changed the title [Triton/Gluon] Fix flash_kda test gfx942 [Triton/Gluon] Fix flash_kda test in gfx942 Sep 16, 2026
@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 5594 --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.

🟢 Approval recommended

No unresolved review comments; changes safely guard unsupported test configurations.

Pull request overview

Fixes Flash KDA test behavior on gfx942 by skipping unsupported Gluon and autotuning scenarios.

Changes:

  • Skip tuner validation when only one schedule is available.
  • Skip Gluon K2 checks on unsupported architectures.
File summaries
File Summary
op_tests/triton_tests/chunk_delta_attn/test_flash_kda.py Adds architecture- and configuration-aware test skips.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

@brunomazzottiamd

Copy link
Copy Markdown
Contributor Author

Deprecated in favor of #5590.

@brunomazzottiamd
brunomazzottiamd deleted the bmazzott/fix-test-flash-kda-in-gfx942 branch September 17, 2026 13:05
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