fix: compile error on RDNA4 (gfx1201) ROCm#815
Open
Kaihui-AMD wants to merge 1 commit into
Open
Conversation
Signed-off-by: Kaihui-AMD <Kaihui.Tang@amd.com>
Author
|
@turboderp @kingbri1 Would you mind taking a look? This fixes an RDNA4 (gfx1201) compile blocker in rms_norm.cu and layer_norm.cu — two small changes, CUDA path unchanged. Thanks! |
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.
Summary — AMD consumer GPUs
ExLlamaV2 fails to compile on RDNA4 GPUs (gfx1201: RX 9070, RX 9060, R9700) with ROCm 7.x.
rms_norm.cuandlayer_norm.cudefineNUM_WARPS = 1024 / warpSizeunderUSE_ROCM. On HIP,warpSizeis a runtime__device__variable (RDNA4 supports both wave32 and wave64), soNUM_WARPSis not a compile-time constant. This causes:__shared__ float sums[NUM_WARPS]— variable length array in shared memoryNUM_THREADS—__device__variable used in__host__contexterror: variable length array declaration cannot have 'static' storage duration shared float sums[NUM_WARPS];
Fix
Add compile-time constants
MAX_NUM_WARPS(32) andNUM_THREADS_CONST(1024):__shared__arrays useMAX_NUM_WARPS(upper bound: 1024 / 32 = 32 warps)NUM_THREADS_CONST(NUM_WARPS * WARP_SIZE= 1024 for all warp sizes)Test environment
rocm/pytorch:rocm7.2.3_ubuntu24.04_py3.12_pytorch_release_2.9.1Test results
Build:
pip install --no-build-isolation -e .— success (was failing before)test_hgemm.py: 24/24 GEMM shapes passed