[None][chore] Replace cache_salt_id impl with main's TreeTaskId (cp #13793) - #14351
Conversation
Signed-off-by: Yueh-Ting Chen <yueh.ting.chen@gmail.com> (cherry picked from commit 4baeec3) Signed-off-by: lancelly <108499334+lancelly@users.noreply.github.com>
0d9c7b9 to
e457809
Compare
|
/bot run --disable-fail-fast |
peihu-nv
left a comment
There was a problem hiding this comment.
Direction LGTM, approving to unblock the stack assuming follow up PR to land right after.
- Seems to me that test_v2_root_key_distinguishes_lora_from_cache_salt_id still calls RootBlock.make_key(None, None), now it is a single arg.
- _event_manager._root_attrs_from_root_block still reads lora_task_id/cache_salt_id off RootBlock, but this PR removes both → silently (None, None) for every event → V1-compat hashes break for any LoRA/salt request and Dynamo routing degrades. Not sure if dropping V1 compat is intentional or might need to address this in the ReuseScope follow-up (root.reuse_scope.lora_id/.salt).
|
/bot run --disable-fail-fast |
|
PR_Github #49467 [ run ] triggered by Bot. Commit: |
|
PR_Github #49467 [ run ] completed with state
|
After NVIDIA#14140 (cherry-picked in NVIDIA#14353) RootBlock no longer exposes ``lora_task_id`` / ``cache_salt_id`` directly — both fields are folded into a ``ReuseScope`` NamedTuple attached as ``root.reuse_scope``. ``KVCacheEventManager._root_attrs_from_root_block`` was still reading the legacy attribute names via ``getattr(..., None)``, so every emitted event silently received ``(None, None)`` and the V1-compat hash collapsed to the same value for any LoRA/salt request. Downstream Dynamo routing depends on those hashes, so this regression would materially degrade prefix cache hit rate for any request carrying a LoRA task id or a cache salt. Fix ``_root_attrs_from_root_block`` to prefer ``root.reuse_scope`` and fall back to the legacy attributes (keeps any in-flight pre-refactor RootBlock instances working). Also: - Update the now-stale ``test_v2_root_key_distinguishes_lora_from_cache_salt_id`` to use the new single-arg ``RootBlock.make_key(ReuseScope(...))`` API. - Extend ``_FakeRootBlock`` with an optional ``reuse_scope`` kwarg so tests can mimic both the pre- and post-refactor RootBlock shape. - Add a regression test ``test_v2_kv_cache_event_manager_v1_hash_reads_root_reuse_scope`` that asserts (a) a ReuseScope-shaped root and a legacy root with the same lora/salt produce identical V1 event hashes, (b) different scopes still produce different hashes (no silent collapse), and (c) an empty ReuseScope matches a legacy root with no salt/lora. Addresses reviewer feedback on NVIDIA#14351 (peihu-nv). Signed-off-by: lancelly <108499334+lancelly@users.noreply.github.com>
After NVIDIA#14140 (cherry-picked in NVIDIA#14353) RootBlock no longer exposes ``lora_task_id`` / ``cache_salt_id`` directly — both fields are folded into a ``ReuseScope`` NamedTuple attached as ``root.reuse_scope``. ``KVCacheEventManager._root_attrs_from_root_block`` was still reading the legacy attribute names via ``getattr(..., None)``, so every emitted event silently received ``(None, None)`` and the V1-compat hash collapsed to the same value for any LoRA/salt request. Downstream Dynamo routing depends on those hashes, so this regression would materially degrade prefix cache hit rate for any request carrying a LoRA task id or a cache salt. Fix ``_root_attrs_from_root_block`` to prefer ``root.reuse_scope`` and fall back to the legacy attributes (keeps any in-flight pre-refactor RootBlock instances working). Also: - Update the now-stale ``test_v2_root_key_distinguishes_lora_from_cache_salt_id`` to use the new single-arg ``RootBlock.make_key(ReuseScope(...))`` API. - Extend ``_FakeRootBlock`` with an optional ``reuse_scope`` kwarg so tests can mimic both the pre- and post-refactor RootBlock shape. - Add a regression test ``test_v2_kv_cache_event_manager_v1_hash_reads_root_reuse_scope`` that asserts (a) a ReuseScope-shaped root and a legacy root with the same lora/salt produce identical V1 event hashes, (b) different scopes still produce different hashes (no silent collapse), and (c) an empty ReuseScope matches a legacy root with no salt/lora. Addresses reviewer feedback on NVIDIA#14351 (peihu-nv). Signed-off-by: lancelly <108499334+lancelly@users.noreply.github.com>
After NVIDIA#14140 (cherry-picked in NVIDIA#14353) RootBlock no longer exposes ``lora_task_id`` / ``cache_salt_id`` directly — both fields are folded into a ``ReuseScope`` NamedTuple attached as ``root.reuse_scope``. ``KVCacheEventManager._root_attrs_from_root_block`` was still reading the legacy attribute names via ``getattr(..., None)``, so every emitted event silently received ``(None, None)`` and the V1-compat hash collapsed to the same value for any LoRA/salt request. Downstream Dynamo routing depends on those hashes, so this regression would materially degrade prefix cache hit rate for any request carrying a LoRA task id or a cache salt. Fix ``_root_attrs_from_root_block`` to prefer ``root.reuse_scope`` and fall back to the legacy attributes (keeps any in-flight pre-refactor RootBlock instances working). Also: - Update the now-stale ``test_v2_root_key_distinguishes_lora_from_cache_salt_id`` to use the new single-arg ``RootBlock.make_key(ReuseScope(...))`` API. - Extend ``_FakeRootBlock`` with an optional ``reuse_scope`` kwarg so tests can mimic both the pre- and post-refactor RootBlock shape. - Add a regression test ``test_v2_kv_cache_event_manager_v1_hash_reads_root_reuse_scope`` that asserts (a) a ReuseScope-shaped root and a legacy root with the same lora/salt produce identical V1 event hashes, (b) different scopes still produce different hashes (no silent collapse), and (c) an empty ReuseScope matches a legacy root with no salt/lora. Addresses reviewer feedback on NVIDIA#14351 (peihu-nv). Signed-off-by: lancelly <108499334+lancelly@users.noreply.github.com>
Build #39108 of PR NVIDIA#14351 failed 7 tests in tests/unittest/disaggregated/ test_router.py with: TypeError: RootBlock.make_key() takes 1 positional argument but 2 were given This PR collapses the prior (lora_task_id, cache_salt_id) pair into a single TreeTaskId seed for the radix tree, but two callers on the base feat/deepseek_v4 branch were not migrated: - tensorrt_llm/serve/router.py — two call sites still pass (None, cache_salt_id) to V2RootBlock.make_key - tests/unittest/disaggregated/test_router.py — two call sites still pass cache_salt_id as the 4th positional argument to sequence_to_blockchain_keys Fix by computing the seed via _KVCache._make_tree_task_id(lora_task_id, cache_salt_id) and passing it as the single TreeTaskId argument. The helper returns lora_task_id unchanged when cache_salt_id is None so the unsalted fast path is unaffected; with a salt it returns the SHA-256 digest that binds the two fields together. Signed-off-by: lancelly <108499334+lancelly@users.noreply.github.com>
|
/bot run --disable-fail-fast |
|
PR_Github #49540 [ run ] triggered by Bot. Commit: |
Build #39108 of PR NVIDIA#14351 failed 7 tests in tests/unittest/disaggregated/ test_router.py with: TypeError: RootBlock.make_key() takes 1 positional argument but 2 were given This PR collapses the prior (lora_task_id, cache_salt_id) pair into a single TreeTaskId seed for the radix tree, but two callers on the base feat/deepseek_v4 branch were not migrated: - tensorrt_llm/serve/router.py — two call sites still pass (None, cache_salt_id) to V2RootBlock.make_key - tests/unittest/disaggregated/test_router.py — two call sites still pass cache_salt_id as the 4th positional argument to sequence_to_blockchain_keys Fix by computing the seed via _KVCache._make_tree_task_id(lora_task_id, cache_salt_id) and passing it as the single TreeTaskId argument. The helper returns lora_task_id unchanged when cache_salt_id is None so the unsalted fast path is unaffected; with a salt it returns the SHA-256 digest that binds the two fields together. Signed-off-by: lancelly <108499334+lancelly@users.noreply.github.com>
a0824a2 to
eaddc9a
Compare
|
/bot run --disable-fail-fast |
|
/bot run --disable-fail-fast |
|
PR_Github #49544 [ run ] triggered by Bot. Commit: |
|
PR_Github #49540 [ run ] completed with state |
|
PR_Github #49546 [ run ] triggered by Bot. Commit: |
After NVIDIA#14140 (cherry-picked in NVIDIA#14353) RootBlock no longer exposes ``lora_task_id`` / ``cache_salt_id`` directly — both fields are folded into a ``ReuseScope`` NamedTuple attached as ``root.reuse_scope``. ``KVCacheEventManager._root_attrs_from_root_block`` was still reading the legacy attribute names via ``getattr(..., None)``, so every emitted event silently received ``(None, None)`` and the V1-compat hash collapsed to the same value for any LoRA/salt request. Downstream Dynamo routing depends on those hashes, so this regression would materially degrade prefix cache hit rate for any request carrying a LoRA task id or a cache salt. Fix ``_root_attrs_from_root_block`` to prefer ``root.reuse_scope`` and fall back to the legacy attributes (keeps any in-flight pre-refactor RootBlock instances working). Also: - Update the now-stale ``test_v2_root_key_distinguishes_lora_from_cache_salt_id`` to use the new single-arg ``RootBlock.make_key(ReuseScope(...))`` API. - Extend ``_FakeRootBlock`` with an optional ``reuse_scope`` kwarg so tests can mimic both the pre- and post-refactor RootBlock shape. - Add a regression test ``test_v2_kv_cache_event_manager_v1_hash_reads_root_reuse_scope`` that asserts (a) a ReuseScope-shaped root and a legacy root with the same lora/salt produce identical V1 event hashes, (b) different scopes still produce different hashes (no silent collapse), and (c) an empty ReuseScope matches a legacy root with no salt/lora. Addresses reviewer feedback on NVIDIA#14351 (peihu-nv). Signed-off-by: lancelly <108499334+lancelly@users.noreply.github.com>
After NVIDIA#14140 (cherry-picked in NVIDIA#14353) RootBlock no longer exposes ``lora_task_id`` / ``cache_salt_id`` directly — both fields are folded into a ``ReuseScope`` NamedTuple attached as ``root.reuse_scope``. ``KVCacheEventManager._root_attrs_from_root_block`` was still reading the legacy attribute names via ``getattr(..., None)``, so every emitted event silently received ``(None, None)`` and the V1-compat hash collapsed to the same value for any LoRA/salt request. Downstream Dynamo routing depends on those hashes, so this regression would materially degrade prefix cache hit rate for any request carrying a LoRA task id or a cache salt. Fix ``_root_attrs_from_root_block`` to prefer ``root.reuse_scope`` and fall back to the legacy attributes (keeps any in-flight pre-refactor RootBlock instances working). Also: - Update the now-stale ``test_v2_root_key_distinguishes_lora_from_cache_salt_id`` to use the new single-arg ``RootBlock.make_key(ReuseScope(...))`` API. - Extend ``_FakeRootBlock`` with an optional ``reuse_scope`` kwarg so tests can mimic both the pre- and post-refactor RootBlock shape. - Add a regression test ``test_v2_kv_cache_event_manager_v1_hash_reads_root_reuse_scope`` that asserts (a) a ReuseScope-shaped root and a legacy root with the same lora/salt produce identical V1 event hashes, (b) different scopes still produce different hashes (no silent collapse), and (c) an empty ReuseScope matches a legacy root with no salt/lora. Addresses reviewer feedback on NVIDIA#14351 (peihu-nv). Signed-off-by: lancelly <108499334+lancelly@users.noreply.github.com>
|
PR_Github #49546 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #49688 [ run ] triggered by Bot. Commit: |
|
PR_Github #49688 [ run ] completed with state |
After NVIDIA#14140 (cherry-picked in NVIDIA#14353) RootBlock no longer exposes ``lora_task_id`` / ``cache_salt_id`` directly — both fields are folded into a ``ReuseScope`` NamedTuple attached as ``root.reuse_scope``. ``KVCacheEventManager._root_attrs_from_root_block`` was still reading the legacy attribute names via ``getattr(..., None)``, so every emitted event silently received ``(None, None)`` and the V1-compat hash collapsed to the same value for any LoRA/salt request. Downstream Dynamo routing depends on those hashes, so this regression would materially degrade prefix cache hit rate for any request carrying a LoRA task id or a cache salt. Fix ``_root_attrs_from_root_block`` to prefer ``root.reuse_scope`` and fall back to the legacy attributes (keeps any in-flight pre-refactor RootBlock instances working). Also: - Update the now-stale ``test_v2_root_key_distinguishes_lora_from_cache_salt_id`` to use the new single-arg ``RootBlock.make_key(ReuseScope(...))`` API. - Extend ``_FakeRootBlock`` with an optional ``reuse_scope`` kwarg so tests can mimic both the pre- and post-refactor RootBlock shape. - Add a regression test ``test_v2_kv_cache_event_manager_v1_hash_reads_root_reuse_scope`` that asserts (a) a ReuseScope-shaped root and a legacy root with the same lora/salt produce identical V1 event hashes, (b) different scopes still produce different hashes (no silent collapse), and (c) an empty ReuseScope matches a legacy root with no salt/lora. Addresses reviewer feedback on NVIDIA#14351 (peihu-nv). Signed-off-by: lancelly <108499334+lancelly@users.noreply.github.com>
…VIDIA#13793) (NVIDIA#14351) Signed-off-by: Yueh-Ting Chen <yueh.ting.chen@gmail.com> Signed-off-by: lancelly <108499334+lancelly@users.noreply.github.com> Co-authored-by: Yueh-Ting (eop) Chen <yuehtingc@nvidia.com>
…VIDIA#13793) (NVIDIA#14351) Signed-off-by: Yueh-Ting Chen <yueh.ting.chen@gmail.com> Signed-off-by: lancelly <108499334+lancelly@users.noreply.github.com> Co-authored-by: Yueh-Ting (eop) Chen <yuehtingc@nvidia.com>
…VIDIA#13793) (NVIDIA#14351) Signed-off-by: Yueh-Ting Chen <yueh.ting.chen@gmail.com> Signed-off-by: lancelly <108499334+lancelly@users.noreply.github.com> Co-authored-by: Yueh-Ting (eop) Chen <yuehtingc@nvidia.com>
Summary
Replaces feat/deepseek_v4's parallel
cache_salt_idimpl (introduced as a side effect of PR #13624 / commit 07adb42, which mainly added V1↔V2 KV event hash matching) with main'sTreeTaskIdabstraction from PR #13793.Both implementations achieve identical user-visible behavior (per-request salt-based KV cache reuse isolation). The differences are internal:
lora_task_id+cache_salt_idas 2 fieldstree_task_id: int | bytes | None_make_root_key+ tag bytes_KVCache._make_tree_task_idRootBlocktree_task_idThe opaque-seed shape allows mixing future dimensions (e.g. multi-modal digest) without changing the tree. It is also the prerequisite for cherry-picking PR #14140 (ReuseScope NamedTuple refactor) and PR #14333 (KV cache reuse probe), which will follow in subsequent PRs.
Conflict resolution notes
stop_committing()anyway so the salt choice is inert, but explicitly passingNoneavoids coupling synthetic data to any salted branch.None-return path in_create_kv_cache(needed for disagg gen-trans-in-progress requests).