-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[TRTLLM-6549] chore: record delay introduced by disaggregated serving in kv cache measure #6135
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
Conversation
📝 WalkthroughWalkthroughThe changes add conditional delay measurement and reporting for KV cache data transfers in the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant openai_server.py
participant CacheFormatter/MLACacheFormatter
participant KvCacheMeasureHelper
User->>openai_server.py: Send request
openai_server.py->>openai_server.py: Check TRTLLM_KVCACHE_TIME_OUTPUT_PATH
openai_server.py->>CacheFormatter/MLACacheFormatter: Call format/unformat (with return_perf_metrics)
CacheFormatter/MLACacheFormatter->>KvCacheMeasureHelper: appendKVCacheTransfer(delay, duration, size)
KvCacheMeasureHelper->>KvCacheMeasureHelper: Store Measure (delay, duration, bandwidth)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ 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)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
/bot run |
PR_Github #12183 [ run ] triggered by Bot |
PR_Github #12183 [ run ] completed with state |
0cc1045
to
3657333
Compare
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: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
cpp/tensorrt_llm/batch_manager/cacheFormatter.cpp
(10 hunks)cpp/tensorrt_llm/batch_manager/dataTransceiver.h
(4 hunks)cpp/tensorrt_llm/batch_manager/mlaCacheFormatter.cpp
(5 hunks)tensorrt_llm/serve/openai_server.py
(2 hunks)
🧰 Additional context used
🪛 Ruff (0.12.2)
tensorrt_llm/serve/openai_server.py
257-257: Undefined name os
(F821)
410-410: Undefined name os
(F821)
🔇 Additional comments (6)
cpp/tensorrt_llm/batch_manager/mlaCacheFormatter.cpp (2)
111-117
: LGTM! Timing logic for cache sending is well-implemented.The conditional initialization of
lastTokenTime
and delay calculation properly handles the case when performance metrics are disabled by using a sentinel value.Also applies to: 236-244
297-311
: LGTM! Comprehensive timing implementation for cache receiving.The code properly:
- Uses context request ID for tracking generation-side metrics
- Conditionally tracks arrival time based on performance metrics flag
- Accumulates sizes correctly across multiple receive operations
- Records delay from arrival time to cache receive start
Also applies to: 395-441
cpp/tensorrt_llm/batch_manager/dataTransceiver.h (2)
272-294
: Well-designed struct for encapsulating KV cache transfer metrics.The
Measure
struct effectively groups related metrics with clear documentation of units. The updatedappendKVCacheTransfer
method signature maintains consistency.
306-324
: LGTM! Clear CSV output format for performance metrics.The updated CSV headers and output formatting correctly reflect the new
Measure
struct fields with appropriate units.cpp/tensorrt_llm/batch_manager/cacheFormatter.cpp (2)
169-175
: Consistent timing implementation for cache sending.The delay tracking logic correctly measures the time from last token generation to cache send start, maintaining consistency with the MLA formatter implementation.
Also applies to: 360-368
423-439
: Comprehensive timing coverage across all receive paths.The implementation correctly tracks delays and sizes across all code paths (zero-copy, legacy, and normal), ensuring consistent performance metrics regardless of the transfer method used.
Also applies to: 656-724
/bot run |
PR_Github #12282 [ run ] triggered by Bot |
PR_Github #12282 [ run ] completed with state |
/bot run |
PR_Github #12406 [ run ] triggered by Bot |
PR_Github #12406 [ run ] completed with state |
/bot run |
PR_Github #12415 [ run ] triggered by Bot |
PR_Github #12415 [ run ] completed with state |
/bot run |
PR_Github #12428 [ run ] triggered by Bot |
PR_Github #12428 [ run ] completed with state |
/bot run |
PR_Github #12449 [ run ] triggered by Bot |
PR_Github #12449 [ run ] completed with state |
/bot run |
PR_Github #12493 [ run ] triggered by Bot |
PR_Github #12493 [ run ] completed with state |
LGTM. As @pcastonguay said, let's merge this PR first and then after we merge the customer's metric PR, we can see how to refactor this part and make it clean. |
Thanks for your work. I do have some confusion regarding the |
Signed-off-by: zhengd-nv <[email protected]>
Signed-off-by: zhengd-nv <[email protected]>
/bot run |
PR_Github #13002 [ run ] triggered by Bot |
/bot run |
PR_Github #13124 [ run ] triggered by Bot |
PR_Github #13124 [ run ] completed with state |
/bot run |
PR_Github #13164 [ run ] triggered by Bot |
PR_Github #13164 [ run ] completed with state |
/bot run |
PR_Github #13337 [ run ] triggered by Bot |
PR_Github #13337 [ run ] completed with state |
… in kv cache measure (NVIDIA#6135) Signed-off-by: zhengd-nv <[email protected]> Signed-off-by: Lanyu Liao <[email protected]>
… in kv cache measure (NVIDIA#6135) Signed-off-by: zhengd-nv <[email protected]>
Description
Add delay metrics in KV cache measure helper to track extra TTFT introduced by disaggregated serving. Also add transmission time recording in the generation instance, using the context request id for comparation.
The delay refers to:
Test Coverage
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 [--disable-fail-fast --skip-test --stage-list "A10-1, xxx" --gpu-type "A30, H100_PCIe" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-[Post-Merge]-1, xxx"]
Launch build/test pipelines. All previously running jobs will be killed.
--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-1, xxx"
(OPTIONAL) : Only run the specified test stages. Examples: "A10-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.--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. Will also run 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-[Post-Merge]-1, xxx"
(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-[Post-Merge]-1, xxx".For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.md
.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.
Summary by CodeRabbit
New Features
Improvements