Building Tensorflow with custom Onednn
Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62355">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62355">No</a>
 @vishwascm,
COuld you please provide complete steps you have followed to install the tensorflow and also provide the code and the error log which you are encountered which helps us to debug the issue. Thank you! Hi @tilakrayal these are the steps I followed:

**1**. git clone https://github.com/tensorflow/tensorflow.git 
**2**. cd tensorflow
**3**. git checkout v2.13.0
**4.** In tensorflow/workspace2.bzl replace following line of code:
  `tf_http_archive(
        name = "mkl_dnn_acl_compatible",
        build_file = "//third_party/mkl_dnn:mkldnn_acl.BUILD",
        patch_file = [ ... ],
        sha256 = "a50993aa6265b799b040fe745e0010502f9f7103cc53a9525d59646aef006633",
        strip_prefix = "oneDNN-2.7.3",
        urls = tf_mirror_urls("https://github.com/oneapi-src/oneDNN/archive/v2.7.3.tar.gz"),
    )
With

 tf_http_archive(
        name = "mkl_dnn_acl_compatible",
        build_file = "//third_party/mkl_dnn:mkldnn_acl.BUILD",
        patch_file = [ ... ],
        sha256 = "b57f83a60518ad919493ecd71ed06d38881654bd90fc62016efdcb718ca1143e",
        strip_prefix = "oneDNN-3.1.1",
        urls = tf_mirror_urls("https://github.com/deepeshfujitsu/oneDNN/archive/refs/tags/v3.1.1.tar.gz"),
    )

Here sha256, strip_prefix and urls are changed accordingly to our modified onednn repo.

  **5.** Also made following change in mkldnn_acl.BUILD file:
     expand_template(
    name = "dnnl_version_h",
    out = "include/oneapi/dnnl/dnnl_version.h",
    substitutions = {
        "@DNNL_VERSION_MAJOR@": "2",   
        "@DNNL_VERSION_MINOR@": "7",
        "@DNNL_VERSION_PATCH@": "3",
        "@DNNL_VERSION_HASH@": "N/A",
    },
    template = "include/oneapi/dnnl/dnnl_version.h.in",
) 
 
with
 expand_template(
    name = "dnnl_version_h",
    out = "include/oneapi/dnnl/dnnl_version.h",
    substitutions = {
        "@DNNL_VERSION_MAJOR@": "3",   
        "@DNNL_VERSION_MINOR@": "1",
        "@DNNL_VERSION_PATCH@": "1",
        "@DNNL_VERSION_HASH@": "N/A",
    },
    template = "include/oneapi/dnnl/dnnl_version.h.in",
) 

**6.** Bazel build: 
  bazel build -s --config=mkl_aarch64 --features=-layering_check --copt=-O3 --copt=-march=armv8-a+sve --copt=-msve-vector-bits=256 --copt=-Wno-gnu-offsetof-extensions --copt=-Wno-unused-but-set-variable  //tensorflow/tools/pip_package:build_pip_package --verbose_failures 

**7 .** Build is getting failed and getting error:
      ERROR: An error occurred during the fetch of repository 'mkl_dnn_acl_compatible':
   Traceback (most recent call last):
        File "/home/vishwas/Graviton/tensorflow/third_party/repo.bzl", line 83, column 30, in _tf_http_archive_impl
                ctx.patch(patch_file, strip = 1)
 
It is not able to fetch repo, repo is public.



 @vishwascm  Could you build successfully with the original code without the change in steps 4 and 5 ? And what's your taget platform info? @feng-intel yes I can build successfully without changes of step 4 and 5. The issue is resolved now, I was able to build by using custom onednn which is based on onednn v2.7.3.
### Issue type

Build/Install

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

source

### TensorFlow version

v2.13.0

### Custom code

Yes

### OS platform and distribution

ubuntu 22.04.1 on aarch64 

### Mobile device

_No response_

### Python version

python 3.10.12

### Bazel version

6.1.0

### GCC/compiler version

clang version 16.0.6

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

Hi,
I am trying to build tensorflow with custom Onednn. For this I have replaced following code of lines in /tensorflow/workspace2.bzl folder:

tf_http_archive(
        name = "onednn",
        build_file = "//third_party/mkl_dnn:mkldnn_v1.BUILD",
        sha256 = "2f76b407ef8893cca71340f88cd800019a1f14f8ac1bbdbb89a84be1370b52e3",
        strip_prefix = "oneDNN-3.2.1",
        urls = tf_mirror_urls("https://github.com/oneapi-src/oneDNN/archive/refs/tags/v3.2.1.tar.gz"),
    )

Here urls is replaced by url to my custom onednn and also sha256 is changed. 

So bazel build is successful, but if I run some deeplearning models  it is not running on onednn itself. 
So it will be great if someone helpme with this.

### Standalone code to reproduce the issue

```shell
Results are that my custom onednn is not getting used.
```


### Relevant log output

_No response_