[paddle-adapt] fix: find and load libcudart dynamically via /proc/self/maps#25
Open
BingooYang wants to merge 1 commit into
Open
[paddle-adapt] fix: find and load libcudart dynamically via /proc/self/maps#25BingooYang wants to merge 1 commit into
BingooYang wants to merge 1 commit into
Conversation
- Add find_loaded_library() to search /proc/self/maps for a loaded .so - Use the found cudart path first before falling back to hardcoded path - Fixes loading cudart.so issues when CUDA_LIB_PATH does not match - Regression: norm/rmsnorm_silu PASS, dit_layernorm 35 PASS, moe smoke PASS Refs: MISMATCH_EXPERIMENT §21
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.
📌 Description
Fix loading cudart.so by dynamically discovering the already-loaded library path via
/proc/self/mapsbefore falling back to the hardcodedCUDA_LIB_PATH.Problem: The hardcoded path
${CUDA_LIB_PATH}/libcudart.so.12often does not exist in PaddlePaddle environments (different CUDA installation layout), causingflashinfer.jitto silently skip loading cudart and leading to downstream JIT compilation failures.Fix: Added
find_loaded_library(lib_name)that reads/proc/self/mapsto locate the already-in-process cudart .so, using that path first. The hardcoded fallback is retained for backward compatibility.Changes:
flashinfer/jit/__init__.py: +32/-1, addfind_loaded_library()+ update cudart loading orderRegression verified (fi_paddle env):
🔍 Related Issues
Backport of dedaff1 to the 0.6 branch.
🚀 Pull Request Checklist
✅ Pre-commit Checks
pip install pre-commitpre-commit installpre-commit run --files flashinfer/jit/__init__.py— all hooks passed (ruff-format auto-fixed, ruff check ✅, mypy ✅)🧪 Tests
Reviewer Notes
Minimal, self-contained fix. Only
flashinfer/jit/__init__.pyis changed. Thefind_loaded_libraryfunction gracefully returnsNonewhen not found, fully preserving backward compatibility.