cuda: fused FWHT quantizer for 64-wide warps - #303
Merged
Merged
Conversation
The fused FWHT + q8_1 quantizer asserted QK8_1 == warp_size, so it did not compile for wave64 HIP targets (gfx908, gfx90a, gfx942) and broke the ROCm release build. A 64-wide warp holds two complete 32-blocks and the 32-wide warp reductions already reduce each half, so index the block with lane % QK8_1 and only require warp_size to be a multiple of QK8_1. 32-wide warps are unchanged.
khosravipasha
approved these changes
Oct 2, 2026
khosravipasha
left a comment
Collaborator
There was a problem hiding this comment.
🤖 Reviewing on behalf of the maintainers
The wave64 indexing fix looks correct and preserves wave32 behavior. Please update the PR with the ROCm compile results when available; wave64 hardware validation remains outstanding.
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.
Overview
The Prism release build fails on
ubuntu-22-rocm(run 37038350494). The fused FWHT + q8_1 quantizer inquantize.cuassertsQK8_1 == warp_size, so every instantiation fails to compile for the wave64 targets in that job (gfx908, gfx90a, gfx942).windows-hippasses because it only builds 32-wide RDNA targets.A 64-wide warp holds two complete 32-blocks of the transform output. The quantizer already reduces with
warp_reduce_max<QK8_1>/warp_reduce_sum<QK8_1>, which on HIP shuffle with width 32 and so reduce each half on its own. The only 32-wide assumption left is the block indexiqs = lane. This changes it tolane % QK8_1and relaxes the assert towarp_size % QK8_1 == 0. The shared butterfly (ggml_cuda_fwht_block_butterfly) is already generic in the warp size.On 32-wide warps
lane % 32 == lane, so NVIDIA and RDNA behave exactly as before.Testing
rocm/dev-ubuntu-22.04:7.2.1-complete, same version as the release job) with the release job's HIP flags (-DHIP_PLATFORM=amd -DGGML_HIP_ROCWMMA_FATTN=ON):prismat a14c7de,GPU_TARGETS=gfx90a: fails inquantize.cuwith the same32 == warp_sizestatic assert as the release run.GPU_TARGETS=gfx908;gfx90a;gfx942:ggml-hipbuilds and links, 0 errors.Requirements