Repository navigation
[mkldnn][15/N] Port ideep transposed convolution op into ATen - #203645
Closed
frost-intel wants to merge 7 commits into
Closed
frost-intel wants to merge 7 commits into
frost-intel wants to merge 7 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/203645
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 1 Unclassified FailureAs of commit b5b2382 with merge base 780bf8e ( 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. |
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.
frost-intel
force-pushed
the
ideep-removal/15-port-deconv
branch
from
November 10, 2026 14:44
becbd8a to
c990970
Compare
This was referenced Nov 12, 2026
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.
frost-intel
force-pushed
the
ideep-removal/15-port-deconv
branch
from
November 13, 2026 20:13
c990970 to
b5b2382
Compare
This was referenced Nov 10, 2026
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 20, 2026
## Linked issue or supporting maintainer Part of #154444 ## BC-breaking? No ## Summary (human written only) Ports floating-point conv **forward** operators from ideep. Only ops called within ATen are ported over. Backward and quantized ops are left for a follow-up PR Ports are line-for-line and do not change any behavior. ## Agent details (if applicable) Developed with assistance from Claude Opus 5.5. > Ports the floating-point convolution **forward** operators that ATen uses from ideep (`ideep::convolution_forward`) into `aten/src/ATen/native/mkldnn/detail/Conv.{h,cpp}` (namespace `at::native::mkldnn`). The port is line-for-line and changes no behavior: it still takes `ideep::tensor` / `ideep::attr_t` and uses ideep's engine, stream and primitive cache. > > To stay under the PR size limit, convolution is split across three PRs: > - **This PR:** fp32 forward. > - **#201229, backward:** `convolution_backward_data` / `convolution_backward_weights`, in `detail/Conv.{h,cpp}`. > - **#202611, `compute_v2`:** ideep's deprecated `compute_v2` and the int8 `prepare_parameters` / `compute_dispatch` it routes through. Used only by `ConvPrepack.cpp`. Stacked on this PR. > > ### Ported > Public (`detail/Conv.h`), each with ideep's comment: > - `convolution_forward_compute_v3`: with and without bias. > - `convolution_forward_compute_binary<reorder_src, reorder_weight>`: with and without bias. Explicitly instantiated for `<true, true>`, the only combination ATen uses. > - `convolution_forward_expected_weights_desc`: the overload that takes `is_channels_last` at runtime. > > File-local (`detail/Conv.cpp`), same names as in ideep: > - `convolution_forward_params` > - `conv_deconv_utils::prepare_parameters` (fp32 overload) > - `get_primitive_desc`: the uncached aarch64 variant and the cached x86 variant > - `expected_weights_desc<is_channels_last>` > - `do_compute`, `do_compute_binary` > - `compute_dispatch` (fp32) > - `do_prepare` (fp32) > - `compute_binary_dispatch` > > ### Call sites switched > - `mkldnn/Conv.cpp`: `compute_v3` ×2, `compute_binary` ×2. > - `mkldnn/ConvPrepack.cpp`: `expected_weights_desc`. > - `mkldnn/MKLDNNConversions.cpp`: `expected_weights_desc` ×2 (conv2d/conv3d weight reorder). > - `quantized/cpu/qconv_prepack.cpp`: `expected_weights_desc` ×2. This is a quantized file, but the call is the same fp `expected_weights_desc` overload. > > Still on ideep: > - backward data and weights (backward PR) > - `ConvPrepack.cpp` `compute_v2` (`compute_v2` PR) > - quantized `prepare` / `compute` in `qconv.cpp` > - transposed convolution > - `t_store().clear()` in `IDeepRegistration.cpp` > > ### Dropped (no ATen callers / unused) > - `convolution_forward::use_gemm` > - unused overloads, and the `engine` / `lowp_kind` parameters on the public functions > - the int8 `do_prepare` and the param-based `prepare` / `compute(params, ...)` overloads (moving with quantized conv) > > ### Other changes > - `IDEEP_ENFORCE` becomes a debug-only `dnnl::error::wrap_c_api(...)` under `#ifndef NDEBUG`. `IDEEP_CHECK` becomes an unconditional `wrap_c_api`. Both behave as in ideep. > - Called directly from ideep for now: `ideep::utils::get_compatible_dilates`, `ideep::utils::group_dims`, `ideep::utils::create_key`, `ideep::utils::computation_cache`. > - The primitive cache is ideep's thread-local `computation_cache<dnnl::convolution_forward::primitive_desc>`, the same store ideep uses. `clear_computation_cache()` therefore needs no change. > - Two loop indices in `expected_weights_desc` changed from `int` to `size_t` (sign-compare; ideep hides this as a system header). > - Fixed typos in a comment copied from ideep: "workaroud", "detials", "weihgts". > > ### Testing > oneDNN verbose logs (`ONEDNN_VERBOSE=1`, timings stripped, sorted counts) are identical before and after: > - `test_mkldnn.py` plus `test_freezing.py -k mkldnn`: 6,572 distinct lines. > - `quantization/core/test_quantized_op.py -k "qconv and pt2e and not fp8"`: 257 distinct lines. > - `test_mkldnn_fusion.py`, `nn/test_convolution.py -k mkldnn`, and `inductor/test_mkldnn_pattern_matcher.py -k "conv and not qconv and not quant and not woq"`: 1,284 distinct lines, 772 of them convolution. > > Four Inductor tests fail identically with and without this change: `test_conv{2,3}d_binary_broadcast_shapes_cpu` and `test_conv_transpose{2,3}d_unary_cpu`, all with bf16 tolerance errors. `test_conv2d_unary_cpu` is flaky at its fp32 tolerance. > > Convolution is split across PRs for size: forward (#201224), backward (#201229), `compute_v2` (#202611), quantized (#202622) and transposed (#203645). Backward lives in `detail/Conv.{h,cpp}` alongside forward. > > (`test/jit/test_freezing.py` and `test/test_mkldnn_fusion.py` were later deleted upstream by #203621. The final A/B comparison of the whole series against `main`, described in #204808, re-checks these paths without it.) > > Previously submitted as #201224. Pull Request resolved: #205716 Approved by: https://github.com/albanD ghstack dependencies: #205709, #205710, #205711, #205712, #205713, #205714, #205715
pytorchmergebot
pushed a commit
that referenced
this pull request
Nov 25, 2026
## Linked issue or supporting maintainer Part of #154444 Supported by @albanD ## BC-breaking? No ## Summary (human written only) Ports transposed convolution ops from ideep to ATen. Verbose logs form ONEDNN_VERBOSE were used to verify exact matching behavior before/after this change. We dropped unused params and an unused overload. ## Agent details (if applicable) Developed with assistance from Claude Opus 5.5. > > Ports the fp32 transposed-convolution operators that ATen uses from ideep's `deconv.hpp` into `aten/src/ATen/native/mkldnn/detail/Deconv.{h,cpp}` (namespace `at::native::mkldnn`). The port is line-for-line and changes no behavior: it still takes `ideep::tensor` / `ideep::attr_t` and uses ideep's engine, stream and primitive cache. > > ### Ported > Public (`detail/Deconv.h`), with ideep's comments and default arguments. Comments that no longer describe the code are rewritten: the backward-data weights layout (`{o, i, ...}`, as the caller passes), what `is_channels_last` controls in `expected_weights_desc` (src/dst format only), the `transposed` default, and which template arguments are instantiated: > - `convolution_transpose_forward_compute_v3<reorder_src, reorder_weight>`: with and without bias. Explicitly instantiated for `<true, true>`. > - `convolution_transpose_forward_expected_weights_desc<is_channels_last, transposed>`: instantiated for `<true, true>`, `<false, true>` and `<true, false>`, the combinations ATen uses. > - `convolution_transpose_backward_data_compute_v3` > - `convolution_transpose_backward_weights_compute_v3`: with and without bias. > > File-local (`detail/Deconv.cpp`), same names as in ideep: > - `deconv_forward_params`, default constructor only (ideep's member-wise constructors are unused) > - `get_primitive_desc<with_bias>` > - `do_prepare` (fp32) > - `do_compute` > - `compute_impl` (fp32) > - `backward_weights_compute_impl`: ideep's `convolution_transpose_backward_weights::compute_impl`, renamed to avoid clashing with the forward `compute_impl`, as in the conv port. > > ideep's deconvolution has no aarch64-specific code. > > `get_primitive_desc` uses ideep's thread-local `computation_cache<dnnl::deconvolution_forward::primitive_desc>`, the same store ideep's own `convolution_transpose_forward` uses (still used by quantized deconvolution). The cache key fields and their order are unchanged. > > ### Shared with conv > - The fp32 `conv_deconv_utils::prepare_parameters` is shared with the conv port through `Conv.h` (declared there in 12/N). ideep shares it the same way between `conv.hpp` and `deconv.hpp`. This PR does not edit `detail/Conv.{h,cpp}`. > > ### Call sites switched > - `mkldnn/Conv.cpp`: forward ×2, backward data, backward weights ×2. > - `mkldnn/MKLDNNConversions.cpp`: `expected_weights_desc<true>` / `<false>` (`_reorder_convolution_transpose_weight`). > - `quantized/cpu/qconv_prepack.cpp`: `expected_weights_desc<true, false>`, for the quantized transposed-conv weight prepack. It uses the same fp weight-descriptor function. > > Still on ideep: quantized deconvolution in `quantized/cpu/qconv.cpp` (`prepare` / `compute`), ported in 15/N. > > ### Dropped / changed > - The `engine` parameters, as in the earlier ports. > - The unused non-`_v3` `compute` overloads and all int8 overloads (no fp callers). > - `expected_weights_desc`: two loop indices changed from `int` to `size_t` (sign-compare; ideep hides this as a system header). > - `do_prepare`: `std::move(super(pd))` becomes `dnnl::deconvolution_forward(pd)`; moving a temporary is a no-op. > - The commented-out `is_nhwc` block in backward data is removed. > - Four `// May replace ...` comments are added at the `reinit_if_possible` calls, following the convention of the earlier ports. They are new, not from ideep. > > ### Testing > oneDNN verbose logs (`ONEDNN_VERBOSE=1`, timings stripped, sorted counts) are identical before and after: > - `test_mkldnn.py` plus `test_freezing.py -k mkldnn`: 6,572 distinct lines, 1,598 of them deconvolution. Calls to the ported entry points from these tests and the quantized tests below: > > | Entry point | Calls | > |---|---| > | forward, with bias | 432 | > | forward, without bias | 436 | > | backward data | 392 | > | backward weights, with bias | 196 | > | backward weights, without bias | 196 | > | `expected_weights_desc` | 11 | > > (Counted with temporary instrumentation, not included in the PR.) > - `quantization/core/test_quantized_op.py -k "(qconv or conv_transpose or qconvtranspose) and not fp8 and not cudnn"` with `PYTORCH_HYPOTHESIS_PROFILE=pytorch_ci` (derandomized): 675 distinct lines. > - `test_mkldnn_fusion.py`, `nn/test_convolution.py -k mkldnn`, and `inductor/test_mkldnn_pattern_matcher.py -k "conv and not qconv and not quant and not woq"`: 1,284 distinct lines. > > Four Inductor tests fail identically with and without this change: `test_conv{2,3}d_binary_broadcast_shapes_cpu` and `test_conv_transpose{2,3}d_unary_cpu`, all with bf16 tolerance errors. > > (`test/jit/test_freezing.py` was later deleted upstream by #203621, and `test_mkldnn_fusion.py` no longer exists upstream. The final A/B comparison of the whole series against `main`, described in #204808, re-checks these paths without them.) > > Previously submitted as #203645. Pull Request resolved: #205974 Approved by: https://github.com/albanD ghstack dependencies: #205972, #205973
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.
Linked issue or supporting maintainer
Part of #154444
BC-breaking?
No
Summary (human written only)
Ports transposed convolution ops from ideep to ATen. Verbose logs form ONEDNN_VERBOSE were used to verify exact matching behavior before/after this change. We dropped unused params and an unused overload.
Depends on #201224
Fake stack
sum,binary, anddirect_copyops from ideep into ATen #201059compute_v2op into ATen #202611Agent details (if applicable)
Developed with assistance from Claude Opus 5.5.
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @aditew01