-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Draft: [TRTLLM][feat] Set NIXL backend to default #7535
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: BatshevaBlack <[email protected]>
|
/bot run --add-multi-gpu-test --disable-fail-fast |
📝 WalkthroughWalkthroughDefault KV cache transceiver backend switched from UCX to NIXL in both C++ and Python paths. Python env-var handling for DEFAULT updated to prioritize UCX and MPI overrides. Documentation updated to reflect DEFAULT → NIXL. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Factory as C++ CacheTransceiverFactory
participant PyExec as Python create_kv_cache_transceiver
participant Env as Environment
rect rgba(230,245,255,0.6)
note over Factory: Backend resolution (C++)
Caller->>Factory: createCacheTransceiver(backend=DEFAULT)
alt backend == DEFAULT
Factory-->>Caller: select NIXL
else backend == UCX/NIXL/MPI
Factory-->>Caller: select specified backend
end
end
rect rgba(240,255,230,0.6)
note over PyExec: Backend resolution (Python)
Caller->>PyExec: create_kv_cache_transceiver(backend=DEFAULT)
alt DEFAULT with env overrides
PyExec->>Env: check TRTLLM_USE_UCX_KVCACHE
alt UCX env set
PyExec-->>Caller: select UCX
else
PyExec->>Env: check MPI env
alt MPI env set
PyExec-->>Caller: select MPI (deprecated)
else
PyExec-->>Caller: select NIXL
end
end
else Explicit UCX/NIXL/MPI
PyExec-->>Caller: select specified backend
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
examples/disaggregated/README.md (1)
231-239: Typo breaks copy-paste: refersh_interval → refresh_interval.Parameter name is misspelled in the YAML block; the prose below uses the correct form.
hostname: "localhost" port: 2379 health_check_timeout: 5.0 -refersh_interval: 10.0 +refresh_interval: 10.0cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpp (1)
160-174: Windows build bug: dlerror() used on _WIN32 path.
dlerror()is POSIX-only; this will fail to compile on Windows. UseGetLastError()under_WIN32.- TLLM_CHECK_WITH_INFO( - mWrapperLibHandle != nullptr, "UCX wrapper library is not open correctly. error : %s", dlerror()); + #if defined(_WIN32) + TLLM_CHECK_WITH_INFO( + mWrapperLibHandle != nullptr, + "UCX wrapper library is not open correctly. error code: %lu", + static_cast<unsigned long>(GetLastError())); + #else + TLLM_CHECK_WITH_INFO( + mWrapperLibHandle != nullptr, + "UCX wrapper library is not open correctly. error : %s", + dlerror()); + #endiftensorrt_llm/_torch/pyexecutor/kv_cache_transceiver.py (1)
41-52: ADD DEFAULT NIXL LOGGING, SUPPORT NIXL ENV VAR & FIX DOC TYPO
- In
tensorrt_llm/_torch/pyexecutor/kv_cache_transceiver.py, after defaulting to NIXL, insert an info log and include the NIXL env-var for backward compatibility:# NIXL is the default backend cache_transceiver_config.backend = BackendTypeCpp.NIXL
logger.info("Using default NIXL kv-cache transceiver (no env override set)") # Ordered by priority
env_vars = [("TRTLLM_USE_UCX_KVCACHE", BackendTypeCpp.UCX),("TRTLLM_USE_MPI_KVCACHE", BackendTypeCpp.MPI)]
env_vars = [("TRTLLM_USE_UCX_KVCACHE", BackendTypeCpp.UCX),("TRTLLM_USE_NIXL_KVCACHE", BackendTypeCpp.NIXL),("TRTLLM_USE_MPI_KVCACHE", BackendTypeCpp.MPI),]
- Fix the typo in
examples/disaggregated/README.md: changerefersh_interval→refresh_interval.
🧹 Nitpick comments (4)
examples/disaggregated/README.md (2)
15-19: DEFAULT → NIXL doc update looks good; add explicit env-var override note.Make it clear that DEFAULT will be overridden by env vars for UCX/MPI to match code paths.
Apply:
cache_transceiver_config: - # KV cache transmission backend. Valid options include `DEFAULT` (i.e., NIXL), `UCX`, `NIXL`. + # KV cache transmission backend. Valid options include `DEFAULT` (i.e., NIXL), `UCX`, `NIXL`. + # Note: If `backend: DEFAULT`, setting `TRTLLM_USE_UCX_KVCACHE=1` selects UCX; setting + # `TRTLLM_USE_MPI_KVCACHE=1` selects MPI (deprecated; prefer NIXL or UCX). backend: <str>
30-40: Examples: consider using DEFAULT to reflect new recommended default.Optional, but keeps examples aligned with “DEFAULT = NIXL”.
# ctx_extra-llm-api-config.yaml ... cache_transceiver_config: - backend: UCX + backend: DEFAULT max_tokens_in_buffer: 2048# gen_extra-llm-api-config.yaml ... cache_transceiver_config: - backend: UCX + backend: DEFAULT max_tokens_in_buffer: 2048Also applies to: 38-40
cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpp (2)
71-94: DEFAULT fallback switched to NIXL; add an explicit log for observability.When no env overrides are set, log that we’re defaulting to NIXL to aid debugging.
else { - backendType = executor::CacheTransceiverConfig::BackendType::NIXL; + backendType = executor::CacheTransceiverConfig::BackendType::NIXL; + TLLM_LOG_INFO("Defaulting to NIXL KV cache transport (no env override set)."); }
121-125: Name magic numbers for kvFactor.Replace 2/1 with named function-scope constants per style guide.
- int kvFactor = 2; + static constexpr int kKV_FACTOR_DEFAULT = 2; + static constexpr int kKV_FACTOR_SELF_K_ONLY = 1; + int kvFactor = kKV_FACTOR_DEFAULT; if (cacheManager->getCacheType() == kv_cache_manager::CacheType::kSELFKONLY) { - kvFactor = 1; + kvFactor = kKV_FACTOR_SELF_K_ONLY; }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpp(1 hunks)examples/disaggregated/README.md(1 hunks)tensorrt_llm/_torch/pyexecutor/kv_cache_transceiver.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Filenames compiled into a target must be case-insensitively unique
Files:
examples/disaggregated/README.mdcpp/tensorrt_llm/batch_manager/cacheTransceiver.cpptensorrt_llm/_torch/pyexecutor/kv_cache_transceiver.py
**/*.{h,hpp,hh,hxx,cc,cpp,cxx,cu,cuh}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.{h,hpp,hh,hxx,cc,cpp,cxx,cu,cuh}: Closing braces of C++ namespaces must include a comment naming the namespace (e.g., } // namespace foo)
Avoid using literals (except 0, nullptr, true, false) directly in logic; use named constants for comparisons
Use Allman brace style in C++
Place semicolon of empty for/while loop on its own line
Use brace-delimited statements for bodies of switch/while/do/for and always brace if/else bodies
C++ type names use UpperCamelCase
Local variables, methods, and namespaces use lowerCamelCase
Non-static, externally visible globals use g prefix with lowerCamelCase (e.g., gDontUseGlobalFoos)
Static or anonymous-namespace globals use s prefix with lowerCamelCase (e.g., sMutableStaticGlobal)
Locally visible static variables use s prefix (e.g., static std::once_flag sFlag)
Member variables use m prefix with CamelCase (public may omit but encouraged)
Constants (enums, globals, static consts, function-scope magic numbers) use k prefix with UPPER_SNAKE (e.g., kDIGIT_NUM)
Function-scope non-literal, non-magic constants use normal non-const naming (e.g., const bool pass)
If macros are necessary, name them in UPPER_SNAKE_CASE
Avoid Hungarian notation except allowed app’s hungarian like nb for counts
Constructor parameters conflicting with member names get a trailing underscore (e.g., foo_)
Use uppercase literal suffixes (e.g., 1234L not 1234l)
Format C++ with clang-format (LLVM style), max line length 120; justify any exceptions with clang-format off/on blocks
Use C++-style comments; C comments not allowed except special inline cases; single-line comments use //
Use inline parameter comments in calls when arguments aren’t obvious (e.g., /* checkForErrors = / false)
Disable code with #if/#endif (optionally mnemonic conditions or no-op macros); do not comment out code; avoid dead code
Use the least forceful C++ cast; avoid removing const/volatile; avoid C-style and functional casts (except explicit constructors); cast void to T* with static_cas...
Files:
cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpp
**/*.{cc,cpp,cxx,cu}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.{cc,cpp,cxx,cu}: Prefer const or constexpr variables over #define for constants in C++
Declare variables const if not modified after initialization
Use smart pointers for heap allocation; prefer unique_ptr for sole ownership, shared_ptr for shared; weak_ptr only exceptionally; avoid deprecated smart pointers
Avoid declaring large functions inline unless there’s a quantifiable benefit; remember in-class definitions are implicitly inline
Every defined function must be referenced at least once; avoid unused methods
Files:
cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpp
**/*.{h,hpp,hh,hxx,cc,cpp,cxx,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Use spaces, not tabs; indent 4 spaces
Files:
cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpptensorrt_llm/_torch/pyexecutor/kv_cache_transceiver.py
**/*.{cpp,cc,cxx,h,hpp,hh,hxx,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Prepend NVIDIA copyright header (current year) to all source files
Files:
cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpptensorrt_llm/_torch/pyexecutor/kv_cache_transceiver.py
**/*.py
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.py: Code must target Python 3.8+
Indent with 4 spaces; do not use tabs (Python)
Maintain module namespace on import: prefer from package.subpackage import foo; use foo.Symbol()
Python filenames use snake_case
Python class names use PascalCase
Python functions and methods use snake_case
Python local variables use snake_case; if starting with a number concept, prefix with k (e.g., k_99th_percentile)
Python global variables use G_ prefix with UPPER_SNAKE_CASE
Python constants use UPPER_SNAKE_CASE
Avoid shadowing variables from outer scopes
Initialize all externally visible class members in init
For public interfaces, prefer docstrings over comments; comments should be for in-function or file-local interfaces
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes and variables inline with docstrings immediately after assignment
Avoid reflection when a non-reflective approach suffices
Limit except clauses to specific exceptions where possible
When using try/except for duck-typing, keep try body minimal and move logic to else
Files:
tensorrt_llm/_torch/pyexecutor/kv_cache_transceiver.py
⏰ 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 (1)
tensorrt_llm/_torch/pyexecutor/kv_cache_transceiver.py (1)
53-56: MPI deprecation warning text is consistent with C++ path. LGTM.No changes requested.
|
PR_Github #17664 [ run ] triggered by Bot |
|
@bo-nv @BatshevaBlack I'm looking at this Epic https://jirasw.nvidia.com/browse/TRTLLM-7870 and none of the tasks are completed. Before we make NIXL the default, shouldn't we make sure we address all those? @Shixiaowei02 @schetlur-nv for vis |
|
@pcastonguay sure we have to do those tasks first, we just triggered the CI to see if there might be any more issues that we don't know about that we need to solve before setting NIXL to default. |
Ok thanks, just want to make sure it doesn't get merged rn. |
|
PR_Github #17664 [ run ] completed with state |
|
@BatshevaBlack do you mind if we close this PR since we've made NIXl the default now? Thanks. |
Summary by CodeRabbit
Refactor
Documentation
Chores
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-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.