Skip to content
  • Robert Maynard's avatar
    CUDA: Pass more link libraries to device linking · 41eab150
    Robert Maynard authored and Brad King's avatar Brad King committed
    Previously we dropped non-target items from the device link line because
    nvcc rejects paths to shared library files, and only with target items
    do we know the kind of library.  However, this also prevents projects
    from linking to system-provided libraries like `cublas_device` that
    contain device code.
    
    Fix this by passing more link items to device linking.  Items that are
    not file paths, such as `-lfoo`, can simply be passed unconditionally.
    Items that are targets known to be shared libraries can still be
    skipped.  Items that are paths to library files can be passed directly
    if they end in `.a`.  Otherwise, pass them using `-Xnvlink` to bypass
    nvcc's front-end.  The nvlink tool knows to ignore shared library files.
    
    Issue: #16317
    41eab150