Repository navigation
[mkldnn][18/N] Use MkldnnMemory as an alias for ideep::tensor (1/2) - #205978
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 (2): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/205978
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 4284ca5 with merge base efd2c8f ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
[ghstack-poisoned]
|
Addressing bot comments:
|
[ghstack-poisoned]
| namespace at::native::mkldnn { | ||
|
|
||
| // oneDNN tensor (memory descriptor, buffer, scales/zero points, workspace). | ||
| // Alias for ideep::tensor until the tensor class is ported. |
There was a problem hiding this comment.
Are you planning on moving the whole Tensor class?
Do we really still need a custom Tensor object here?
There was a problem hiding this comment.
@albanD Just to give a little more context, we have 3 different tensor-like classes to distinguish here:
dnnl::memory: oneDNN's raw memory handler. A descriptor (dims, dtype, layout, blocking) and a buffer.at::Tensor: sizes, strides, dtype, storage, autograd. No place for oneDNN layouts or state.ideep::tensor, which I ported in [mkldnn][21/N] Port ideep::tensor, engine and stream into ATen #206276 asITensor: adnnl::memorysubclass which adds the pieces that ATen depends on:- blocked-layout storage, prepacked conv/linear/LSTM weights
- quantized scales and zero points
- max-pool workspace
- allocation using c10
- reorder and re-init helpers
There are a few design options here if we want to remove this class:
- Option A: If the main objection is just that we don't want another unrelated class named "Tensor", then I'm happy to rename to "MkldnnMemory" or "MkldnnHandle" or similar. I just went with
ITensoras a contraction ofideep::tensor, but I can see that might be concerning. - Option B: If we want to use
at::Tensorwherever possible (similar to what XPU does), we could do this, but it involves some significant design changes and behavior change as well, since different primitives could be chosen, additional reorders could occur, and so on. I do not support this as part of this initial port ofideep, due to these changes, but we could adopt this in follow-ups - Option C: Use
at::Tensorwith a separate descriptor/state struct, that can be done without changing behavior, but I think it would introduce a lot of duplication. - Option D: Keep this scoped
ITensorclass, private tomkldnn/detail, which we incrementally shrink after ideep is removed- We land the ideep removal stack as-is (or rename to
MkldnnMemoryif you want to avoidITensor) - Move pure descriptors out of the class.
- Switch callers that can use plain formats to use
at::Tensor - Reduce the scope and only use
ITensorwhere required (blocked layouts, prepacked weights, oneDNN scaled tensors, etc)
- We land the ideep removal stack as-is (or rename to
I'd prefer option D, let me know if you require the ITensor rename.
There was a problem hiding this comment.
I went ahead and switched the alias name to MkldnnMemory in preparation of moving forward with Option D, that seems like the best choice to avoid any name confusion. This also includes a 25th PR on the top of the stack with some function renames from itensor_* to memory_* or similar.
There was a problem hiding this comment.
Option D sounds like a good way to go.
Thanks for sharing the details on this.
[ghstack-poisoned]
There was a problem hiding this comment.
Automated review of 5a504e9: nothing blocking; ready for human review.
The PR adds at::native::mkldnn::ITensor as a temporary alias for ideep::tensor and moves Common.h, MKLDNNCommon.h and 24 detail/ files over to it. The review found no correctness, ABI or test problems. Recommendation: Needs Discussion, because @ albanD's Changes Requested review is still open and the design choice (options AD) is up to the maintainers; both points the review raises are non-blocking.
⚪ 2 non-blocking findings
ITensor name (non-blocking, raised in the last review). The author says the "I" is short for ideep::tensor, but the prefix stops meaning anything once ideep is removed at the end of the stack. It also reads like an interface prefix, and ATen already has ITensorListRef (ATen/core/IListRef_inl.h:195), where the "I" comes from IListRef. The author has offered MkldnnMemory or MkldnnHandle instead (option A). If a rename is going to happen, doing it now, before this PR and 19/N move every call site, avoids renaming the same lines again in 21/N.
Duplicated <cassert> workaround (non-blocking, low priority). Lines 6-8 repeat the comment, #include <cassert> and #include <ideep/tensor.hpp> that are already in detail/Attr.h:7-9. Attr.h only needs ideep/tensor.hpp for its ideep::attr_t conversion at Attr.h:365, so it could include detail/Tensor.h instead and keep the workaround in one place. Both copies are temporary, so this can wait until 21/N replaces Tensor.h.
This review is AI-generated and advisory. Each new automated review replaces the previous one. Report a bad review
Withdrawn: the automated review of 5a504e9 found nothing blocking.
[ghstack-poisoned]
|
Starting merge as part of PR stack under #206630 |
…205979) ## Linked issue or supporting maintainer Part of #154444 Supported by @albanD ## BC-breaking? No ## Summary (human written only) Rename `ideep::tensor` to `at::native::mkldnn::MkldnnMemory`. For now, this is an alias for `ideep::tensor`, and will replace it with the ported class in the next PR. ## Agent details (if applicable) Developed with assistance from Claude Opus 5.5. > > Part 2 of the mechanical `ideep::tensor` -> `at::native::mkldnn::MkldnnMemory` rename. 18/N added the alias in `detail/Memory.h` and renamed `Common.h`, `MKLDNNCommon.h` and the non-conv `detail/` files; this PR renames the rest. 21/N replaces the alias with a ported class. > > ### Changes > - 33 files: `ideep::tensor` -> `MkldnnMemory`, including the nested `ideep::tensor::desc` -> `MkldnnMemory::desc`, across `detail/Conv` and `detail/Deconv`, the rest of `aten/src/ATen/native/mkldnn/`, `native/Activation.cpp`, `native/quantized/cpu/` (including the aarch64-only `ACLUtils`) and `torch/csrc/jit/passes/frozen_ops_to_mkldnn.cpp`. > - Three functions that declared `using ideep::tensor;` now declare `using tensor = at::native::mkldnn::MkldnnMemory;`, so their bodies stay unchanged. > - `quantized/cpu/OnednnUtils.h` had one such declaration that nothing used. It is deleted rather than converted, because the converted form trips `-Wunused-local-typedefs` under `-Werror`. > > Comments that mention `ideep::tensor` are left as they are and updated in a later PR. > > ### Testing > No behavior change: this is a type alias, so the generated code is unchanged. > - For the whole rename (both parts, as previously submitted), `libtorch_cpu.so` and `libtorch_python.so` have the same symbols and byte-identical `.text` before and after. > - Compiles cleanly with `-Wall -Wextra -Wsign-compare -Werror` in release and debug builds. > > Previously submitted, together with 18/N, as #204805. Pull Request resolved: #205979 Approved by: https://github.com/albanD ghstack dependencies: #205978
… ATen (#205980) ## 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: * 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. ## Agent details (if applicable) 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/Memory.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 memory class is not named is `Tensor`. `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. Pull Request resolved: #205980 Approved by: https://github.com/albanD ghstack dependencies: #205978, #205979
## 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)
Rename
ideep::tensortoat::native::mkldnn::MkldnnMemory. For now, this is an alias forideep::tensor, and will replace it with the ported class in the next PR.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