tensorflow-windows-wheel icon indicating copy to clipboard operation
tensorflow-windows-wheel copied to clipboard

could you please tell me what are the flags for compiling it with bazel and switch XNNPACK OFF? python 2.12 and tensorflow 2.18.0

Open dicotom opened this issue 10 months ago • 4 comments

Hi, Although I disable all the avx instructions , it still fails with XNNPACK

ERROR: C:/users/user/_bazel_user/yopxtjri/external/XNNPACK/BUILD.bazel:803:36: Compiling external/XNNPACK/avx512vnni_prod_microkernels.c failed: (Exit 1): clang-cl.exe failed: error executing command (from target @XNNPACK//:avx512vnni_prod_microkernels)

dicotom avatar Feb 03 '25 15:02 dicotom

Do you have C++ Clang Compiler for Windows, MSBuild support for LLVM (clang-cl) toolset and C++ Clang tools for Windows installed? (in Visual Studio installer)

Can you change the compiler in your build command from clang back to msvc?

fo40225 avatar Feb 05 '25 01:02 fo40225

of course, I followed this guide https://www.tensorflow.org/install/source_windows

The cpu does not support avx instructions, so in configure I included the relevant noavx flags and in bazel build --define=tflite_with_xnnpack=false, but still no luck.

The guide says: Note: Clang will be the preferred compiler to build TensorFlow CPU wheels on the Windows Platform starting with TF 2.16.1 The currently supported version is LLVM/clang 17.0.6. Note: To build with Clang on Windows, it is required to install both LLVM and Visual C++ Build tools as although Windows uses clang-cl.exe as the compiler, Visual C++ Build tools are needed to link to Visual C++ libraries

Do I need to use msvc? if yes, how do I do that? and which command line is it? As you can see from the guide:

Version | Python version | Compiler | Build tools

tensorflow-2.18.0 | 3.9-3.12 | CLANG 17.0.6 | Bazel 6.5.0 tensorflow-2.17.0 | 3.9-3.12 | CLANG 17.0.6 | Bazel 6.5.0 tensorflow-2.16.1 | 3.9-3.12 | CLANG 17.0.6 | Bazel 6.5.0 tensorflow-2.15.0 | 3.9-3.11 | MSVC 2019 | Bazel 6.1.0

MSVC was used up to tensorflow 2.15.0

dicotom avatar Feb 05 '25 07:02 dicotom

Sorry, I haven't compiled TensorFlow in a while.

You can refer to this link https://www.tensorflow.org/install/source_windows#cpu-only to use msvc or clang.

Try using msvc or make sure that your clang-cl and llvm/clang are installed correctly.

fo40225 avatar Feb 05 '25 07:02 fo40225

You did not get it. I know how to do that, but it does not work because it tries to compile the XNNPACK which uses avx512. Most probably when you did it, there was no XNNPACK integrated with tensorflow, but was only available with tensorflow lite.

dicotom avatar Feb 05 '25 08:02 dicotom