Skip to content

Add TransferQDQPixelUnshuffleChainToConv2d pass#779

Draft
nvunnam57128 wants to merge 1 commit into
Xilinx:feature/onnx-to-tosafrom
nvunnam57128:nvunnam.pixel-unshuffle-chain-to-conv2d
Draft

Add TransferQDQPixelUnshuffleChainToConv2d pass#779
nvunnam57128 wants to merge 1 commit into
Xilinx:feature/onnx-to-tosafrom
nvunnam57128:nvunnam.pixel-unshuffle-chain-to-conv2d

Conversation

@nvunnam57128
Copy link
Copy Markdown

No description provided.

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>
@nvunnam57128 nvunnam57128 marked this pull request as draft May 25, 2026 14:35
@jorickert jorickert removed request for jorickert and p-lanza May 26, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant