ERROR: tensorflow/tensorflow/compiler/xla/service/gpu/runtime/BUILD:146:11: in deps attribute of cc_library rule //tensorflow/compiler/xla/service/gpu/runtime:gemm: target '//tensorflow/compiler/xla/service/gpu:non_atomically_upgradeable_rw_lock' does not exist
"Me too"
 Backporting the relevant support from the master branch seems to do the trick:

[naurwlock.patch](https://github.com/tensorflow/tensorflow/files/10877485/naurwlock.patch)

I have also created a [pull request](https://github.com/tensorflow/tensorflow/pull/59885). @plopresti Thank you for creating the pull request. We can merge your fix to master first, run all the tests (including nightly tests). If everything is green we can send the cherry pick to r2.12 for review. WDYT?
@reedwm Could you please take a look and share your guidance? Looks like this was broken by https://github.com/tensorflow/tensorflow/pull/59842, which cherry-picked 740005d28413923af3f38f7d6401f7f99d26f8f3 into TF 2.12. The PR uses a BUILD target introduced by 890a846bdc26e0e1e66120adb1e2fb2aa33c7323, which was not cherry-picked, which is why the error is occurring. Either https://github.com/tensorflow/tensorflow/pull/59842 should be rolled back or  890a846bdc26e0e1e66120adb1e2fb2aa33c7323 (and potentially other commits 740005d28413923af3f38f7d6401f7f99d26f8f3 relies on) should also be cherry-picked.

@venkat2469 @rishikasinha-tf @anlunx, how should this be handled? @learning-to-play @reedwm Yeah, my pull request is identical to 890a846. I can confirm that this change alone fixes this PR, and there are no further dependencies. I suggest cherry-picking 890a846 into r2.12. This is very helpful, thank you both for the additional information! Created https://github.com/tensorflow/tensorflow/pull/59889. Hi, @vyepishov1 

It seems like this PR [#59889](https://github.com/tensorflow/tensorflow/pull/59889) got merged so could you please try to build tensorflow from source now and check whether are you getting any error or not ? Thank you! > Hi, @vyepishov1
> 
> It seems like this PR [#59889](https://github.com/tensorflow/tensorflow/pull/59889) got merged so could you please try to build tensorflow from source now and check whether are you getting any error or not ? Thank you!

Hi @gaikwadrahul8,

I have managed to rebuild recently, so it seems to work now. Thank you for quick response and support! Hi, @vyepishov1 

Good to hear that and thank you for the confirmation, Could you please confirm if this issue is resolved for you ? Please feel free to close the issue if it is resolved ? or if you need any further assistance please let us know? Thank you!
 > 

Hi @gaikwadrahul8,

My apologies for the last unclear answer.
Yes, the issue has been resolved.
I was able to both build the new version of tensorflow as well as test it.
Thank you for your help! Hi, @vyepishov1 

No problem and Good to hear that your issue got resolved and thank you for the confirmation so now I'm closing this issue from my end. If you need any further assistance please feel free to create new issue. Thank you! 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/59878">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/59878">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

No

### Source

source

### Tensorflow Version

2.12

### Custom Code

No

### OS Platform and Distribution

Linux Ubuntu 22.04

### Mobile device

_No response_

### Python version

3.10

### Bazel version

5.3.0

### GCC/Compiler version

11.3.0

### CUDA/cuDNN version

12.1/8.8.0.121

### GPU model and memory

NVIDIA GeForce 940MX

### Current Behaviour?

```shell
$ bazel build --config=mkl --config=opt //tensorflow/tools/pip_package:build_pip_package
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=211
INFO: Reading rc options for 'build' from tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from tensorflow/.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from tensorflow/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=~/Documents/dev/programs/anaconda3/envs/tf/bin/python3 --action_env PYTHON_LIB_PATH=~/Documents/dev/programs/anaconda3/envs/tf/lib/python3.10/site-packages --python_path=~/Documents/dev/programs/anaconda3/envs/tf/bin/python3 --action_env CUDA_TOOLKIT_PATH=/usr/local/cuda-12.1 --action_env TF_CUDA_COMPUTE_CAPABILITIES=5.0 --action_env LD_LIBRARY_PATH=/usr/lib/libreoffice/program:/usr/local/cuda/targets/x86_64-linux/lib:/usr/lib/x86_64-linux-gnu --action_env GCC_HOST_COMPILER_PATH=/usr/bin/x86_64-linux-gnu-gcc-11 --config=cuda
INFO: Reading rc options for 'build' from ~/Documents/dev/git/tensorflow/.bazelrc:
  'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file ~/Documents/dev/git/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file ~/Documents/dev/git/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:cuda in file ~/Documents/dev/git/tensorflow/.bazelrc: --repo_env TF_NEED_CUDA=1 --crosstool_top=@local_config_cuda//crosstool:toolchain --@local_config_cuda//:enable_cuda
INFO: Found applicable config definition build:mkl in file ~/Documents/dev/git/tensorflow/.bazelrc: --define=build_with_mkl=true --define=enable_mkl=true --define=tensorflow_mkldnn_contraction_kernel=0 --define=build_with_openmp=true -c opt
INFO: Found applicable config definition build:opt in file ~/Documents/dev/git/tensorflow/.tf_configure.bazelrc: --copt=-Wno-sign-compare --host_copt=-Wno-sign-compare
INFO: Found applicable config definition build:linux in file ~/Documents/dev/git/tensorflow/.bazelrc: --host_copt=-w --copt=-Wno-all --copt=-Wno-extra --copt=-Wno-deprecated --copt=-Wno-deprecated-declarations --copt=-Wno-ignored-attributes --copt=-Wno-array-bounds --copt=-Wunused-result --copt=-Werror=unused-result --copt=-Wswitch --copt=-Werror=switch --copt=-Wno-error=unused-but-set-variable --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --config=dynamic_kernels --distinct_host_configuration=false --experimental_guard_against_concurrent_changes
INFO: Found applicable config definition build:dynamic_kernels in file ~/Documents/dev/git/tensorflow/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/91d765cad5599f9710973d3e34d4dc22583e2e79.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/10939d1d580b9d3c9c2f3539c6bdb39f408179c0.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/081771d4a0e9d7d3aa0eed2ef389fa4700dfb23e.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/curl.haxx.se/download/curl-7.88.0.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/boringssl/archive/b9232f9e27e5668bc0414879dcdedb2a59ea75f2.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/XNNPACK/archive/659147817805d17c7be2d60bd7bbca7e780f9c82.zip failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/nvidia/nccl/archive/v2.16.2-1.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
ERROR: ~/Documents/dev/git/tensorflow/tensorflow/compiler/xla/service/gpu/runtime/BUILD:146:11: in deps attribute of cc_library rule //tensorflow/compiler/xla/service/gpu/runtime:gemm: target '//tensorflow/compiler/xla/service/gpu:non_atomically_upgradeable_rw_lock' does not exist
ERROR: ~/Documents/dev/git/tensorflow/tensorflow/compiler/xla/service/gpu/runtime/BUILD:146:11: Analysis of target '//tensorflow/compiler/xla/service/gpu/runtime:gemm' failed
INFO: Repository cudnn_frontend_archive instantiated at:
  ~/Documents/dev/git/tensorflow/WORKSPACE:15:14: in <toplevel>
  ~/Documents/dev/git/tensorflow/tensorflow/workspace2.bzl:967:21: in workspace
  ~/Documents/dev/git/tensorflow/tensorflow/workspace2.bzl:171:20: in _tf_repositories
  ~/Documents/dev/git/tensorflow/third_party/repo.bzl:136:21: in tf_http_archive
Repository rule _tf_http_archive defined at:
  ~/Documents/dev/git/tensorflow/third_party/repo.bzl:89:35: in <toplevel>
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: 
INFO: Elapsed time: 92.916s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (602 packages loaded, 36603 targets configured)
    Fetching https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v0.7.3.zip; 8,793,160B 8s
```


### Standalone code to reproduce the issue

```shell
./configure
bazel build --config=mkl --config=opt //tensorflow/tools/pip_package:build_pip_package
```


### Relevant log output

_No response_</details>