Skip to content

[TRITON] Add gluon support for MXFP4 quant kernel in gfx950 and gfx1250#4193

Open
NimitPtl wants to merge 4 commits into
ROCm:mainfrom
NimitPtl:quant_mxfp4
Open

[TRITON] Add gluon support for MXFP4 quant kernel in gfx950 and gfx1250#4193
NimitPtl wants to merge 4 commits into
ROCm:mainfrom
NimitPtl:quant_mxfp4

Conversation

@NimitPtl

Copy link
Copy Markdown

Motivation

Using gluon instead of triton for performance improvement

Technical Details

Gluon kernel, with sizes derived from the TTGIR of Triton kernel.

Test Plan

Test suite as well as benchmark script for testing accuracy and speed of quant kernel.

Test Result

Marginal improvement for gfx950 and around 10% improvement with usage of LDS in gfx1250

Submission Checklist

@NimitPtl NimitPtl self-assigned this Jul 10, 2026
@NimitPtl NimitPtl requested a review from azaidy July 10, 2026 23:18
@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 on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 4193 --add-label <label>

@NimitPtl NimitPtl marked this pull request as ready for review July 10, 2026 23:36
@NimitPtl NimitPtl requested a review from a team July 10, 2026 23:36
@NimitPtl NimitPtl force-pushed the quant_mxfp4 branch 6 times, most recently from 70ea8b9 to dfea523 Compare July 11, 2026 00:16
@cagrikymk cagrikymk changed the title Add gluon support for quant kernel in 350 and 450 [TRITON] Add gluon support for quant kernel in 350 and 450 Jul 11, 2026
@cagrikymk cagrikymk changed the title [TRITON] Add gluon support for quant kernel in 350 and 450 [TRITON] Add gluon support for MXFP4 quant kernel in gfx950 and gfx1250 Jul 11, 2026

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 move this file (aiter/ops/triton/gluon/quant_mxfp4.py) to aiter/ops/triton/_gluon_kernels/{gfx950,gfx1250}/quant/quant.py

_gluon_kernels folder is to store the arch specific gluon implementations. Also, given equivalent triton implementation lives under quant/quant.py , we can do the same for gluon implementations to mirror the existing structure.

order=[0, 1],
)

for pid_n in range(start_n, min(start_n + NUM_ITER, N), num_stages=NUM_STAGES):

@cagrikymk cagrikymk Jul 11, 2026

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.

Can you double check if num_stages has any effect for gluon implementations?

As far as I know the pass that creates multiple stages for the loops is specific to the triton backend:

https://github.com/triton-lang/triton/blob/c57bbbd8c1d83a8388baa508cf1286bfdad1695d/third_party/amd/backend/compiler.py#L288

If this is no-op, it will be confusing later.

If you want to add multi-stage support, you need to manually do so, similar to how it is done for the 1250 implementation (double buffering to break the dependency between memory op and quant op).

)
load_idx += 1

x_reg = gl.amd.cdna4.async_copy.load_shared_relaxed(

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.

I think it is better to use regular lds load here instead of cdna specific relaxed load.

bs_offs_n = pid_n * NUM_QUANT_BLOCKS + gl.arange(0, NUM_QUANT_BLOCKS)
bs_offs = bs_offs_m[:, None] * stride_bs_m + bs_offs_n[None, :] * stride_bs_n
if EVEN_M_N:
gl.store(bs_ptr + bs_offs, bs_e8m0)

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.

This can be added later, but TDM store might be useful here for perf.

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