Does tensorflow lite not support compilation with both parameters set on windows? "--cpu=x64_x86_windows --define tflite_with_xnnpack=true"
Hi @gootaoo and @sushreebarsa, this issue similar to https://github.com/grpc/grpc/issues/29167
I think, the actual issue is x86_windows(32 bits) is not supported yet for Windows. You can successfully create a build with
 bazel --output_user_root=./../tensorflow_build build -s --config=opt --define tflite_with_xnnpack=true --cpu=x64_
windows //tensorflow/lite:tensorflowlite.dll Thanks for reply, @mraunak and @sushreebarsa  it should support compiling x86 (32-bit) compilation. When I remove the tflite_with_xnnpack parameter, it can be compiled successfully.
 @gootaoo could you please confirm if your CPU supports SSE2, SSE4, AVX, AVX2, or AVX512. As per documentation https://blog.tensorflow.org/2020/07/accelerating-tensorflow-lite-xnnpack-integration.html, the 'xnnpack' optimizes these instruction sets. @gootaoo Could you please refer to the comment above and update on the same. Thank you! Hi @mraunak @sushreebarsa , my cpu supports SSE2, SSE4.1, SSE4.2, AVX and AVX2, i want to compile the Windows 32-bit TFLite library and support XNNPACK acceleration. Is there any other way? Hi @gootaoo 

The bazel build support for XNNPACK on 32 built windows might not be supported as [this](https://github.com/google/XNNPACK/issues/4637#issuecomment-1502152928) comment suggests.

The CMAKE build has support for XNNPACK on Windows as per the [documentation](https://www.tensorflow.org/lite/guide/build_cmake#available_options_to_build_tensorflow_lite).

Could you please try building using CMAKE using these [instructions](https://www.tensorflow.org/lite/guide/build_cmake) and using `DTFLITE_ENABLE_XNNPACK = ON`.

`cmake ../tensorflow_src/tensorflow/lite -DTFLITE_ENABLE_XNNPACK = ON`

Thanks. Hi @pjpratik  when i run: cmake -DCMAKE_GENERATOR_PLATFORM=Win32 -DTFLITE_ENABLE_XNNPACK=ON ../../tensorflow-r2.5/tensorflow/lite, i got errors : 

`Completed 'pthreadpool'
  Building Custom Rule C:/Users/xxx/Desktop/tensorflow-r2.5-tflite-win/tflitecpp-x86/pthreadpool-download/CMakeLists.txt
  Building Custom Rule C:/Users/xxx/Desktop/tensorflow-r2.5-tflite-win/tflitecpp-x86/pthreadpool-download/CMakeLists.txt
CMake Error at C:/Users/xxx/Desktop/tensorflow-r2.5-tflite-win/tflitecpp-x86/xnnpack/CMakeLists.txt:2928 (ADD_SUBDIRECTORY):
  ADD_SUBDIRECTORY given source
  "C:/Users/xxx/Desktop/tensorflow-r2.5-tflite-win/tflitecpp-x86/clog-source/deps/clog"
  which is not an existing directory.


CMake Error at C:/Users/xxx/Desktop/tensorflow-r2.5-tflite-win/tflitecpp-x86/xnnpack/CMakeLists.txt:2932 (SET_PROPERTY):
  SET_PROPERTY could not find TARGET clog.  Perhaps it has not yet been created.


CMake Error at C:/Users/xxx/Desktop/tensorflow-r2.5-tflite-win/tflitecpp-x86/cpuinfo-source/CMakeLists.txt:255 (ADD_SUBDIRECTORY):
  ADD_SUBDIRECTORY not given a binary directory but the given source
  directory
  "C:/Users/xxx/Desktop/tensorflow-r2.5-tflite-win/tflitecpp-x86/clog-source"
  is not a subdirectory of
  "C:/Users/xxx/Desktop/tensorflow-r2.5-tflite-win/tflitecpp-x86/cpuinfo-source".
  When specifying an out-of-tree source a binary directory must be explicitly
  specified.


CMake Error at C:/Users/xxx/Desktop/tensorflow-r2.5-tflite-win/tflitecpp-x86/cpuinfo-source/CMakeLists.txt:258 (SET_PROPERTY):
  SET_PROPERTY could not find TARGET clog.  Perhaps it has not yet been created.`

**When I build the TFLite C library, I can get a XNNPACK.lib library, reference it in the project has no effect, how can I add the XNNPACK delegate ?**

Thanks. Hi @gootaoo 

The CMake should choose platform automatically when building the files if not specified. 

Can you please try `cmake tensorflow/lite -DTFLITE_ENABLE_XNNPACK=ON` ?

Also, can you try with latest stable version which is `r2.12`.

 I have tried to build on x64 windows with `r2.12` and was able to build without any error.  Please find the screenshots below.

<img width="956" alt="Screenshot 2023-04-24 at 11 55 29 AM" src="https://user-images.githubusercontent.com/118897289/233917267-09171f37-7ba3-4b44-be56-27054963f691.png">

<img width="751" alt="Screenshot 2023-04-24 at 11 56 14 AM" src="https://user-images.githubusercontent.com/118897289/233917245-a170254d-a3b6-401b-ba36-8b8659c716f3.png">

Thanks.


 Hi @pjpratik  x64 compilation is fine, i just want to compile an x86 (32-bit) TFLite library and support XNNPACK acceleration (or other acceleration), do I need to find a 32-bit window computer? thanks. Hi @gootaoo 

Could you please try with `cmake -A Win32 ..\tensorflow\lite -DTFLITE_ENABLE_XNNPACK=ON` command on your machine?

Please see the relevant thread [#47166](https://github.com/tensorflow/tensorflow/issues/47166) and let us know if it helps.

Thanks. This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. Hi @pjpratik  
It works fine for me, thank you so much ! Hi @gootaoo 

Glad it worked. Feel free to close the issue if it is resolved.

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

Bug

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

Yes

### Source

source

### Tensorflow Version

r2.9,r2.10,2.11

### Custom Code

No

### OS Platform and Distribution

Windows 11

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

```shell
run: bazel --output_user_root=./../tensorflow_build build -s --config=opt --define tflite_with_xnnpack=true --cpu=x64_x86_windows //tensorflow/lite:tensorflowlite.dll
```


### Standalone code to reproduce the issue

```shell
result: 
ERROR: C:/users/togrey/desktop/tensorflow_build/master1/gaunzc4b/external/XNNPACK/BUILD.bazel:4762:26: configurable attribute "deps" in @XNNPACK//:amalgam_microkernels doesn't match this configuration. Would a default condition help?

Conditions checked:
 @XNNPACK//:aarch32
 @XNNPACK//:aarch64
 @XNNPACK//:x86
 @XNNPACK//:emscripten_wasm
 @XNNPACK//:emscripten_wasmsimd
 @XNNPACK//:emscripten_wasmrelaxedsimd
 @XNNPACK//:riscv
To see a condition's definition, run: bazel query --output=build <condition label>.

On tf version r2.9:
ERROR: C:/users/togrey/desktop/tensorflow_build/2.11/gaunzc4b/external/cpuinfo/BUILD.bazel:103:11: configurable attribute "srcs" in @cpuinfo//:cpuinfo_impl doesn't match this configuration. Would a default condition help?

Conditions checked:
 @cpuinfo//:linux_x86_64
 @cpuinfo//:linux_arm
 @cpuinfo//:linux_armhf
 @cpuinfo//:linux_armv7a
 @cpuinfo//:linux_armeabi
 @cpuinfo//:linux_aarch64
 @cpuinfo//:linux_mips64
 @cpuinfo//:linux_riscv64
 @cpuinfo//:linux_s390x
 @cpuinfo//:macos_x86_64
 @cpuinfo//:macos_arm64
 @cpuinfo//:windows_x86_64
 @cpuinfo//:android_armv7
 @cpuinfo//:android_arm64
 @cpuinfo//:android_x86
 @cpuinfo//:android_x86_64
 @cpuinfo//:ios_x86_64
 @cpuinfo//:ios_x86
 @cpuinfo//:ios_armv7
 @cpuinfo//:ios_arm64
 @cpuinfo//:ios_arm64e
 @cpuinfo//:ios_sim_arm64
 @cpuinfo//:watchos_x86_64
 @cpuinfo//:watchos_x86
 @cpuinfo//:watchos_armv7k
 @cpuinfo//:watchos_arm64_32
 @cpuinfo//:tvos_x86_64
 @cpuinfo//:tvos_arm64
 @cpuinfo//:emscripten_wasm

To see a condition's definition, run: bazel query --output=build <condition label>.
```


### Relevant log output

_No response_</details>