build: check for the bad combo of Cuda >= 13.2 but LLVM < 22.1.2 (#2133)

Fixes #2129

CUDA 13.2+ requires LLVM 22.1.2+ for the _NV_RSQRT_SPECIFIER fix.

Assisted-by: Claude Code / sonnet-4.6

Signed-off-by: Larry Gritz <lg@larrygritz.com>
This commit is contained in:
Larry Gritz
2026-07-10 15:02:02 -07:00
committed by GitHub
parent e5552e0097
commit ab7b8cea3c
+10
View File
@@ -132,6 +132,16 @@ if (OSL_USE_OPTIX)
message (FATAL_ERROR "NVPTX target is not available in the provided LLVM build")
endif()
# CUDA 13.2+ requires LLVM 22.1.2+ for the _NV_RSQRT_SPECIFIER fix.
# See: https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/issues/2129
if (CUDA_VERSION VERSION_GREATER_EQUAL "13.2" AND LLVM_VERSION VERSION_LESS "22.1.2")
message (FATAL_ERROR
"${ColorRed}CUDA ${CUDA_VERSION} requires LLVM 22.1.2 or newer "
"(you have LLVM ${LLVM_VERSION}). CUDA 13.2+ needs the "
"_NV_RSQRT_SPECIFIER fix from llvm-project commit c1c833734cf0, "
"first shipped in LLVM 22.1.2. Either upgrade LLVM or downgrade CUDA.${ColorReset}")
endif ()
set (CUDA_LIB_FLAGS "--cuda-path=${CUDA_TOOLKIT_ROOT_DIR}")
# If the user wants, try to use static libs here to putting static lib