[all-commits] [llvm/llvm-project] dfcd28: [offload] Add `dlwrap::loaded` function to check f...

blazej-smorawski via All-commits all-commits at lists.llvm.org
Mon Aug 3 07:57:41 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dfcd28df1d80c1056aa820bd148e6dba42166945
      https://github.com/llvm/llvm-project/commit/dfcd28df1d80c1056aa820bd148e6dba42166945
  Author: blazej-smorawski <56126596+blazej-smorawski at users.noreply.github.com>
  Date:   2026-08-03 (Mon, 03 Aug 2026)

  Changed paths:
    M offload/plugins-nextgen/amdgpu/CMakeLists.txt
    A offload/plugins-nextgen/common/include/APIHelpers.h
    M offload/plugins-nextgen/common/include/DLWrap.h
    M offload/plugins-nextgen/cuda/CMakeLists.txt
    M offload/plugins-nextgen/level_zero/CMakeLists.txt
    M offload/plugins-nextgen/level_zero/dynamic_l0/L0DynWrapper.cpp
    M offload/plugins-nextgen/level_zero/include/L0CmdListManager.h
    A offload/plugins-nextgen/level_zero/include/L0Compat.h

  Log Message:
  -----------
  [offload] Add `dlwrap::loaded` function to check for optional symbols (#210737)

This PR adds a new template into `dlwrap` namespace that can be used to
check if a symbol was correctly loaded. It adds and easy way to see if
version of shared object in a system has required capability. We could
use it to improve prefetch in CUDA backend as noted
[here](https://github.com/llvm/llvm-project/blob/main/offload/plugins-nextgen/cuda/src/rtl.cpp#L912)
without breaking compatibility with older platforms using CUDA older
than 13.

In the case of prefetch, the new `dlwrap` API could be used like: 
```cpp
bool BatchedPrefetchAvailable = dlwrap::loaded<cuMemPrefetchBatchAsync>();
if (BatchedPrefetchAvailable)
    cuMemPrefetchAsync(....)
else
    // Current implementation
```

Small note, to implement the prefetch we will also have to make loading
of the symbols optional inside plugins too. This would require to change
it
[here](https://github.com/llvm/llvm-project/blob/main/offload/plugins-nextgen/cuda/dynamic_cuda/cuda.cpp#L176),
but I think that the change can be a part of a PR that implements
prefetch.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list