Skip to content

[https://nvbugs/6503299][fix] Default fabric memory KV pool for Python cache transceiver - #16832

Open
chuangz0 wants to merge 2 commits into
NVIDIA:mainfrom
chuangz0:use_fabric_pool_default_for_python_cache_transceiver
Open

[https://nvbugs/6503299][fix] Default fabric memory KV pool for Python cache transceiver#16832
chuangz0 wants to merge 2 commits into
NVIDIA:mainfrom
chuangz0:use_fabric_pool_default_for_python_cache_transceiver

Conversation

@chuangz0

@chuangz0 chuangz0 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Description

When the Python cache transceiver (cache_transceiver_config.transceiver_runtime='PYTHON') is used together with the C++ V1 KV cache manager, the KV cache pool should be allocated with fabric memory so KV blocks can be transferred over MNNVL.

This PR:

  1. Defaults TRTLLM_KVCACHE_POOL_USE_FABRIC_MEMORY=1 in KvCacheCreator.__init__ when:

    • the cache transceiver is enabled with transceiver_runtime='PYTHON', and
    • the resolved KV cache manager is the C++ V1 route (KVCacheManager and its hybrid subclasses; KVCacheManagerV2 is excluded).

    The default is applied before any pool allocation (the C++ env getter caches on first read). An explicit user setting is always respected, and platforms without fabric memory support fall back to standard GPU allocation in C++ with a warning.

  2. Sets kv_cache_bounce_size_mb: 512 in the GPT-OSS disaggregated perf configs (from [None][perf] Validate GPT-OSS transceiver v2 performance #15765) where the ctx/gen KV-head sharding differs (ctx TP1 → gen TP4, no attention DP), which requires the bounce buffer to regroup KV heads during transfer. Configs with matching per-rank KV-head layout (equal TP, or gen with attention DP) are intentionally left unchanged.

Test Coverage

  • Covered by existing disaggregated serving tests using transceiver_runtime: PYTHON.
  • The updated perf configs are exercised by the disaggregated perf-sanity/perf pipelines.

PR Checklist

  • PR title and description are self-explanatory
  • Coding guidelines followed
  • Test coverage considered

🤖 Generated with Claude Code

Dev Engineer Review

  • Added KvCacheCreator._maybe_enable_fabric_memory_for_python_transceiver() in tensorrt_llm/_torch/pyexecutor/_util.py, called from KvCacheCreator.__init__.
  • When using the Python cache transceiver (cache_transceiver_config.transceiver_runtime == "PYTHON") with the C++ V1 KV cache manager (KVCacheManager), the helper defaults TRTLLM_KVCACHE_POOL_USE_FABRIC_MEMORY=1 only if the env var isn’t already set; otherwise it leaves configuration unchanged so other/unsupported combinations behave as before.
  • Updated GB200 GPT-OSS disaggregated performance YAMLs to add kv_cache_bounce_size_mb: 512 under both worker_config.gen.cache_transceiver_config and worker_config.ctx.cache_transceiver_config for the listed NIXL variants:
    • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_1k1k_con64_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
    • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con1024_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
    • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con128_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
    • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con4_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
    • tests/scripts/perf/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con1024_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
    • tests/scripts/perf/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con128_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
    • tests/scripts/perf/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con4_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
    • tests/scripts/perf/disaggregated/gb200_stress-gpt-oss-120b-fp4_8k1k_ctx1_tp1_gen1_tp4_eplb0_eagle3_ccb-NIXL.yaml

QA Engineer Review

  • Updated performance/disaggregated YAMLs under tests/scripts/ to add kv_cache_bounce_size_mb: 512 in the gen and ctx cache_transceiver_config blocks for the files listed in the Dev Engineer Review section.
  • Updated tests/integration/test_lists/waives.txt by removing three perf/test_perf_sanity.py::test_e2e waiver entries for disagg_upload targeting gb300_glm-5-fp4_8k1k:
    • disagg_upload-e2e for con1024/ctx1/dep2/gen1/dep8/eplb256/mtp1
    • disagg_upload-gen_only for con1024/ctx1/dep2/gen1/dep32
    • disagg_upload-gen_only for con512/ctx1/dep2/gen1/dep32 (the variant described in the waiver removal list, including the eplb0/mtp3 portion)
  • Test functions added/modified/removed: none (no changes outside test list/config files).
  • Verdict: needs follow-up (CBTS/coverage data not provided here).

@chuangz0
chuangz0 requested review from a team as code owners July 24, 2026 07:24
@chuangz0 chuangz0 changed the title [None][feat] Default fabric memory KV pool for Python cache transceiver [https://nvbugs/6503299][fix] Default fabric memory KV pool for Python cache transceiver Jul 24, 2026
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3f29dba0-b5b2-4a44-9040-6705dd7515cf

📥 Commits

Reviewing files that changed from the base of the PR and between 7014802 and 7821757.

📒 Files selected for processing (10)
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tests/integration/test_lists/waives.txt
  • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_1k1k_con64_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con1024_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con128_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con4_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con1024_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con128_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con4_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf/disaggregated/gb200_stress-gpt-oss-120b-fp4_8k1k_ctx1_tp1_gen1_tp4_eplb0_eagle3_ccb-NIXL.yaml
💤 Files with no reviewable changes (1)
  • tests/integration/test_lists/waives.txt
🚧 Files skipped from review as they are similar to previous changes (9)
  • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con4_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con128_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con4_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con128_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con1024_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf/disaggregated/gb200_stress-gpt-oss-120b-fp4_8k1k_ctx1_tp1_gen1_tp4_eplb0_eagle3_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_1k1k_con64_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tests/scripts/perf/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con1024_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml

Walkthrough

The change enables Fabric-memory pooling for compatible Python/V1 KV-cache setups and adds a 512 MB KV-cache bounce size to eight GB200 GPT-OSS NIXL benchmark configurations.

Changes

KV-cache Fabric memory configuration

Layer / File(s) Summary
Fabric memory defaulting
tensorrt_llm/_torch/pyexecutor/_util.py
KvCacheCreator conditionally sets TRTLLM_KVCACHE_POOL_USE_FABRIC_MEMORY=1 for Python transceivers using the V1 KVCacheManager, without overriding explicit environment settings.
Benchmark cache bounce settings
tests/scripts/perf*/disaggregated/gb200_*NIXL.yaml
Generation and context cache_transceiver_config sections now set kv_cache_bounce_size_mb: 512.

Estimated code review effort: 2 (Simple) | ~15 minutes

Suggested reviewers: dc3671, tabrizian, qijune, nv-ananjappa, brnguyen2

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the PR template and clearly summarizes the main change with the correct fix type.
Description check ✅ Passed The description follows the required template and includes Description, Test Coverage, and PR Checklist sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

347-347: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the required return annotation.

As per coding guidelines, every Python function must be annotated; declare this helper as returning None.

Proposed fix
-def _maybe_enable_fabric_memory_for_python_transceiver(self):
+def _maybe_enable_fabric_memory_for_python_transceiver(self) -> None:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tensorrt_llm/_torch/pyexecutor/_util.py` at line 347, Update
_maybe_enable_fabric_memory_for_python_transceiver to include an explicit None
return annotation, preserving its existing behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tensorrt_llm/_torch/pyexecutor/_util.py`:
- Line 347: Update _maybe_enable_fabric_memory_for_python_transceiver to include
an explicit None return annotation, preserving its existing behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e54489eb-50c5-42cb-9963-81b94b2899ed

📥 Commits

Reviewing files that changed from the base of the PR and between 8514fa3 and 442491c.

📒 Files selected for processing (9)
  • tensorrt_llm/_torch/pyexecutor/_util.py
  • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_1k1k_con64_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con1024_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con128_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf-sanity/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con4_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con1024_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con128_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf/disaggregated/gb200_gpt-oss-120b-fp4_8k1k_con4_ctx1_tp1_gen1_tp4_eplb0_mtp0_ccb-NIXL.yaml
  • tests/scripts/perf/disaggregated/gb200_stress-gpt-oss-120b-fp4_8k1k_ctx1_tp1_gen1_tp4_eplb0_eagle3_ccb-NIXL.yaml

@chuangz0
chuangz0 force-pushed the use_fabric_pool_default_for_python_cache_transceiver branch from 442491c to ab93d7a Compare July 27, 2026 06:04
@chuangz0

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fast-fail

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61828 Bot args parsing error: usage: /bot [-h]
{run,kill,skip,submit,reviewers,reuse-pipeline,reuse-review} ...
/bot: error: unrecognized arguments: --disable-fast-fail

Link to invocation

@chuangz0

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61833 [ run ] triggered by Bot. Commit: 7014802 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61833 [ run ] completed with state FAILURE. Commit: 7014802
/LLM/main/L0_MergeRequest_PR pipeline #50028 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

chuangz0 added 2 commits July 28, 2026 09:36
Default TRTLLM_KVCACHE_POOL_USE_FABRIC_MEMORY=1 when the Python cache
transceiver (transceiver_runtime='PYTHON') is used with the C++ V1 KV
cache manager, so the KV pool is allocated with fabric memory for MNNVL
transfers. Explicit user settings are respected, and unsupported
platforms fall back to standard allocation in C++.

Also set kv_cache_bounce_size_mb=512 in the GPT-OSS disagg perf configs
where the ctx/gen KV-head sharding differs (ctx TP1 -> gen TP4), which
requires the bounce buffer to regroup KV heads during transfer.

Signed-off-by: Chuang Zhu <111838961+chuangz0@users.noreply.github.com>
Signed-off-by: Chuang Zhu <111838961+chuangz0@users.noreply.github.com>
@chuangz0
chuangz0 force-pushed the use_fabric_pool_default_for_python_cache_transceiver branch from 7014802 to 7821757 Compare July 28, 2026 01:36
@chuangz0

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62056 [ run ] triggered by Bot. Commit: 7821757 Link to invocation

perf/test_perf_sanity.py::test_e2e[aggr_upload-k25_thinking_fp4_2_nodes_grace_blackwell-k25_thinking_fp4_tep8_32k8k] SKIP (https://nvbugs/6422339)
perf/test_perf_sanity.py::test_e2e[aggr_upload-super_ad_blackwell-super_ad_ws1_1k1k] SKIP (https://nvbugs/6153575)
perf/test_perf_sanity.py::test_e2e[disagg_upload-e2e-gb200_deepseek-r1-fp4_128k8k_con128_ctx1_pp8_gen1_dep16_eplb0_mtp1_ccb-NIXL] SKIP (https://nvbugs/6426890)
perf/test_perf_sanity.py::test_e2e[disagg_upload-e2e-gb300_glm-5-fp4_8k1k_con1024_ctx1_dep2_gen1_dep8_eplb256_mtp1_ccb-NIXL] SKIP (https://nvbugs/6517846)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see 7 cases being waived, do you missed to unwaive others? Thanks!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not missed — https://nvbugs/6517846 is a post-merge bug that covers multiple failures with different root causes. I think only the 3 cases are related by the fix.

if not issubclass(self._kv_cache_manager_cls, KVCacheManager):
return
if os.environ.get("TRTLLM_KVCACHE_POOL_USE_FABRIC_MEMORY") is None:
os.environ["TRTLLM_KVCACHE_POOL_USE_FABRIC_MEMORY"] = "1"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: Modifying an environment variable defined by ourselves is not a good idea in the long term. If you have a chance can you move the default heuristic to the consumer of the TRTLLM_KVCACHE_POOL_USE_FABRIC_MEMORY env var instead of modifying it here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

moving the heuristic to the consumer side is not straightforward here. The consumer of this env var is the C++ BlockManager at pool-allocation time, which has no knowledge of the transceiver runtime — the transceiver is created after the KV cache manager, and transceiver_runtime only exists in the Python-side config.
Also, we want users to be able to override the heuristic via the env var: the default is only applied when TRTLLM_KVCACHE_POOL_USE_FABRIC_MEMORY is unset, so an explicit =0 (or =1) always wins.

@ZhanruiSunCh ZhanruiSunCh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM for infra part.

@YihuiLu512 YihuiLu512 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62056 [ run ] completed with state FAILURE. Commit: 7821757
/LLM/main/L0_MergeRequest_PR pipeline #50241 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

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.