-
Couldn't load subscription status.
- Fork 1.8k
refactor: Remove unused buffers and bindings from sampler #6484
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
📝 Walkthrough📝 WalkthroughThe changes remove Python bindings and exposure of several classes and buffers related to batch management and runtime requests from both nanobind and pybind11 modules. Header includes and opaque bindings related to requests and medusa buffers are deleted. Additionally, a tensor allocation in a Python sampler is removed. No core logic or public API declarations are altered. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Possibly related PRs
Suggested reviewers
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 (15)
💤 Files with no reviewable changes (8)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (3)
🧰 Additional context used📓 Path-based instructions (2)**/*.{cpp,h,hpp,cc,cxx}📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
Files:
**/*.{cpp,h,hpp,cc,cxx,cu,py}📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
Files:
🧠 Learnings (1)cpp/tensorrt_llm/nanobind/batch_manager/algorithms.cpp (2)Learnt from: yechank-nvidia Learnt from: CR ⏰ 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)
🔇 Additional comments (1)
✨ 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. 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 |
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
🔭 Outside diff range comments (2)
cpp/tensorrt_llm/pybind/batch_manager/algorithms.cpp (1)
2-2: Update copyright year to include 2025.The copyright header should include the current year (2025) as required by the coding guidelines. The nanobind version correctly shows "2022-2025" while this file shows "2022-2024".
- * SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.cpp/tensorrt_llm/nanobind/common/customCasters.h (1)
47-51: StaleNB_MAKE_OPAQUEforRequest/SamplingConfig– will not compile after header removal
NB_MAKE_OPAQUE(std::vector<tensorrt_llm::runtime::decoder_batch::Request>)and
NB_MAKE_OPAQUE(std::vector<tensorrt_llm::runtime::SamplingConfig>)rely on the
types that were just de-included in this patch.
Because no forward declaration for these symbols exists in this translation unit,
the compiler will error out with “unknown type name”.If the intention of the PR is to drop those bindings entirely (as implied by the
removal ofrequest.h/samplingConfig.helsewhere), the opaque
registrations must go as well.-NB_MAKE_OPAQUE(std::vector<tensorrt_llm::runtime::decoder_batch::Request>) -NB_MAKE_OPAQUE(std::vector<tensorrt_llm::runtime::SamplingConfig>)Alternatively, add forward declarations and keep the include in at least one
TU, but that contradicts the stated objective of removing the sampler
bindings.
🧹 Nitpick comments (2)
cpp/tensorrt_llm/nanobind/common/customCasters.h (1)
37-40: Duplicate & inconsistent<filesystem>/<vector>includes
<nanobind/stl/filesystem.h>already drags in<filesystem>and<nanobind/stl/vector.h>already drags in<vector>. Keeping the raw headers here adds redundant work for the compiler and increases include-order fragility.-#include <deque> -#include <filesystem> -#include <vector> +#include <deque>cpp/tensorrt_llm/pybind/common/customCasters.h (1)
36-38: Minor include hygiene
<pybind11/stl_bind.h>already transitively includes<vector>and, via the STL
bindings, typically pulls in<filesystem>as well. While harmless, the
explicit additions grow compile times and violate the “only include what you
use” rule of thumb. Consider pruning unless a direct dependency exists.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
cpp/include/tensorrt_llm/runtime/gptDecoder.h(0 hunks)cpp/tensorrt_llm/nanobind/batch_manager/algorithms.cpp(2 hunks)cpp/tensorrt_llm/nanobind/batch_manager/bindings.cpp(0 hunks)cpp/tensorrt_llm/nanobind/common/customCasters.h(1 hunks)cpp/tensorrt_llm/nanobind/runtime/bindings.cpp(0 hunks)cpp/tensorrt_llm/pybind/CMakeLists.txt(0 hunks)cpp/tensorrt_llm/pybind/batch_manager/algorithms.cpp(2 hunks)cpp/tensorrt_llm/pybind/batch_manager/bindings.cpp(0 hunks)cpp/tensorrt_llm/pybind/batch_manager/buffers.cpp(0 hunks)cpp/tensorrt_llm/pybind/batch_manager/buffers.h(0 hunks)cpp/tensorrt_llm/pybind/bindings.cpp(0 hunks)cpp/tensorrt_llm/pybind/common/customCasters.h(1 hunks)cpp/tensorrt_llm/pybind/runtime/bindings.cpp(0 hunks)tensorrt_llm/_torch/pyexecutor/sampler.py(0 hunks)
💤 Files with no reviewable changes (10)
- cpp/include/tensorrt_llm/runtime/gptDecoder.h
- cpp/tensorrt_llm/pybind/CMakeLists.txt
- cpp/tensorrt_llm/pybind/bindings.cpp
- cpp/tensorrt_llm/nanobind/runtime/bindings.cpp
- tensorrt_llm/_torch/pyexecutor/sampler.py
- cpp/tensorrt_llm/nanobind/batch_manager/bindings.cpp
- cpp/tensorrt_llm/pybind/batch_manager/buffers.h
- cpp/tensorrt_llm/pybind/runtime/bindings.cpp
- cpp/tensorrt_llm/pybind/batch_manager/bindings.cpp
- cpp/tensorrt_llm/pybind/batch_manager/buffers.cpp
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{cpp,h,hpp,cc,cxx}
📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
**/*.{cpp,h,hpp,cc,cxx}: Closing braces of namespaces should have a comment saying the namespace it closes (e.g., } // namespace foo).
Prefer const or constexpr variables over #defines whenever possible, as the latter are not visible to the compiler.
A variable that is not modified after its initialization should be declared as const.
Except 0 (only used in comparison for checking signness/existence/emptiness) and nullptr, true, false, all other literals should only be used for variable initialization.
Use the Allman indentation style for braces in C++ code.
Put the semicolon for an empty for or while loop in a new line.
The statement forming the body of a switch, while, do .. while or for statement shall be a compound statement (use brace-delimited statements).
If and else should always be followed by brace-delimited statements, even if empty or a single statement.
C++ filenames should use camel case with first letter lowercase (e.g., thisIsAFilename.cpp), and all files involved in a compilation target must have filenames that are case-insensitive unique.
All types (including class names) are camel case with uppercase first letter (e.g., FooBarClass).
Local variables, methods, and namespaces use camel case with first letter lowercase (e.g., localFooBar).
Non-magic-number global variables that are non-static and not defined in anonymous namespace use camel case prefixed by a lower case 'g' (e.g., gDontUseGlobalFoos).
Non-magic-number global variables that are static or defined in an anonymous namespace use camel case prefixed by a lower case 's' (e.g., sMutableStaticGlobal).
Locally visible static variable uses camel case with lowercase prefix 's' as the first letter of the name (e.g., static std::once_flag sFlag;).
Class member variables use camelcase prefixed with an 'm' (e.g., mNbFooValues). Public member variables do not require the 'm' prefix but it is encouraged for clarity.
Enumerations, global constants, static constants at class-scope, and function-scope ...
Files:
cpp/tensorrt_llm/pybind/common/customCasters.hcpp/tensorrt_llm/nanobind/common/customCasters.hcpp/tensorrt_llm/nanobind/batch_manager/algorithms.cppcpp/tensorrt_llm/pybind/batch_manager/algorithms.cpp
**/*.{h,hpp}
📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
Use a preprocessor guard in header files. The guard name must have prefix TRTLLM_ followed by the filename, all in caps, and no trailing underscore.
Files:
cpp/tensorrt_llm/pybind/common/customCasters.hcpp/tensorrt_llm/nanobind/common/customCasters.h
**/*.{cpp,h,cu,py}
📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
All TensorRT-LLM Open Source Software code should contain an NVIDIA copyright header that includes the current year. This includes .cpp, .h, .cu, .py, and any other source files which are compiled or interpreted.
Files:
cpp/tensorrt_llm/pybind/common/customCasters.hcpp/tensorrt_llm/nanobind/common/customCasters.hcpp/tensorrt_llm/nanobind/batch_manager/algorithms.cppcpp/tensorrt_llm/pybind/batch_manager/algorithms.cpp
🧠 Learnings (4)
cpp/tensorrt_llm/pybind/common/customCasters.h (5)
Learnt from: CR
PR: NVIDIA/TensorRT-LLM#0
File: CODING_GUIDELINES.md:0-0
Timestamp: 2025-07-30T06:11:42.362Z
Learning: Applies to **/*.{cpp,h,cu,py} : All TensorRT-LLM Open Source Software code should contain an NVIDIA copyright header that includes the current year. This includes .cpp, .h, .cu, .py, and any other source files which are compiled or interpreted.
Learnt from: CR
PR: NVIDIA/TensorRT-LLM#0
File: CODING_GUIDELINES.md:0-0
Timestamp: 2025-07-30T06:11:42.362Z
Learning: Applies to **/*.{h,hpp} : Use a preprocessor guard in header files. The guard name must have prefix TRTLLM_ followed by the filename, all in caps, and no trailing underscore.
Learnt from: CR
PR: NVIDIA/TensorRT-LLM#0
File: CODING_GUIDELINES.md:0-0
Timestamp: 2025-07-30T06:11:42.362Z
Learning: Applies to **/*.{cpp,h,hpp,cc,cxx} : Avoid dynamic_cast in C++.
Learnt from: CR
PR: NVIDIA/TensorRT-LLM#0
File: CODING_GUIDELINES.md:0-0
Timestamp: 2025-07-30T06:11:42.362Z
Learning: Applies to **/*.{cpp,h,hpp,cc,cxx} : C headers should not be used directly. Use instead of <stdint.h>.
Learnt from: moraxu
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.
cpp/tensorrt_llm/nanobind/common/customCasters.h (2)
Learnt from: CR
PR: NVIDIA/TensorRT-LLM#0
File: CODING_GUIDELINES.md:0-0
Timestamp: 2025-07-30T06:11:42.362Z
Learning: Applies to **/*.{cpp,h,cu,py} : All TensorRT-LLM Open Source Software code should contain an NVIDIA copyright header that includes the current year. This includes .cpp, .h, .cu, .py, and any other source files which are compiled or interpreted.
Learnt from: yechank-nvidia
PR: #6254
File: tensorrt_llm/_torch/pyexecutor/model_engine.py:1201-1204
Timestamp: 2025-07-22T09:22:14.726Z
Learning: In TensorRT-LLM's multimodal processing pipeline, shared tensor recovery using from_shared_tensor() is only needed during the context phase. Generation requests reuse the already-recovered tensor data and only need to call strip_for_generation() to remove unnecessary multimodal data while preserving the recovered tensors. This avoids redundant tensor recovery operations during generation.
cpp/tensorrt_llm/nanobind/batch_manager/algorithms.cpp (2)
Learnt from: yechank-nvidia
PR: #6254
File: tensorrt_llm/_torch/pyexecutor/model_engine.py:1201-1204
Timestamp: 2025-07-22T09:22:14.726Z
Learning: In TensorRT-LLM's multimodal processing pipeline, shared tensor recovery using from_shared_tensor() is only needed during the context phase. Generation requests reuse the already-recovered tensor data and only need to call strip_for_generation() to remove unnecessary multimodal data while preserving the recovered tensors. This avoids redundant tensor recovery operations during generation.
Learnt from: CR
PR: NVIDIA/TensorRT-LLM#0
File: CODING_GUIDELINES.md:0-0
Timestamp: 2025-07-30T06:11:42.362Z
Learning: Applies to **/*.{cpp,h,cu,py} : All TensorRT-LLM Open Source Software code should contain an NVIDIA copyright header that includes the current year. This includes .cpp, .h, .cu, .py, and any other source files which are compiled or interpreted.
cpp/tensorrt_llm/pybind/batch_manager/algorithms.cpp (1)
Learnt from: yechank-nvidia
PR: #6254
File: tensorrt_llm/_torch/pyexecutor/model_engine.py:1201-1204
Timestamp: 2025-07-22T09:22:14.726Z
Learning: In TensorRT-LLM's multimodal processing pipeline, shared tensor recovery using from_shared_tensor() is only needed during the context phase. Generation requests reuse the already-recovered tensor data and only need to call strip_for_generation() to remove unnecessary multimodal data while preserving the recovered tensors. This avoids redundant tensor recovery operations during generation.
⏰ 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 (3)
cpp/tensorrt_llm/nanobind/batch_manager/algorithms.cpp (2)
1-16: LGTM!The copyright header correctly includes the current year (2025) as required by the coding guidelines.
110-123: LGTM! Clean parameter removal.The removal of the
medusa_buffersparameter from the Python interface while maintaining internal compatibility by passingstd::nulloptis well implemented. This aligns with the broader refactoring to remove unused Medusa buffer functionality.cpp/tensorrt_llm/pybind/batch_manager/algorithms.cpp (1)
112-125: LGTM! Consistent parameter removal across binding interfaces.The removal of the
medusa_buffersparameter is implemented consistently with the nanobind version, maintaining internal compatibility while simplifying the Python interface.
|
PR_Github #13527 [ run ] triggered by Bot |
|
PR_Github #13527 [ run ] completed with state |
0a29aea to
949df88
Compare
|
/bot run |
|
PR_Github #13531 [ run ] triggered by Bot |
|
PR_Github #13531 [ run ] completed with state |
949df88 to
bc14587
Compare
|
/bot run |
|
PR_Github #13539 [ run ] triggered by Bot |
|
PR_Github #13539 [ run ] completed with state |
Signed-off-by: Robin Kobus <[email protected]>
…aders - Remove unused Request class from gptDecoder. - Remove unused Request class from bindings. Signed-off-by: Robin Kobus <[email protected]>
…ationLogits, and MakeDecodingBatchInputOutput - Removed unused class bindings and associated methods from both nanobind and pybind implementations. - Cleaned up includes to streamline the codebase. Signed-off-by: Robin Kobus <[email protected]>
…atures - Removed MedusaBuffers class bindings from both nanobind and pybind implementations. - Updated function signatures in initBindings to remove medusaBuffers parameter, defaulting it to std::nullopt within the function body. Signed-off-by: Robin Kobus <[email protected]>
…d nanobind - Deleted Buffers class and its bindings from both pybind and nanobind implementations. - Cleaned up include statements in related files to streamline the codebase. Signed-off-by: Robin Kobus <[email protected]>
- Updated the copyright year from 2024 to 2025 in various source files including bindings and algorithms. - Ensured consistency across all relevant files in the codebase. Signed-off-by: Robin Kobus <[email protected]>
bc14587 to
b6e9786
Compare
|
/bot run |
|
PR_Github #13668 [ run ] triggered by Bot |
|
PR_Github #13668 [ run ] completed with state |
|
/bot run |
|
PR_Github #13705 [ run ] triggered by Bot |
|
PR_Github #13705 [ run ] completed with state |
Signed-off-by: Robin Kobus <[email protected]> Signed-off-by: Lanyu Liao <[email protected]>
Signed-off-by: Robin Kobus <[email protected]>
Summary by CodeRabbit
Description
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 [--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.