Skip to content

[FlyDSL] flydsl implementation of a16w16 gemm - #2725

Merged
omuhamma merged 63 commits into
mainfrom
omuhamma/fly_a16w16
Sep 14, 2026
Merged

omuhamma merged 63 commits into
mainfrom
omuhamma/fly_a16w16

Conversation

@omuhamma

@omuhamma omuhamma commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

To write the gemm for gfx1250 in flydsl

FlyDsl Pr: ROCm/FlyDSL#401

Test Plan

Unit tests & performance taken on HW

e2e testing on HW

Benchmarked with ISL/OSL 1k, 64 CONC, 640 num prompts

Test Result

All tests pass

server and benchmark work, accuracy remains the same (90%) before and after the change as well (with lm_eval)

image

Submission Checklist

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:triton-355 Run Triton tests on MI355 in addition to MI325
ci:sglang SGLang integration tests
ci:atom ATOM benchmark (DeepSeek-R1 + GPT-OSS)
ci:vllm vLLM benchmark
ci:all All of the above

Add labels via the sidebar or gh pr edit 2725 --add-label <label>

@omuhamma omuhamma self-assigned this Apr 13, 2026
@coderfeli

Copy link
Copy Markdown
Collaborator

@omuhamma is this validated on silicon? could you plz also create a pr to flydsl if ready? Also, @yadaish is also trying naive gemm here.

@omuhamma

Copy link
Copy Markdown
Contributor Author

@coderfeli Its only been tested on AM workflows as of now, I will further optimize the code and test it on hardware soon.

Added FlyDSL PR to the description

@zufayu
zufayu requested review from yzhou103 and removed request for yzhou103 June 26, 2026 08:57
@zufayu
zufayu removed the request for review from yzhou103 July 13, 2026 02:23
@omuhamma
omuhamma marked this pull request as ready for review July 20, 2026 15:18
@omuhamma
omuhamma requested a review from a team July 20, 2026 15:18
coderfeli
coderfeli previously approved these changes Sep 4, 2026
Comment thread aiter/tuned_gemm.py Resolved
Comment thread aiter/tuned_gemm.py Resolved
coderfeli
coderfeli previously approved these changes Sep 9, 2026

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all changes should under "aiter/ops/flydsl/"

@omuhamma
omuhamma merged commit acc17ad into main Sep 14, 2026
56 checks passed
@omuhamma
omuhamma deleted the omuhamma/fly_a16w16 branch September 14, 2026 14:30
sammysun0711 pushed a commit to sammysun0711/aiter that referenced this pull request Sep 16, 2026
* flydsl implementation of a16w16 gemm, WIP

* Code styling and unit test fixes

* UT update

* code updates, best runs

* Kernel updates,split k for smaller configs and unroll variable

* Update shuffle.py

* Added compute bound variant + black/ruff

* black/ruff

* black/ruff

* new api

* Cleanup pt2

* Reverting UT changes that existed for AM

* Revert prev commit

* small refactor

* Splitting up kernel / wrapper

* black/ruff

* refactor with claude skill

* black/ruff

* kernel updates based off comments

* black/ruff

* Update gemm_a16w16_gfx1250.py

* oob edge cases

* Revert "Update gemm_a16w16_gfx1250.py"

This reverts commit da29bb5.

* e2e testing and fixes

* Wire flydsl_gfx1250 a16w16 dispatch into tuned_gemm solMap

The tuned CSV rows added for gfx1250 (libtype=flydsl_gfx1250) had no
matching solMap entry, so those bf16 shapes would KeyError at dispatch.
Add the kernelName parser (tile/warp/buffer/split_k/unroll encoding) and
the flydsl_gfx1250_gemm dispatch wrapper, and register it in solMap.

Addresses PR review feedback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Update aiter/tuned_gemm.py

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Address review nits: fx-native LDS pointer, single typed casts

- _frag transposed load: replace raw llvm_dialect.inttoptr +
  ir.Type.parse("!llvm.ptr<3>") with fx.PointerType/fx.inttoptr/
  fx.to_llvm_ptr (matches chunk_gated_delta_h); drops the flydsl._mlir
  imports entirely.
- Collapse redundant fx wraps in _f32/_imm64/_slot_off to single typed
  casts.

No functional change: 172/172 op tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Support FlyDSL >=0.3.1: version-gate raw buffer op aux argument

FlyDSL 0.3.1 changed raw_ptr_buffer_store/atomic_fadd's trailing aux
from a required SSA operand (i32 Value) to an optional MLIR attribute;
the old Value form raises on store and is silently dropped on
atomic_fadd (losing the split-k device-scope bits). Gate the four call
sites on the installed version at compile time: <=0.3.0 keeps the
operand form, >=0.3.1 passes aux=SCOPE_DEV as an int and omits the zero
aux on stores.

Tested: 172/172 op tests on both flydsl 0.3.0 and 0.3.1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* resolving comments

* removing bad copies, and unncessary padding

* config picker, refactor, kernel change to prevent copies with split k

* Fix ruff I001 and drop deleted is_flydsl_available import

Co-authored-by: Cursor <cursoragent@cursor.com>

* Addressing comments

* CI fix

---------

Co-authored-by: Satya Nikhil <nikhil.kodukula@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Felix Li <felix.li@amd.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Xiake Sun <xiake.sun@amd.com>
RElbers pushed a commit that referenced this pull request Sep 25, 2026
* flydsl implementation of a16w16 gemm, WIP

* Code styling and unit test fixes

* UT update

* code updates, best runs

* Kernel updates,split k for smaller configs and unroll variable

* Update shuffle.py

* Added compute bound variant + black/ruff

* black/ruff

* black/ruff

* new api

* Cleanup pt2

* Reverting UT changes that existed for AM

* Revert prev commit

* small refactor

* Splitting up kernel / wrapper

* black/ruff

* refactor with claude skill

* black/ruff

* kernel updates based off comments

* black/ruff

* Update gemm_a16w16_gfx1250.py

* oob edge cases

* Revert "Update gemm_a16w16_gfx1250.py"

This reverts commit da29bb5.

* e2e testing and fixes

* Wire flydsl_gfx1250 a16w16 dispatch into tuned_gemm solMap

The tuned CSV rows added for gfx1250 (libtype=flydsl_gfx1250) had no
matching solMap entry, so those bf16 shapes would KeyError at dispatch.
Add the kernelName parser (tile/warp/buffer/split_k/unroll encoding) and
the flydsl_gfx1250_gemm dispatch wrapper, and register it in solMap.

Addresses PR review feedback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Update aiter/tuned_gemm.py

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Address review nits: fx-native LDS pointer, single typed casts

- _frag transposed load: replace raw llvm_dialect.inttoptr +
  ir.Type.parse("!llvm.ptr<3>") with fx.PointerType/fx.inttoptr/
  fx.to_llvm_ptr (matches chunk_gated_delta_h); drops the flydsl._mlir
  imports entirely.
- Collapse redundant fx wraps in _f32/_imm64/_slot_off to single typed
  casts.

No functional change: 172/172 op tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Support FlyDSL >=0.3.1: version-gate raw buffer op aux argument

FlyDSL 0.3.1 changed raw_ptr_buffer_store/atomic_fadd's trailing aux
from a required SSA operand (i32 Value) to an optional MLIR attribute;
the old Value form raises on store and is silently dropped on
atomic_fadd (losing the split-k device-scope bits). Gate the four call
sites on the installed version at compile time: <=0.3.0 keeps the
operand form, >=0.3.1 passes aux=SCOPE_DEV as an int and omits the zero
aux on stores.

Tested: 172/172 op tests on both flydsl 0.3.0 and 0.3.1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* resolving comments

* removing bad copies, and unncessary padding

* config picker, refactor, kernel change to prevent copies with split k

* Fix ruff I001 and drop deleted is_flydsl_available import

Co-authored-by: Cursor <cursoragent@cursor.com>

* Addressing comments

* CI fix

---------

Co-authored-by: Satya Nikhil <nikhil.kodukula@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Felix Li <felix.li@amd.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
RElbers pushed a commit that referenced this pull request Sep 25, 2026
* flydsl implementation of a16w16 gemm, WIP

* Code styling and unit test fixes

* UT update

* code updates, best runs

* Kernel updates,split k for smaller configs and unroll variable

* Update shuffle.py

* Added compute bound variant + black/ruff

* black/ruff

* black/ruff

* new api

* Cleanup pt2

* Reverting UT changes that existed for AM

* Revert prev commit

* small refactor

* Splitting up kernel / wrapper

* black/ruff

* refactor with claude skill

* black/ruff

* kernel updates based off comments

* black/ruff

* Update gemm_a16w16_gfx1250.py

* oob edge cases

* Revert "Update gemm_a16w16_gfx1250.py"

This reverts commit da29bb5.

* e2e testing and fixes

* Wire flydsl_gfx1250 a16w16 dispatch into tuned_gemm solMap

The tuned CSV rows added for gfx1250 (libtype=flydsl_gfx1250) had no
matching solMap entry, so those bf16 shapes would KeyError at dispatch.
Add the kernelName parser (tile/warp/buffer/split_k/unroll encoding) and
the flydsl_gfx1250_gemm dispatch wrapper, and register it in solMap.

Addresses PR review feedback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Update aiter/tuned_gemm.py

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Address review nits: fx-native LDS pointer, single typed casts

- _frag transposed load: replace raw llvm_dialect.inttoptr +
  ir.Type.parse("!llvm.ptr<3>") with fx.PointerType/fx.inttoptr/
  fx.to_llvm_ptr (matches chunk_gated_delta_h); drops the flydsl._mlir
  imports entirely.
- Collapse redundant fx wraps in _f32/_imm64/_slot_off to single typed
  casts.

No functional change: 172/172 op tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Support FlyDSL >=0.3.1: version-gate raw buffer op aux argument

FlyDSL 0.3.1 changed raw_ptr_buffer_store/atomic_fadd's trailing aux
from a required SSA operand (i32 Value) to an optional MLIR attribute;
the old Value form raises on store and is silently dropped on
atomic_fadd (losing the split-k device-scope bits). Gate the four call
sites on the installed version at compile time: <=0.3.0 keeps the
operand form, >=0.3.1 passes aux=SCOPE_DEV as an int and omits the zero
aux on stores.

Tested: 172/172 op tests on both flydsl 0.3.0 and 0.3.1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* resolving comments

* removing bad copies, and unncessary padding

* config picker, refactor, kernel change to prevent copies with split k

* Fix ruff I001 and drop deleted is_flydsl_available import

Co-authored-by: Cursor <cursoragent@cursor.com>

* Addressing comments

* CI fix

---------

Co-authored-by: Satya Nikhil <nikhil.kodukula@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Felix Li <felix.li@amd.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants