fix cuda 12.x compile error: Include cuda_fp8.h / cuda_bf16.h where their types are used - #12
Merged
ZJY0516 merged 1 commit intoSep 19, 2026
Conversation
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>
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.
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:
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.