-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ci: Add support for max_inflight_requests parameter to prevent unbounded memory growth in ensemble models
#8458
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
Merged
pskiran1
merged 36 commits into
main
from
spolisetty/tri-26-triton-dali-ensemble-model-memory-issue
Nov 3, 2025
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
240a223
Update
pskiran1 974aa25
Update
pskiran1 337e0a7
Update
pskiran1 05dcb71
Update
pskiran1 4f379ed
Fix pre-commit
pskiran1 9ed216f
Fix pre-commit errors
pskiran1 78698fc
Update
pskiran1 8665a0d
Update
pskiran1 0258eda
Update
pskiran1 81561fd
Remove duplicate code and add request cancellation test
pskiran1 10dacec
Fix pre-commit
pskiran1 e2e48a3
Fix pre-commit
pskiran1 f8f1468
Update
pskiran1 3d8b848
Update
pskiran1 4a1a8fe
Improve model preparation
pskiran1 554e1b9
Update tests
pskiran1 b2ad735
Add documentation
pskiran1 977420a
Update copyright
pskiran1 c7a6abf
Apply suggestion from @yinggeh
pskiran1 673ec6a
Update docs/user_guide/decoupled_models.md
pskiran1 ce95e2f
Update docs/user_guide/ensemble_models.md
pskiran1 6612bb3
Update tests and docs
pskiran1 81be2ff
Update
pskiran1 d28c7bb
Update qa/L0_simple_ensemble/ensemble_backpressure_test.py
pskiran1 df6de1d
Update qa/L0_simple_ensemble/ensemble_backpressure_test.py
pskiran1 8645e4f
Update
pskiran1 beb8484
Update
pskiran1 801ab01
Update qa/L0_simple_ensemble/ensemble_backpressure_test.py
pskiran1 2ff1d0b
Fix typo
pskiran1 e5ed718
Update documentation
pskiran1 6d76e59
Update docs/user_guide/decoupled_models.md
pskiran1 c686cea
Update docs/user_guide/ensemble_models.md
pskiran1 70a457f
Update docs/user_guide/ensemble_models.md
pskiran1 3a922ad
Update
pskiran1 8cc7a94
Fix pre-commit
pskiran1 5be6ce4
Fix test case errors
pskiran1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
qa/L0_simple_ensemble/backpressure_test_models/decoupled_producer/1/model.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Copyright 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # Redistribution and use in source and binary forms, with or without | ||
| # modification, are permitted provided that the following conditions | ||
| # are met: | ||
| # * Redistributions of source code must retain the above copyright | ||
| # notice, this list of conditions and the following disclaimer. | ||
| # * Redistributions in binary form must reproduce the above copyright | ||
| # notice, this list of conditions and the following disclaimer in the | ||
| # documentation and/or other materials provided with the distribution. | ||
| # * Neither the name of NVIDIA CORPORATION nor the names of its | ||
| # contributors may be used to endorse or promote products derived | ||
| # from this software without specific prior written permission. | ||
| # | ||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY | ||
| # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
| # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
| # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
| # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
| # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
| # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
|
||
|
|
||
| import numpy as np | ||
| import triton_python_backend_utils as pb_utils | ||
|
|
||
|
|
||
| class TritonPythonModel: | ||
| """ | ||
| Decoupled model that produces N responses based on input value. | ||
| """ | ||
|
|
||
| def execute(self, requests): | ||
| for request in requests: | ||
| # Get input - number of responses to produce | ||
| in_tensor = pb_utils.get_input_tensor_by_name(request, "IN") | ||
| count = in_tensor.as_numpy()[0] | ||
pskiran1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| response_sender = request.get_response_sender() | ||
|
|
||
| # Produce 'count' responses, each with 0.5 as the output value | ||
| for i in range(count): | ||
| out_tensor = pb_utils.Tensor("OUT", np.array([0.5], dtype=np.float32)) | ||
| response = pb_utils.InferenceResponse(output_tensors=[out_tensor]) | ||
| response_sender.send(response) | ||
|
|
||
| # Send final flag | ||
| response_sender.send(flags=pb_utils.TRITONSERVER_RESPONSE_COMPLETE_FINAL) | ||
|
|
||
| return None | ||
58 changes: 58 additions & 0 deletions
58
qa/L0_simple_ensemble/backpressure_test_models/decoupled_producer/config.pbtxt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Copyright 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # Redistribution and use in source and binary forms, with or without | ||
| # modification, are permitted provided that the following conditions | ||
| # are met: | ||
| # * Redistributions of source code must retain the above copyright | ||
| # notice, this list of conditions and the following disclaimer. | ||
| # * Redistributions in binary form must reproduce the above copyright | ||
| # notice, this list of conditions and the following disclaimer in the | ||
| # documentation and/or other materials provided with the distribution. | ||
| # * Neither the name of NVIDIA CORPORATION nor the names of its | ||
| # contributors may be used to endorse or promote products derived | ||
| # from this software without specific prior written permission. | ||
| # | ||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY | ||
| # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
| # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
| # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
| # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
| # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
| # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
|
||
|
|
||
| name: "decoupled_producer" | ||
| backend: "python" | ||
| max_batch_size: 0 | ||
|
|
||
| input [ | ||
| { | ||
| name: "IN" | ||
| data_type: TYPE_INT32 | ||
| dims: [ 1 ] | ||
| } | ||
| ] | ||
|
|
||
| output [ | ||
| { | ||
| name: "OUT" | ||
| data_type: TYPE_FP32 | ||
| dims: [ 1 ] | ||
| } | ||
| ] | ||
|
|
||
| instance_group [ | ||
| { | ||
| count: 1 | ||
| kind: KIND_CPU | ||
| } | ||
| ] | ||
|
|
||
| model_transaction_policy { | ||
| decoupled: true | ||
| } | ||
|
|
75 changes: 75 additions & 0 deletions
75
...le_ensemble/backpressure_test_models/ensemble_disabled_max_inflight_requests/config.pbtxt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # Copyright 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
pskiran1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # | ||
| # Redistribution and use in source and binary forms, with or without | ||
| # modification, are permitted provided that the following conditions | ||
| # are met: | ||
| # * Redistributions of source code must retain the above copyright | ||
| # notice, this list of conditions and the following disclaimer. | ||
| # * Redistributions in binary form must reproduce the above copyright | ||
| # notice, this list of conditions and the following disclaimer in the | ||
| # documentation and/or other materials provided with the distribution. | ||
| # * Neither the name of NVIDIA CORPORATION nor the names of its | ||
| # contributors may be used to endorse or promote products derived | ||
| # from this software without specific prior written permission. | ||
| # | ||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY | ||
| # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
| # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
| # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
| # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
| # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
| # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
|
||
|
|
||
| platform: "ensemble" | ||
| max_batch_size: 0 | ||
|
|
||
| input [ | ||
| { | ||
| name: "IN" | ||
| data_type: TYPE_INT32 | ||
| dims: [ 1 ] | ||
| } | ||
| ] | ||
|
|
||
| output [ | ||
| { | ||
| name: "OUT" | ||
| data_type: TYPE_FP32 | ||
| dims: [ 1 ] | ||
| } | ||
| ] | ||
|
|
||
| ensemble_scheduling { | ||
| step [ | ||
| { | ||
| model_name: "decoupled_producer" | ||
| model_version: -1 | ||
| input_map { | ||
| key: "IN" | ||
| value: "IN" | ||
| } | ||
| output_map { | ||
| key: "OUT" | ||
| value: "intermediate" | ||
| } | ||
| }, | ||
| { | ||
| model_name: "slow_consumer" | ||
| model_version: -1 | ||
| input_map { | ||
| key: "INPUT0" | ||
| value: "intermediate" | ||
| } | ||
| output_map { | ||
| key: "OUTPUT0" | ||
| value: "OUT" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.