Skip to content

[gfx1250] Add A8W8/A8W4/A4W4 compute-bound GEMM - #971

Open
aoli26 wants to merge 34 commits into
mainfrom
gfx1250/gemm-opt-0805
Open

aoli26 wants to merge 34 commits into
mainfrom
gfx1250/gemm-opt-0805

Conversation

@aoli26

@aoli26 aoli26 commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Add 256x256 tile specific compute-bound A8W4, A4W4 and A8W8 kernel for gfx1250.

Technical Details

  • gemm_{a8w8,a8w4,a4w4}_256x256_gfx1250.py (new): hand-scheduled for exactly one profile — 256x256x128 tile, 2x2 waves. Hand-placed s_wait_dscnt/READY fences, odd/even wave-parity loop clones, operand-major planar LDS with B in its own 64 KiB segment.
  • tdm_ops.py: add update_tensor_descriptor_2d_lds_addr (re-point one persistent descriptor per ring slot); widen lds_memref to accept !fly.memref. Both additive.
  • Also folds the a8w8 mx32/mx128/ptpc variants into one launcher via is_mxscale / block_size constexprs.

Test Plan

pytest tests/kernels/test_gemm_fp8fp4_gfx1250.py on gfx1250.

Test Result

All tests passed.

Submission Checklist

@aoli26
aoli26 force-pushed the gfx1250/gemm-opt-0805 branch from 3cf26da to 462fd44 Compare August 6, 2026 09:35
@aoli26
aoli26 force-pushed the gfx1250/gemm-opt-0805 branch from 7e4a5f0 to f5482e9 Compare August 11, 2026 14:57
@aoli26
aoli26 force-pushed the gfx1250/gemm-opt-0805 branch from ace7f0a to 44158f9 Compare August 25, 2026 07:48
@aoli26 aoli26 changed the title [gfx1250] Add 256x256 compute-bound GEMM (WIP) [gfx1250] Add 256x256 compute-bound GEMM Aug 26, 2026
@aoli26 aoli26 changed the title [gfx1250] Add 256x256 compute-bound GEMM [gfx1250] Add A8W8/A8W4/A4W4 compute-bound GEMM Aug 26, 2026
@aoli26
aoli26 marked this pull request as ready for review August 26, 2026 07:23
Copilot AI lite review requested due to automatic review settings August 26, 2026 07:23

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.

Pull request overview

Adds new hand-scheduled, compute-bound GEMM kernels for gfx1250 (A8W8/A8W4/A4W4 at 256-wide tiles) and extends TDM descriptor utilities to support persistent descriptor reuse and !fly.memref LDS views, with expanded correctness/behavioral tests (including split-K reduction and guard-row OOB detection).

Changes:

  • Introduces new gfx1250 compute-bound GEMM launchers for 256x256-family tiles (A8W8/A8W4/A4W4), plus a split-K reduction epilogue kernel.
  • Extends tdm_ops.make_tensor_descriptor_2d to accept Fly shared views and adds update_tensor_descriptor_2d_lds_addr for retargeting persistent descriptors.
  • Refactors/expands the gfx1250 GEMM test harness to cover new modes, profile constraints, split-K, cluster constraints, determinism, and OOB store clamping.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/kernels/test_gemm_fp8fp4_gfx1250.py Refactors mode/case construction; adds coverage for new 256-wide kernels, split-K reduce, determinism, and OOB store clamping.
python/flydsl/expr/rocdl/tdm_ops.py Adds LDS-base extraction for !fly.memref and a helper to update the LDS address field in a 2D descriptor.
kernels/gemm/gemm_a8w8_splitk_reduce_gfx1250.py New split-K partial-reduction epilogue kernel and cached compiler entrypoint.
kernels/gemm/gemm_a8w8_gfx1250.py Unifies mx32/mx128/ptpc launcher knobs; adds split-K support and kernel-name sanitization.
kernels/gemm/gemm_a8w8_256x256_gfx1250.py New hand-scheduled compute-bound A8W8 256-wide kernel with strict tuned-profile assertions.
kernels/gemm/gemm_a8w4_mxscale_gfx1250.py Adds split-K support and updates wave-size handling.
kernels/gemm/gemm_a8w4_256x256_gfx1250.py New hand-scheduled compute-bound A8W4 256x256 kernel (fixed tuned profile).
kernels/gemm/gemm_a4w4_256x256_gfx1250.py New hand-scheduled compute-bound A4W4 256x256 kernel (fixed tuned profile).
kernels/common/kernels_common.py Adds format_kernel_name() to sanitize kernel symbol names for assembly/linking.

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

Comment thread kernels/gemm/gemm_a8w8_splitk_reduce_gfx1250.py Outdated
Comment thread tests/kernels/test_gemm_fp8fp4_gfx1250.py Outdated

This branch has not been deployed

No deployments
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.

2 participants