Replace per-capability libdevice bitcode with unified libdevice.10.bc#9226
Open
alexreinking wants to merge 1 commit into
Open
Replace per-capability libdevice bitcode with unified libdevice.10.bc#9226alexreinking wants to merge 1 commit into
alexreinking wants to merge 1 commit into
Conversation
Halide vendored NVIDIA's libdevice.compute_{20,30,35}.10.bc since its
original CUDA/PTX backend (~2013), and picked between them via a
capability table that was never extended past sm_50. Every newer
capability (sm_61 and up) silently linked libdevice.compute_20.10.bc,
a Fermi-era math library, regardless of the actual target GPU.
NVIDIA replaced the whole per-capability split with a single
libdevice.10.bc back in CUDA 9.0 (2017). Switch to vendoring that
file instead (taken from CUDA 11.6) and simplify the Makefile,
CMakeLists.txt, and LLVM_Runtime_Linker.cpp accordingly: one initmod,
no capability-based selection logic.
Fixes #9225
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.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.
Summary
libdevice.compute_{20,30,35}.10.bc) since its original CUDA/PTX backend landed circa 2013. NVIDIA itself dropped this per-capability split in CUDA 9.0 (2017) in favor of a single, architecture-genericlibdevice.10.bc.LLVM_Runtime_Linker.cppwas never extended pastsm_50, so every newer capability Halide supports (sm_61,sm_70,sm_75,sm_80,sm_86) silently fell through tolibdevice.compute_20.10.bc— a Fermi-era (2010) file — regardless of the actual target GPU.libdevice.10.bc(sourced from CUDA Toolkit 11.6) and simplifiesMakefile,src/runtime/CMakeLists.txt, andsrc/LLVM_Runtime_Linker.cppaccordingly: one initmod, no capability-based selection table to keep in sync as NVIDIA adds compute capabilities.src/runtime/nvidia_libdevice_bitcode/README.mddocumenting what the file is, how to refresh it, and the governing NVIDIA CUDA Toolkit EULA.Fixes #9225
Test plan
libHalidefrom scratch (Ninja, LLVM 22, NVPTX enabled) with these changes; links clean.sin/sqrtGPU pipeline to PTX forsm_35,sm_61, andsm_86targets — all succeed.sm_61output now calls into the new libdevice (__nv_sinf,__internal_trig_reduction_slowpath,__nv_fmul_rn), where previously it would have silently linked the Fermi-eracompute_20file instead.