fatal error C1002: compiler out of heap space in pass 2 when build pip-package for tensorflow 2.9.3 and python 3.9.1 on Windows 10
My configure:
D:\NDev\tensorflow-2.9.3>python ./configure.py

You have bazel 5.4.1 installed.

Please specify the location of python. [Default is C:\Users\Administrator\AppData\Local\Programs\Python\Python39\python.exe]:





Found possible Python library paths:

  C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages

Please input the desired Python library path to use.  Default is [C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages]



Do you wish to build TensorFlow with ROCm support? [y/N]: N

No ROCm support will be enabled for TensorFlow.



Do you wish to build TensorFlow with CUDA support? [y/N]: y

CUDA support will be enabled for TensorFlow.



Do you wish to build TensorFlow with TensorRT support? [y/N]: n

No TensorRT support will be enabled for TensorFlow.



Found CUDA 11.2 in:

    C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/lib/x64

    C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/include

Found cuDNN 8 in:

    C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/lib/x64

    C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/include





Please specify a list of comma-separated CUDA compute capabilities you want to build with.

You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus. Each capability can be specified as "x.y" or "compute_xy" to include both virtual and binary GPU code, or as "sm_xy" to only include the binary code.

Please note that each additional compute capability significantly increases your build time and binary size, and that TensorFlow only supports compute capabilities >= 3.5 [Default is: 3.5,7.0]: 8.6





Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is /arch:AVX]:





Would you like to override eigen strong inline for some C++ compilation to reduce the compilation time? [Y/n]:

Eigen strong inline overridden.



Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: n

Not configuring the WORKSPACE for Android builds.



Preconfigured Bazel build configs. You can use any of the below by adding "--config=<>" to your build command. See .bazelrc for more details.

        --config=mkl            # Build with MKL support.

        --config=mkl_aarch64    # Build with oneDNN and Compute Library for the Arm Architecture (ACL).

        --config=monolithic     # Config for mostly static monolithic build.

        --config=numa           # Build with NUMA support.

        --config=dynamic_kernels        # (Experimental) Build kernels into separate shared objects.

        --config=v1             # Build with TensorFlow 1 API instead of TF 2 API.

Preconfigured Bazel build configs to DISABLE default on features:

        --config=nogcp          # Disable GCP support.

        --config=nonccl         # Disable NVIDIA NCCL support. @tricoffee If you're using an older version of the C++ compiler, consider upgrading to a newer version that may have better memory management. Please delete any existing build files and directories to ensure a fresh start. We recommend you to upgrade the TF version instead of the older version. Kindly let us know the update on this?
Thank you! Upgrade the TF version to 2.10.0 with python 3.10.1 build complete successfully @sushreebarsa  @tricoffee Thank you for the update!
Could you please make this issue to closed status if it is resolved?
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/62688">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/62688">No</a>
 build tensorflow_cc.dll with tensorflow-2.10.0 with python 3.10.1 Linking tensorflow/tensorflow_cc.dll failed: (Exit 1120): link.exe failed: error executing command  @sushreebarsa 
### Issue type

Build/Install

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

No

### Source

source

### TensorFlow version

tf 2.9.3

### OS platform and distribution

Windows 10  Version 22H2 (OS Internal Version 19405.3803)

### Python version

3.9.1

### Bazel version

5.4.1

### GCC/compiler version
MSVC 2019
The Path Environment for compiler  is
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\Hostx64\x64

### CUDA/cuDNN version

cuDNN 8.1 for Cuda 11.2
Cuda was installed from cuda_11.2.0_460.89_win10.exe
Cudnn for cuda 11.2.0  is from cudnn-11.2-windows-x64-v8.1.0.77.zip

### GPU model and memory

NVIDIA GeForce RTX 3080 ti  12288MiB
Nvidia Driver Version is  546.33
The driver was installed from 546.33-desktop-win10-win11-64bit-international-nsd-dch-whql.exe

### Current behavior?

**build tensorflow_cc.dll for tensorflow 2.9.3 ** successfully.
but bazel build --config=opt --config=cuda --define=no_tensorflow_py_deps=true --copt=-nvcc_options=disable-warnings --local_ram_resources=2048 //tensorflow:tensorflow_cc.dll
**build tensorflow_cc.lib for tensorflow 2.9.3 ** successfully
but bazel build --config=opt --config=cuda --define=no_tensorflow_py_deps=true --copt=-nvcc_options=disable-warnings --local_ram_resources=2048 //tensorflow:tensorflow_cc_dll_import_lib
**build cpp headers for tensorflow 2.9.3  ** successfully
but bazel build --config=opt --config=cuda --define=no_tensorflow_py_deps=true --copt=-nvcc_options=disable-warnings --local_ram_resources=2048 //tensorflow:install_headers
but bazel build --config=opt --config=cuda --define=no_tensorflow_py_deps=true --copt=-nvcc_options=disable-warnings --local_ram_resources=**2048**  //tensorflow/tools/pip_package:build_pip_package failed because compiler out of heap space in pass 2
**try again with more local RAM resources but failed for the same reason**
but bazel build --config=opt --config=cuda --define=no_tensorflow_py_deps=true --copt=-nvcc_options=disable-warnings --local_ram_resources=**4096**  //tensorflow/tools/pip_package:build_pip_package failed because compiler out of heap space in pass 2 






### Standalone code to reproduce the issue

```shell
but bazel build --config=opt --config=cuda --define=no_tensorflow_py_deps=true --copt=-nvcc_options=disable-warnings --local_ram_resources=4096 //tensorflow/tools/pip_package:build_pip_package
```


### Relevant log output

```shell
**Latest logs are:**
注意: 包含文件:      D:\ndev\tf293_build\hu3sahy6\execroot\org_tensorflow\third_party\eigen3\unsupported\Eigen\CXX11\src/FixedPoint/MatVecProduct.h
注意: 包含文件:     external/mkl_dnn_v1/include\dnnl.h
注意: 包含文件:      D:\ndev\tf293_build\hu3sahy6\execroot\org_tensorflow\external\mkl_dnn_v1\include\oneapi/dnnl/dnnl.h
注意: 包含文件:       bazel-out/x64_windows-opt/bin/external/mkl_dnn_v1/include\oneapi/dnnl/dnnl_config.h
注意: 包含文件:        D:\ndev\tf293_build\hu3sahy6\execroot\org_tensorflow\external\mkl_dnn_v1\include\oneapi/dnnl/dnnl_types.h
注意: 包含文件:       bazel-out/x64_windows-opt/bin/external/mkl_dnn_v1/include\oneapi/dnnl/dnnl_version.h
注意: 包含文件:     .\tensorflow/core/platform/dynamic_annotations.h
注意: 包含文件:      .\tensorflow/core/platform/platform.h
注意: 包含文件:      .\tensorflow/core/platform/default/dynamic_annotations.h
注意: 包含文件:  .\tensorflow/compiler/xla/service/cpu/runtime_lightweight_check.h
D:\ndev\tf293_build\hu3sahy6\execroot\org_tensorflow\external\eigen_archive\Eigen\src\Core\products\GeneralBlockPanelKernel.h(2073) : fatal error C1002: 在第 2 遍中编译器的堆空间 不足
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 14994.948s, Critical Path: 2927.75s
INFO: 9275 processes: 66 internal, 9209 local.
FAILED: Build did NOT complete successfully
```
