[gfx1201] Enable quantization kernels for gfx1201#3
Open
big-yellow-duck wants to merge 2 commits intomainfrom
Open
[gfx1201] Enable quantization kernels for gfx1201#3big-yellow-duck wants to merge 2 commits intomainfrom
big-yellow-duck wants to merge 2 commits intomainfrom
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
tjtanaa
reviewed
Mar 16, 2026
csrc/include/ck_tile/vec_convert.h
Outdated
| #undef CK_TILE_TYPE_CONVERT | ||
|
|
||
| } // namespace ck_tile | ||
| } // namespace ck_tile No newline at end of file |
tjtanaa
reviewed
Mar 16, 2026
csrc/include/hip_reduce.h
Outdated
|
|
||
| return local; | ||
| } | ||
| } No newline at end of file |
Member
There was a problem hiding this comment.
@big-yellow-duck remove this unnecessary line change
tjtanaa
reviewed
Mar 16, 2026
csrc/kernels/quant_kernels.cu
Outdated
| asm volatile( "s_mov_b32 m0 %0\n\t" | ||
| "buffer_load_dword %1, %2, 0 offen offset:0 lds\n\t" | ||
| ::"s"(lds_ptr_sgpr), "v"(offset), "s"(buffer_hash.cached_rsrc): "memory", "m0"); | ||
| asm volatile("s_mov_b32 m0, %0; buffer_load_dword %1, %2, 0 offen lds;" :: "s"(lds_ptr_sgpr), "v"(offset), "s"(buffer_hash.cached_rsrc) : "memory"); |
Member
There was a problem hiding this comment.
@big-yellow-duck is this change necessary? It looks the same. If it is just a alignment issue, please revert this to original code. Let's not reformat the code to avoid confusion. This makes the reviewer thinks you have modified the instruction.
Author
There was a problem hiding this comment.
the patch was to fix the smooth quant kernel on gfx1201 but it will affect gfx9 gpus. changed to another implementation for gfx12 cards
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
FP8 quantization operations fail on AMD gfx1201 (RDNA4) architecture due to three compatibility issues:
v_pk_mul_f32assembly instruction is not supported on gfx11/gfx12This PR enables FP8 quantization support on gfx1201 by addressing these incompatibilities.
Technical Details
1. FP8 Dtype Registration (
aiter/utility/dtypes.py)Added gfx1201 to the default FP8 dtype mapping to enable
torch.float8_e4m3fnsupport on RDNA4.2. Scalar Multiplication Fallback (
csrc/include/ck_tile/vec_convert.h)The
v_pk_mul_f32assembly instruction is not supported on gfx11/gfx12. Addedamd_scalar_mul_f32()function as a portable fallback:The conversion functions
fp32x2_t_to_fp8x2_tandfp32x2_t_to_int8x2_tnow conditionally use the scalar path:3. DPP Broadcast Replacement (
csrc/include/hip_reduce.h)DPP broadcast operations are not supported on gfx11/gfx12. Replaced with
rocprim::warp_shuffle()for cross-lane communication in:wave_reduce()- for WarpSize > 16 and WarpSize > 32 reductionsmultithread_reduce()- for 16-thread and 32-thread reduction pathsExample change:
4. Naive load to LDS fallback (
csrc/kernels/quant_kernels.cu)gfx12x Fallback to naive loading from global memory to LDS in
smooth_per_token_scaled_quant_kernel.Test Plan
Run the quantization test suite with various tensor sizes:
Test Result
All quantization tests pass successfully on gfx1201:
Submission Checklist