Repository navigation
[HIP] [FlyDSL] conv3d: kW and kH x kW LDS reuse of the im2col input on gfx950 - #6421
Conversation
The implicit-GEMM conv3d reloads the same input pixels from L2 once per filter tap; on the hot VAE layers L2 was ~97% busy and the kernel time tracked L2 traffic / L2 rate. Add an opt-in A path (AITER_CONV3D_KW_REUSE=1): for each (kt, kh, 32-channel block) the block DMAs one strip of tile_m + 2*halo input pixels into LDS, and the KW taps read it back at a row shift of kw*dw. Rows that wrap to the next output row get a per-lane segment offset, so MFMA A fragments are read at per-lane LDS addresses. Groups are double buffered with one barrier per group; the weight packing and the epilogue are unchanged. make_im2col_plan enables it only for stride-1 W, KW > 1, C/groups % 32 == 0, zeros padding, groups == 1, no split-K, no BIG_IN, Wo >= tile_m, and only when its LDS footprint keeps as many blocks resident per CU as the default path (128x192 would go 80 KB -> 96 KB, 2 -> 1 block/CU). gfx950, kernel-only, tuned tile 192x96/3x1: down_0_1 @480x832 1179 -> 1021 us (1.155x) res_96_L0 @1328^2 511 -> 445 us (1.148x) L2 requests x 64B -30 to -32%; DMA 486 -> 297, barriers 41 -> 27. op_tests/test_flydsl_conv_implicit.py: 0 mismatches on every shape; per-pass Wan2.1 encode 1.05-1.06x, decode 1.08x, Qwen-Image 1.04-1.05x. Co-authored-by: Cursor <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
…with kW reuse on
Three changes that cut L2 traffic without lowering blocks per CU, plus the
retune that lets the tables use them.
- Partial last B DMA round. validate_launch_config only needs B's last round
to end on a wave boundary; the waves past its end still issue the DMA, with
the OOB sentinel and a 1 KiB LDS park as destination, so there is no branch.
This makes e.g. 256x96/4x1 legal: 4 waves of 64x96 each, 77 KiB with kW
reuse, two blocks (8 waves) per CU, and a quarter less weight traffic than
192x96.
- XCD-contiguous block numbering. gfx950 deals workgroups round-robin over 8
XCDs; block_coords renumbers them so each XCD runs a contiguous M range
(N fastest when the grid has several N tiles, so an M tile's N tiles share
A in one L2). Coordinates stay Int32: Int64 cost 192x128/1x4 four VGPRs and
half its waves.
- AITER_CONV3D_KW_REUSE defaults to 1, and the tuner prunes candidates by the
LDS the runtime will actually allocate (plan_lds_bytes, via a new
lds_bytes_fn hook in conv3d_policy) instead of the default-path formula.
- Both VAE tables retuned with --max_configs 160 (the newly legal tiles would
otherwise push smaller incumbents out of the 96 cut): 72 of 76 rows change
tile, tuner time 1.21x on both tables.
down_0_1 (Wan2.1, 480x832), kernel-only, sustained load, gfx950:
192x96 kW reuse 1018 us
+ XCD-contiguous 963 us
256x96/4x1 kW reuse 973 us
256x96/4x1 + XCD 911 us (L2 requests 7.57 -> 6.53 GB,
L2-miss reads 1.46 -> 0.49 GB)
op_test per-pass totals vs the previous commit (kW reuse on), same day:
Wan2.1 encode 1.099-1.104x, decode-only shapes 1.156-1.167x,
Qwen-Image 1.078-1.093x; Wan resamplers 368x544 0.986x. All 0 mismatches.
Adds op_test keyword case 2d_tile_256x96 (partial B round on the reuse path).
Co-authored-by: Cursor <[email protected]>
…une) Fresh run of the same retune as the previous commit (branch code, kW reuse on, --max_configs 160), on an idle gfx950. It reproduces that table: the sum of tuner times is within 0.2% (Qwen-Image 5258 -> 5269 us, Wan2.1 8194 -> 8182 us). The 24 rows whose tile changed differ by at most 3% from the previous pick (mostly WGM or wave layout), i.e. near-ties; res_96_L0 @1328^2 moves from 256x96/2x2 to 256x96/4x1 (kernel-only sustained 404 -> 396 us). Against main 89a47b8, same idle GPU, same day: tuner --run_config, all 76 tuned shapes: sum 1.204x (Qwen-Image) / 1.214x (Wan2.1), 75/76 >= 0.97x. op_test per-pass totals: Wan2.1 encode 1.15-1.18x, decode-only shapes 1.25-1.26x, Qwen-Image 1.14-1.15x. 0 mismatches. Co-authored-by: Cursor <[email protected]>
A block can own an R x C patch of output pixels in one (n, t) plane instead of TILE_M consecutive ones (R * C == TILE_M). Per (kt, 32-channel block) it DMAs one LDS patch of (R + (kH-1)dh) x (C + (kW-1)dw) input pixels, and all kH*kW taps read it at a constant offset through the per-lane A read. B uses the default path's 4-stage ring (two taps per barrier); the patch is double buffered per group and its DMA rounds are spread over the batches it may be issued in (all at once was ~3% slower). - Conv3dImplicitParam.block_rows (compile key). make_im2col_plan decides: unit H/W stride, kH or kW > 1, C % 16, C/groups % 32, zeros padding, groups 1, no split-K, no BIG_IN/BIG_OUT, and blocks per CU no lower than on the path the layer would otherwise take (kW reuse where it applies). - Grid: N * Do * ceil(Ho/R) * ceil(Wo/C) M tiles; H/W tails are masked in the epilogue (OutputScatter.store row_of / row_ok). dyn_hw supported (Ho from hw_o / wo). NCDHW vector store kept only when Wo % 4 == 0. - Host: optional tuned-CSV column block_r (missing/empty/Null = 1), carried by the lookup, borrow, AOT and the tuner, which sweeps block_rows = TILE_M / C for C in (32, 64, 128); flydsl_conv_implicit takes block_rows= to force it. - op_test keyword case 2d_block_rows4 (H and W tails). Tables are not retuned in this commit, so production picks are unchanged until a table carries block_r. gfx950, 256x96/4x1, kernel only, sustained, vs kW reuse at the same tile: down_0_1 @480x832 R=4 907.9 -> 824.5 us (1.10x) down_0_1 @368x544 R=8 466.2 -> 419.8 us (1.11x) res_96_L0 @1024^2 R=4 238.0 -> 223.7 us (1.06x) res_96_L0 @1328^2 R=4 396.9 -> 382.4 us (1.04x) down_0_1 PMC: L2 requests 6.53 -> 5.11 GB, DMA 297 -> 225, barriers 27 -> 41, VGPR 228 -> 196. Co-authored-by: Cursor <[email protected]>
Both VAE tables retuned on this branch with kW reuse on and the block_rows sweep (--max_configs 160). 44 of 76 rows now pick block_r > 1 (Qwen-Image 20/32, Wan2.1 22/44). The three Wan2.1 3x3x3 rows at 480x832 with K >= 5184 (C192 242x418, C384 122x210, C384 62x106) timed out under the default --timeout 1800 in the full run and were retuned on their own with --timeout 7200 (375 / 1471 / 447 s, 0 failures). gfx950, conv3d_tune.py --run_config, each tree on its own table, mean of 3 rotating rounds, all 76 shapes OK: vs a664ea4: Qwen-Image sum 5284.3 -> 4816.0 us (1.097x), Wan2.1 sum 8230.6 -> 7324.7 us (1.124x), min 0.987x, no shape below 0.97x vs 89a47b8: Qwen-Image sum 6370.0 -> 4816.0 us (1.323x), Wan2.1 sum 9960.0 -> 7324.7 us (1.360x), only enc_down_384 @1328^2 (stride 2) below 0.97x (0.921x, same as on a664ea4) Co-authored-by: Cursor <[email protected]>
_body_kw_reuse and _body_kh_reuse read geom.cgp, which put the whole ConvGeometry (do/ho/wo/npq) into the closure FlyDSL hashes for the launch's manager_key. Under dyn_hw that made every resolution its own artifact, while the AOT dedupe (one job per layer) compiled only one of them: with the block_r tables, 4 of the 76 rows (two resolutions of one layer with the same config) missed the AOT cache and JIT-compiled on first call. Use the compile-scope CGP instead, as _body does. Fresh-cache AOT (139 jobs) then conv3d_tune.py --run_config under FLYDSL_RUNTIME_RUN_ONLY=1: 76/76 rows OK (was 72/76). op_test full 112 rows, 0 mismatches. Co-authored-by: Cursor <[email protected]>
The 2D-block path stays covered by the VAE model shapes (44 tuned rows take it, 22 of them with an H or W tail) and by the targeted block_rows cases run for the PR; keep the op_test keyword surface to what it was. Co-authored-by: Cursor <[email protected]>
…n it in op_test AITER_CONV3D_KW_REUSE was the only switch the reuse work added, but make_im2col_plan checked it for the kW strip only. With it at 0, all 44 tuned rows with block_r > 1 still took the 2D-block path, and in the final tables only 3 of 76 rows use the kW strip at all, so the switch rolled back almost nothing. kh_layer_ok now requires param.kw_reuse as well: 0 gives one A tile per tap on every row (largest default-path footprint 112 KiB, inside the 160 KiB per CU); 1 (the default) is unchanged. The switch is documented as a temporary rollback while the reuse paths are validated. op_test: the 2D-block path was only reached through tuned-table rows (NCDHW, dyn_hw on). Add KW cases that force block_rows=8 on tile 256x96/4x1: NHWC and NDHWC with H and W tails, W dilation 2, and a stride-2 shape the plan must decline; plus test_block_rows_static, which runs the 2D path with AITER_CONV3D_DYN_HW off for the call. Co-authored-by: Cursor <[email protected]>
- make_im2col_plan: the layer conditions both reuse paths share (switch, scalar K, zeros padding, groups 1, no split-K) are checked once. - Im2colPlan.out_block is set only when kh_reuse applies, so the grid_out_block() filter is gone and callers pass plan.out_block. - compile_conv3d_implicit: N_CC computed once for both reuse bodies. - conv3d_tune: block_rows_options caches (block_rows, plan) per tile, so lds_bytes_fn and the candidate filter stop re-deriving the same plans. - op_test: the forced kH x kW cases share _KH8 and the layout dicts. Checked host-side against the previous commit, with AITER_CONV3D_KW_REUSE at 1 and 0: plan, launch grid, scatter plan and LDS bytes of all 76 tuned rows (both output layouts, block_rows 1/4/8/12) and of the tile-forcing op_test cases; every tuner candidate of the 76 shapes; the AOT job list of both tables and host-side compile_conv3d_implicit of its 136 conv jobs. Co-authored-by: Cursor <[email protected]>
Resolve conflicts with #6421 (gfx950 kW / kH x kW LDS reuse), which also added a block_rows field to the conv3d tuned table: - Use main's tuned-CSV column block_r (TUNED_BLOCK_ROWS_COLUMN, _parse_block_rows) for gfx1250 as well, drop TUNED_OPTIONAL_RESULT_COLUMNS, and rename the gfx1250 tuned CSV header from block_rows to block_r. With two column names the config merge zero-fills the other arch's column, and AOT parse_csv let block_r's default override the gfx1250 value. - conv3d_tune.py: gfx950 keeps main's per-tile block_rows sweep; gfx1250 keeps its policy, which already returns block_rows. Both use main's task tuple order and write block_r. - _conv3d_impl takes both block_rows and patch_reuse; keep the new op test cases from both sides. Co-authored-by: Cursor <[email protected]>
Summary
Cut L2 traffic of the FlyDSL bf16 implicit-GEMM conv3d on gfx950 without lowering blocks per CU, first by
sharing one LDS strip across the kW taps, then by sharing one LDS patch across all kH x kW taps of a 2D output
block, and retune both VAE tables for it. Against
main@89a47b84aon an idle MI355X:down_0_1@480x832 1.43x, Qwen-Imageres_96_L0@1328^2 1.34x.
conv3d_tune.py --run_config), sum of per-shape times:0 mismatches everywhere. Branch
feature/flydsl-conv3d-kw-reuse:5dda31588,576f46dcf,a664ea487,03e548b11,96a94eb41,7270f3c0f,eacb9b1c0,372e6699b,972999632.Motivation
The hot VAE layers (96->96, 3x3(x3), stride 1) are bound by data movement, not by MFMA. On
main,down_0_1moves 11.2 GB through L2 per call:
L2 reads as ~97% busy. Under sustained load the card also sits at its 1000 W cap, with sclk around 1.5 GHz. An
ablation (DMAs redirected to the OOB sentinel, so instructions and LDS writes stay) showed that removing traffic
still pays under sustained load, through power and clock headroom rather than bandwidth:
The constraint that came out of this: a bigger tile only pays if blocks per CU do not drop.
384x96/6x1cuttraffic 28% but halved residency and gained nothing.
Changes
1. kW reuse: one LDS strip per (kt, kh, channel block) (
5dda31588)(kt, kh, 32-channel block)the block DMAs one strip oftile_m + 2*haloinput pixels.KWtaps read the strip back at a row shift ofkw*dw, so A traffic drops to about 1/3.s(m) = m + halo*(m >= m_w), soA fragments are read at per-lane LDS addresses (
MmaTiling.read_a_at, rows frompartition_A).unchanged.
make_im2col_planenables it only for:KW > 1,C/groups % 32 == 0;groups == 1;Wo >= tile_m;this,
128x192goes from 2 to 1 block/CU and runs at 0.70-0.90x.dyn_hw: only the boolean follows the resolution.2. Partial last B round (
576f46dcf)validate_launch_configrequired B's vector count to be a multiple ofblock_threads.TileConfig.b_tail_threads).destination (
WeightLoader.stage,LdsStager.dst(park=...)).256x96/4x1and384x64/4x1become legal. They keep two blocks per CU under kWreuse (77 KiB / 80 KiB) and reload the weights 25-50% less often.
256x96/4x1runs 4 waves of 64x96 each, i.e. 8 waves/CU instead of 6.3. XCD-contiguous block numbering (
576f46dcf)share input rows, but land in different L2s that each fetch those rows again.
block_coordsrenumbers blocks (_xcd_contiguous) so each XCD runs a contiguous range:that L2. Under the old round-robin this sharing happened by accident whenever
grid_m % 8 == 0;decoding M-major lost it and cost those layers 5-14%;
192x128/1x4from 256 to 260 VGPRs, i.e. one wave per SIMD, andcost
res_384_L339%.4. kH x kW reuse: 2D output blocks (
03e548b11)R x Cpatch of output pixels in one(n, t)plane instead ofTILE_Mconsecutive ones (
R * C == TILE_M).Ris the newConv3dImplicitParam.block_rows(compile key); 1 keepsconsecutive rows.
(kt, 32-channel block)the block DMAs one LDS patch of(R + (kH-1)dh) x (C + (kW-1)dw)input pixels, and all
kH*kWtaps read it at a constant offset through the per-lane A read.in (all at once was ~3% slower).
make_im2col_plandecides: unit H/W stride,kHorkW > 1,C % 16,C/groups % 32, zerospadding,
groups == 1, no split-K, no BIG_IN/BIG_OUT, and blocks per CU no lower than on the path the layerwould otherwise take (kW reuse where it applies).
N * Do * ceil(Ho/R) * ceil(Wo/C)M tiles. H and W tails are masked in the epilogue(
OutputScatter.storerow_of/row_ok).dyn_hwis supported (Ho fromhw_o / wo). The NCDHW vectorstore is kept only when
Wo % 4 == 0.block_r(missing / empty /Null= 1), carried by the lookup, theborrow, AOT and the tuner. The tuner sweeps
block_rows = TILE_M / CforCin (32, 64, 128);flydsl_conv_implicittakesblock_rows=to force it.down_0_1(256x96/4x1, R=4 vs kW reuse at the same tile):H or W tail), and
372e6699badds cases that force it independently of the tables (see change 7).5. Defaults, tuner, tables (
576f46dcf,a664ea487,96a94eb41)AITER_CONV3D_KW_REUSEnow defaults to 1. The tables are tuned with it on: some of their tiles only fittwo blocks per CU in the reuse layout. It is part of the compile key, like
AITER_CONV3D_DYN_HW, and since372e6699bit gates both reuse paths (see change 7).conv3d_policytakes anew
lds_bytes_fn(tile)hook, fed fromconv3d_im2col.plan_lds_bytes. Without it,256x96is pruned atthe default-path 88 KiB.
--max_configs 160and theblock_rsweep (96a94eb41):block_r > 1(Qwen-Image 20/32, Wan2.1 24/44), mostly R = 8 or 12;a664ea487: 1.10x (Qwen-Image) and 1.12x (Wan2.1) on the sum of--run_configtimes, no shape below 0.97x (see Results).384x32,384x48) pass the LDS filter and the policy'sfill/area ranking would push small incumbents out of the default 96 cut.
2d_tile_256x96: partial B round on the reuse path.6. Resolution-free closure of the reuse bodies (
7270f3c0f)_body_kw_reuseand_body_kh_reusereadgeom.cgp, which put the wholeConvGeometry(do/ho/wo/npq) into the closure FlyDSL hashes for the launch'smanager_key.dyn_hwthat made every resolution its own artifact, while the AOT dedupe (one job per layer) compiledonly one of them. With the
block_rtables, 4 of the 76 rows (two resolutions of one layer with the sameconfig) missed the AOT cache and JIT-compiled on first call.
CGP, as_bodydoes. Generated code is unchanged.7. One rollback switch for both reuse paths; op_test pins the 2D path (
372e6699b)make_im2col_plancheckedAITER_CONV3D_KW_REUSEfor the kW strip only. With it at 0, all 44block_r > 1rows still took the 2D-block path, and in the final tables only 3 of 76 rows use the kW strip,so the switch rolled back almost nothing. The kH x kW gate now requires it too: 0 runs one A tile per tap on
every row. With 1 (the default) nothing changes.
block_rows=8forced on256x96/4x1:2d_block_rows8_nhwc,3d_block_rows8_ndhwc: NHWC / NDHWC in and out, with H and W tails;2d_block_rows8_dil_w2: W dilation 2;2d_block_rows8_gated_s2: stride 2, which the plan must decline (default path).test_block_rows_static: the 2D path withAITER_CONV3D_DYN_HWoff for the call (static extents),which otherwise only runs when the whole process sets it.
8. Trim the reuse plumbing, no behavior change (
972999632)make_im2col_planchecks the layer conditions both reuse paths share once.Im2colPlan.out_blockis set only when kH x kW reuse applies, so thegrid_out_block()filter is gone andcallers pass
plan.out_block.(block_rows, plan)per tile instead of re-deriving the same plans three times.N_CCis computed once; the forced op_test cases share their keyword dicts.Files:
aiter/aot/flydsl/conv.py,conv3d_gfx950_utils.py,conv3d_im2col.py,conv3d_implicit_gfx950.py,conv3d_policy.py,conv_kernels.py,csrc/flydsl_conv3d/conv3d_tune.py,op_tests/test_flydsl_conv_implicit.py, and the twomodel_configs/*_tuned_conv3d.csv(10 files,+1123 / -153).
Results
Setup
main@89a47b84avs this branch, both on their own production path: own tuned table, own defaults.Hot layers, kernel only
block_rfrom its table).down_0_1@480x832192x96/3x1, branch256x96/4x1 r4)res_96_L0@1328^2192x96/3x1, branch256x96/4x1 r8)Under sustained load the branch runs at a lower sclk (about 1.43-1.49 vs 1.55-1.57 GHz) but does more per
cycle.
What the 2D block adds on top of kW reuse, same tile
256x96/4x1, kernel only, sustained:down_0_1@480x832down_0_1@368x544res_96_L0@1024^2res_96_L0@1328^2PMC on
down_0_1@480x832:192x96/3x1256x96/4x1256x96/4x1 r4Why the hit rate drops with 2D blocks: a block's LDS patch is larger than its output block by the halo it shares
with its neighbours (10x34 vs 8x32 at R=8, +33%). Under kW reuse that overlap was re-read from L2 as hits; with
2D blocks it is mostly missed, so reads past L2 grow (
TCC_EA0_RDREQ, a relative measure: +44% ondown_0_1,+28% on
res_96_L0@1328^2). It does not cost time: a column-strip block order (4 blocks wide) recovered abouthalf of those misses but left sustained time unchanged on
down_0_1andres_96_L0(within 0.4%), so the roworder is kept.
All tuned shapes (
conv3d_tune.py --run_config)89a47b84avs branch96a94eb41(7270f3c0fdoes not changegenerated code).
mean of 3 rotating rounds.
tiles carry
rRwhenblock_r > 1.Against the kW-reuse tables of
a664ea487(same run), i.e. what the 2D blocks and the retune add:Qwen-Image VAE @1024x1024 (16 shapes)
64x96/1x2 g1192x96/4x1 g1192x96/3x1 g1256x96/4x1 g1 r8128x96/2x1 g1128x96/2x2 g1128x192/2x2 g1256x96/4x1 g1 r8128x192/2x2 g1256x96/4x1 g8 r4128x192/2x2 g1128x192/2x2 g1128x192/4x1 g1256x96/4x1 g8 r8128x128/2x2 g8256x96/2x2 g8 r4128x128/2x2 g1128x128/2x4 g8128x128/2x2 g8256x64/4x1 g1 r432x32/1x2 g164x32/2x1 g1128x128/2x4 g1128x96/4x1 g1128x192/4x1 g1256x96/2x2 g1 r8128x192/2x2 g1256x96/2x2 g1 r4128x128/2x2 g1256x96/4x1 g1 r8128x32/2x1 g1256x32/2x1 g1 r8Qwen-Image VAE @1328x1328 (16 shapes)
192x96/3x2 g1192x96/4x1 g1192x96/3x1 g1256x96/4x1 g1 r8192x128/2x2 g1192x96/2x2 g1128x192/2x2 g1384x64/4x1 g8 r12128x192/2x2 g1384x64/4x1 g8 r12128x192/2x2 g1128x192/2x2 g1128x128/4x2 g8384x64/4x1 g8 r12192x128/2x2 g8256x128/2x2 g8 r8192x128/4x1 g1192x128/2x2 g1192x128/1x4 g1256x96/2x2 g1 r832x32/1x2 g464x32/2x1 g1128x192/2x2 g4128x192/2x2 g1128x192/4x1 g1256x96/2x2 g8 r8128x192/2x2 g1384x64/4x1 g4 r1296x96/2x3 g1256x96/2x2 g1 r8192x48/3x1 g1256x32/2x1 g1 r8Wan2.1 VAE @368x544 (22 shapes)
192x128/4x1 g1192x96/4x1 g1192x96/3x1 g1256x96/4x1 g1 r8128x96/2x1 g1128x96/2x2 g1128x96/2x1 g1128x96/2x2 g1128x192/2x2 g1384x64/4x1 g8 r12128x192/2x2 g1384x64/4x1 g8 r1264x64/2x2 g164x64/2x2 g4128x192/2x2 g1128x192/2x2 g1192x128/4x1 g4256x96/2x2 g8 r8192x128/4x1 g8256x96/2x2 g8 r832x32/1x2 g132x32/1x2 g864x64/2x2 g164x64/2x2 g832x32/1x2 g132x32/1x2 g832x32/1x2 g164x32/2x1 g132x32/1x2 g832x32/1x2 g164x64/2x2 g864x64/2x2 g4192x64/4x1 g8256x48/4x1 g8 r8128x192/1x4 g1256x96/2x2 g4 r896x96/3x2 g8384x64/4x1 g8 r1296x96/2x3 g1256x96/2x2 g1 r896x96/2x3 g1256x96/4x1 g1 r864x32/1x2 g1256x32/2x1 g1 r8Wan2.1 VAE @480x832 (22 shapes)
192x96/3x1 g1192x96/4x1 g1192x96/3x1 g1256x96/4x1 g1 r4128x96/1x2 g1128x96/2x2 g1192x128/2x2 g1192x96/4x1 g1128x192/2x2 g1384x64/4x1 g8 r12128x192/2x2 g1384x64/4x1 g4 r1296x96/2x1 g896x96/1x2 g1128x192/2x2 g1128x192/2x2 g1128x128/2x4 g8256x96/2x2 g1 r8128x128/4x2 g8256x96/2x2 g4 r864x64/2x2 g164x64/2x2 g8128x128/2x1 g896x128/3x1 g464x64/2x2 g164x64/2x2 g832x32/1x2 g464x48/4x1 g1 r264x64/2x2 g864x64/2x2 g196x96/2x1 g8192x64/4x1 g4 r6128x192/1x4 g1256x96/2x2 g4 r8128x192/4x1 g1256x96/2x2 g8 r8128x192/2x2 g1384x64/4x1 g1 r1296x96/3x2 g1256x96/4x1 g1 r496x96/2x3 g1256x96/4x1 g1 r896x32/1x2 g1256x32/2x1 g1 r8Testing
op_tests/test_flydsl_conv_implicit.py(full), ateacb9b1c0with the final tables: 111 rows, 0 mismatches,exit 0. Includes the new
2d_tile_256x96case.op_tests/tuning_tests/test_config_shape_collision.py: 20 passed.F.conv3d(rtol = atol = 2e-2), each run with kW reuse on and off: 0mismatches. They cover:
dyn_hwon / off,Wo = tile_m +- 1;256x96/4x1(3D and padded 2D) and192x128/3x1with an N tail.flydsl_conv_implicit(block_rows=)vs fp32F.conv3d: 0 mismatches.They cover H and W tails (
dyn_hwon / off), NCDHW output withWo % 40 and odd, 2D / 3D padding, Wdilation, an N tail,
R = 8with 32 columns, a1x1x3filter, and the gate turning it off (occupancy,stride 2, 8-column blocks).
python -m aiter.aot.flydsl.convinto an empty cache (139 jobs, 0 failed), then both tables through--run_configwithFLYDSL_RUNTIME_RUN_ONLY=1: 76/76 rows OK, no JIT.g4/g8rows.down_0_1256x96/4x1VGPR 228 (kW reuse) / 196 (R=4),192x128/1x4back to 256VGPRs; no scratch.
372e6699b: host-side only so far. Recomputingmake_im2col_planfor all 76 tuned rows gives 44 on the2D path with the switch at 1 (unchanged) and 0 with it at 0 (largest footprint 112 KiB); the four new cases
plan to the paths named in change 7. The new cases still need a gfx950 run (CI MI35X shard 7).
972999632, against372e6699b, withAITER_CONV3D_KW_REUSEat 1 and 0: identical plan, launch grid,scatter plan and LDS bytes for all 76 tuned rows (both output layouts,
block_rows1/4/8/12) and thetile-forcing op_test cases; identical tuner candidates for the 76 shapes; identical AOT job lists, and
host-side
compile_conv3d_implicitpasses for their 136 conv jobs.black/ruffclean on all changed Python files.Notes for reviewers
AITER_CONV3D_KW_REUSEdefaults to 1 andblock_rowsis a new compile-key field,so build-time AOT artifacts have to be regenerated. A mismatch is not wrong, it just JITs on first call.
AITER_CONV3D_KW_REUSE=0turns off both reuse paths, the kW strip and the kH x kWblocks. It is a temporary rollback switch while they are validated. The tables assume it on: tiles such as
256x96and384x64then hold one block per CU (89 / 112 KiB) and are slower thanmain's picks. The XCDnumbering and the partial B round are not behind it; neither changes results.
enc_down_384@1328^2 (C384 333x333 s2, K=384), 0.92x (95.5 -> 103.5 us).It comes from the multi-N-tile block order of change 3, not from the stride:
L2 holds all 3 weight slices (~2.6 MB here) at once.
main's round-robin order shares A across N tiles only by accident (grid_m = 144, a multiple of 8) andkeeps one weight slice per L2 at a time; for this weight-heavy layer that wins by 8% at the same tile.
faster (all within +-0.6%), it is slower on 9 of them, and it makes this row 14% slower (103.5 -> 117.6 us),
because the N-fastest decode then spreads an M tile over three L2s.
--max_configs 160; the default stays 96. Re-tuning with thedefault would see a different candidate set (see change 5).
block_rsweep the large 3x3x3 layers have 430-490 candidates. In the full Wan2.1run three of them (480x832, K >= 5184) passed the default
--timeout 1800; retuned on their own with--timeout 7200they took 375 / 1471 / 447 s. Use--timeout 3600or more for a full retune.run_perftesttiming sits between burst and sustained, and under the power capthe two can rank tiles differently. The tables were picked on the tuner's measure.
Follow-ups
Checked and dropped:
the expected 0.31 GB on
down_0_1(misses unchanged: the half-filled writes were L2 hits) but ran 0.7-1.3%slower under sustained load on
down_0_1andres_96_L0.