[NNCF] Move is_weight_compression_needed and BackendParameters to com… #3693
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 refactors duplicated logic for weight compression handling across different backends.
The is_weight_compression_needed function and the BackendParameters class were previously defined in multiple backend-specific files (FX and OpenVINO).
Since the logic is identical, they have now been consolidated into a single shared module for better code reuse and maintainability.
###Changes Made
Moved common logic to a new file:
src/nncf/common/quantization/backend_parameters.py
Removed backend-specific duplicates:
src/nncf/experimental/torch/fx/quantization/backend_parameters.py
src/nncf/openvino/quantization/backend_parameters.py
Updated import statements in affected modules to reference the new common file.
No logic changes — purely a structural refactor.
###Reason for Change
Having identical logic across multiple backend implementations caused unnecessary duplication and made maintenance harder.
This refactor improves:
Code consistency
Readability
Ease of future modifications
###Testing
Ran full pytest suite — all tests passed successfully.
Verified that all backend compression logic functions as expected using the common implementation.
###Related Issue
Fixes: #3668