FlyDSL icon indicating copy to clipboard operation
FlyDSL copied to clipboard

[gfx1250][gemm] Make mxscale B-scale preshuffle tile-independent

Open aoli26 opened this issue 5 months ago • 0 comments

Motivation

Decouple gfx1250 MXScale B-scale preshuffle from the GEMM tile shape, and unify each scale side onto a single path (A = VGPR ring, B = 32x4) while dropping the experimental/legacy scale paths that had accumulated.

Technical Details

  • B-scale: every scheduler (row-major / quadrant / deep pipeline / fp4 bank-friendly) now uses the tile-independent 32x4 preshuffle_scale layout [N//32, K//128, 32, 4]; op_sel pairs adjacent 16-N halves on even-rep fp8/a8w4.
  • A-scale: always the natural buffer_load->VGPR ring (M op_sel for power-of-2 rep); the LDS scaffolding is kept for a future TDM->LDS A-scale path.
  • Add kernel-side 32x4 B-scale LDS load, including a 4-byte-aligned lds_load_b32_raw for the one-i32-per-atom reads.
  • ptpc-fp8 now uses the dedicated no-scale WMMA (wmma_f32_16x16x128_fp8_fp8); fix the ptpc row-major s_wait_dscnt scale-ds over-count.
  • Update the host-side preshuffle_scale helper, test config/CLI args, and benchmark/graph-replay plumbing.
  • Drop legacy paths (use_scale_opsel, legacy B preshuffle, the nws cooperative TDM loop, A-tdm; TDM is always wave-specialized, num_warps>=2); consolidate predicates to is_mxscale, drop the n4k4/natural naming, and remove dead code.

Test Plan

python3 -m pytest tests/kernels/test_gemm_fp8fp4_gfx1250.py

Test Result

All tests passed; ptpc/a8w4 and unchanged paths stay ISA byte-identical (the ptpc-fp8 ISA change is the intended no-scale WMMA), and the mxscale schedulers pass offline parity + GPU cosine across schedulers, tiles, and dtypes.

Submission Checklist

  • [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.

aoli26 avatar Jun 14 '26 15:06 aoli26