-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[None][doc] Facilitates the integration of the transfer agent #7867
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: Shixiaowei02 <[email protected]>
📝 WalkthroughWalkthroughIntroduces a memory-transfer framework (descriptors, requests, status), extends BaseTransferAgent API (local agent/connection info, remote invalidation, remote descriptor checks, status-returning submits), and replaces getConnectionInfo/connectRemoteAgent with getLocalConnectionInfo/loadRemoteAgent across implementation, utilities, and tests. Updates logs and unit tests to the new API; functional flow otherwise unchanged. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Test as Test/Client
participant R as RemoteAgent
participant L as LocalAgent
Test->>R: getLocalConnectionInfo()
R-->>Test: ConnectionInfoType
Test->>L: loadRemoteAgent(remoteName, ConnectionInfoType)
Note over L,R: Remote agent is registered/loaded using connection info
sequenceDiagram
autonumber
participant Client
participant L as LocalAgent
participant R as RemoteAgent
Client->>L: checkRemoteDescs(remoteName, MemoryDescs)
alt supported
L-->>Client: true
Client->>L: submitTransferRequests(TransferRequest)
L-->>Client: TransferStatus
par async transfer
L->>R: Transfer (READ/WRITE)
Note over L,R: Data movement per MemoryDesc regions
and wait/notify
Client->>L: TransferStatus.wait() / isCompleted()
L-->>Client: completion
L-->>Client: getNotifiedSyncMessages()
end
else not supported
L-->>Client: false
Note over Client: Abort or adjust descriptors
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches❌ Failed checks (3 warnings)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. 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
🧹 Nitpick comments (4)
cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp (1)
399-402
: Consider adding descriptive comments for the API transition.While the changes from
connectRemoteAgent
toloadRemoteAgent
are correct, the log message on line 400 still references the old method name in its text. Also, there's a validation check that seems sender-specific but lacks context about why senders shouldn't call this particular overload.else { - TLLM_CHECK_WITH_INFO(!isSender, "Sender shouldn't call loadRemoteAgent"); - TLLM_LOG_DEBUG(mpi::MpiComm::world().getRank(), "mAgentName: %s connect to %s with loadRemoteAgent", + TLLM_CHECK_WITH_INFO(!isSender, "Sender shouldn't call loadRemoteAgent without metadata"); + TLLM_LOG_DEBUG(mpi::MpiComm::world().getRank(), "mAgentName: %s loading remote agent %s", mAgentName.c_str(), remoteAgentName.c_str()); m_Agent->loadRemoteAgent(remoteAgentName, connectionInfo);cpp/include/tensorrt_llm/executor/transferAgent.h (3)
43-44
: Add documentation for the MemoryDesc class.While the comment provides a brief description, comprehensive Doxygen documentation would help users understand the purpose and usage of each constructor and method.
-// `MemoryDesc` is used to describe a memory region, which can then be designated -// as the source or destination of read/write operations. +//! \brief Describes a memory region for transfer operations. +//! +//! MemoryDesc encapsulates the address, length, and device ID of a memory region +//! that can be used as source or destination in read/write operations. class MemoryDesc
216-217
: Add documentation for the TransferOp enum.While the comment provides basic information, formal Doxygen documentation would improve API clarity.
-// `TransferOp` is an enumeration that represents the types of transfer operations. -// Currently, it supports two operations: `read` and `write`. +//! \brief Enumeration of supported transfer operations. +//! +//! Defines the direction of data transfer operations. enum class TransferOp : uint8_t { - kREAD, - kWRITE, + kREAD, //!< Read data from remote to local + kWRITE, //!< Write data from local to remote };
228-233
: Fix parameter descriptions in TransferRequest constructor documentation.The documentation for the
op
parameter incorrectly describes it as "Source data arrangement" instead of describing the transfer operation type.- /// @param op Source data arrangement. + /// @param op Transfer operation type (read or write).
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
cpp/include/tensorrt_llm/executor/transferAgent.h
(5 hunks)cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp
(3 hunks)cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
(2 hunks)cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.h
(1 hunks)cpp/tests/unit_tests/executor/transferAgentTest.cpp
(7 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh}
: Namespace closing braces must include a trailing comment with the namespace name (e.g., '} // namespace foo').
Prefer const or constexpr variables over #define for constants.
Declare variables that are not modified after initialization as const.
Avoid magic literals in code; except for 0, nullptr, true, false. Use named constants for comparisons and logic.
Use Allman brace style for formatting.
Place the semicolon of an empty for/while loop on a new line.
Bodies of switch/while/do-while/for must be compound statements (brace-delimited), and if/else must always be followed by brace-delimited statements.
Type names (e.g., classes) must be CamelCase starting with an uppercase letter (e.g., FooBar).
Local variables, methods, and namespaces use lowerCamelCase (e.g., localFooBar).
Non-magic-number global variables that are non-static and not in an anonymous namespace must be lowerCamelCase prefixed with 'g' (e.g., gDontUseGlobalFoos).
Non-magic-number globals that are static or in an anonymous namespace use lowerCamelCase prefixed with 's' (e.g., sMutableStaticGlobal).
Locally visible static variables use lowerCamelCase with 's' prefix (e.g., static std::once_flag sFlag).
Private/protected member variables use 'm' prefix with CamelCase (e.g., mNbFooValues). Public members may omit, but 'm' is encouraged for clarity.
Constants (enums, global constants, static constants, and function-scope magic/literal constants) use uppercase SNAKE_CASE with 'k' prefix (e.g., kDIGIT_NUM).
Function-scope constants that are not magic numbers or literals are named like non-constant variables (e.g., bool const pass = a && b).
If macros are necessary, name them in UPPER_SNAKE_CASE (e.g., FOO_VERSION) and prefer constants over #define.
Use LLVM clang-format; wrap lines at a maximum of 120 columns; use '// clang-format off/on' sparingly with justification.
Use smart pointers for heap allocations; prefer unique_ptr for sole ownership, shared_ptr for shared...
Files:
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.h
cpp/tests/unit_tests/executor/transferAgentTest.cpp
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp
cpp/include/tensorrt_llm/executor/transferAgent.h
**/*.{cpp,cxx,cc,cu,h,hpp,hh,hxx,cuh}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
C++ filenames should be lowerCamelCase (first letter lowercase) and must be case-insensitive unique within a compilation target.
Files:
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.h
cpp/tests/unit_tests/executor/transferAgentTest.cpp
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp
cpp/include/tensorrt_llm/executor/transferAgent.h
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Use only spaces, no tabs; indent with 4 spaces.
Files:
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.h
cpp/tests/unit_tests/executor/transferAgentTest.cpp
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp
cpp/include/tensorrt_llm/executor/transferAgent.h
**/*.{h,hpp,hh,hxx}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Document new class interfaces and function prototypes with Doxygen; use //! for single-line and //!< for members.
Files:
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.h
cpp/include/tensorrt_llm/executor/transferAgent.h
**/*.{h,hpp,hh,hxx,cpp,cxx,cc}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc}
: Prefer anonymous namespaces over 'static' for internal linkage of functions.
All templates (class/function/member/static) must be instantiated at least once; non-POD classes should have private data members.
Files:
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.h
cpp/tests/unit_tests/executor/transferAgentTest.cpp
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp
cpp/include/tensorrt_llm/executor/transferAgent.h
**/*.{h,hpp,hh,hxx,cuh}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Use include guards named 'TRTLLM_<FILE_NAME_IN_CAPS_WITH_UNDERSCORES>_H' (no leading or trailing underscore; directory names excluded).
Files:
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.h
cpp/include/tensorrt_llm/executor/transferAgent.h
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Prepend the NVIDIA Apache-2.0 copyright header with current year to the top of all source files (e.g., .cpp, .h, .cu, .py).
Files:
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.h
cpp/tests/unit_tests/executor/transferAgentTest.cpp
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp
cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp
cpp/include/tensorrt_llm/executor/transferAgent.h
🧬 Code graph analysis (3)
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.h (1)
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp (6)
getLocalConnectionInfo
(472-475)getLocalConnectionInfo
(472-472)loadRemoteAgent
(384-392)loadRemoteAgent
(384-384)loadRemoteAgent
(477-511)loadRemoteAgent
(477-477)
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp (1)
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.h (1)
getLocalConnectionInfo
(87-95)
cpp/include/tensorrt_llm/executor/transferAgent.h (1)
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp (32)
registerMemory
(366-375)registerMemory
(366-366)registerMemory
(553-560)registerMemory
(553-553)deregisterMemory
(377-382)deregisterMemory
(377-377)deregisterMemory
(562-569)deregisterMemory
(562-562)loadRemoteAgent
(384-392)loadRemoteAgent
(384-384)loadRemoteAgent
(477-511)loadRemoteAgent
(477-477)invalidateRemoteAgent
(402-405)invalidateRemoteAgent
(402-402)getLocalAgentDesc
(394-400)getLocalAgentDesc
(394-394)getLocalConnectionInfo
(472-475)getLocalConnectionInfo
(472-472)nodiscard
(198-209)nodiscard
(211-214)nodiscard
(216-224)nodiscard
(226-234)nodiscard
(236-244)nodiscard
(246-254)nodiscard
(256-264)nodiscard
(326-329)nodiscard
(407-440)nodiscard
(461-470)submitTransferRequests
(407-407)notifySyncMessage
(442-459)notifySyncMessage
(442-442)getNotifiedSyncMessages
(461-461)
⏰ 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 (11)
cpp/tensorrt_llm/executor/cache_transmission/agent_utils/connection.cpp (2)
147-147
: LGTM! API migration properly implemented.The change from
getConnectionInfo()
togetLocalConnectionInfo()
aligns with the updated BaseTransferAgent interface.
212-212
: LGTM! Local agent state initialization uses the new API.The AgentState correctly uses the new
getLocalConnectionInfo()
method.cpp/include/tensorrt_llm/executor/transferAgent.h (1)
298-345
: Well-structured API expansion with clear documentation.The new methods for the BaseTransferAgent interface are well-documented and follow a logical structure. The addition of
loadRemoteAgent
overloads,invalidateRemoteAgent
,getLocalAgentDesc
,getLocalConnectionInfo
, andcheckRemoteDescs
provides a comprehensive interface for managing agent connections and transfers.cpp/tests/unit_tests/executor/transferAgentTest.cpp (4)
83-84
: Test properly migrated to new API.The test correctly uses
getLocalConnectionInfo()
andloadRemoteAgent()
following the new API pattern.
204-205
: Connect test properly demonstrates the new connection flow.The test appropriately uses the new API methods for establishing connections between agents.
216-216
: Second agent connection also properly migrated.The nixlAgent2 connection correctly uses
loadRemoteAgent()
with the connection info.
254-255
: SyncMessage test thoroughly validates bidirectional communication.The test properly demonstrates both directions of agent communication using the new API methods.
Also applies to: 290-291
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.h (1)
87-89
: Method signatures correctly updated to match base interface.The method declarations properly implement the renamed virtual methods from BaseTransferAgent.
cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/transferAgent.cpp (3)
472-475
: getLocalConnectionInfo implementation is correct.The method properly returns the stored address as the connection information.
477-511
: loadRemoteAgent implementation properly handles connection setup.The implementation correctly:
- Parses the connection info into IP and port
- Updates log messages to reflect the new method name
- Maintains the retry logic for checking remote metadata
384-392
: AgentDesc-based loadRemoteAgent correctly validates the remote agent name.Good practice to verify that the loaded remote agent name matches the expected name.
|
||
ReceiveCacheResource(runtime::BufferManager&& bufferManager, runtime::CudaEvent&& cudaEvent) | ||
: mBufferManager(bufferManager) | ||
ReceiveCacheResource(runtime::BufferManager bufferManager, runtime::CudaEvent cudaEvent) |
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.
buffermanager should avoid be in copied
Summary by CodeRabbit
New Features
Refactor
Tests
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
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.
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-list
parameter 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.md
and the
scripts/test_to_stage_mapping.py
helper.kill
kill
Kill all running builds associated with pull request.
skip
skip --comment COMMENT
Skip 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-pipeline
Reuse 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.