Skip to content

Commit 140ff43

Browse files
authored
Revert "[PROTON] Prefer the default library path when loading profiler backends" (#5749)
Reverts triton-lang/triton#5739 This causes problem on setup where the wheel is used on a remote machine. @Jokeren is working on a different fix
1 parent 23719b7 commit 140ff43

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def get_proton_cmake_args(self):
411411
if cupti_lib_dir == "":
412412
cupti_lib_dir = os.path.join(get_base_dir(), "third_party", "nvidia", "backend", "lib", "cupti")
413413
cmake_args += ["-DCUPTI_LIB_DIR=" + cupti_lib_dir]
414-
roctracer_include_dir = get_env_with_keys(["TRITON_ROCTRACER_INCLUDE_PATH"])
414+
roctracer_include_dir = get_env_with_keys(["ROCTRACER_INCLUDE_PATH"])
415415
if roctracer_include_dir == "":
416416
roctracer_include_dir = os.path.join(get_base_dir(), "third_party", "amd", "backend", "include")
417417
cmake_args += ["-DROCTRACER_INCLUDE_DIR=" + roctracer_include_dir]

third_party/proton/csrc/include/Driver/Dispatch.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,25 @@ template <typename ExternLib> class Dispatch {
5959

6060
static void init(const char *name, void **lib) {
6161
if (*lib == nullptr) {
62-
// If not found, try to load it from the default path
62+
// First reuse the existing handle
63+
*lib = dlopen(name, RTLD_NOLOAD);
64+
}
65+
if (*lib == nullptr) {
66+
// If not found, try to load it from LD_LIBRARY_PATH
67+
*lib = dlopen(name, RTLD_LOCAL | RTLD_LAZY);
68+
}
69+
if (*lib == nullptr) {
70+
// If still not found, try to load it from the default path
6371
auto dir = std::string(ExternLib::defaultDir);
6472
if (dir.length() > 0) {
6573
auto fullPath = dir + "/" + name;
6674
*lib = dlopen(fullPath.c_str(), RTLD_LOCAL | RTLD_LAZY);
67-
} else {
68-
// Only if the default path is not set, we try to load it from the
69-
// system.
70-
// First reuse the existing handle
71-
*lib = dlopen(name, RTLD_NOLOAD);
72-
if (*lib == nullptr) {
73-
// If not found, try to load it from LD_LIBRARY_PATH
74-
*lib = dlopen(name, RTLD_LOCAL | RTLD_LAZY);
75-
}
7675
}
7776
}
7877
if (*lib == nullptr) {
79-
throw std::runtime_error("Could not load `" + std::string(name) + "`");
78+
throw std::runtime_error("Could not find `" + std::string(name) +
79+
"`. Make sure it is in your "
80+
"LD_LIBRARY_PATH.");
8081
}
8182
}
8283

0 commit comments

Comments
 (0)