[AMD] Avoid double loading libamdhip64.so if loaded in process#4255
Merged
antiagainst merged 3 commits intotriton-lang:mainfrom Aug 23, 2024
Merged
[AMD] Avoid double loading libamdhip64.so if loaded in process#4255antiagainst merged 3 commits intotriton-lang:mainfrom
antiagainst merged 3 commits intotriton-lang:mainfrom
Conversation
PyTorch have ways to load the libamdhip64.so library, and the original logic has problems detecting this shared object file because it can be placed at any location with venv/DT_RUNPATH/LD_LIBRARY_PATH. Now Triton enumerates the address space with dl_iterate_phdr, and prefer the libamdhip64.so that is already loaded into address space over everything else except for TRITON_LIBHIP_PATH.
c5fd338 to
3013fd4
Compare
e46ad61 to
a2a0462
Compare
a2a0462 to
f719c95
Compare
antiagainst
approved these changes
Aug 23, 2024
bertmaher
pushed a commit
to bertmaher/triton
that referenced
this pull request
Sep 24, 2024
…ng#4255) PyTorch have ways to load the libamdhip64.so library, and the original logic has problems detecting this shared object file because it can be placed at any location with `venv`/`DT_RUNPATH`/`LD_LIBRARY_PATH`/ `/etc/ld.so.conf.d/*.conf`/`LD_PRELOAD`. Notably the `RUNPATH` has become the preferred approach for multi-version ROCm installations. This patch let Triton enumerate the address space with `dl_iterate_phdr`, and choose the libamdhip64.so that is already loaded into address space unless `TRITON_LIBHIP_PATH` is already set. --------- Co-authored-by: Lei Zhang <antiagainst@gmail.com>
bertmaher
pushed a commit
to bertmaher/triton
that referenced
this pull request
Dec 10, 2024
…ng#4255) PyTorch have ways to load the libamdhip64.so library, and the original logic has problems detecting this shared object file because it can be placed at any location with `venv`/`DT_RUNPATH`/`LD_LIBRARY_PATH`/ `/etc/ld.so.conf.d/*.conf`/`LD_PRELOAD`. Notably the `RUNPATH` has become the preferred approach for multi-version ROCm installations. This patch let Triton enumerate the address space with `dl_iterate_phdr`, and choose the libamdhip64.so that is already loaded into address space unless `TRITON_LIBHIP_PATH` is already set. --------- Co-authored-by: Lei Zhang <antiagainst@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PyTorch have ways to load the libamdhip64.so library, and the original logic has problems detecting this shared object file because it can be placed at any location with
venv/DT_RUNPATH/LD_LIBRARY_PATH//etc/ld.so.conf.d/*.conf/LD_PRELOAD. Notably theRUNPATHhas become the preferred approach for multi-version ROCm installations.This patch let Triton enumerate the address space with
dl_iterate_phdr, and choose the libamdhip64.so that is already loaded into address space unlessTRITON_LIBHIP_PATHis already set.Complete the following tasks before sending your PR, and replace
[ ]with[x]to indicate you have done them.rules.
pre-commit run --from-ref origin/main --to-ref HEAD./testforlittests/unittestfor C++ tests/python/testfor end-to-end testslittests.littests I have added follow these best practices,including the "tests should be minimal" section. (Usually running Python code
and using the instructions it generates is not minimal.)