Add TransferQDQPixelUnshuffleChainToConv2d pass#779
Draft
nvunnam57128 wants to merge 1 commit into
Draft
Conversation
Folds the model-specific 5-op Reshape/Transpose chain that algebraically computes pixel-unshuffle (NCHW SpaceToDepth) into a single stride-B identity-weight onnx.Conv with zero bias. Any trailing layout-switch transpose (e.g. NCHW->NHWC) is left untouched and is now applied to the new Conv result, so the rewrite is semantically equivalent to the original chain. This combines the work of two xcompiler-frontend passes that the xmodel-input flow used to run on XIR: TransferQDQPatternToPixelUnShufflePass (chain -> pixel-shuffle-fix) TransferPixelUnshuffleToTileConvPass (lowers to gstiling + shuffle) into a single ONNX-MLIR transform, so the ONNX-input flow now reaches the same end state. The DPU lowers a stride-B identity conv into the same gstiling + channel-shuffle primitives. Bias is emitted as i32 storage with scale = x_scale * w_scale, matching the ONNX QLinearConv spec and the convention used by every other quantized Conv in the XIR lowering (the downstream QDQ_ConvA8W8Wrapper kernel reads bias as int32). Includes a lit test covering the exact PSV-3.4.0 chain shape (1x3x256x256 -> 1x64x64x48, B=4) with a trailing NCHW->NHWC transpose, plus a B=2 positive case and a wrong-perm negative case. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
No description provided.