[ROCm] Fix missing hip_bfloat16 include in MoE permute dispatch header - #1066
Merged
Conversation
csrc/moe/permute_unpermute_kernels/dispatch.h uses hip_bfloat16 in ScalarType2CudaType<at::ScalarType::BFloat16> but never includes the header that declares it (hip/hip_bfloat16.h). It only compiled by relying on some other header transitively pulling that declaration in before dispatch.h was processed; that transitive path stopped working with the 2026-07-28 ROCm/PyTorch nightlies, breaking the ROCm wheel build with: error: unknown type name 'hip_bfloat16'; did you mean '__hip_bfloat16'? hip_bfloat16 (host-side type from hip/hip_bfloat16.h) and __hip_bfloat16 (device-native type from hip/amd_detail/amd_hip_bf16.h) are distinct HIP types; dispatch.h intentionally uses the former, so the fix is to include its header directly rather than depend on include-order luck from callers. Changes: - Add #include <hip/hip_bfloat16.h> under the USE_ROCM branch in dispatch.h, alongside the existing hip_fp8.h include. Co-authored-by: Claude Signed-off-by: Matthias Gehre <matthias.gehre@amd.com>
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.
Why
CI's "Build RDNA3/3.5 prototype wheels" workflow started failing on 2026-07-28 with:
dispatch.huseship_bfloat16(declared inhip/hip_bfloat16.h) inScalarType2CudaType<at::ScalarType::BFloat16>, but never includes thatheader — it only includes
hip/hip_fp8.h. The type name was only visiblebecause something reachable through
torch/all.htransitively pulled it inbefore
dispatch.hwas processed; that transitive path broke with the2026-07-28 ROCm/PyTorch nightlies (
rocm==7.15.0a20260728,torch==2.12.0+rocm7.15.0a20260728). The previous day's nightlies(
...a20260727) built the same file cleanly, and no vLLM commit touchedcsrc/moe/in between, so this is an upstream nightly change, not a vLLMregression.