Skip to content

[TRITON] Optimize per token fp8 quant kernel - #306

Closed
vgokhale wants to merge 1 commit into
mainfrom
vinayak/quant_optimization
Closed

vgokhale wants to merge 1 commit into
mainfrom
vinayak/quant_optimization

Conversation

@vgokhale

@vgokhale vgokhale commented Apr 17, 2025 •

Copy link
Copy Markdown
Contributor
  1. Made the grid equal to num rows. Previously it was one WG every 32 rows. (60us -> 5.5us)
  2. Added cache modifiers for ld/st (5.5us -> 4.7us)
  3. Explicit reciprocal to avoid Newton Raphson steps on result (4.7 -> 3.5us)

Results on 128 x 8192 tensor. Roofline ~1us.

This is now exposing HBM latency. Can't really optimize more without significant effort.

@vgokhale vgokhale self-assigned this Apr 17, 2025
@rahulbatra85
rahulbatra85 force-pushed the vinayak/quant_optimization branch 2 times, most recently from 83c3783 to 0421aaf Compare April 17, 2025 14:30
@vgokhale vgokhale changed the title Optimize per token fp8 quant kernel [TRITON] Optimize per token fp8 quant kernel Apr 17, 2025
jayfurmanek
jayfurmanek previously approved these changes Apr 17, 2025
	-Optimized per token fp8 quant kernel
	 1) Made the grid equal to num rows. Previously it was one
	    WG every 32 rows. (60us -> 5.5us)
	 2) Added cache modifiers for ld/st (5.5us -> 4.7us)
	 3) Explicit reciprocal to avoid Newton Raphson steps on
	    result (4.7 -> 3.5us)
	   Results on 128 x 8192 tensor. Roofline ~1us.

	-Fixed bug with per tensor quant
	  1) Needed a second kernel call to quantize after computing
             atomic max
	  2) Also did perf optimizations similar to the per_token quant to
             the other kernels.
@rahulbatra85
rahulbatra85 force-pushed the vinayak/quant_optimization branch from 744d8db to acbd434 Compare April 18, 2025 01:12
@rahulbatra85

Copy link
Copy Markdown
Contributor

Pulled into this PR
#304

amirakb89 pushed a commit that referenced this pull request May 29, 2026
Verbatim snapshot of ROCm/FlyDSL kernels/moe_blockscale_2stage.py
(PRs #164 / #252 / #306). Only change: rewrite two `from kernels.X`
imports to relative `.X` for the aiter package layout. All referenced
helpers already exist in aiter's mfma_preshuffle_pipeline.py and
mfma_epilogues.py.

Co-Authored-By: Claude Opus 4 <[email protected]>
amirakb89 pushed a commit that referenced this pull request Jun 9, 2026
Verbatim snapshot of ROCm/FlyDSL kernels/moe_blockscale_2stage.py
(PRs #164 / #252 / #306). Only change: rewrite two `from kernels.X`
imports to relative `.X` for the aiter package layout. All referenced
helpers already exist in aiter's mfma_preshuffle_pipeline.py and
mfma_epilogues.py.

Co-Authored-By: Claude Opus 4 <[email protected]>
amirakb89 pushed a commit that referenced this pull request Jun 11, 2026
Verbatim snapshot of ROCm/FlyDSL kernels/moe_blockscale_2stage.py
(PRs #164 / #252 / #306). Only change: rewrite two `from kernels.X`
imports to relative `.X` for the aiter package layout. All referenced
helpers already exist in aiter's mfma_preshuffle_pipeline.py and
mfma_epilogues.py.

Co-Authored-By: Claude Opus 4 <[email protected]>
amirakb89 pushed a commit to amirakb89/aiter that referenced this pull request Jun 19, 2026
Verbatim snapshot of ROCm/FlyDSL kernels/moe_blockscale_2stage.py
(PRs ROCm#164 / ROCm#252 / ROCm#306). Only change: rewrite two `from kernels.X`
imports to relative `.X` for the aiter package layout. All referenced
helpers already exist in aiter's mfma_preshuffle_pipeline.py and
mfma_epilogues.py.

Co-Authored-By: Claude Opus 4 <[email protected]>
@zufayu
zufayu deleted the vinayak/quant_optimization branch August 11, 2026 06:44
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