Skip to content

Add AOT support for gluon_paged_mqa_logits - #1309

Merged
sjfeng1999 merged 2 commits into
085_aiterfrom
AOT-085_aiter
Oct 31, 2025
Merged

sjfeng1999 merged 2 commits into
085_aiterfrom
AOT-085_aiter

Conversation

@sjfeng1999

@sjfeng1999 sjfeng1999 commented Oct 31, 2025 •

Copy link
Copy Markdown
Contributor

Motivation

Add AOT support for gluon_paged_mqa_logits, allow customer to use the latest feature in a older triton version.

Technical Details

Test Plan

Test Result

Submission Checklist

…#1172)

* Add triton_metadata_redirect module with with_metadata_path decorator

Core Features:
- `with_custom_metadata_path()` decorator for custom kernel metadata storage
- Thread-safe global registry for kernel-to-directory mappings
- Automatic patching of CompiledKernel.__init__ method
- Full backward compatibility with existing @triton.jit usage

Example usage:
```python
from aiter.utility.triton.triton_metadata_redirect import with_custom_metadata_path

@with_custom_metadata_path("/custom/metadata/path")
@triton.jit
def my_kernel(...):
    ...
```

* update code format
@sjfeng1999
sjfeng1999 merged commit 4367f68 into 085_aiter Oct 31, 2025
@sjfeng1999
sjfeng1999 deleted the AOT-085_aiter branch October 31, 2025 08:53
xudoyuan added a commit that referenced this pull request Oct 20, 2026
CI builds the wheel against the pinned flydsl==0.4.0, not a local checkout of
upstream, and the mx128 tiled-atom conversion fails there two ways:

  the innermost descriptor dim must be contiguous in global memory (stride 1),
  got global mode 0 -- the LDS tile's majorness does not match the global
  tensor's

is a real bug: the sa_m_major=False branch builds the global view as
(KT_ALL, mn_oob) strided (stride_ask64, 1), making M contiguous, while the LDS
box stayed K-major. bd8fbfd set that box's row stride but left its majorness
alone, so it did not help. FlyDSL #1309 addresses this compiler-side.

  physical TDM tile_dim0 must span at least 16 bytes, got 4 elements at 8 bits

is invisible locally: upstream dropped that floor, the 0.4.0 wheel still has it.

Restore both only after the flydsl pin moves past #1302 and #1309, and fix the
majorness mismatch first. The steps are in the tdm-tiled-atom-migration skill,
section 13; the migration itself is 039e267 plus bd8fbfd.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
yadaish pushed a commit that referenced this pull request Nov 2, 2026
Converts the five `fx.rocdl.make_tdm_atom` sites that are plain
(non-gather, non-split-padding) copies to
`fx.rocdl.cdna5.make_tiled_tdm_atom` + `tdm_partition`:

  gemm_a8w8_gfx1250.py:922          C store
  gemm_a4w4_256x256_gfx1250.py:848  C store
  gemm_a4w4_gfx1250.py:471          C store
  mla_pagesize1_fp8_fp8.py:1517     per-wave O store
  mla_pagesize1_bf16_bf16.py:1450   per-wave O store

All five are padded stores. A TDM store cannot drain a padded LDS tile, so
each spells the pad the way the old interface did: `tdm_tile` is the PADDED
width and the global view's inner extent is the REAL width, leaving the
derived padAmount at 0 and letting boundary_check drop the pad columns. The
old `tensor_extents` clamps move into the view's shape unchanged, including
the runtime ones (`mn_oob`, `store_rows`), so M tails, split-k offsets,
`batched` offsets and the zero-row invalid-wave store all behave as before.

Dropped `early_timeout=False` on the a8w8 C store (already false).

Verified against the FlyDSL wheel aiter pins (`flydsl==0.4.1`), not a local
FlyDSL checkout, with each variant in its own FLYDSL_RUNTIME_CACHE_DIR:

  test_gemm_a8w8_mxfp8_bpreshuffle.py   36 shapes, err 0, median -0.07%
  test_gemm_a4w4.py                    116 rows / 58 timed, err 0, median +0.03%
  test_mla_flydsl.py                    45 shapes, err 0, median -0.31%

Baselines came from a separate worktree at main. Outliers past +/-5% appear
in both directions on the a4w4 suite and match its known run-to-run spread.

Not converted, with reasons:
  - gemm_a8w8_gfx1250.py:318/332/348 -- the A load carries A_PAD_SPLIT split
    padding, which a flat LDS box cannot express; needs the K axis split into
    pad-interval chunks on box and view both, plus a K-extent audit at every
    caller. Its mx128 scale caller additionally needs FlyDSL #1309, which is
    NOT in the pinned 0.4.1.
  - mxfp4_preshuffle_gfx1250_tdm.py:680/801/2362 and
    mega_moe_gfx1250/combine.py:460 -- convertible, but no single-GPU op_test
    reaches them; they need an output-equivalence driver rather than a suite.
  - the gather/scatter family -- make_tiled_tdm_atom takes only
    TensorLoad()/TensorStore().

Co-Authored-By: Claude Opus 5 <[email protected]>
coderfeli pushed a commit that referenced this pull request Nov 3, 2026
…atom (#7213)

* [FlyDSL] Migrate five gfx1250 TDM stores to the tiled atom

Converts the five `fx.rocdl.make_tdm_atom` sites that are plain
(non-gather, non-split-padding) copies to
`fx.rocdl.cdna5.make_tiled_tdm_atom` + `tdm_partition`:

  gemm_a8w8_gfx1250.py:922          C store
  gemm_a4w4_256x256_gfx1250.py:848  C store
  gemm_a4w4_gfx1250.py:471          C store
  mla_pagesize1_fp8_fp8.py:1517     per-wave O store
  mla_pagesize1_bf16_bf16.py:1450   per-wave O store

All five are padded stores. A TDM store cannot drain a padded LDS tile, so
each spells the pad the way the old interface did: `tdm_tile` is the PADDED
width and the global view's inner extent is the REAL width, leaving the
derived padAmount at 0 and letting boundary_check drop the pad columns. The
old `tensor_extents` clamps move into the view's shape unchanged, including
the runtime ones (`mn_oob`, `store_rows`), so M tails, split-k offsets,
`batched` offsets and the zero-row invalid-wave store all behave as before.

Dropped `early_timeout=False` on the a8w8 C store (already false).

Verified against the FlyDSL wheel aiter pins (`flydsl==0.4.1`), not a local
FlyDSL checkout, with each variant in its own FLYDSL_RUNTIME_CACHE_DIR:

  test_gemm_a8w8_mxfp8_bpreshuffle.py   36 shapes, err 0, median -0.07%
  test_gemm_a4w4.py                    116 rows / 58 timed, err 0, median +0.03%
  test_mla_flydsl.py                    45 shapes, err 0, median -0.31%

Baselines came from a separate worktree at main. Outliers past +/-5% appear
in both directions on the a4w4 suite and match its known run-to-run spread.

Not converted, with reasons:
  - gemm_a8w8_gfx1250.py:318/332/348 -- the A load carries A_PAD_SPLIT split
    padding, which a flat LDS box cannot express; needs the K axis split into
    pad-interval chunks on box and view both, plus a K-extent audit at every
    caller. Its mx128 scale caller additionally needs FlyDSL #1309, which is
    NOT in the pinned 0.4.1.
  - mxfp4_preshuffle_gfx1250_tdm.py:680/801/2362 and
    mega_moe_gfx1250/combine.py:460 -- convertible, but no single-GPU op_test
    reaches them; they need an output-equivalence driver rather than a suite.
  - the gather/scatter family -- make_tiled_tdm_atom takes only
    TensorLoad()/TensorStore().

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

* [FlyDSL] Convert the a8w8 B load too, and drop the added comments

Continues the same refactor: gemm_a8w8_gfx1250.py:332's B load moves to the
layout-friendly interface. Its K advance becomes an i32 tile index on the
coordinate rest instead of a byte imm_offset, and the view spans the whole K,
which also retires the per-iteration "extent_1" write that handled the K
tail. B_LDS_ROW == tile_k * 16, so the box carries no padding, as before.

Verified per shape against main over the configurations the B path varies on
-- sk4, sk2 fused-splitk, sk1 and t256x256x128 -- err 0 on both sides, timing
within noise. The full-suite sequential run is currently unusable on this
machine: it takes a GPU memory access fault at a different shape each run on
main as well as on this branch, with other tenants on the same device.

Also removes the explanatory comments added by the previous commit.

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

* [FlyDSL] Convert the mxfp4 C stores and the combine scale load

Three more sites onto the layout-friendly interface:

  mxfp4_preshuffle_gfx1250_tdm.py  make_tdm_store helper + both C-store callers
  mega_moe_gfx1250/combine.py:460  scale-plane load

mxfp4's three store branches collapse into one tiled_store helper: with
STORE_PAD == 0 the padded width STORE_PITCH equals STORE_N, so the no-pad
branch is the same expression and no longer needs its own code path.

combine's scale plane was held back by the 16-byte tile_dim0 span floor, as
its own comment recorded. The pinned flydsl is now 0.4.1, which carries the
relaxed padAmount-gated rule, so the plane gets the SC_TILE the comment
described and its LDS view grows the size-1 rest that tdm_partition needs.

mxfp4: op_tests/test_flydsl_batched_gemm.py, 80 shapes passed before the run
hit a GPU memory access fault whose faulting kernel is a Tensile assembly
kernel (Cijk_Alik_Bljk_..._ISA1250_...), not a FlyDSL one -- the same
shared-device instability seen on main elsewhere in this branch.
combine: no single-GPU entry point; compile-checked only.

Not converted: mxfp4_preshuffle_gfx1250_tdm.py's segmented add_tdm_loads
folds each wave's inner offset into the base pointer. The tiled coordinate
rest counts tiles rather than rows, so that offset has to move into the
rest's starting index instead, across six callers with different geometries,
and it carries a per-iteration tail extent as well. That class of mistake
produces wrong addresses, not a compile error, so compile-only evidence
cannot cover it.

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

* [FlyDSL] black formatting

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

---------

Co-authored-by: Claude Opus 5 <[email protected]>
shantipriya-amd pushed a commit to shantipriya-amd/aiter that referenced this pull request Nov 18, 2026
…atom (ROCm#7213)

* [FlyDSL] Migrate five gfx1250 TDM stores to the tiled atom

Converts the five `fx.rocdl.make_tdm_atom` sites that are plain
(non-gather, non-split-padding) copies to
`fx.rocdl.cdna5.make_tiled_tdm_atom` + `tdm_partition`:

  gemm_a8w8_gfx1250.py:922          C store
  gemm_a4w4_256x256_gfx1250.py:848  C store
  gemm_a4w4_gfx1250.py:471          C store
  mla_pagesize1_fp8_fp8.py:1517     per-wave O store
  mla_pagesize1_bf16_bf16.py:1450   per-wave O store

All five are padded stores. A TDM store cannot drain a padded LDS tile, so
each spells the pad the way the old interface did: `tdm_tile` is the PADDED
width and the global view's inner extent is the REAL width, leaving the
derived padAmount at 0 and letting boundary_check drop the pad columns. The
old `tensor_extents` clamps move into the view's shape unchanged, including
the runtime ones (`mn_oob`, `store_rows`), so M tails, split-k offsets,
`batched` offsets and the zero-row invalid-wave store all behave as before.

Dropped `early_timeout=False` on the a8w8 C store (already false).

Verified against the FlyDSL wheel aiter pins (`flydsl==0.4.1`), not a local
FlyDSL checkout, with each variant in its own FLYDSL_RUNTIME_CACHE_DIR:

  test_gemm_a8w8_mxfp8_bpreshuffle.py   36 shapes, err 0, median -0.07%
  test_gemm_a4w4.py                    116 rows / 58 timed, err 0, median +0.03%
  test_mla_flydsl.py                    45 shapes, err 0, median -0.31%

Baselines came from a separate worktree at main. Outliers past +/-5% appear
in both directions on the a4w4 suite and match its known run-to-run spread.

Not converted, with reasons:
  - gemm_a8w8_gfx1250.py:318/332/348 -- the A load carries A_PAD_SPLIT split
    padding, which a flat LDS box cannot express; needs the K axis split into
    pad-interval chunks on box and view both, plus a K-extent audit at every
    caller. Its mx128 scale caller additionally needs FlyDSL ROCm#1309, which is
    NOT in the pinned 0.4.1.
  - mxfp4_preshuffle_gfx1250_tdm.py:680/801/2362 and
    mega_moe_gfx1250/combine.py:460 -- convertible, but no single-GPU op_test
    reaches them; they need an output-equivalence driver rather than a suite.
  - the gather/scatter family -- make_tiled_tdm_atom takes only
    TensorLoad()/TensorStore().

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

* [FlyDSL] Convert the a8w8 B load too, and drop the added comments

Continues the same refactor: gemm_a8w8_gfx1250.py:332's B load moves to the
layout-friendly interface. Its K advance becomes an i32 tile index on the
coordinate rest instead of a byte imm_offset, and the view spans the whole K,
which also retires the per-iteration "extent_1" write that handled the K
tail. B_LDS_ROW == tile_k * 16, so the box carries no padding, as before.

Verified per shape against main over the configurations the B path varies on
-- sk4, sk2 fused-splitk, sk1 and t256x256x128 -- err 0 on both sides, timing
within noise. The full-suite sequential run is currently unusable on this
machine: it takes a GPU memory access fault at a different shape each run on
main as well as on this branch, with other tenants on the same device.

Also removes the explanatory comments added by the previous commit.

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

* [FlyDSL] Convert the mxfp4 C stores and the combine scale load

Three more sites onto the layout-friendly interface:

  mxfp4_preshuffle_gfx1250_tdm.py  make_tdm_store helper + both C-store callers
  mega_moe_gfx1250/combine.py:460  scale-plane load

mxfp4's three store branches collapse into one tiled_store helper: with
STORE_PAD == 0 the padded width STORE_PITCH equals STORE_N, so the no-pad
branch is the same expression and no longer needs its own code path.

combine's scale plane was held back by the 16-byte tile_dim0 span floor, as
its own comment recorded. The pinned flydsl is now 0.4.1, which carries the
relaxed padAmount-gated rule, so the plane gets the SC_TILE the comment
described and its LDS view grows the size-1 rest that tdm_partition needs.

mxfp4: op_tests/test_flydsl_batched_gemm.py, 80 shapes passed before the run
hit a GPU memory access fault whose faulting kernel is a Tensile assembly
kernel (Cijk_Alik_Bljk_..._ISA1250_...), not a FlyDSL one -- the same
shared-device instability seen on main elsewhere in this branch.
combine: no single-GPU entry point; compile-checked only.

Not converted: mxfp4_preshuffle_gfx1250_tdm.py's segmented add_tdm_loads
folds each wave's inner offset into the base pointer. The tiled coordinate
rest counts tiles rather than rows, so that offset has to move into the
rest's starting index instead, across six callers with different geometries,
and it carries a per-iteration tail extent as well. That class of mistake
produces wrong addresses, not a compile error, so compile-only evidence
cannot cover it.

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

* [FlyDSL] black formatting

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

---------

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants