Skip to content

Conversation

@pcastonguay
Copy link
Collaborator

@pcastonguay pcastonguay commented Nov 13, 2025

Summary by CodeRabbit

  • New Features

    • Added optional timeout configuration for KV cache sender operations in disaggregated inference scenarios, with default value of 1000ms
  • Documentation

    • Updated configuration examples with new timeout parameter for cache transceiver settings
  • Tests

    • Added test case validating timeout behavior and cache cleanup in disaggregated inference

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.

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 the stage-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.

Signed-off-by: Patrice Castonguay <55748270+pcastonguay@users.noreply.github.com>
@pcastonguay
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24499 [ run ] triggered by Bot. Commit: 23decaf

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 13, 2025

📝 Walkthrough

Walkthrough

The pull request extends the CacheTransceiverConfig API across C++ and Python layers by introducing an optional kvTransferSenderFutureTimeoutMs parameter. This timeout controls how long the cache transceiver waits for sender futures to become ready. Changes include adding getter/setter methods, updating serialization logic, extending Python bindings, and implementing timeout-aware future handling in the transceiver.

Changes

Cohort / File(s) Summary
CacheTransceiverConfig Header & Implementation
cpp/include/tensorrt_llm/executor/executor.h, cpp/tensorrt_llm/executor/cacheTransceiverConfig.cpp
Added optional kvTransferSenderFutureTimeoutMs parameter to constructor; introduced public getter/setter methods; added private member variable with validation ensuring positive values.
Cache Transceiver Context Transfer Logic
cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpp
Implemented timeout-aware future handling in checkContextTransferStatus using future::wait_for; branches on timeout expiration (logs warning, keeps future in map) vs. success (retrieves result, marks complete, erases entry) vs. error (logs error, marks error state, erases entry).
Serialization & Deserialization
cpp/tensorrt_llm/executor/serialization.cpp
Extended serialization flow to read/write the new optional timeout field; updated size computation to account for serialized timeout; added getter usage in serialization macros.
Python Bindings
cpp/tensorrt_llm/nanobind/executor/executorConfig.cpp, cpp/tensorrt_llm/pybind/executor/executorConfig.cpp
Extended constructor binding to accept fourth optional int parameter; added new property binding kv_transfer_sender_future_timeout_ms with corresponding getter/setter for both nanobind and pybind.
Python Configuration Layer
tensorrt_llm/llmapi/llm_args.py, tensorrt_llm/_torch/pyexecutor/kv_cache_transceiver.py
Added kv_transfer_sender_future_timeout_ms field with default 1000 and validation; initialized field in transceiver from config; updated _to_pybind to pass timeout to underlying C++ binding.
Tests & Documentation
cpp/tests/unit_tests/executor/serializeUtilsTest.cpp, tests/unittest/llmapi/test_llm_pytorch.py, examples/disaggregated/README.md
Updated serialization test with new constructor signature and assertions for new accessors; added parameterized functional test for context-only requests with KV cache exhaustion and timeout scenarios; documented new configuration field in README example.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Config as CacheTransceiverConfig
    participant Transceiver as CacheTransceiver
    participant Future as Future<Result>
    
    User->>Config: Create with kvTransferSenderFutureTimeoutMs
    Config->>Config: Store timeout (validate > 0)
    
    Transceiver->>Transceiver: checkContextTransferStatus()
    Transceiver->>Config: getKvTransferSenderFutureTimeoutMs()
    Config-->>Transceiver: timeout value
    
    alt timeout configured
        Transceiver->>Future: wait_for(timeout)
        Future-->>Transceiver: ready within timeout
        Transceiver->>Transceiver: Retrieve result
        Transceiver->>Transceiver: Mark kDISAGG_CONTEXT_COMPLETE
        Transceiver->>Transceiver: Erase future from map
    else timeout expires
        Transceiver->>Future: wait_for(timeout)
        Future-->>Transceiver: timeout occurred
        Transceiver->>Transceiver: Log warning
        Note over Transceiver: Leave future in map
    else unexpected status
        Transceiver->>Transceiver: Mark kDISAGG_TRANS_ERROR
        Transceiver->>Transceiver: Erase future from map
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Consistent pattern: All changes follow the same repetitive pattern (add parameter, add getter/setter, update serialization across layers), minimizing unique reasoning needed per file.
  • Limited logic complexity: The new timeout-aware logic in cacheTransceiver.cpp is straightforward branching based on future status; no complex state transitions or interdependencies.
  • Well-scoped changes: Each file makes isolated, focused modifications without cross-file logic changes.

Areas requiring attention:

  • cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpp: Verify timeout-aware branching correctly handles all three cases (ready, timeout, error) and that future erasure logic is consistent with exception handling paths.
  • tests/unittest/llmapi/test_llm_pytorch.py: Confirm the parameterized test with sender_future_timeout_ms values (100, 1000) adequately exercises both timeout and non-timeout paths and correctly validates KV cache cleanup.
  • Serialization round-trip: Ensure new optional field is correctly serialized/deserialized and does not break existing configurations that omit it.

Suggested reviewers

  • Shixiaowei02
  • chuangz0
  • chzblych
  • Funatiq
  • syuoni

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is mostly empty with only the template structure present and no actual implementation details, test coverage information, or explanation of the changes provided. Add a detailed description explaining the problem, solution, KV cache exhaustion scenario, timeout mechanism, and list the specific tests added (e.g., test_llm_context_only_timed_out_kv_cache_exausted).
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main feature: ability to cancel disaggregated requests when KV cache resources are exhausted, matching the core functionality added across multiple files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
cpp/tensorrt_llm/executor/cacheTransceiverConfig.cpp (1)

34-38: operator== omits kvTransferSenderFutureTimeoutMs.

Equality should include the newly added field to avoid false positives/negatives in comparisons and tests.

Apply this diff:

 bool CacheTransceiverConfig::operator==(CacheTransceiverConfig const& other) const
 {
-    return mMaxTokensInBuffer == other.mMaxTokensInBuffer && mBackendType == other.mBackendType
-        && mKvTransferTimeoutMs == other.mKvTransferTimeoutMs;
+    return mMaxTokensInBuffer == other.mMaxTokensInBuffer
+        && mBackendType == other.mBackendType
+        && mKvTransferTimeoutMs == other.mKvTransferTimeoutMs
+        && mKvTransferSenderFutureTimeoutMs == other.mKvTransferSenderFutureTimeoutMs;
 }
cpp/tensorrt_llm/pybind/executor/executorConfig.cpp (2)

417-427: Include the fourth parameter in pickle serialization for CacheTransceiverConfig.

The field kv_transfer_sender_future_timeout_ms is lost during pickle round-trip. Extend both getstate and setstate to handle all 4 constructor parameters instead of 3.

     auto cacheTransceiverConfigGetstate = [](tle::CacheTransceiverConfig const& self)
-    { return py::make_tuple(self.getBackendType(), self.getMaxTokensInBuffer(), self.getKvTransferTimeoutMs()); };
+    {
+        return py::make_tuple(self.getBackendType(),
+                              self.getMaxTokensInBuffer(),
+                              self.getKvTransferTimeoutMs(),
+                              self.getKvTransferSenderFutureTimeoutMs());
+    };
     auto cacheTransceiverConfigSetstate = [](py::tuple const& state)
     {
-        if (state.size() != 3)
+        if (state.size() != 4)
         {
             throw std::runtime_error("Invalid CacheTransceiverConfig state!");
         }
-        return tle::CacheTransceiverConfig(state[0].cast<tle::CacheTransceiverConfig::BackendType>(),
-            state[1].cast<std::optional<size_t>>(), state[2].cast<std::optional<int>>());
+        return tle::CacheTransceiverConfig(
+            state[0].cast<tle::CacheTransceiverConfig::BackendType>(),
+            state[1].cast<std::optional<size_t>>(),
+            state[2].cast<std::optional<int>>(),
+            state[3].cast<std::optional<int>>());
     };

Apply the same fix to cpp/tensorrt_llm/nanobind/executor/executorConfig.cpp (lines ~435–445).


448-454: Fix py::init template arity and pickle completeness for CacheTransceiverConfig.

The C++ constructor accepts 4 parameters, but the pybind py::init template declares only 3 types while binding 4 arguments—this causes a binding error. Additionally, the pickle implementation only preserves 3 fields, dropping kv_transfer_sender_future_timeout_ms during serialization.

Update lines 449–450 in cpp/tensorrt_llm/pybind/executor/executorConfig.cpp and lines 418, 421–426 to handle all 4 parameters:

-    py::class_<tle::CacheTransceiverConfig>(m, "CacheTransceiverConfig")
-        .def(py::init<std::optional<tle::CacheTransceiverConfig::BackendType>, std::optional<size_t>,
-                 std::optional<int>>(),
+    py::class_<tle::CacheTransceiverConfig>(m, "CacheTransceiverConfig")
+        .def(py::init<
+                 std::optional<tle::CacheTransceiverConfig::BackendType>,
+                 std::optional<size_t>,
+                 std::optional<int>,
+                 std::optional<int>
+             >(),
             py::arg("backend") = std::nullopt, py::arg("max_tokens_in_buffer") = std::nullopt,
             py::arg("kv_transfer_timeout_ms") = std::nullopt,
             py::arg("kv_transfer_sender_future_timeout_ms") = std::nullopt)

Also update the pickle getstate and setstate functions (lines 417–426) to include the 4th field.

cpp/tensorrt_llm/nanobind/executor/executorConfig.cpp (1)

435-445: Clarify that pybind11 has the same bug—this isn't mirroring an existing fix.

The review correctly identifies that getKvTransferSenderFutureTimeoutMs() must be added to the pickle tuple to prevent data loss. The method exists, the constructor accepts the 4th parameter, and the proposed type casting is correct. However, pybind11's getstate also only returns a 3-element tuple and setstate expects 3 elements, so this is not a mirror of an existing pybind11 fix—rather, both implementations need the same fix applied. Update the justification to reflect that both codebases require the same correction.

🧹 Nitpick comments (5)
tensorrt_llm/_torch/pyexecutor/kv_cache_transceiver.py (1)

114-114: Remove redundant attribute or document its purpose.

This value isn’t used in Python; the C++ impl reads it via _to_pybind(). Keeping it risks drift. Either remove or add a brief comment explaining why it’s stored.

-        self.kv_transfer_sender_future_timeout_ms = cache_transceiver_config.kv_transfer_sender_future_timeout_ms
+        # Note: timeout is carried via cache_transceiver_config._to_pybind() to C++. No local use here.
+        # self.kv_transfer_sender_future_timeout_ms = cache_transceiver_config.kv_transfer_sender_future_timeout_ms
cpp/tests/unit_tests/executor/serializeUtilsTest.cpp (1)

1031-1038: Add nullopt round‑trip coverage for the new field.

Also test when kvTransferSenderFutureTimeoutMs is unset to ensure serialization preserves std::nullopt.

 TEST(SerializeUtilsTest, CacheTransceiverConfig)
 {
     texec::CacheTransceiverConfig cacheTransceiverConfig(
         tensorrt_llm::executor::CacheTransceiverConfig::BackendType::UCX, 1024, 100, 1000);
     auto cacheTransceiverConfig2 = serializeDeserialize(cacheTransceiverConfig);
@@
     EXPECT_EQ(cacheTransceiverConfig.getKvTransferSenderFutureTimeoutMs(),
         cacheTransceiverConfig2.getKvTransferSenderFutureTimeoutMs());
+
+    // Unset optional should remain unset after round-trip
+    texec::CacheTransceiverConfig unsetTimeout(texec::CacheTransceiverConfig::BackendType::UCX, 1024, 100, std::nullopt);
+    auto unsetTimeout2 = serializeDeserialize(unsetTimeout);
+    EXPECT_FALSE(unsetTimeout2.getKvTransferSenderFutureTimeoutMs().has_value());
 }
examples/disaggregated/README.md (1)

22-23: Clarify default and units for the new knob.

State the default (1000 ms) and keep units consistent.

-  # Timeout in milliseconds to wait for the sender future to be ready when scheduled batch size is 0. This allows the request to be eventually cancelled by the user or because of kv_transfer_timeout_ms
-  kv_transfer_sender_future_timeout_ms: <int>
+  # Timeout (milliseconds) to wait for the sender future when scheduled batch size is 0.
+  # Default: 1000 ms. Enables eventual cancellation by the user or by kv_transfer_timeout_ms.
+  kv_transfer_sender_future_timeout_ms: <int>
tensorrt_llm/llmapi/llm_args.py (1)

1566-1571: Mark as prototype and confirm cross‑lang default alignment.

Consider marking this new knob as unstable for now. Also ensure C++/bindings default matches Python’s 1000 ms to avoid behavior divergence when constructed from C++.

-    kv_transfer_sender_future_timeout_ms: Optional[int] = Field(
-        default=1000,
+    kv_transfer_sender_future_timeout_ms: Optional[int] = Field(
+        default=1000,
+        status="prototype",
         gt=0,
         description=...
     )
tests/unittest/llmapi/test_llm_pytorch.py (1)

1108-1112: Stabilize stats assertion; mirror the retry used above.

Avoid flaky len(results) == 1 by adding a bounded retry with sleep, like test_llm_context_only_timed_out.

-    results = llm.get_stats(2)
-    assert len(results) == 1
+    max_retries = 10
+    for _ in range(max_retries):
+        results = llm.get_stats(2)
+        if len(results) == 1:
+            break
+        time.sleep(1)
+    else:
+        pytest.fail(f"Failed to get stats with len==1 after {max_retries} retries")
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 12f339f and 23decaf.

📒 Files selected for processing (11)
  • cpp/include/tensorrt_llm/executor/executor.h (2 hunks)
  • cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpp (2 hunks)
  • cpp/tensorrt_llm/executor/cacheTransceiverConfig.cpp (3 hunks)
  • cpp/tensorrt_llm/executor/serialization.cpp (1 hunks)
  • cpp/tensorrt_llm/nanobind/executor/executorConfig.cpp (1 hunks)
  • cpp/tensorrt_llm/pybind/executor/executorConfig.cpp (1 hunks)
  • cpp/tests/unit_tests/executor/serializeUtilsTest.cpp (2 hunks)
  • examples/disaggregated/README.md (1 hunks)
  • tensorrt_llm/_torch/pyexecutor/kv_cache_transceiver.py (1 hunks)
  • tensorrt_llm/llmapi/llm_args.py (1 hunks)
  • tests/unittest/llmapi/test_llm_pytorch.py (1 hunks)
🧰 Additional context used
🧠 Learnings (8)
📚 Learning: 2025-08-20T06:56:02.889Z
Learnt from: eopXD
Repo: NVIDIA/TensorRT-LLM PR: 6768
File: cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp:577-579
Timestamp: 2025-08-20T06:56:02.889Z
Learning: In cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp, maxSequenceLength is now enforced as a non-optional argument in the BlockManager constructor, so concerns about std::nullopt defaulting to 0 are not applicable. When windowSize > maxSequenceLength, a warning should be added instead of handling optional parameter cases.

Applied to files:

  • cpp/include/tensorrt_llm/executor/executor.h
  • cpp/tensorrt_llm/executor/serialization.cpp
  • cpp/tensorrt_llm/executor/cacheTransceiverConfig.cpp
  • cpp/tensorrt_llm/pybind/executor/executorConfig.cpp
  • cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpp
  • cpp/tensorrt_llm/nanobind/executor/executorConfig.cpp
📚 Learning: 2025-08-14T21:04:50.248Z
Learnt from: thorjohnsen
Repo: NVIDIA/TensorRT-LLM PR: 6910
File: cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp:0-0
Timestamp: 2025-08-14T21:04:50.248Z
Learning: In KV cache onboarding logic during prefill in cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp, when calculating which blocks fall within the attention window, use getTokensPerBlock() to advance token indices rather than block->getUniqueTokens().size(), because the calculation needs to consider the post-prefill state where blocks will be filled to capacity, not their current token count.

Applied to files:

  • cpp/include/tensorrt_llm/executor/executor.h
  • cpp/tensorrt_llm/executor/serialization.cpp
  • cpp/tensorrt_llm/executor/cacheTransceiverConfig.cpp
  • cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpp
📚 Learning: 2025-08-15T06:46:54.897Z
Learnt from: eopXD
Repo: NVIDIA/TensorRT-LLM PR: 6767
File: cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp:0-0
Timestamp: 2025-08-15T06:46:54.897Z
Learning: In cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp addToken function, newly allocated blocks are unshared by design. The beam search path in addToken (when sequence.getNumTokens() > windowSize) is currently broken/non-functional with SWA, so the block allocation doesn't follow a shared-then-unshared pattern.

Applied to files:

  • cpp/tensorrt_llm/executor/serialization.cpp
  • cpp/tensorrt_llm/executor/cacheTransceiverConfig.cpp
  • cpp/tests/unit_tests/executor/serializeUtilsTest.cpp
📚 Learning: 2025-08-21T09:41:49.347Z
Learnt from: eopXD
Repo: NVIDIA/TensorRT-LLM PR: 6768
File: cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp:2010-2045
Timestamp: 2025-08-21T09:41:49.347Z
Learning: In cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp, updateSequenceCacheBlockOffsets is specifically for updating bookkeeping when blocks are added during the context phase, not for refreshing offsets after detach operations. During detach operations, GenerationRequest::removeFrontBlock handles the necessary cache block bookkeeping internally.

Applied to files:

  • cpp/tensorrt_llm/executor/serialization.cpp
  • cpp/tensorrt_llm/batch_manager/cacheTransceiver.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/batch_manager/cacheTransceiver.cpp
📚 Learning: 2025-08-20T06:48:45.368Z
Learnt from: eopXD
Repo: NVIDIA/TensorRT-LLM PR: 6768
File: cpp/include/tensorrt_llm/batch_manager/kvCacheManager.h:0-0
Timestamp: 2025-08-20T06:48:45.368Z
Learning: In cpp/tensorrt_llm/batch_manager/kvCacheManager.cpp, updateSequenceCacheBlockOffsets is only called when adding a sequence, not during detach operations. During detach, the cache block bookkeeping is handled by GenerationRequest::removeFrontBlock.

Applied to files:

  • cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpp
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxu
Repo: NVIDIA/TensorRT-LLM PR: 6303
File: tests/integration/test_lists/qa/examples_test_list.txt:494-494
Timestamp: 2025-07-28T17:06:08.621Z
Learning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.

Applied to files:

  • tests/unittest/llmapi/test_llm_pytorch.py
📚 Learning: 2025-08-14T15:38:01.771Z
Learnt from: MatthiasKohl
Repo: NVIDIA/TensorRT-LLM PR: 6904
File: cpp/tensorrt_llm/pybind/thop/bindings.cpp:55-57
Timestamp: 2025-08-14T15:38:01.771Z
Learning: In TensorRT-LLM Python bindings, tensor parameter collections like mla_tensor_params and spec_decoding_tensor_params are kept as required parameters without defaults to maintain API consistency, even when it might affect backward compatibility.

Applied to files:

  • tensorrt_llm/llmapi/llm_args.py
🧬 Code graph analysis (8)
cpp/include/tensorrt_llm/executor/executor.h (2)
cpp/tensorrt_llm/executor/cacheTransceiverConfig.cpp (15)
  • CacheTransceiverConfig (24-32)
  • other (34-38)
  • other (34-34)
  • setKvTransferTimeoutMs (50-57)
  • setKvTransferTimeoutMs (50-50)
  • setKvTransferSenderFutureTimeoutMs (59-66)
  • setKvTransferSenderFutureTimeoutMs (59-59)
  • getMaxTokensInBuffer (73-76)
  • getMaxTokensInBuffer (73-73)
  • getBackendType (68-71)
  • getBackendType (68-68)
  • getKvTransferTimeoutMs (78-81)
  • getKvTransferTimeoutMs (78-78)
  • getKvTransferSenderFutureTimeoutMs (83-86)
  • getKvTransferSenderFutureTimeoutMs (83-83)
tensorrt_llm/llmapi/llm_args.py (1)
  • CacheTransceiverConfig (1545-1579)
cpp/tensorrt_llm/executor/cacheTransceiverConfig.cpp (1)
tensorrt_llm/llmapi/llm_args.py (1)
  • CacheTransceiverConfig (1545-1579)
cpp/tensorrt_llm/pybind/executor/executorConfig.cpp (1)
cpp/tensorrt_llm/executor/cacheTransceiverConfig.cpp (8)
  • getKvTransferTimeoutMs (78-81)
  • getKvTransferTimeoutMs (78-78)
  • setKvTransferTimeoutMs (50-57)
  • setKvTransferTimeoutMs (50-50)
  • getKvTransferSenderFutureTimeoutMs (83-86)
  • getKvTransferSenderFutureTimeoutMs (83-83)
  • setKvTransferSenderFutureTimeoutMs (59-66)
  • setKvTransferSenderFutureTimeoutMs (59-59)
cpp/tensorrt_llm/batch_manager/cacheTransceiver.cpp (1)
cpp/tests/unit_tests/multi_gpu/cacheTransceiverTest.cpp (7)
  • future (167-176)
  • request (893-943)
  • request (893-893)
  • request (945-952)
  • request (945-945)
  • request (954-1005)
  • request (954-954)
cpp/tests/unit_tests/executor/serializeUtilsTest.cpp (3)
cpp/tensorrt_llm/executor/cacheTransceiverConfig.cpp (1)
  • CacheTransceiverConfig (24-32)
tensorrt_llm/llmapi/llm_args.py (1)
  • CacheTransceiverConfig (1545-1579)
cpp/tests/unit_tests/multi_gpu/cacheTransceiverTest.cpp (2)
  • serializeDeserialize (72-81)
  • serializeDeserialize (72-72)
tests/unittest/llmapi/test_llm_pytorch.py (4)
tensorrt_llm/llmapi/llm_args.py (2)
  • KvCacheConfig (1366-1510)
  • CacheTransceiverConfig (1545-1579)
tensorrt_llm/llmapi/llm.py (3)
  • LLM (1101-1117)
  • generate (259-341)
  • get_stats (517-528)
tensorrt_llm/sampling_params.py (1)
  • SamplingParams (113-540)
tensorrt_llm/disaggregated_params.py (1)
  • DisaggregatedParams (15-92)
tensorrt_llm/llmapi/llm_args.py (1)
tensorrt_llm/builder.py (1)
  • default (45-50)
cpp/tensorrt_llm/nanobind/executor/executorConfig.cpp (1)
cpp/tensorrt_llm/executor/cacheTransceiverConfig.cpp (16)
  • getBackendType (68-71)
  • getBackendType (68-68)
  • setBackendType (40-43)
  • setBackendType (40-40)
  • getMaxTokensInBuffer (73-76)
  • getMaxTokensInBuffer (73-73)
  • setMaxTokensInBuffer (45-48)
  • setMaxTokensInBuffer (45-45)
  • getKvTransferTimeoutMs (78-81)
  • getKvTransferTimeoutMs (78-78)
  • setKvTransferTimeoutMs (50-57)
  • setKvTransferTimeoutMs (50-50)
  • getKvTransferSenderFutureTimeoutMs (83-86)
  • getKvTransferSenderFutureTimeoutMs (83-83)
  • setKvTransferSenderFutureTimeoutMs (59-66)
  • setKvTransferSenderFutureTimeoutMs (59-59)
⏰ 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 (8)
cpp/tests/unit_tests/executor/serializeUtilsTest.cpp (1)

792-793: Constructor arity update looks correct.

UCX + (1024, 100, 1000) matches the extended signature. LGTM.

tensorrt_llm/llmapi/llm_args.py (1)

1577-1580: Pybind forwarding LGTM.

Field is correctly forwarded to _CacheTransceiverConfig.

cpp/tensorrt_llm/executor/serialization.cpp (1)

1293-1296: Wire-format extension adds two fields; confirm compatibility and add round‑trip tests.

Appending kvTransferTimeoutMs and kvTransferSenderFutureTimeoutMs is fine, but older payloads will be shorter and older readers may choke on the longer layout. Please confirm producer/consumer version lockstep or add versioning/tolerant reads, and add a serialize/deserialize round‑trip test covering nullopt and set values.

Also applies to: 1302-1304, 1311-1313

cpp/tensorrt_llm/executor/cacheTransceiverConfig.cpp (1)

24-31: Ctor/getter/setter for sender-future timeout: LGTM.

Validation and plumbing look correct.

Also applies to: 59-66, 83-86

cpp/tensorrt_llm/pybind/executor/executorConfig.cpp (1)

460-462: New property binding: LGTM.

Getter/setter wiring for kv_transfer_sender_future_timeout_ms looks correct.

cpp/include/tensorrt_llm/executor/executor.h (1)

1468-1470: API surface for sender-future timeout: LGTM.

Signatures and docs are consistent with implementation. Ensure equality includes this field (addressed in cpp).

Also applies to: 1475-1475, 1480-1481, 1489-1492

cpp/tensorrt_llm/nanobind/executor/executorConfig.cpp (2)

466-472: 4‑arg constructor binding: LGTM.


479-481: New property binding: LGTM.

Signed-off-by: Patrice Castonguay <55748270+pcastonguay@users.noreply.github.com>
Signed-off-by: Patrice Castonguay <55748270+pcastonguay@users.noreply.github.com>
@pcastonguay
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24502 [ run ] triggered by Bot. Commit: 32a96f4

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24499 [ run ] completed with state ABORTED. Commit: 23decaf
LLM/main/L0_MergeRequest_PR #18492 (Blue Ocean) completed with status: ABORTED

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24502 [ run ] completed with state FAILURE. Commit: 32a96f4
/LLM/main/L0_MergeRequest_PR pipeline #18494 completed with status: 'FAILURE'

Signed-off-by: Patrice Castonguay <55748270+pcastonguay@users.noreply.github.com>
@pcastonguay
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24529 [ run ] triggered by Bot. Commit: 41f941d

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24529 [ run ] completed with state SUCCESS. Commit: 41f941d
/LLM/main/L0_MergeRequest_PR pipeline #18514 completed with status: 'FAILURE'

@pcastonguay
Copy link
Collaborator Author

/bot run --disable-fail-fast

@pcastonguay pcastonguay requested review from Tabrizian and removed request for hchings and laikhtewari November 14, 2025 17:17
@tensorrt-cicd
Copy link
Collaborator

PR_Github #24609 [ run ] triggered by Bot. Commit: 41f941d

@tensorrt-cicd
Copy link
Collaborator

PR_Github #24609 [ run ] completed with state SUCCESS. Commit: 41f941d
/LLM/main/L0_MergeRequest_PR pipeline #18576 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

@pcastonguay pcastonguay enabled auto-merge (squash) November 18, 2025 18:46
Copy link
Collaborator

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM on the llmapi changes.

@pcastonguay pcastonguay merged commit 9b0f452 into NVIDIA:main Nov 19, 2025
5 checks passed
lkomali pushed a commit to lkomali/TensorRT-LLM that referenced this pull request Nov 19, 2025
…ce are exhausted (NVIDIA#9155)

Signed-off-by: Patrice Castonguay <55748270+pcastonguay@users.noreply.github.com>
Signed-off-by: lkomali <lkomali@nvidia.com>
@AmosGem
Copy link

AmosGem commented Nov 23, 2025

Hi @pcastonguay @chuangz0 @Tabrizian. I noticed that when kv cache resource is exhausted, decoding node will also block on future.get(), could you please take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants