Skip to content

[mkldnn][17/N] Port ideep quantized transposed convolution into ATen - #204615

Closed
frost-intel wants to merge 10 commits into
pytorch:mainfrom
frost-intel:ideep-removal/17-port-quantized-deconv
Closed

frost-intel wants to merge 10 commits into
pytorch:mainfrom
frost-intel:ideep-removal/17-port-quantized-deconv

Conversation

@frost-intel

@frost-intel frost-intel commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Linked issue or supporting maintainer

Part of #154444

BC-breaking?

No

Summary (human written only)

Ports the int8 quantized transposed conv (deconv) from ideep. I don't port functions not used in ATen, and drop unused overloads and engine params.

This PR ports the last of the ops ideep ops used in ATen.

Depends on #203645 and #202622

Fake stack

Agent details (if applicable)

Developed with assistance from Claude Opus 5.5.

Part of #154444. Depends on 14/N (quantized conv) and 15/N (fp32 deconv); draft until both land.

Ports the int8 paths of ideep::convolution_transpose_forward that quantized conv_transpose uses into aten/src/ATen/native/mkldnn/detail/Deconv.{h,cpp}. The port is line for line, with no behavior change, and still uses ideep's primitive cache.

  • deconv_forward_params moves into Deconv.h; DeconvParams in OnednnUtils.h now points at it.
  • Ported: int8 prepare, compute with prepared params, and int8 2-in-1 compute, plus the int8 do_prepare and compute_impl behind them. Call sites in qconv.cpp are switched over.
  • The int8 conv_deconv_utils::prepare_parameters from 14/N is now declared in Conv.h, and its definition moves out of Conv.cpp's anonymous namespace. That move also fixes a build error when 14/N and 15/N are combined: with the int8 overload left in the anonymous namespace, it hides 15/N's fp32 overload.

Not ported, because ATen never reaches them: compute_v2, prepare_v3, and the no-bias int8 overloads. The only change from ideep is dropping the engine parameter.

With PRs 1-17 applied together, every ideep operator ATen uses is ported (this branch alone does not include the quantized matmul port, #204617). The remaining non-type ideep use is the primitive cache clear in IDeepRegistration.cpp.

Testing: A/B oneDNN verbose logs (before vs. after) are identical for:

  • the quantized conv/deconv tests, with fixed random seeds
  • test_mkldnn
  • a probe that reuses packed deconv weights with new input scales and shapes to reach the cache-miss path; its outputs are also bitwise equal

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @aditew01

Part of pytorch#154444.

Replace ideep type aliases with the oneDNN (or std) types they name.
Each is a plain `using` in ideep, so this is a pure spelling change
with no effect on generated code. It removes about a third of the
remaining ideep references from ATen CPU code.
Part of pytorch#154444. Move ideep::eltwise_forward/backward into aten.
Switch all CPU callers (relu, sigmoid, tanh, gelu, scalar mul,
dense GELU, JIT frozen scalar mul). Line-for-line port.
Part of pytorch#154444. Depends on pytorch#201055.

Port the floating-point convolution forward, backward-data and
backward-weights operators ATen uses from ideep into
aten/src/ATen/native/mkldnn/detail/Conv.{h,cpp}. The port is
line-for-line, still takes ideep::tensor/attr_t, and shares ideep's
primitive cache, so behavior is unchanged.

Switch the call sites in mkldnn/Conv.cpp, ConvPrepack.cpp,
MKLDNNConversions.cpp and quantized/cpu/qconv_prepack.cpp
(expected_weights_desc only). Quantized prepare/compute and transposed
convolution remain on ideep for now.

Drop code ATen never reaches: use_gemm, unused overloads/parameters,
backward_weights' diff_weight_type, and the fixed algorithm parameter on
backward. Remove an unused variable and fix sign-compare loop indices
that surface outside ideep's system-header include.
Keep only the fp32 forward port (compute_v3, compute_binary,
expected_weights_desc and their helpers) to stay under the PR size limit.
Backward data/weights and compute_v2 with its int8 prepare_parameters /
compute_dispatch path move to separate PRs; their call sites in
mkldnn/Conv.cpp and ConvPrepack.cpp go back to ideep until those land.
Part of pytorch#154444. Depends on pytorch#201224.

Port ideep's deprecated convolution_forward::compute_v2 (with and
without bias) and the code it routes through, the scale/zero-point
compute_dispatch and the int8 conv_deconv_utils::prepare_parameters,
into aten/src/ATen/native/mkldnn/detail/Conv.{h,cpp}. The port is
line-for-line, still takes ideep::tensor/attr_t, and shares ideep's
primitive cache, so behavior is unchanged.

Switch the two compute_v2 calls in mkldnn/ConvPrepack.cpp. Drop the
algorithm, prop_kind, lowp_kind and engine parameters ATen never passes,
and an unused weights_zero_point local.
@pytorch-bot

pytorch-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/204615

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 1 Unclassified Failure

As of commit 78aad31 with merge base 780bf8e (image):

NEW FAILURE - The following job has failed:

UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Move the fp32 and int8 prepare_parameters overloads out of Conv.cpp's
anonymous namespace and declare both in Conv.h. The transposed
convolution port reuses them from Deconv.cpp; with only the fp32
overload at namespace scope, the int8 one in the anonymous namespace
hides it and the fp32 calls fail to compile.
Part of pytorch#154444. Depends on pytorch#201224.

Port the fp32 transposed-convolution path ATen uses from ideep's
deconv.hpp into aten/src/ATen/native/mkldnn/detail/Deconv.{h,cpp}:
convolution_transpose_forward::compute_v3 and expected_weights_desc,
convolution_transpose_backward_data::compute_v3, and
convolution_transpose_backward_weights::compute_v3 with their file-local
helpers. The port is line-for-line, still takes ideep::tensor/attr_t,
and shares ideep's deconvolution primitive cache, so behavior is
unchanged.

Give the already-ported fp32 prepare_parameters external linkage and
declare it in Conv.h so Deconv.cpp can use it, as ideep's deconv uses
conv_deconv_utils. Switch the call sites in mkldnn/Conv.cpp,
MKLDNNConversions.cpp and quantized/cpu/qconv_prepack.cpp. Quantized
deconvolution in qconv.cpp remains on ideep.
Part of pytorch#154444. Depends on pytorch#202611.

Port the int8 convolution entry points qconv uses into
aten/src/ATen/native/mkldnn/detail/Conv.{h,cpp}: convolution_forward::
prepare (int8, with bias), compute with pre-prepared params, the int8
2-in-1 compute used on a primitive-cache miss, and the int8 do_prepare
they share. The port is line-for-line, still takes ideep::tensor/attr_t,
and shares ideep's primitive cache, so behavior is unchanged.

Move the ported convolution_forward_params into Conv.h and point
OnednnUtils.h's ConvParams at it. Switch the calls in qconv.cpp, dropping
the engine argument (always cpu_engine()). Drop an unused is_channels_last
local in the 2-in-1 compute that ideep computes but never reads.
Part of pytorch#154444.

Ports the int8 paths of `ideep::convolution_transpose_forward` that quantized `conv_transpose` uses into `aten/src/ATen/native/mkldnn/detail/Deconv.{h,cpp}`. The port is line for line, with no behavior change, and still uses ideep's primitive cache.

- `deconv_forward_params` moves into `Deconv.h`; `DeconvParams` in `OnednnUtils.h` now points at it.
- Ported: int8 `prepare`, `compute` with prepared params, and int8 2-in-1 `compute`, plus the int8 `do_prepare` and `compute_impl` behind them. Call sites in `qconv.cpp` are switched over.
- The int8 `conv_deconv_utils::prepare_parameters` from 14/N is now declared in `Conv.h`, and its definition moves out of `Conv.cpp`'s anonymous namespace. That move also fixes a build error when 14/N and 15/N are combined: with the int8 overload left in the anonymous namespace, it hides 15/N's fp32 overload.

Not ported, because ATen never reaches them: `compute_v2`, `prepare_v3`, and the no-bias int8 overloads. The only change from ideep is dropping the `engine` parameter.

With this, every ideep operator ATen uses is ported. The remaining non-type ideep use is the primitive cache clear in `IDeepRegistration.cpp`.

Testing: A/B oneDNN verbose logs (before vs. after) are identical for:
- the quantized conv/deconv tests, with fixed random seeds
- `test_mkldnn`
- a probe that reuses packed deconv weights with new input scales and shapes to reach the cache-miss path; its outputs are also bitwise equal
@frost-intel
frost-intel force-pushed the ideep-removal/17-port-quantized-deconv branch from d0828ee to 78aad31 Compare November 13, 2026 20:13
pytorchmergebot pushed a commit that referenced this pull request Nov 19, 2026
…1053)

## Linked issue or supporting maintainer
Part of #154444

## BC-breaking?
No

## Summary (human written only)
See #154444 for ideep removal discussion.
Replace ideep type aliases with the oneDNN or std types they name. Each is a plain `using` in ideep, so this is a pure spelling change with no effect on generated code. It removes about a third of the remaining ideep references from ATen CPU code.

#### Fake Stack
* #201052
* -> #201053
* Port ops:
* #201055
* #201059
* #201062
* #201080
* #201083
* #201126
* #201194
* #201224
* #201229
* #202547
* #202611
* #202622
* #203645
* #204617
* #204615
* Port classes and utils:
* #204801
* #204805
* #204806
* #204807
* Final removal:
* #204808

## Agent details (if applicable)

Developed with assistance from Claude Opus 5.5
Summary:
> Replace ideep type aliases with the oneDNN (or std) types they name:
> data_type, dims, format_tag/tag, prop_kind, algorithm, scale_t,
> zero_point_t and exec_args. Each is a plain `using` in ideep, so this is
> a pure spelling change with no effect on generated code. It removes
> about a third of the remaining ideep references from ATen CPU code
> without touching any ideep-specific behavior.

Pull Request resolved: #201053
Approved by: https://github.com/albanD, https://github.com/malfet
pytorchmergebot pushed a commit that referenced this pull request Nov 25, 2026
…205975)

## Linked issue or supporting maintainer
Part of #154444
Supported by @albanD

## BC-breaking?
No

## Summary (human written only)
Ports the int8 quantized transposed conv (deconv) from ideep. I don't port functions not used in ATen, and drop unused overloads and engine params.

This PR ports the last of the ops ideep ops used in ATen.

## Agent details (if applicable)
Developed with assistance from Claude Opus 5.5.

>
> Ports the int8 paths of `ideep::convolution_transpose_forward` that quantized `conv_transpose` uses into `aten/src/ATen/native/mkldnn/detail/Deconv.{h,cpp}`. The port is line for line, with no behavior change, and still uses ideep's primitive cache.
>
> - `deconv_forward_params` moves into `Deconv.h`; `DeconvParams` in `OnednnUtils.h` now points at it.
> - Ported: int8 `prepare`, `compute` with prepared params, and int8 2-in-1 `compute`, plus the int8 `do_prepare` and `compute_impl` behind them. Call sites in `qconv.cpp` are switched over.
> - These use the int8 `conv_deconv_utils::prepare_parameters`, which 12/N declares in `Conv.h`. This PR does not edit `detail/Conv.{h,cpp}`.
>
> Not ported, because ATen never reaches them: `compute_v2`, `prepare_v3`, and the no-bias int8 overloads. Changes from ideep: the `engine` parameter is dropped (ATen only ever passes `ideep::engine::cpu_engine()`, which the ported code uses directly), and the prepared-params `compute` loses its default template arguments, since only `<false, false>` is instantiated. Header comments that no longer match the code (defaults the parameters don't have, "for compatibility", "for both fp32 and int8") are rewritten.
>
> After this PR every ideep convolution and transposed-convolution operator ATen uses is ported. The remaining ideep operator, matmul (fp32 and quantized), is ported in 16/N.
>
> Testing: A/B oneDNN verbose logs (before vs. after) are identical for:
> - the quantized conv/deconv tests, with fixed random seeds
> - `test_mkldnn`
> - a probe that reuses packed deconv weights with new input scales and shapes to reach the cache-miss path; its outputs are also bitwise equal
>
> Previously submitted as #204615.

Pull Request resolved: #205975
Approved by: https://github.com/albanD
ghstack dependencies: #205972, #205973, #205974
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: cpu CPU specific problem (e.g., perf, algorithm) open source release notes: quantization release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants