Fix memory consumption issue with quantized Gemini Nano2 models on CPU #32149
+8
−1
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.
Details:
Problem:
Quantized models (i8/fp16 weights) were consuming excessive memory (up to 90GB) due to
ConstantFolding transformation converting compressed weights to fp32.
Root cause:
Solution:
This allows proper pattern recognition for Einsum operations
This preserves the protection against unwanted constant folding
Transformation pipeline flow:
Before fix:
MarkDequantization -> [Einsum blocks pattern] -> ConstantFolding converts to fp32
After fix:
EinsumDecomposition -> MarkDequantization -> [Pattern recognized] -> Constants preserved
Test results on einsum_model_with_fp16_i8:
Both changes are required - applying only one results in incorrect behavior.
Tickets: