Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions cmake/CuteDsl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -769,25 +769,34 @@ function(cute_dsl_setup)

# Link the static archive + shim + driver lib into LINK_TARGETS.
#
# For STATIC libraries, use PUBLIC so executables that link edgellmCore /
# edgellmKernels also inherit the CuTe DSL archive. Otherwise unresolved AOT
# wrapper symbols only show up at the final executable link step.
# For STATIC libraries, propagate the archive, cudart shim, driver library,
# and wrap option to dependents. The final executable performs the actual link
# step, so it must inherit all CuTe DSL runtime compatibility pieces.
foreach(_tgt ${ARG_LINK_TARGETS})
get_target_property(_tgt_type ${_tgt} TYPE)
if(_tgt_type STREQUAL "STATIC_LIBRARY")
target_link_libraries(${_tgt} PUBLIC "${_static_lib}")
target_link_libraries(${_tgt} PUBLIC "${_static_lib}"
trt_edgellm_cutedsl_cudart_shim)
else()
target_link_libraries(${_tgt} PRIVATE "${_static_lib}"
trt_edgellm_cutedsl_cudart_shim)
endif()
if(CUDA_DRIVER_LIB AND NOT CUDA_DRIVER_LIB MATCHES "-NOTFOUND$")
target_link_libraries(${_tgt} PRIVATE "${CUDA_DRIVER_LIB}")
if(_tgt_type STREQUAL "STATIC_LIBRARY")
target_link_libraries(${_tgt} PUBLIC "${CUDA_DRIVER_LIB}")
else()
target_link_libraries(${_tgt} PRIVATE "${CUDA_DRIVER_LIB}")
endif()
endif()
# CUDA < 12.8: wrap _cudaLaunchKernelEx (cudaKernel_t → CUfunction, e.g.
# JetPack 6).
if(NOT _cute_dsl_cuda_ver STREQUAL "" AND _cute_dsl_cuda_ver VERSION_LESS
12.8)
target_link_options(${_tgt} PRIVATE "-Wl,--wrap=_cudaLaunchKernelEx")
if(_tgt_type STREQUAL "STATIC_LIBRARY")
target_link_options(${_tgt} INTERFACE "-Wl,--wrap=_cudaLaunchKernelEx")
else()
target_link_options(${_tgt} PRIVATE "-Wl,--wrap=_cudaLaunchKernelEx")
endif()
endif()
endforeach()

Expand Down