Repository navigation
Commit 26b4f5d
authored
Don't log an error when there are no CUDA backend symbols to promote (#23895)
### Summary
`load_library` re-opens the library that holds the CUDA backend with
`RTLD_NOLOAD | RTLD_GLOBAL` to make its symbols global. When the backend
is linked into the executable, as in a statically linked runner,
`dladdr` names the executable, and `dlopen` finds no library to re-open
and sets no error. So every first load logged "Failed to promote
symbols: (null)", although the executable's symbols are already global
and there is nothing to promote. The error is now logged only when
`dlopen` reports one; `dlerror()` is cleared before the call so a stale
error is not reported.
This PR was authored with AI (Claude Code).
### Test plan
`backends/cuda/runtime/platform/platform.cpp` compiles (`g++ -std=c++17
-fsyntax-only -Wall -Wextra`). The `dlopen` behavior the change relies
on, checked with a small program that calls `dlopen(<its own path>,
RTLD_NOW | RTLD_GLOBAL | RTLD_NOLOAD)` on glibc 2.39 (Jetson AGX Thor,
Ubuntu 24.04):
```
dli_fname=./noload handle=(nil) dlerror=(null)
```
cc @cccclai @nil-is-all @Gasoonjia @digantdesai1 parent b086d44 commit 26b4f5d
1 file changed
Lines changed: 15 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
93 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
94 | 107 | | |
95 | 108 | | |
96 | 109 | | |
| |||
0 commit comments