Repository navigation
[mkldnn][5/N] Port softmax and prelu from ideep to ATen - #201062
Closed
frost-intel wants to merge 4 commits into
Closed
frost-intel wants to merge 4 commits into
frost-intel wants to merge 4 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/201062
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit dfd1785 with merge base 780bf8e ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Oct 15, 2026
This was referenced Oct 27, 2026
frost-intel
force-pushed
the
ideep-removal/05-port-softmax-prelu
branch
from
October 29, 2026 16:04
375e7f6 to
6f0b324
Compare
This was referenced Oct 29, 2026
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. Move ideep::softmax_forward, ideep::prelu_forward and ideep::prelu_backward into aten/src/ATen/native/mkldnn/detail/ {Softmax,Prelu}.{h,cpp} and switch the callers in SoftMax.cpp and Prelu.cpp. The port is line-for-line; prelu_backward drops ideep's unused prop_kind parameter. ideep::softmax_backward has no ATen callers and is not ported. Verified with ONEDNN_VERBOSE=1 over test_mkldnn.py and the mkldnn freezing tests: all 6572 distinct primitive create/exec lines are identical before and after.
Replace the weight_with_src_rank helper with ideep's inline code in prelu_forward and prelu_backward so the port reads line-for-line against ideep's prelu.hpp. No behavior change; ONEDNN_VERBOSE logs are unchanged.
frost-intel
force-pushed
the
ideep-removal/05-port-softmax-prelu
branch
from
November 10, 2026 14:44
6f0b324 to
dfd1785
Compare
This was referenced Nov 12, 2026
This was referenced Nov 13, 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
Collaborator
Author
|
Moved to ghstack: |
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) Softmax is ported line-for-line from ideep. Since the backward pass is never called in ATen, that is not ported. As part of this process, any ideep code that is not called in ATen is not being ported. A softmax backend for mkldnn tensors doesn't currently exist, but adding it is outside the scope of this PR. Generally loss has been computed on regular tensors, making mkldnn softmax backward unnecessary. Prelu forward and backward are ported line-for-line. An unused arg is dropped from `prelu_backward` (`prop_kind`). Any calls to the ideep operators are removed from ATen. ## Agent details (if applicable) Developed with assistance from Claude Opus 5.5. > **What changed** (7 files, +209/−4): > > - **`detail/Softmax.{h,cpp}`:** `softmax_forward`, ported line for line, including the in-place buffer replacement on `dst`. Only the forward pass is ported, because ATen never calls ideep's `softmax_backward`. > - **`detail/Prelu.{h,cpp}`:** `prelu_forward` and `prelu_backward`, ported line for line. > - Kept: the weight reshape to match the input's rank, the input reorders, buffer replacement on the outputs, the avx2_vnni_2 bf16/f16 check (using `is_avx2_vnni_2` from `mkldnn/Utils.h`), and reshaping the weight gradient back at the end. > - Dropped two things ideep never used: an unused variable, and the `prop_kind` argument of `prelu_backward`. The call site no longer passes `dnnl::prop_kind::backward`. > - **Call sites:** `SoftMax.cpp` (1) and `Prelu.cpp` (2). Neither file calls ideep operators anymore. > - **`build_variables.bzl`:** 2 entries. > > **Checks:** > > - **Same oneDNN calls before and after.** I ran all of `test_mkldnn.py` plus `test_freezing.py -k mkldnn` with `ONEDNN_VERBOSE=1` and compared the logged primitive creations and executions, with timings stripped. All 6,572 distinct primitive log lines are identical. > - `prelu` runs 64 times in those tests, 13 of the distinct lines being backward. > - `softmax` runs only 3 times. > - **Tests:** > - `test_mkldnn.py`: 92 passed, 1 skipped. > - Freezing tests: 4 passed, 5 skipped. > - `test_nn.py -k "prelu or softmax"`: 36 passed. > - **Lint:** clean. > > (`test/jit/test_freezing.py` was 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 #201062. Pull Request resolved: #205711 Approved by: https://github.com/albanD ghstack dependencies: #205709, #205710
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)
Softmax is ported line-for-line from ideep. Since the backward pass is never called in ATen, that is not ported. As part of this process, any ideep code that is not called in ATen is not being ported. A softmax backend for mkldnn tensors doesn't currently exist, but adding it is outside the scope of this PR. Generally loss has been computed on regular tensors, making mkldnn softmax backward unnecessary.
Prelu forward and backward are ported line-for-line. An unused arg is dropped from
prelu_backward(prop_kind).Any calls to the ideep operators are removed from ATen.
Fake stack
sum,binary, anddirect_copyops from ideep into ATen #201059Agent details (if applicable)
Developed with assistance from Claude Opus 5.5.
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @aditew01