Build tent#2089
Conversation
There was a problem hiding this comment.
Code Review
This pull request enhances the build system and CUDA transport logic by introducing a local CUDA build script, making unit test compilation optional, and improving the NVLink transport layer with CUDA device context management and VMM allocation support. Feedback from the review focuses on improving script portability by removing hardcoded user paths, addressing a security vulnerability in LD_LIBRARY_PATH construction, and ensuring robust error handling for CUDA driver API calls.
| CUresult retain_result = | ||
| cuMemRetainAllocationHandle(&generic_handle, (void*)desc.addr); | ||
| if (retain_result == CUDA_SUCCESS) { | ||
| cuMemRelease(generic_handle); |
| SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
| REPO_ROOT="$(cd -- "${SCRIPT_DIR}/.." >/dev/null 2>&1 && pwd)" | ||
|
|
||
| DEPS_PREFIX="${MOONCAKE_DEPS:-/home/inf-daole/.local/mooncake-deps}" |
There was a problem hiding this comment.
| # ${BUILD_DIR}/ep_pg_staging when the project was built with -DWITH_EP=ON. | ||
| BUILD_DIR="${BUILD_DIR:-build}" | ||
| echo "Building wheel for Python ${PYTHON_VERSION} with output directory ${OUTPUT_DIR}" | ||
| DEPS_PREFIX="${MOONCAKE_DEPS:-/home/inf-daole/.local/mooncake-deps}" |
|
|
||
| # Ensure LD_LIBRARY_PATH includes /usr/local/lib | ||
| export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/$(pwd)/build/mooncake-common:/usr/local/lib | ||
| export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}:$(pwd)/${BUILD_DIR}/mooncake-common:${DEPS_PREFIX}/lib:/usr/local/lib |
There was a problem hiding this comment.
When LD_LIBRARY_PATH is empty or unset, the current construction results in a leading colon (e.g., :path/to/lib). In Linux, a leading or trailing colon in LD_LIBRARY_PATH is equivalent to including the current directory (.) in the search path. This can be a security risk if the script is executed in a directory containing untrusted shared objects.
| export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}:$(pwd)/${BUILD_DIR}/mooncake-common:${DEPS_PREFIX}/lib:/usr/local/lib | |
| export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}$(pwd)/${BUILD_DIR}/mooncake-common:${DEPS_PREFIX}/lib:/usr/local/lib" |
Description
Module
mooncake-transfer-engine)mooncake-store)mooncake-ep)mooncake-integration)mooncake-p2p-store)mooncake-wheel)mooncake-pg)mooncake-rl)Type of Change
How Has This Been Tested?
Checklist
./scripts/code_format.shbefore submitting.