Skip to content

[TRITON]: Add fused GEMMs to optimize FF block - #736

Merged
rahulbatra85 merged 20 commits into
mainfrom
willz/fused-ff-gemms
Aug 2, 2025
Merged

rahulbatra85 merged 20 commits into
mainfrom
willz/fused-ff-gemms

Conversation

@willzhou-amd

@willzhou-amd willzhou-amd commented Jul 28, 2025 •

Copy link
Copy Markdown
Contributor

Adding fused GEMM + activation + gating options to reduce memory movement overhead in a FF block.

Changes:

  • Add activation string parameter support for gemm_a16w16 to fuse an activation function with the GEMM.
  • Add gemm_a16w16_gating.py which uses the first half of the (M, N) output along the N dimension as the gating activations and the second half as the layer activations. Produces a tensor of shape (M, N//2). This also includes an activation parameter for the gating activation.
  • Write tests.
  • Write a fully-fused E2E FF kernel. Will go into next PR.

Benchmarks on 350x:
image

Post-tuning:
image

Benchmarks on 300x:
image

Multikernel-ff is where we're at right now (e.g launching two Aiter Triton GEMMs).

@willzhou-amd willzhou-amd self-assigned this Jul 28, 2025
Comment thread aiter/ops/triton/gemm_a16w16_gated.py Resolved
Comment thread aiter/ops/triton/gemm_a16w16_gated.py Resolved

@rahulbatra85 rahulbatra85 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.

Please add logging for the new op

@rahulbatra85
rahulbatra85 merged commit 4822e67 into main Aug 2, 2025
@rahulbatra85
rahulbatra85 deleted the willz/fused-ff-gemms branch August 2, 2025 01:50
valarLip pushed a commit that referenced this pull request Mar 18, 2026
* Add optional fused activation + gating args to a16w16 GEMM

* Add tests for fused a16w16 GEMM

* Formatting changes

* Add gating & activation tests for fused a16w16 GEMM

* Factor out fused GEMM kernel into separate file

* Revert testing tolerances to not affect CI

* Update a16w16 gated GEMM tests

* Factor out FF block function into separate file + write tests + benchmarks

* Add tests for full FF interface

* Formatting changes

* Update fused-act-gate a16w16 benchmark

* Fix shape error for FF interface when y is not provided

* Add tests for ungated FF function

* Tune a16w16 performance for standard & gated GEMMs

* Remove FF interface (will refactor for next PR)

* Add mi300x tuning configs for A16W16 & Gated A16W16 GEMMs

* Fix error with DS config under new config format

* Restore config to previously tuned variables

* Add logging to a16w16 gated GEMM
klin-amd added a commit that referenced this pull request Oct 20, 2026
Add the ROUND_BEFORE_ACT constexpr. The wrapper sets it only on gfx1151,
the arch where the change was measured. The original activation path was
benchmarked on gfx942 and gfx950 (#736). With ROUND_BEFORE_ACT=False, the
kernel compiles to the same instructions as before on gfx942, gfx950 and
gfx1100.

Co-Authored-By: Claude <[email protected]>
menglcai-amd pushed a commit that referenced this pull request Nov 10, 2026
Add the ROUND_BEFORE_ACT constexpr. The wrapper sets it only on gfx1151,
the arch where the change was measured. The original activation path was
benchmarked on gfx942 and gfx950 (#736). With ROUND_BEFORE_ACT=False, the
kernel compiles to the same instructions as before on gfx942, gfx950 and
gfx1100.

Co-Authored-By: Claude <[email protected]>
menglcai-amd pushed a commit that referenced this pull request Nov 22, 2026
Add the ROUND_BEFORE_ACT constexpr. The wrapper sets it only on gfx1151,
the arch where the change was measured. The original activation path was
benchmarked on gfx942 and gfx950 (#736). With ROUND_BEFORE_ACT=False, the
kernel compiles to the same instructions as before on gfx942, gfx950 and
gfx1100.

Co-Authored-By: Claude <[email protected]>
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.

3 participants