Repository navigation
[FlyDSL] Tdm new interface refactor: make_tdm_atom -> make_tiled_tdm_atom - #7213
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
NOT READY FOR HUMAN REVIEWPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
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]>
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]>
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]>
Co-Authored-By: Claude Opus 5 <[email protected]>
19ad990 to
0e9beab
Compare
add_tdm_loads was the one site PR #7213 left behind: it carved each wave's slice out by hand, folding the slice offset into the base pointer, and the tiled coordinate rest counts tiles rather than rows, so that offset had to move somewhere else across six callers with different geometries. It does not have to move anywhere. The atom is now built with num_warps=len(wv) and tdm_partition hands each owner its share of the same compact LDS traversal, whichever axis that splits. The outer/inner segment arithmetic, the per-wave base offsets and the split_inner flag that chose between the two axes all go away, along with the Job fields that carried them. Each view spans every k-tile its rest index reaches instead of one tile at a runtime offset, so the ragged last tile is clamped by the view's own extent: the per-iteration extent_1 write, its is_tail predicate and the tail_ext field are gone, and imm_offset becomes the rest's tile number. pad_interval / pad_amount are implicit in a box row wider than the tile, so the pad argument survives only as an assertion that the two agree. Net -5 lines, and the remaining asserts state the invariants the old form computed: the rest steps exactly one tile per k-tile, and a padded row stays inside the pad interval's encodable range. No make_tdm_atom call sites remain in aiter. Unverified: the GPU was busy and the AOT dry run reaches the GPU runtime for every config on main as well, so neither path could gate this yet. Co-Authored-By: Claude Opus 5 <[email protected]>
…atom (#7655) * [FlyDSL] Migrate the a8w8 gfx1250 A load and scale atoms to the tiled atom Seven make_tdm_atom sites: the A load and the six scale atoms _tdm1 builds. _tdm1 now returns (atom, blk). Every scale view spans the whole K rather than one k-tile, because the rest index the copy uses carries the split-k base and a one-split extent would put the later tiles out of bounds, where boundary_check returns zeros instead of failing. The ragged last tile is clamped by that same extent, so _tail -- which wrote extent_1 per iteration, a slot the tiled atom does not expose -- is gone, and with it K_REM and the six sa_imm/sb_imm closures. The mx128 B scale is the site the migration notes recorded as unconvertible: its (N_BLOCKS, K_WS) tile collapses to one element along the contiguous mode at tile_k == 128, which deriveTdmAtom could not describe. flydsl 0.4.2 carries ROCm/FlyDSL#1309, which puts the contiguous mode's filler dim at the front, so it builds now. The non-m-major mx128 A scale keeps K on its outer axis and takes its rest from there. The A load pads once per A_PAD_INTERVAL. A flat (row, stride) box states a single skip at the end, so a row needing more than one pad splits its K axis on the global view and the LDS box alike; A_PAD_SPLIT == 1 keeps the flat form, so the common path is untouched. early_timeout is dropped rather than restored as atom state: on the tiled atom bit 21 comes from a runtime slot guarded by assume(early == 0 || mask != 0), and writing it under a zero mask is undefined behaviour. Unverified: the AOT dry run reaches the GPU runtime on this machine for every config on main as well (0 ok / 2011 failed either side), so it is not a usable compile gate here, and the GPU was busy. Co-Authored-By: Claude Opus 5 <[email protected]> * [FlyDSL] Migrate the mxfp4 segmented TDM loader to the tiled atom add_tdm_loads was the one site PR #7213 left behind: it carved each wave's slice out by hand, folding the slice offset into the base pointer, and the tiled coordinate rest counts tiles rather than rows, so that offset had to move somewhere else across six callers with different geometries. It does not have to move anywhere. The atom is now built with num_warps=len(wv) and tdm_partition hands each owner its share of the same compact LDS traversal, whichever axis that splits. The outer/inner segment arithmetic, the per-wave base offsets and the split_inner flag that chose between the two axes all go away, along with the Job fields that carried them. Each view spans every k-tile its rest index reaches instead of one tile at a runtime offset, so the ragged last tile is clamped by the view's own extent: the per-iteration extent_1 write, its is_tail predicate and the tail_ext field are gone, and imm_offset becomes the rest's tile number. pad_interval / pad_amount are implicit in a box row wider than the tile, so the pad argument survives only as an assertion that the two agree. Net -5 lines, and the remaining asserts state the invariants the old form computed: the rest steps exactly one tile per k-tile, and a padded row stays inside the pad interval's encodable range. No make_tdm_atom call sites remain in aiter. Unverified: the GPU was busy and the AOT dry run reaches the GPU runtime for every config on main as well, so neither path could gate this yet. Co-Authored-By: Claude Opus 5 <[email protected]> * [Docs] Record that make_tdm_atom is retired in aiter Both skills still described fx.rocdl.make_tdm_atom as a live interface with a migration pending. No aiter kernel calls it any more, so they now say so and spell out what replaced each parameter: extents and strides move into the global view's layout, imm_offset becomes the coordinate tensor's tile index, pad_interval / pad_amount become row slack in the LDS box, and a hand-split across waves becomes num_warps plus a matching tdm_partition warp layout. early_timeout is called out as dropped rather than rewritten, because on the tiled atom that bit comes from a runtime slot guarded by assume(early == 0 || mask != 0) and writing it under a zero mask is undefined behaviour. The remaining exception is the gather/scatter family. The 16-byte innermost span is noted as a FlyDSL check rather than an ISA rule, and the one-element contiguous-mode tile is noted as fixed in flydsl 0.4.2 (ROCm/FlyDSL#1309). Co-Authored-By: Claude Opus 5 <[email protected]> * [FlyDSL] Define the pad-interval bound the mxfp4 loader asserts against The assert added with the tiled-atom migration referenced _TDM_MAX_PAD_INTERVAL_BYTES, which is defined in gemm_a8w8_gfx1250.py and not here. It sits inside a traced function, so the NameError was a trace-time crash rather than a lint error: every launch of this kernel died before the migrated loader ran at all. Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude Opus 5 <[email protected]>
…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]>
Summary
make_tdm_atom -> make_tiled_tdm_atom
Motivation
Changes
Performance (if applicable)
Testing
Documentation
Dependencies
Breaking Changes
PR Self-Review
Reviewed revision
Behavior and intent
Validation and unverified scope
PR-specific question
Changed op tests