Preserve shape ops when removing QDQ pairs#5048
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5048 +/- ##
===========================================
+ Coverage 92.78% 92.81% +0.03%
===========================================
Files 596 597 +1
Lines 32011 32164 +153
===========================================
+ Hits 29700 29851 +151
- Misses 2311 2313 +2
🚀 New features to boost your workflow:
|
Regressions detected 🔴 |
|
TedThemistokleous
left a comment
There was a problem hiding this comment.
Hey thanks for your contribution!
I have a few suggested changes and some initial questions
| inline auto get_input_path(instruction_ref ins) | ||
| { | ||
| return unfold(ins, [](instruction_ref x) -> std::optional<instruction_ref> { | ||
| if(x->inputs().size() != 1) |
There was a problem hiding this comment.
What if there's multiple inputs?
Is this intending on check for single inputs or non zero non multi inputs. Some ops can have two inputs like gather (calculate shape for indicies and data).
There was a problem hiding this comment.
This is intentionally limited to linear single-input chains. Encountering an instruction with multiple inputs terminates the traversal because there is no unambiguous input path to follow. I added a comment to clarify this.
|
Adding Shiv since he's looked a lot of the QDQ stuff |
Motivation
Fix
simplify_qdqso Q/DQ pair removal does not accidentally drop intervening shape operations or produce shape-changing rewrites.Technical Details
Updated Q/DQ removal to replay supported shape operations when removing non-FP4 fake quantization chains, while continuing to drop FP4 pack/unpack adapter operations where appropriate. Added guards for concat QLinear splitting when sliced scale or zero-point shapes do not match the corresponding concat input. Added a regression test for preserving
sliceandreshapethrough Q/DQ removal.Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot Applicable