-
Notifications
You must be signed in to change notification settings - Fork 2k
[https://nvbugs//5584607][fix] Ray supports nixl backend #10259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Chuang Zhu <[email protected]>
|
/bot run --add-multi-gpu-test |
📝 WalkthroughWalkthroughThe pull request retrofits cache transmission executor modules to support both MPI-based and non-MPI (world_pg) environments. Changes introduce MPI-agnostic rank/size helpers throughout the codebase, adding conditional logic to use either MPI or process group utilities for synchronization, data gathering, and logging. Address format and build configuration updates enable broader compatibility. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (2)
cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp (1)
21-22: DuplicategetRank()helper - already noted in mooncake_utils review.Same duplication issue as noted for
mooncake_utils/transferAgent.cpp. This helper should be centralized.Also applies to: 27-28, 33-48
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp (1)
45-74:getRank()andgetWorldSize()helpers are file-local duplicates.This file has both
getRank()andgetWorldSize()helpers. ThegetRank()is duplicated with the other two files, andgetWorldSize()is unique to this file but could also be centralized inpgUtils.hfor broader use.
🧹 Nitpick comments (1)
cpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cpp (1)
24-24: Code duplication:getRank()helper is duplicated across three files.The
getRank()function is identically implemented in:
cpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cpp(lines 48-59)cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp(lines 48-59)cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp(lines 36-47)Consider extracting this helper to a shared location (e.g.,
pgUtils.halongsideuseMPI()) to reduce duplication and ensure consistent behavior across all modules.🔎 Suggested addition to pgUtils.h
inline int getRank() { if (useMPI()) { return mpi::MpiComm::world().getRank(); } else { auto const& worldPg = get_world_pg(); return worldPg ? worldPg->getRank() : 0; } } inline int getWorldSize() { if (useMPI()) { return mpi::MpiComm::world().getSize(); } else { auto const& worldPg = get_world_pg(); return worldPg ? worldPg->getSize() : 1; } }Also applies to: 40-41, 45-60
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cppcpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/CMakeLists.txtcpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cppcpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txtcpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpptests/integration/defs/disaggregated/test_disaggregated.py
💤 Files with no reviewable changes (1)
- tests/integration/defs/disaggregated/test_disaggregated.py
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{cpp,h,cu,cuh}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.{cpp,h,cu,cuh}: Closing braces of namespaces should have a comment saying the namespace it closes:} // namespace foo
Preferconstorconstexprvariables over#definewhenever possible, as the latter are not visible to the compiler
A variable that is not modified after its initialization should be declared asconst
For naming of constants in C++, follow the naming section conventions
Except0(only used in comparison for checking signness/existence/emptiness) andnullptr,true,false, all other literals should only be used for variable initialization in C++
Use the Allman indentation style in C++
Put the semicolon for an emptyfororwhileloop in a new line in C++
The statement forming the body of aswitch,while,do .. whileorforstatement shall be a compound statement (use brace-delimited statements) in C++
If and else should always be followed by brace-delimited statements, even if empty or a single statement in C++
C++ filenames should use camel case with first letter lowercase:thisIsASubDirandthisIsAFilename.cpp
All files involved in the compilation of a compilation target (.exe/.so) must have filenames that are case-insensitive unique in C++
All types (including class names) in C++ should use camel case with uppercase first letter:FooBarClass
Local variables, methods and namespaces in C++ should use camel case with first letter lowercase:localFooBar
Non-magic-number global variables that are non-static and not defined in anonymous namespace in C++ should use camel case prefixed by a lower case 'g':gDontUseGlobalFoos
Non-magic-number global variables that are static or defined in an anonymous namespace in C++ should use camel case prefixed by a lower case 's':sMutableStaticGlobal
Locally visible static variables in C++ should use camel case with lowercase prefix 's' as the first letter:static std::once_flag sFlag;
Public, private and protected class member variables in C++ should use camel case prefi...
Files:
cpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cppcpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cppcpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
**/*.{cpp,h,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
All TensorRT-LLM Open Source Software code should contain an NVIDIA copyright header that includes the year of its latest meaningful modification
Files:
cpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cppcpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cppcpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
🧠 Learnings (8)
📚 Learning: 2025-09-16T09:30:09.716Z
Learnt from: tongyuantongyu
Repo: NVIDIA/TensorRT-LLM PR: 7763
File: cpp/tensorrt_llm/CMakeLists.txt:297-301
Timestamp: 2025-09-16T09:30:09.716Z
Learning: In the TensorRT-LLM project, NCCL libraries are loaded earlier by PyTorch libraries or the bindings library, so the main shared library doesn't need NCCL paths in its RPATH - the libraries will already be available in the process address space when needed.
Applied to files:
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txtcpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/CMakeLists.txtcpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
📚 Learning: 2025-09-23T15:01:00.070Z
Learnt from: nv-lschneider
Repo: NVIDIA/TensorRT-LLM PR: 7910
File: cpp/tensorrt_llm/kernels/nccl_device/config.cu:15-17
Timestamp: 2025-09-23T15:01:00.070Z
Learning: In TensorRT-LLM NCCL device kernels, the <sstream> header is not needed as an explicit include in config.cu because it's provided transitively through other headers. Local compilation testing confirms this works without the explicit include.
Applied to files:
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txtcpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cppcpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/CMakeLists.txtcpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
📚 Learning: 2025-08-18T09:08:07.687Z
Learnt from: tongyuantongyu
Repo: NVIDIA/TensorRT-LLM PR: 6984
File: cpp/tensorrt_llm/CMakeLists.txt:297-299
Timestamp: 2025-08-18T09:08:07.687Z
Learning: In the TensorRT-LLM project, artifacts are manually copied rather than installed via `cmake --install`, so INSTALL_RPATH properties are not needed - only BUILD_RPATH affects the final artifacts.
Applied to files:
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txtcpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/CMakeLists.txt
📚 Learning: 2025-09-02T13:42:44.885Z
Learnt from: pcastonguay
Repo: NVIDIA/TensorRT-LLM PR: 7455
File: tensorrt_llm/_torch/pyexecutor/py_executor.py:1852-1860
Timestamp: 2025-09-02T13:42:44.885Z
Learning: In MPI communication within TensorRT-LLM pipeline parallelism, different communication types (tokens, logits, termination sync) must use disjoint tag namespaces to avoid message routing collisions when using the same source/destination patterns.
Applied to files:
cpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cppcpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cppcpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
📚 Learning: 2025-09-23T15:01:00.070Z
Learnt from: nv-lschneider
Repo: NVIDIA/TensorRT-LLM PR: 7910
File: cpp/tensorrt_llm/kernels/nccl_device/config.cu:15-17
Timestamp: 2025-09-23T15:01:00.070Z
Learning: In TensorRT-LLM NCCL device kernels (cpp/tensorrt_llm/kernels/nccl_device/config.cu), std::ostringstream is used but <sstream> doesn't need to be explicitly included because it's provided transitively through other headers like tensorrt_llm/common/cudaUtils.h or config.h. Local compilation testing confirms this works without the explicit include.
Applied to files:
cpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cppcpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
📚 Learning: 2025-09-23T14:58:05.372Z
Learnt from: nv-lschneider
Repo: NVIDIA/TensorRT-LLM PR: 7910
File: cpp/tensorrt_llm/kernels/nccl_device/config.cu:42-49
Timestamp: 2025-09-23T14:58:05.372Z
Learning: In TensorRT-LLM NCCL device kernels (cpp/tensorrt_llm/kernels/nccl_device/), the token partitioning intentionally uses ceil-like distribution (same token_per_rank for all ranks) to ensure all ranks launch the same number of blocks. This is required for optimal NCCL device API barrier performance, even though it may launch extra blocks for non-existent tokens on later ranks. Runtime bounds checking in the kernel (blockID validation) handles the overshoot cases.
Applied to files:
cpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cppcpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cppcpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
📚 Learning: 2025-08-06T08:18:28.669Z
Learnt from: zhengd-nv
Repo: NVIDIA/TensorRT-LLM PR: 6633
File: cpp/tensorrt_llm/batch_manager/dataTransceiverImpl.cpp:145-155
Timestamp: 2025-08-06T08:18:28.669Z
Learning: In cpp/tensorrt_llm/batch_manager/dataTransceiverImpl.cpp, the existing `mMtxForMap` mutex in DataSenderImpl is sufficient to synchronize measurement file operations in the `release` method, as all file operations occur within the same critical section that protects the `mRequestToSession` map access.
Applied to files:
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
📚 Learning: 2025-08-25T08:47:24.758Z
Learnt from: tshmilnvidia
Repo: NVIDIA/TensorRT-LLM PR: 5488
File: cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp:531-547
Timestamp: 2025-08-25T08:47:24.758Z
Learning: For NIXL API postXferReq function in NixlLoopbackAgent::submitLoopbackRequests, the expected return status is exactly NIXL_IN_PROG, not NIXL_SUCCESS. The strict check `TLLM_CHECK(status == NIXL_IN_PROG)` is correct and intentional for this specific API call.
Applied to files:
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
🧬 Code graph analysis (3)
cpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cpp (4)
cpp/tensorrt_llm/common/ipUtils.cpp (2)
getLocalIp(206-223)getLocalIp(206-206)cpp/tensorrt_llm/common/envUtils.cpp (2)
getEnvMooncakeInterface(352-367)getEnvMooncakeInterface(352-352)cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp (2)
getRank(36-47)getRank(36-36)cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp (2)
getRank(48-59)getRank(48-48)
cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp (2)
cpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cpp (2)
getRank(48-59)getRank(48-48)cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp (2)
getRank(48-59)getRank(48-48)
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp (3)
cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp (2)
getRank(36-47)getRank(36-36)cpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cpp (2)
getRank(48-59)getRank(48-48)cpp/tensorrt_llm/common/envUtils.cpp (2)
getEnvNixlInterface(313-328)getEnvNixlInterface(313-313)
🪛 Cppcheck (2.19.0)
cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp
[error] 26-26: There is an unknown macro here somewhere. Configuration is required. If TRTLLM_NAMESPACE_BEGIN is a macro then please configure it.
(unknownMacro)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (12)
cpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/CMakeLists.txt (1)
40-42: Dependencies are correctly configured and actively used.The addition of
${TORCH_LIBRARIES}andpg_utilsis verified as appropriate:
${TORCH_LIBRARIES}is properly defined byfind_package(Torch REQUIRED)atcpp/CMakeLists.txt:509- The
pg_utilstarget is built incpp/tensorrt_llm/runtime/utils/CMakeLists.txtand properly linkedtransferAgent.cppactively uses these dependencies: it includespgUtils.h(line 24) and callsget_world_pg()(line 40) to support non-MPI process group environmentsThe linkage is correct and necessary for the non-MPI (world_pg) support added in this change.
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt (1)
40-42: No action required. The TORCH_LIBRARIES and pg_utils dependencies are properly available in the build configuration.TORCH_LIBRARIES is found in cpp/CMakeLists.txt:509 via
find_package(Torch REQUIRED)before any subdirectories are processed. pg_utils is defined in cpp/tensorrt_llm/runtime/utils/CMakeLists.txt:17 and the runtime subdirectory is added at line 146 in cpp/tensorrt_llm/CMakeLists.txt, which occurs before the executor subdirectory is added at line 166. transferAgent.cpp correctly uses both libraries: it includes pgUtils.h and calls pg_utils::get_world_pg().Likely an incorrect or invalid review comment.
cpp/tensorrt_llm/executor/cache_transmission/mooncake_utils/transferAgent.cpp (2)
294-294: LGTM!The use of
getRank()for IP resolution is appropriate and consistent with the MPI-agnostic approach.
361-362: LGTM!Debug logging now consistently uses
getRank()for the rank prefix, ensuring correct behavior in both MPI and non-MPI environments.cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp (3)
325-373: LGTM! Dual-path allgather implementation is well-structured.The MPI and non-MPI paths correctly implement allgather operations with proper buffer management:
- MPI path uses
displsarray forallgatherv(lines 331-337)- Non-MPI path uses pointer arithmetic for buffer traversal (lines 363-367)
Both paths correctly deserialize
AgentStateobjects with consistent logging.
379-381: LGTM!Logging statements and
CommStateinitialization consistently use the computed rank, ensuring correct behavior in both MPI and non-MPI environments.Also applies to: 490-490, 506-506, 516-517, 524-525
294-310: Inconsistent MPI communicator usage within the same file.Lines 299-300 use
mpi::MpiComm::session()for rank and world size, while thegetRank()helper function at line 40 usesmpi::MpiComm::world(). This inconsistency appears in other parts of the codebase as well—some files consistently usesession()(e.g., ucxCacheCommunicator.cpp) while others consistently useworld()(e.g., transferAgent.cpp). Verify whethersession()andworld()serve different purposes in your MPI communicator design, or whether this should be unified to use the same communicator.cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp (5)
179-179: LGTM!Logging in
getAvailableIP()correctly usesgetRank()for consistent rank identification.Also applies to: 186-188
227-231: LGTM! Port calculation uses MPI-agnostic helpers.The port increment logic correctly uses
getRank()andgetWorldSize()for MPI-agnostic operation.Note: The function name
getIncrmentPorthas a typo (missing 'e'), but this is pre-existing code.
380-382: Address format change toip#portis a good choice for IPv6 compatibility.The switch from
:to#as the separator avoids ambiguity with IPv6 addresses. The comment on line 381 clearly explains the rationale.
483-485: LGTM!Error message in
submitTransferRequestscorrectly usesgetRank()for rank identification.
515-552: LGTM! Address parsing updated for newip#portformat.The parsing logic correctly:
- Finds the
#separator (line 518)- Validates its presence with a clear error message (lines 519-520)
- Extracts IP and port components (lines 521-522)
Logging statements are updated to use
getRank()consistently.
|
PR_Github #29716 [ run ] triggered by Bot. Commit: |
|
PR_Github #29716 [ run ] completed with state
|
Summary by CodeRabbit
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.
Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
Details
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-listparameter to access the appropriate container environment. Note: Does NOT update GitHub check status.For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip testing for latest commit on pull request.
--comment "Reason for skipping build/test"is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipelineReuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.