Repository navigation
[mkldnn][20/N] Port ideep's utility helpers, constants and enums into ATen - #205980
frost-intel wants to merge 5 commits into
Conversation
[ghstack-poisoned]
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". ✅ AUTOMATED REVIEW - OUTDATED (earlier commit) - Ready for human review:
Findings (5): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/205980
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 28e174e with merge base efd2c8f ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
There was a problem hiding this comment.
Automated review of 3e19321: nothing blocking; ready for human review.
The PR copies ideep's remaining small helpers (scale/zero-point constants, lowp_kind/rnn_kind, bf16/fp16 ISA checks, utils:: mask and dilation helpers, set_verbose) into the new detail/IdeepUtils.h, swaps ideep::post_ops for dnnl::post_ops, and updates the call sites. The review found no correctness, security, thread-safety or BC problems. Recommendation: Approve; every finding is non-blocking cleanup.
⚪ 5 non-blocking findings
Per-file copies of the constants (non-blocking): DEF_SCALE, DEF_ZP, EMPTY_SCALE and EMPTY_ZP are namespace-scope const std::vectors, so every file that includes the header gets its own copy, built at load time. The header comes in through MKLDNNCommon.h and mkldnn/Utils.h (about 47 files, including native/Convolution.cpp, LinearAlgebra.cpp, RNN.cpp, quantized/cpu/.cpp and torch/csrc files), but only detail/Conv.cpp and detail/Matmul.cpp read them. ideep's own IDEEP_ copies remain too while <ideep.hpp> is included. This is also inconsistent with detail/Attr.h:26-27, which uses inline const. Suggested alternative that avoids both costs: accessors returning a function-local static, e.g. inline const std::vector<float>& def_scale() { static const std::vector<float> v{1.0f}; return v; }. All current call sites would work after adding ().
pytorch/aten/src/ATen/native/mkldnn/Utils.h
Line 136 in 3e19321
Stale comment (non-blocking): this line still says "Use ideep to check bf16 on X64", but the next line now calls at::native::mkldnn::has_bf16_type_support(), which asks oneDNN for the CPU ISA. Say oneDNN instead.
Header name (non-blocking): the neighbouring detail/ headers are named for what they contain (Attr.h, Tensor.h, PrimitiveCache.h). IdeepUtils.h is named after the library this stack is removing, and it also holds one_of/is_avx2_vnni_2 (lines 16-25), which have no "Ported from ideep" comment. A neutral name such as detail/Utils.h (as in mkldnn/xpu/detail/Utils.h) would save a rename once ideep is gone.
Duplicate fmap (non-blocking, optional): utils::fmap (lines 66-74) duplicates c10::fmap in aten/src/ATen/core/functional.h:41, which also reserves capacity; its only caller is get_compatible_dilates (line 87). Since the PR aims for a line-for-line port this is optional. The same goes for LOWP_U8S8/LOWP_S8S8 (lines 38-39), which nothing in the repo references.
PR description (non-blocking): the utils:: list leaves out tensor_zp_mask (here), which detail/Conv.cpp:166,170 and detail/Matmul.cpp use. Also, "the only ideep types ATen still uses are the tensor, engine and stream" leaves out ideep::attr_t: detail/Attr.h:384-392 still has operator ideep::attr_t(), kept as a bridge for ideep::tensor reorders.
This review is AI-generated and advisory. Each new automated review replaces the previous one. Report a bad review
[ghstack-poisoned]
… ATen Part of #154444 No Ports the last few ideep helpers into ATen, and switches ATen calls to the new ports. Changes include: * Scale constants * enums for lowp and rnn attributes * Use aliases for `ideep::engine` and `ideep::stream`, to be changed to ports in the next PR. Tests verify no behavior change by checking oneDNN verbose logs before and after, as well as primitive-cache miss counts. Developed with assistance from Claude Opus 5.5. > > This ports the remaining small ideep helpers that ATen calls into the new `aten/src/ATen/native/mkldnn/detail/IdeepUtils.h`, in namespace `at::native::mkldnn`. The code is copied line-for-line from ideep's `abstract_types.hpp`, `utils.hpp` and `attributes.hpp`, with ideep's comments kept. After this PR, the only ideep types ATen still uses are the tensor, engine and stream, which 21/N ports, plus `ideep::attr_t` inside `Attr`'s conversion operator, which those tensor reorders need until then. > > ### Changes > - `detail/IdeepUtils.h` (new) contains: > - constants `DEF_SCALE`, `DEF_ZP`, `EMPTY_SCALE` and `EMPTY_ZP` (from ideep's `IDEEP_DEF_SCALE` etc.); > - enums `lowp_kind` and `rnn_kind`; > - `has_bf16_type_support()` and `has_fp16_type_support()`; > - in `utils::`: `fmap`, `any_le`, `get_compatible_dilates`, `group_dims`, `op_scale_mask`, `tensor_scale_mask`, `tensor_zp_mask`, `conv_weight_scale_mask` and `set_verbose`; > - `one_of` and `is_avx2_vnni_2`, moved unchanged from `mkldnn/Utils.h`, where the earlier ports had added them. > - Nine ported `detail/` files that included `mkldnn/Utils.h` for these helpers include `detail/IdeepUtils.h` instead. `mkldnn/Utils.h` and `MKLDNNCommon.h` include `detail/IdeepUtils.h`, so their other users still see these helpers. > - `ideep::post_ops` becomes `dnnl::post_ops`. ideep's class was a thin wrapper that ATen used only through `dnnl::post_ops` methods. > - `Engine` and `IStream` become aliases of `ideep::engine` and `ideep::stream` in `detail/Tensor.h`. They are ported in 21/N together with the tensor class, because the tensor allocates memory through the engine. > - Call sites in `mkldnn/` and `quantized/cpu/` switch to the ATen names. > > ### Deviations from ideep > None in behavior. Kept as in ideep, although they could be written differently: > - The four constants are plain namespace-scope `const`, as in ideep. `inline const` would avoid one copy per file, but it added about 29 KB of per-file initialization code in `libtorch_cpu.so`, so I kept ideep's form. > - `lowp_kind` and `rnn_kind` stay unscoped enums, as in ideep. > - `utils::set_verbose` keeps ideep's return convention: `true` when oneDNN reports success. Casting `dnnl::status` directly would invert the result, because `success` is 0. > > The stream alias is `IStream`, not `Stream`. A `Stream` in `at::native::mkldnn` would shadow `at::Stream` (`c10::Stream`) for all code in that namespace, the same reason the tensor is `ITensor`. `Engine` has no `at::` counterpart and keeps its name. > > ### Testing > No behavior change: > - oneDNN verbose primitive logs are identical before and after for `test_mkldnn`, quantized conv, conv-transpose and linear, and matmul, as are the outputs of targeted probe scripts. > - Primitive-cache miss counts are identical at the default `LRU_CACHE_CAPACITY` and at `LRU_CACHE_CAPACITY=1`. > - Compiles cleanly with `-Wall -Wextra -Wsign-compare -Werror` in release and debug builds. > > Previously submitted as #204806. cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 aditew01 gujinghui PenghuiCheng jianyuh min-jean-cho yanbing-j Guobing-Chen Xia-Weiwen snadampal ghstack-source-id: 29bbb64 Pull-Request: #205980
|
Addressing bot comments:
|
[ghstack-poisoned]
… ATen Part of #154444 No Ports the last few ideep helpers into ATen, and switches ATen calls to the new ports. Changes include: * Scale constants * enums for lowp and rnn attributes * Use aliases for `ideep::engine` and `ideep::stream`, to be changed to ports in the next PR. Tests verify no behavior change by checking oneDNN verbose logs before and after, as well as primitive-cache miss counts. Developed with assistance from Claude Opus 5.5. > > This ports the remaining small ideep helpers that ATen calls into the new `aten/src/ATen/native/mkldnn/detail/IdeepUtils.h`, in namespace `at::native::mkldnn`. The code is copied line-for-line from ideep's `abstract_types.hpp`, `utils.hpp` and `attributes.hpp`, with ideep's comments kept. After this PR, the only ideep types ATen still uses are the tensor, engine and stream, which 21/N ports, plus `ideep::attr_t` inside `Attr`'s conversion operator, which those tensor reorders need until then. > > ### Changes > - `detail/IdeepUtils.h` (new) contains: > - constants `DEF_SCALE`, `DEF_ZP`, `EMPTY_SCALE` and `EMPTY_ZP` (from ideep's `IDEEP_DEF_SCALE` etc.); > - enums `lowp_kind` and `rnn_kind`; > - `has_bf16_type_support()` and `has_fp16_type_support()`; > - in `utils::`: `fmap`, `any_le`, `get_compatible_dilates`, `group_dims`, `op_scale_mask`, `tensor_scale_mask`, `tensor_zp_mask`, `conv_weight_scale_mask` and `set_verbose`; > - `one_of` and `is_avx2_vnni_2`, moved unchanged from `mkldnn/Utils.h`, where the earlier ports had added them. > - Nine ported `detail/` files that included `mkldnn/Utils.h` for these helpers include `detail/IdeepUtils.h` instead. `mkldnn/Utils.h` and `MKLDNNCommon.h` include `detail/IdeepUtils.h`, so their other users still see these helpers. > - `ideep::post_ops` becomes `dnnl::post_ops`. ideep's class was a thin wrapper that ATen used only through `dnnl::post_ops` methods. > - `Engine` and `IStream` become aliases of `ideep::engine` and `ideep::stream` in `detail/Tensor.h`. They are ported in 21/N together with the tensor class, because the tensor allocates memory through the engine. > - Call sites in `mkldnn/` and `quantized/cpu/` switch to the ATen names. > > ### Deviations from ideep > None in behavior. Kept as in ideep, although they could be written differently: > - The four constants are plain namespace-scope `const`, as in ideep. `inline const` would avoid one copy per file, but it added about 29 KB of per-file initialization code in `libtorch_cpu.so`, so I kept ideep's form. > - `lowp_kind` and `rnn_kind` stay unscoped enums, as in ideep. > - `utils::set_verbose` keeps ideep's return convention: `true` when oneDNN reports success. Casting `dnnl::status` directly would invert the result, because `success` is 0. > > The stream alias is `IStream`, not `Stream`. A `Stream` in `at::native::mkldnn` would shadow `at::Stream` (`c10::Stream`) for all code in that namespace, the same reason the tensor is `ITensor`. `Engine` has no `at::` counterpart and keeps its name. > > ### Testing > No behavior change: > - oneDNN verbose primitive logs are identical before and after for `test_mkldnn`, quantized conv, conv-transpose and linear, and matmul, as are the outputs of targeted probe scripts. > - Primitive-cache miss counts are identical at the default `LRU_CACHE_CAPACITY` and at `LRU_CACHE_CAPACITY=1`. > - Compiles cleanly with `-Wall -Wextra -Wsign-compare -Werror` in release and debug builds. > > Previously submitted as #204806. cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 aditew01 gujinghui PenghuiCheng jianyuh min-jean-cho yanbing-j Guobing-Chen Xia-Weiwen snadampal ghstack-source-id: 77f72a8 Pull-Request: #205980
[ghstack-poisoned]
[ghstack-poisoned]
|
Starting merge as part of PR stack under #206630 |
## Linked issue or supporting maintainer Part of #154444 ## BC-breaking? No ## Summary (human written only) Ports `tensor`, `engine`, and `stream` from ideep to ATen, as well as replacing aliases. After this PR, ATen no longer calls any ideep code. ## Agent details (if applicable) Developed with assistance from Claude Opus 5.5. > Part of #154444 (remove the ideep submodule). > > This ports ideep's `tensor` (with its nested `desc`), `engine`, `stream` and allocator into `aten/src/ATen/native/mkldnn/detail/Memory.h`, as `at::native::mkldnn::{MkldnnMemory, Engine, IStream}`. They replace the aliases added earlier in this series. The code is ported line-for-line from ideep's `tensor.hpp`, `abstract_types.hpp` and `allocators.hpp`, and ideep's comments are kept. After this PR, ATen no longer calls any ideep code. The only thing left is the `#include`, which the next PR removes along with the submodule. > > ### Changes > - `detail/Memory.h`: > - `utils::allocator`; > - `Engine`, a subclass of `dnnl::engine` with `cpu_engine()` and the allocator hooks; > - `IStream::default_stream()`; > - `MkldnnMemory`, a subclass of `dnnl::memory`, with its nested `desc`. > - `detail/Attr.h`: no longer includes ideep, and `operator ideep::attr_t` is removed (nothing needs to convert back to ideep anymore). Adds the `get_scales` / `has_scales_for` / `get_zero_points` / `has_zero_points_for` helpers that the ported tensor code uses. > - `detail/IdeepUtils.h`: adds `utils::array_cmp`. > - `IDeepRegistration.cpp`: defines `Engine::cpu_engine()` and registers the c10 CPU allocator with it, together with the `MKLDNN_*` -> `DNNL_*` environment-variable translation. This replaces the setup that ideep's `ideep_pin_singletons.hpp` did before. > > ### Deviations from ideep > - Members of `tensor` and `desc` that ATen cannot reach are dropped: the `descriptor` typedef; `desc::is_iohw`, `is_limited_blockable`, `is_nchw` and `to_dims`; and `get_descriptor`, `dup_desc`, `dup_descriptor`, `reinit_like` (both overloads), `get_public_format_dims`, `reorder_from`, `extract_submemory` (both overloads), `insert_submemory`, `need_reorder`, `get_hash` and `resize`. > - `IDEEP_ENFORCE` on oneDNN C API calls becomes `dnnl::error::wrap_c_api` under `#ifndef NDEBUG`, which matches ideep's behavior in release builds. > - The loop index in `feed_from`, and in `array_cmp`, is now `size_t` instead of `int`, so they compile under `-Wsign-compare -Werror`. In-tree code is checked with those warnings, while ideep was compiled as a system header. > - `Engine::cpu_engine()` is defined out of line in `IDeepRegistration.cpp` and marked `TORCH_API`, replacing ideep's `IDEEP_EXPORT` declaration and its definition in `ideep_pin_singletons.hpp`. This keeps a single engine instance across shared libraries, as before. > - ideep's GPU engine path is not ported. ATen only uses the CPU engine here; XPU has its own oneDNN integration. > > ### Testing > No behavior change: > - oneDNN verbose primitive logs are identical before and after for `test_mkldnn`, quantized conv, conv-transpose and linear, and matmul, as are the outputs of targeted probe scripts. > - Primitive-cache miss counts are identical at the default `LRU_CACHE_CAPACITY` and at `LRU_CACHE_CAPACITY=1`. > - `to_mkldnn` buffers are still allocated through c10's CPU allocator (they show up in the memory profiler), and `MKLDNN_VERBOSE=1` still turns on oneDNN verbose output. > - The memory-descriptor blob returned by `mkldnn::_get_mkldnn_serialized_md` is unchanged apart from uninitialized struct padding. That padding varies from process to process on `main` too, and will be reported in a separate issue. > - Compiles cleanly with `-Wall -Wextra -Wsign-compare -Werror` in release and debug builds. > > 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. > > ### Exported symbols > `libtorch_cpu.so` no longer exports `ideep::engine::cpu_engine()` and `ideep::engine::gpu_engine()`. Three > `at::native` helpers that took ideep types now take `MkldnnMemory` / `MkldnnMemory::desc`, so their mangled names change: > `itensor_view_from_dense`, `itensor_view_from_const_dense` and `new_with_itensor_mkldnn`. These are internal > ATen functions, and ideep headers were never shipped in `torch/include`, so out-of-tree code could not use them > through public headers. > > Previously submitted as #204807. Pull Request resolved: #206276 Approved by: https://github.com/albanD ghstack dependencies: #205978, #205979, #205980
## 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) Replaces any references to ideep in comments with mkldnn references reflecting the current code. ## Agent details (if applicable) Developed with assistance from Claude Opus 5.5. > Part of #154444 (remove the ideep submodule). > > Comment-only. After ideep is removed, comments in `aten/src/ATen/native/mkldnn/` and `aten/src/ATen/native/quantized/cpu/` still describe ideep doing the work. They now name what does it: `MkldnnMemory` for ideep tensors, `matmul_forward` / `mkldnn::inner_product_forward` for ideep operators, the oneDNN wrappers for "ideep (mkldnn bridge)", and oneDNN where the comment means the library. > > Left as-is on purpose: "Ported from ideep" provenance notes, ideep comments that were ported with the code in `detail/`, and identifiers that still say ideep (`DeviceType::IDEEP`, `IDeepRegistration.cpp`, `make_ideep_tensor`). > > What changed: 10 files, +33/−33, all comment lines. Pull Request resolved: #206278 Approved by: https://github.com/albanD ghstack dependencies: #205978, #205979, #205980, #206276, #206277
…n Attr (#206279) ## Linked issue or supporting maintainer Part of #154444 ## BC-breaking? No ## Summary (human written only) Changing `inner_product_forward_expected_weights_desc` to take an `Attr` parameter as its last argument, allowing the packed weight layout to depend on primitive attributes. This was requested by @mriganks-amd for upcoming ZenDNN fp16 accumulation support. ## Agent details (if applicable) Developed with assistance from Claude Opus 5.5. > Part of #154444. Requested by AMD for ZenDNN fp16 accumulation (#204794). > > `inner_product_forward_expected_weights_desc` now takes `const Attr& attr = Attr()` as its last parameter and passes it to the `dnnl::inner_product_forward::primitive_desc`, as `matmul_forward_expected_weights_desc` already does. The packed weight layout can depend on primitive attributes. For example, with ZenDNN's fp16 "any" accumulation mode, a weight packed with default attributes runs on brgemm even with the mode set. Callers can now pack with the attributes they compute with. > > No behavior change: the only caller, `mkldnn_reorder_linear_weight` in `MKLDNNConversions.cpp`, does not pass `attr`, and a default `Attr` is an empty `dnnl::primitive_attr`, which is what oneDNN uses when no attributes are given. This is an API addition on top of the port; ideep's version takes no attributes. > > Testing: compiles with `-Wall -Wextra -Wsign-compare -Werror` in release and debug builds; `test_mkldnn`, the mkldnn conv tests and the quantized conv/linear tests pass at the tip. Pull Request resolved: #206279 Approved by: https://github.com/albanD ghstack dependencies: #205978, #205979, #205980, #206276, #206277, #206278
## Linked issue or supporting maintainer Part of #154444 ## BC-breaking? No ## Summary (human written only) Rename all itensor functions to `memory_*` to eliminate all itensor references in ideep port. ## Agent details (if applicable) Developed with assistance from Claude Opus 5.5. > Part of #154444 (remove the ideep submodule). > > Follows the `ITensor` -> `MkldnnMemory` rename. The helpers that convert between `at::Tensor` and `MkldnnMemory` drop their `itensor` prefix. This is a mechanical rename with no behavior change: > - `itensor_from_mkldnn` -> `memory_from_mkldnn` > - `itensor_from_tensor` -> `memory_from_tensor` > - `itensor_from_const_tensor` -> `memory_from_const_tensor` > - `itensor_view_from_dense` -> `memory_view_from_dense` > - `itensor_view_from_const_dense` -> `memory_view_from_const_dense` > - `itensor_view_from_dense_impl` -> `memory_view_from_dense_impl` (file-local) > - `new_with_itensor_mkldnn` -> `new_with_mkldnn_memory` > - `typed_itensor_view_from_dense` -> `typed_mkldnn_memory_view_from_dense` (file-local) > > These are internal ATen helpers declared in `MKLDNNCommon.h`, so their exported symbol names change, as with the helpers in 21/N. Pull Request resolved: #206630 Approved by: https://github.com/albanD ghstack dependencies: #205978, #205979, #205980, #206276, #206277, #206278, #206279
Stack from ghstack (oldest at bottom):
Linked issue or supporting maintainer
Part of #154444
Supported by @albanD
BC-breaking?
No
Summary (human written only)
Ports the last few ideep helpers into ATen, and switches ATen calls to the new ports. Changes include:
ideep::engineandideep::stream, to be changed to ports in the next PR.Tests verify no behavior change by checking oneDNN verbose logs before and after, as well as primitive-cache miss counts.
Agent details (if applicable)
Developed with assistance from Claude Opus 5.5.
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @aditew01 @gujinghui @PenghuiCheng @jianyuh @min-jean-cho @yanbing-j @Guobing-Chen @Xia-Weiwen @snadampal