fix(inference): Synchronize cpu_threads configuration for HPI predictors#4972
Open
SankaraVenkatRam wants to merge 1 commit intoPaddlePaddle:developfrom
Open
fix(inference): Synchronize cpu_threads configuration for HPI predictors#4972SankaraVenkatRam wants to merge 1 commit intoPaddlePaddle:developfrom
SankaraVenkatRam wants to merge 1 commit intoPaddlePaddle:developfrom
Conversation
|
Thanks for your contribution! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR fixes an issue where user-defined CPU thread settings (e.g.
cpu_threads=2) were ignored when using the High Performance Inference (HPI) backend.Although the value was correctly set in the legacy
PaddlePredictorOption, it was never propagated to HPI, which instead used its own default (usually 10 threads). This could lead to unexpected CPU overuse, especially in containers or limited environments.What changed
PaddlePredictorOptionandHPIConfigvia a newsync_threadsstep inBasePredictorCPU_NUM_THREADSenvironment variable in:pp_option.pyResult
cpu_threadsvalues are now respected by the HPI backendCPU_NUM_THREADSprovides a simple global override when no value is set in codeWhy it matters
This aligns user intent with actual runtime behavior and avoids silent over-allocation of CPU resources.