fix: exclude host-only MemoryUsage.cpp from CUDA compilation (nvcc 12.8.1 + GCC 13 cudafe++ crash) - #125
Merged
Merged
Conversation
…vcc 12.8.1 + GCC 13 cudafe++ crash src/MemoryUsage.cpp is pure host C++ (calls getrusage) and contains no device code. When KYNEMA_DRIVER_ENABLE_CUDA=ON, set_cuda_build_properties() was unconditionally marking every .cpp source as LANGUAGE CUDA, routing MemoryUsage.cpp through nvcc's cudafe++ front-end, which crashes on the GCC 13 libstdc++ header stl_construct.h (internal assertion failure at lexical.c in find_allocated_name_reference). Fix: extend set_cuda_build_properties() to accept an optional ARGN list of host-only source file paths. Those files are removed from the CUDA sources list and explicitly set to LANGUAGE CXX so they compile through g++ directly. Register src/MemoryUsage.cpp as a host-only source from CMakeLists.txt. All other .cpp files continue to be compiled as CUDA.
Copilot
AI
changed the title
[WIP] Fix CUDA compilation error with nvcc 12.8.1
fix: exclude host-only MemoryUsage.cpp from CUDA compilation (nvcc 12.8.1 + GCC 13 cudafe++ crash)
Jul 23, 2026
jrood-nrel
marked this pull request as ready for review
July 23, 2026 19:20
jrood-nrel
approved these changes
Jul 23, 2026
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.
set_cuda_build_properties()unconditionally marks every.cppsource asLANGUAGE CUDA, routing pure host-only files likesrc/MemoryUsage.cppthrough nvcc'scudafe++front-end. On nvcc 12.8.1 with GCC 13 as the host compiler,cudafe++hits an internal assertion infind_allocated_name_referencewhile parsingstl_construct.h, aborting the build.Changes
cmake/kynema-driver-utils.cmakeset_cuda_build_properties()now accepts an optionalARGNlist of host-only source pathsLANGUAGE CXX, bypassing nvcc entirelyCMakeLists.txt_kynema_host_only_srcscontainingsrc/MemoryUsage.cppand passes it to everyset_cuda_build_properties()call in the CUDA-enabled blockCUDA=OFFpath