Skip to content

TRITON: Tune mxfp4 quantization kernel - #452

Merged
rahulbatra85 merged 7 commits into
mainfrom
cagri/tune-mxfp4-quant
May 21, 2025
Merged

rahulbatra85 merged 7 commits into
mainfrom
cagri/tune-mxfp4-quant

Conversation

@cagrikymk

Copy link
Copy Markdown
Contributor

This PR tunes the Triton mxfp4 quantization kernel and adds the workaround for the 32-bit stride issue where (M*N) > (2^31 - 1) causes integer overflow in pointer arithmetic. The pointer arithmetic for the kernel is now in int64.

The update includes larger block size for the N dimension (multiple blocks of 32), multiple iterations per program with pipelining and parameter tuning.

Performance numbers for bfloat16 to mxfp4 on mi350:

M N Orig. GB/s New Code GB/s Speedup
1 16384 10.9 15.3 1.41
4 16384 40.9 57.3 1.40
8 16384 79.7 109.8 1.38
16 16384 157.2 212.5 1.35
2048 16384 2391.0 2624.6 1.10
4096 16384 2264.1 2899.1 1.28
8192 16384 2061.1 3140.6 1.52
1 53248 17.3 39.2 2.26
4 53248 65.9 158.3 2.40
8 53248 136.0 300.0 2.21
16 53248 263.3 529.6 2.01
2048 53248 2548.1 3071.2 1.21
4096 53248 2784.5 3243.9 1.17
8192 53248 2869.5 3346.9 1.17

@vgokhale
vgokhale requested review from rahulbatra85 and vgokhale May 20, 2025 19:14
Comment thread aiter/ops/triton/quant.py Resolved
Comment thread aiter/ops/triton/quant.py Resolved
@rahulbatra85
rahulbatra85 merged commit adfca08 into main May 21, 2025
@rahulbatra85
rahulbatra85 deleted the cagri/tune-mxfp4-quant branch May 21, 2025 02:21
valarLip pushed a commit that referenced this pull request Mar 18, 2026
* tune mxfp4 quant. kernel and add 64 bit stride workaround

* cast all strides to int64

* comvert grid to tuple

* code cleanup

* code cleanup and config for small N values

* revert bit manip. logic for max. value to the previous state

* code cleanup
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