mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[GH-ISSUE #295] [Bug]: NVRTC JIT compilation fails on CUDA 12.8 (smxx_clean_logits.cuh: expression must have a constant value) #150
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepGEMM#150
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @LilySu on GitHub (Mar 25, 2026).
Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/295
Describe the bug
When running DeepGEMM on CUDA 12.8, the
fp8_mqa_logitskernel fails to JIT-compile via NVRTC. The compiler throws an error stating thatcute::numeric_limits<float>::infinity()cannot be used as aconstexpr.Error Log
Root Cause & Investigation
In CUDA 12.8 device code, the underlying implementation of
cuda::std::numeric_limits<float>::infinity()insidelibcxx/include/limitsis missing theconstexprqualifier under NVRTC's stripped-down compilation environment.What we tried before finding the fix
/root/.deep_gemm,/workspace/.deep_gemm_cache/cache).pip install --no-build-isolation .)..egg-info,.pthfiles).CPLUS_INCLUDE_PATHto CUTLASS headers (NVRTC ignores it).__builtin_inff()) — NVRTC strips host-side built-ins and throws an undefined identifier error.__int_as_float(0xff800000)) — NVRTC refuses to evaluate it as a constant expression.try/exceptfallback usingtorch.einsumto bypass the crashed kernel — this successfully unblocked the model run, confirming the JIT failure was the only roadblock.-1e38fraw literal worked as a true compile-time constant for NVRTC.Proposed Fix / Workaround
To maintain compatibility with CUDA 12.8 without requiring users to upgrade to 12.9, replacing the standard library call with a raw float literal fixes the NVRTC compilation instantly.
In
deep_gemm/include/deep_gemm/impls/smxx_clean_logits.cuh(Line 17):Change from:
constexpr float neg_inf = -cute::numeric_limits<float>::infinity();Change to:
constexpr float neg_inf = -1e38f;Since
-1e38fmathematically acts as negative infinity to mask out attention scores during the Softmax step, it preserves accuracy while bypassing the NVRTCconstexprlimitation.Environment
d30fc36runpod-torch-v280)