Repository navigation
[mkldnn][1/N] Pin oneDNN as a direct submodule to begin ideep removal. - #201052
frost-intel wants to merge 4 commits into
Conversation
PR Status: in progressA maintainer requested changes. Please address their feedback before the PR returns to maintainer review. To become ready for review, please address automated review on your PR either with a code/PR description change. If a review comment is irrelevant, react with 👎 on that specific comment to reject it, and leave a short reply explaining why. The change must pass any running CI and existing failures must be classified as unrelated (see status below in this comment). Passing automated review does not guarantee that this PR will be merged. It still requires maintainer review and may be closed if its design or direction does not align with the project. To minimize iteration time, feel free to run the pr-review skill from the repo locally. To trigger a fresh automated review, make a new push or comment @pytorchbot review. To bypass automated review, please add the "no automated review" label. 🟡 AUTOMATED REVIEW - Changes requested:
Findings (2): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/201052
Note: Links to docs will display an error until the docs builds have been completed. ❌ 57 Cancelled Jobs, 2 Unrelated Failures, 1 Unclassified FailureAs of commit 49e974e with merge base ecf6ba1 ( NEW FAILURES SUPPRESSED BY AI (non-blocking) - The following jobs failed, but the AI CI Advisor judged the failures not to be evidence against this change:
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:
CANCELLED JOBS - The following jobs were cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
72baa24 to
a4fbe3a
Compare
- FindMKLDNN: unset cached MKLDNN/LLGA include dirs so reused build dirs stop resolving dnnl headers from ideep's nested mkl-dnn. - FindMKLDNN: drop the submodule-init block; PreBuildSteps.cmake already verifies every .gitmodules path, including third_party/oneDNN. - OWNERSHIP.yaml / CODEOWNERS: add /third_party/oneDNN next to ideep. - labeler / merge_rules: drop the nonexistent third_party/mkl-dnn.BUILD. - pyproject.toml: update the sdist comment to mention third_party/oneDNN.
|
Most bot comments were reasonable, I addressed them.
|
Only drop the cached MKLDNN_INCLUDE_DIR / LLGA_INCLUDE_DIR when they point into third_party/ideep, which older build directories cached from ideep's nested mkl-dnn. A value passed with -D is kept, as before this series.
|
@pytorchbot merge |
malfet
left a comment
There was a problem hiding this comment.
IMO this should be the very last step, as right now it will just increase checkout size. One already have all the rules in CMake to include oneDNN headers directly, so just start removing the abstraction
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 mandatory check(s) failed. The first few are: Dig deeper by viewing the failures on hud |
There was a problem hiding this comment.
Automated review of 49e974e: changes requested before human review.
The PR adds third_party/oneDNN as a direct submodule pinned to a190d4ab and switches FindMKLDNN.cmake from ideep's nested mkl-dnn to the new submodule for the CPU library and oneDNN Graph. It also updates license manifests, labeler/merge rules and OWNERSHIP/CODEOWNERS to match. Recommendation: Request Changes, because malfet's open CHANGES_REQUESTED review about checking out oneDNN twice still blocks the merge; the other point is non-blocking.
🔴 1 blocking finding is attached to the code below.
⚪ 1 non-blocking finding
pytorch/cmake/Modules/FindMKLDNN.cmake
Line 133 in 49e974e
Non-blocking: with the ideep git submodule update --init mkl-dnn fallback removed, USE_SYSTEM_LIBS=ON builds can lose MKLDNN with only a warning. The PR description says PreBuildSteps.cmake "already initializes all submodules recursively", but that isn't accurate. It auto-initializes only when every submodule is missing (PreBuildSteps.cmake:33-61). If only some are missing, it stops with a FATAL_ERROR (:63-80). With USE_SYSTEM_LIBS=ON it skips the check entirely (:13). After git pull on an existing checkout, third_party/oneDNN stays empty. FindMKLDNN.cmake:138-141 then prints "MKLDNN source files not found!" and returns, and Dependencies.cmake:1622-1630 warns and sets USE_MKLDNN OFF. Configure succeeds without oneDNN, where before this PR the populated ideep/mkl-dnn was used. Fix: either correct the PR description and add a release-note line, or FATAL_ERROR when USE_MKLDNN is requested and third_party/oneDNN is empty.
Please address the findings and push; a new commit normally gets a fresh automated review.
Disagree with a finding? Reply with your reasoning, then comment @pytorchbot review to request a re-review. This review is AI-generated and advisory. Each new automated review replaces the previous one. Report a bad review
| ignore = dirty | ||
| path = third_party/ideep | ||
| url = https://github.com/intel/ideep | ||
| [submodule "third_party/oneDNN"] |
There was a problem hiding this comment.
🔴 Blocking: malfet's CHANGES_REQUESTED review has not been addressed. malfet wrote: "this should be the very last step, as right now it will just increase checkout size... just start removing the abstraction." That review came at 15:21:39Z, after albanD's approval and after the author's @ pytorchbot merge. At HEAD, .gitmodules:61-64 adds third_party/oneDNN while third_party/ideep still pulls in its own nested mkl-dnn. So every recursive checkout fetches oneDNN twice: checkout-pytorch defaults to submodules: recursive, and so does create_release.yml:60. The sdist (third_party/**, pyproject.toml:124) and the release tarball both ship two copies. The stack lists more than 20 follow-up PRs, so the duplication lasts through all of them. albanD's +1 on the 2026-11-12 reply predates malfet's review, and the note that reply quotes (oneDNN carried twice, about 104 MB) is not in the PR body at HEAD. To resolve it, either reorder the stack so this submodule lands last, or drop third_party/ideep/mkl-dnn/** from the sdist and release tarball now and get malfet's agreement.
…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
## Linked issue or supporting maintainer Part of #154444 ## BC-breaking? No ## Summary (human written only) Removes the ideep submodule, including `#include` statements, references in comments, build setup, and related files. ## Agent details (if applicable) Developed with assistance from Claude Opus 5.5. > Part of #154444 (remove the ideep submodule). > > ATen no longer calls into ideep: its operators, tensor, engine, stream, attributes, primitive cache and utilities now live in `aten/src/ATen/native/mkldnn/detail/`. This PR pins oneDNN as a direct submodule, `third_party/oneDNN`, drops the last ideep includes, and deletes `third_party/ideep`. The pin was #201052; maintainers asked for it to land last, so it is part of this PR. > > ### oneDNN pin > - `third_party/oneDNN` is added at `a190d4ab` (v3.14.1), the same commit ideep's nested `mkl-dnn` pins today, so the compiled oneDNN is unchanged. `FindMKLDNN.cmake` builds the CPU library and oneDNN Graph from it. The XPU build is unchanged. > - `FindMKLDNN.cmake` drops a cached `MKLDNN_INCLUDE_DIR` / `LLGA_INCLUDE_DIR` only when it points into `third_party/ideep`, which older build directories cached. A value passed with `-D` is kept. Its submodule-init fallback is removed; `cmake/PreBuildSteps.cmake` already initializes every `.gitmodules` path. > - oneDNN's licenses ship from `third_party/oneDNN` (`pyproject.toml`, license audit manifest). OWNERSHIP/CODEOWNERS list `/third_party/oneDNN`; `labeler.yml` and `merge_rules.yaml` drop the nonexistent `third_party/mkl-dnn.BUILD`; comments in `jit/codegen/onednn` point at `third_party/oneDNN`. > > ### Changes > - The 10 remaining `#include <ideep...>` lines are removed. > - ideep's version gates become oneDNN version gates: `IDEEP_VERSION_*` -> `DNNL_VERSION_*`, and `IDEEP_PREREQ(a, b, c, r)` -> `DNNL_PREREQ(a, b, c)`. `IDEEP_PREREQ` also checked ideep's own API revision, which is 4, and every call site asked for revision 4 or lower. So that check was always true, and each gate takes the same branch as before. > - `detail/IdeepUtils.h` takes over ideep's `<omp.h>` include and its `omp_get_max_threads()` fallback for builds without OpenMP. The primitive cache keys use it. > - `FindMKLDNN.cmake` no longer looks for ideep headers, and no longer defines `IDEEP_USE_MKL`, which only ideep read. > - ideep is removed from `.gitmodules`, the `pyproject.toml` license-files list, the license audit manifest, `labeler.yml`, `merge_rules.yaml` and OWNERSHIP/CODEOWNERS; `third_party/oneDNN` takes its place. > - `DNNL_PREREQ` moves from `MKLDNNCommon.h` to a new `detail/Version.h` that includes only `<oneapi/dnnl/dnnl_version.h>`. `CPUBlas.cpp` uses it for its oneDNN version gates without pulling the mkldnn headers into the core BLAS code. > > - Keeps ideep's MIT license next to the ported code as `aten/src/ATen/native/mkldnn/detail/LICENSE.ideep`, listed in `pyproject.toml` license-files and the license audit manifest, and adds that directory to the audit's discovery globs. > > ### Deviation > - In `qconv.cpp` and `qconv_prepack.cpp`, the `#elif IDEEP_PREREQ(3, 1, 0, 0)` branches are removed. They targeted ideep API revision 0, which used reciprocal weight scales (`1 / scale`). That revision was replaced by revision 1, and these branches could not be compiled in with the bundled ideep (revision 4). Keeping them under a plain oneDNN version check would be wrong: if one were ever selected, every int8 conv would get inverted weight scales. The gates that depend only on the oneDNN version (< 3.1, 3.5 vs 3.6+, 3.9+, 3.13+) are kept as `DNNL_PREREQ` checks. The removed revision-0 branch in `qconv.cpp` carried a TODO (leslie) about removing the weight-scale reciprocal and two copies of the scales; it goes with that branch. The revision-1 branch that remains already passes the scales without the reciprocal. > - The unreachable `TORCH_CHECK(false, "Unexpected IDeep version ...")` messages now say "oneDNN". > - `test_mkldnn.py::test_mkldnn_layer_norm` and its `FileCheck` import are removed. It only exercised the TorchScript frozen-graph pass, and TorchScript is being deleted. > - Leftover ideep mentions are updated: the unsupported-dtype error and two comments in `MKLDNNConversions.cpp`, the `rnn_kind` reference in `torch/_decomp/decompositions.py` (now `detail/IdeepUtils.h`), and an outdated ideep-version comment in `Version.cpp`. > > ### Notes for reviewers > - PyTorch has no system-oneDNN build path: `FindMKLDNN.cmake` always builds `third_party/oneDNN`, so there is no separate minimum-version check to enforce. > - Existing checkouts keep an untracked `third_party/ideep` directory after updating. It is ignored by the build and the license audit; to remove it: `rm -rf third_party/ideep`, plus `.git/modules/third_party/ideep` in the git directory. > > ### Testing > This PR: > - Builds from a fresh CMake configure with `third_party/ideep` absent. No compile command references ideep, and `libtorch_cpu.so` defines no `ideep::` symbols. > - 21/N, the PR before this one, builds from scratch with oneDNN still taken from ideep's nested copy and passes `test_mkldnn.py`, so nothing earlier in the series needs the pin. > - Compiles cleanly with `-Wall -Wextra -Wsign-compare -Werror` in release and debug builds. The license audit and lintrunner are clean. > - Upstream wheels never shipped ideep headers in `torch/include`, so C++ extensions are not affected. > > Whole series, compared with the `main` commit it is based on: both builds were made with identical settings (only the commit differs) and tested on an Intel Xeon 6960P. > - **Numerics:** 202 fixed-seed outputs of oneDNN-backed ops are bitwise identical. They cover mkldnn tensors; fp32/bf16/fp16 convolution and backward; LSTM; matmul with bf16/tf32 fp32-math modes; the Inductor `mkldnn::*_pointwise` and `onednn::q*_pointwise` ops; quantized linear, conv and conv-transpose; and `torch.compile` with freezing. The oneDNN primitives they run are identical too. > - **Primitive cache:** the number of oneDNN primitive creations is identical (465 vs 465) for a workload that changes shapes, scales and thread counts, at the default `LRU_CACHE_CAPACITY` and at `LRU_CACHE_CAPACITY=1`. > - **Tests:** per-test outcomes and executed oneDNN primitives are identical across 13 suite runs (about 1,250 tests). The suites are `test_mkldnn`, `nn/test_convolution -k mkldnn`, `quantization/core/test_quantized_op`, bf16/fp16 `test_linalg`, the CPU LSTM tests in `test_nn`, `inductor/test_mkldnn_pattern_matcher`, `inductor/test_cpu_repro` (conv/linear) and the mkldnn tests in `test_aot_inductor`. `test_mkldnn` and `test_quantized_op` were also run with `ONEDNN_MAX_CPU_ISA` set to `AVX2` and to `AVX512_CORE`. The failures that do occur happen identically on `main` and are tracked separately. > - **Performance:** all 16 op microbenchmarks are within ±3%, both with primitives cached and when a new primitive is created on every call. Measured over 7 alternating rounds, pinned to 16 cores on one NUMA node. > - **Binary size:** `libtorch_cpu.so` `.text` +2.9 KB. The exported-symbol changes are listed in 21/N. > > These measurements were taken when this PR was first submitted. Since then the series has only had review changes (rewritten comments, removed dead code and unused includes, a typo rename); none change behavior. The rebuilt stack passes `-Wall -Wextra -Wsign-compare -Werror` per commit, and `test_mkldnn`, the mkldnn conv tests and the quantized conv/linear tests were rerun at the tip. > > Previously submitted as #204808. Pull Request resolved: #206277 Approved by: https://github.com/albanD ghstack dependencies: #205978, #205979, #205980, #206276
Linked issue or supporting maintainer
Part of #154444
BC-breaking?
No
Summary (human written only)
See discussion of ideep removal in #154444
Add third_party/oneDNN (the same as third_party/ideep/mkl-dnn). The compiled binary is unchanged, but this will allow the eventual phase-out of ideep.
Verified:
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
Summary:
cc @gujinghui @PenghuiCheng @XiaobingSuper @jianyuh @jgong5 @mingfeima @sanchitintel @ashokei @jingxu10 @min-jean-cho @yanbing-j @Guobing-Chen @Xia-Weiwen @snadampal