CUDA C++ Compiler Updates Impacting ELF Visibility and Linkage

AI-generated summary of reporting by NVIDIA Developer Blog. Read the original for the full story.

Why it matters

CUDA 13.0's NVCC defaults will silently break shared libraries and header-only template code that currently compiles, forcing developers to fix link errors or opt out with new flags.

Read this as

NVIDIA is changing how its CUDA compiler (the tool that builds code for Nvidia graphics chips) works, starting with CUDA 13.0. Programs split across multiple files will now fail during the build stage instead of silently misbehaving at runtime, which is easier to fix. This mainly affects developers who package CUDA code into shared libraries on Linux and other non-Windows systems, and anyone using header-only libraries like Thrust. Old behaviour can be restored with compiler flags or code annotations.

Teams maintaining CUDA C++ shared libraries on Linux face build breakage when they move to CUDA 13.0, as symbol-export and template-stub defaults flip to stricter settings. The upside is that silent, hard-to-debug runtime crashes, caused by duplicate statically linked CUDA runtime libraries or merged kernel stubs, become visible link errors at build time. Migration paths exist via NVCC flags or visibility attributes; Windows is unaffected.

CUDA 13.0 NVCC makes two default changes: (1) __global__ functions and __managed__/__device__/__constant__ variables get hidden ELF visibility on non-Windows platforms, so dual statically linked CUDART instances no longer export symbols across shared library boundaries; (2) in whole-program mode (-rdc=false), __global__ function template stubs get internal linkage, preventing the host linker from merging identically named stubs across translation units. Opt-outs: --device-entity-has-hidden-visibility=false, -static-global-template-stub=false, or __attribute__((visibility("default"))). Flags exist since CUDA 12.8; -fvisibility does not override the annotations.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

CUDA 13.0 NVCC CUDART Thrust Linux CUDA 12.8

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading