Skip to content

[ROCm] Fix missing hip_bfloat16 include in MoE permute dispatch header - #1066

Merged
mgehre-amd merged 1 commit into
gfx11from
matthias.fix-moe-dispatch-hip-bfloat16
Jul 28, 2026
Merged

[ROCm] Fix missing hip_bfloat16 include in MoE permute dispatch header#1066
mgehre-amd merged 1 commit into
gfx11from
matthias.fix-moe-dispatch-hip-bfloat16

Conversation

@mgehre-amd

@mgehre-amd mgehre-amd commented Jul 28, 2026

Copy link
Copy Markdown

Why

CI's "Build RDNA3/3.5 prototype wheels" workflow started failing on 2026-07-28 with:

csrc/moe/permute_unpermute_kernels/dispatch.h:49:16: error: unknown type name 'hip_bfloat16'; did you mean '__hip_bfloat16'?

dispatch.h uses hip_bfloat16 (declared in hip/hip_bfloat16.h) in
ScalarType2CudaType<at::ScalarType::BFloat16>, but never includes that
header — it only includes hip/hip_fp8.h. The type name was only visible
because something reachable through torch/all.h transitively pulled it in
before dispatch.h was processed; that transitive path broke with the
2026-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 touched
csrc/moe/ in between, so this is an upstream nightly change, not a vLLM
regression.

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>
@mgehre-amd
mgehre-amd requested a review from roberteg16 July 28, 2026 15:10

@roberteg16 roberteg16 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mgehre-amd
mgehre-amd merged commit cfd0297 into gfx11 Jul 28, 2026
4 checks passed
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