Build systems bake absolute paths into installed artifacts: nvcc
records its own location in the linker command lines it embeds, and
CMake freezes whatever it resolved at configure time into exported
targets. Nix counts any store hash as a reference, so a compiler that
is only ever a nativeBuildInput ends up a runtime dependency.
- gdrcopy: gdrcopy_pplat is the only test built with relocatable
device code, and nvlink embeds its command line, naming both
cuda_nvcc and the cudart that supplied cudadevrt. Neither is needed
at runtime: no binary here has libcudart in DT_NEEDED, and
libcuda.so.1 comes from the driver. CUDA 13 only; on 13.3 the
closure drops from 688,439,736 to 61,081,560 bytes, and all seven
releases now have identical reference sets.
- cudnn-frontend: upstream passes CUDAToolkit_INCLUDE_DIRS to
target_include_directories as a bare absolute path and never
forwards the dependency, so consumers inherit a build-machine path
instead of resolving the toolkit themselves. Confine the path to the
build and export the dependency, so find_package(CUDAToolkit) runs
in the consumer's environment. Closure drops from 1,360,621,552 to
171,758,136 bytes. This is load-bearing rather than cosmetic: on
CUDA 12 crt/ ships in cuda_nvcc and cuda_runtime_api.h includes it,
so a consumer using only find_package(cudnn_frontend) previously
relied on that exported path to compile at all.
- libnvshmem: NVSHMEMEnv.cmake bakes every -D*_HOME into
NVSHMEM_BUILD_VARS, a diagnostic banner that nvshmem-info and
init.cu only ever print, and substitutes it into an installed header
so consumers inherit it too. Strip the dev outputs and nvcc; gdrcopy
and mpi appear in the same string but are genuine runtime
dependencies. References drop from 16 to 12.
gdrcopy also gains a disallowedRequisites guard so the leak cannot
return unnoticed. libnvshmem deliberately does not: ucx and openmpi
pull nvcc into its closure independently of the banner, so the guard
would fail for reasons unrelated to this change.
Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>