Skip to content

fix cuda 12.x compile error: Include cuda_fp8.h / cuda_bf16.h where their types are used - #12

Merged
ZJY0516 merged 1 commit into
vllm-project:devfrom
blueskygzhz:fix/iwyu-cuda-fp8-bf16-includes
Sep 19, 2026
Merged

ZJY0516 merged 1 commit into
vllm-project:devfrom
blueskygzhz:fix/iwyu-cuda-fp8-bf16-includes

Conversation

@blueskygzhz

Copy link
Copy Markdown

layout/mega_mhc.cuh declares __nv_fp8_e4m3 and nv_bfloat16 members, and layout/sparse_mqa_logits.cuh declares nv_bfloat16 members, but neither header includes <cuda_fp8.h> or <cuda_bf16.h>. Both types are currently reachable only transitively via the cutlass/CCCL header chain.

Under CUDA 13 that chain happens to expose them, so host compilation succeeds. CUDA 12.x does not, and any host translation unit that pulls in mega_mhc.cuh fails with:

deep_gemm/layout/mega_mhc.cuh:64:5:
  error: '__nv_fp8_e4m3' does not name a type
     64 |     __nv_fp8_e4m3* y_fp8;
        |     ^~~~~~~~~~~~~

csrc/python_api.cpp includes every api header unconditionally, so this breaks the _C extension build on CUDA 12.x regardless of the target architecture list -- including SM90-only builds that never compile the SM100 mega_mhc kernels.

Include the headers that declare the types instead of relying on transitive includes. No functional change; this is a no-op on CUDA 13.

layout/mega_mhc.cuh declares __nv_fp8_e4m3 and nv_bfloat16 members, and
layout/sparse_mqa_logits.cuh declares nv_bfloat16 members, but neither
header includes <cuda_fp8.h> or <cuda_bf16.h>. Both types are currently
reachable only transitively via the cutlass/CCCL header chain.

Under CUDA 13 that chain happens to expose them, so host compilation
succeeds. CUDA 12.x does not, and any host translation unit that pulls in
mega_mhc.cuh fails with:

    deep_gemm/layout/mega_mhc.cuh:64:5:
      error: '__nv_fp8_e4m3' does not name a type
         64 |     __nv_fp8_e4m3* y_fp8;
            |     ^~~~~~~~~~~~~

csrc/python_api.cpp includes every api header unconditionally, so this
breaks the _C extension build on CUDA 12.x regardless of the target
architecture list -- including SM90-only builds that never compile the
SM100 mega_mhc kernels.

Include the headers that declare the types instead of relying on
transitive includes. No functional change; this is a no-op on CUDA 13.

Signed-off-by: blueskygzhz <blueskygzhz@users.noreply.github.com>
@blueskygzhz blueskygzhz changed the title Include cuda_fp8.h / cuda_bf16.h where their types are used fix cuda 12.x compile error: Include cuda_fp8.h / cuda_bf16.h where their types are used Sep 16, 2026
@ZJY0516
ZJY0516 merged commit e1f418c into vllm-project:dev Sep 19, 2026
1 check 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