Repository: pytorch
Issue: fbgemm_avx512 build failure
Labels: module: build,triaged

### 🐛 Describe the bug

I'm building git master with the [same Arch recipe](https://raw.githubusercontent.com/archlinux/svntogit-community/packages/python-pytorch/trunk/PKGBUILD).

My CPU is Ryzen 2 and does NOT support AVX-512. fbgemm is programmed wrongly and demands `fbgemm_avx512` even when the main project has disabled it:
```
-- Found OpenMP: TRUE   
CMake Warning at third_party/fbgemm/CMakeLists.txt:74 (message):
  OpenMP found! OpenMP_C_INCLUDE_DIRS =


  File "<string>", line 1
    exec(open('defs.bzl').read());print(';'.join(get_fbgemm_avx2_srcs(msvc=)))
                                                                           ^
SyntaxError: invalid syntax
  File "<string>", line 1
    exec(open('defs.bzl').read());print(';'.join(get_fbgemm_inline_avx2_srcs(msvc=)))
                                                                                  ^
SyntaxError: invalid syntax
  File "<string>", line 1
    exec(open('defs.bzl').read());print(';'.join(get_fbgemm_avx512_srcs(msvc=)))
                                                                             ^
SyntaxError: invalid syntax
  File "<string>", line 1
    exec(open('defs.bzl').read());print(';'.join(get_fbgemm_inline_avx512_srcs(msvc=)))
                                                                                    ^
SyntaxError: invalid syntax
CMake Error at third_party/fbgemm/CMakeLists.txt:135 (target_compile_options):
  Cannot specify compile options for target "fbgemm_avx512" which is not
  built by this project.


CMake Warning at third_party/fbgemm/CMakeLists.txt:170 (message):
  ==========


CMake Warning at third_party/fbgemm/CMakeLists.txt:171 (message):
  CMAKE_BUILD_TYPE = Release


CMake Warning at third_party/fbgemm/CMakeLists.txt:172 (message):
  CMAKE_CXX_FLAGS_DEBUG is -g


CMake Warning at third_party/fbgemm/CMakeLists.txt:173 (message):
  CMAKE_CXX_FLAGS_RELEASE is -O3 -DNDEBUG


CMake Warning at third_party/fbgemm/CMakeLists.txt:174 (message):
  ==========


** AsmJit Summary **
   ASMJIT_DIR=./src/pytorch/third_party/fbgemm/third_party/asmjit
   ASMJIT_TEST=FALSE
   ASMJIT_TARGET_TYPE=STATIC
   ASMJIT_DEPS=pthread;rt
   ASMJIT_LIBS=asmjit;pthread;rt
   ASMJIT_CFLAGS=-DASMJIT_STATIC
   ASMJIT_PRIVATE_CFLAGS=-Wall;-Wextra;-Wconversion;-fno-math-errno;-fno-threadsafe-statics;-fno-semantic-interposition;-DASMJIT_STATIC
   ASMJIT_PRIVATE_CFLAGS_DBG=
   ASMJIT_PRIVATE_CFLAGS_REL=-O2;-fmerge-all-constants;-fno-enforce-eh-specs
CMake Error at third_party/fbgemm/CMakeLists.txt:235 (target_include_directories):
  Cannot specify include directories for target "fbgemm_avx512" which is not
  built by this project.


CMake Error at third_party/fbgemm/CMakeLists.txt:262 (target_compile_definitions):
  Cannot specify compile definitions for target "fbgemm_avx512" which is not
  built by this project.


CMake Error at cmake/Dependencies.cmake:826 (set_property):
  set_property could not find TARGET fbgemm_avx512.  Perhaps it has not yet
  been created.
Call Stack (most recent call first):
  CMakeLists.txt:719 (include)
```

### Versions

```
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Arch Linux (x86_64)
GCC version: (GCC) 12.2.0
Clang version: 14.0.6
CMake version: version 3.25.0
Libc version: glibc-2.36

Python version: 3.10.8 (main, Nov  1 2022, 14:18:21) [GCC 12.2.0] (64-bit runtime)
Python platform: Linux-6.1.0-1-rc5-mainline-x86_64-with-glibc2.36
Is CUDA available: N/A
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

Versions of relevant libraries:
[pip3] mypy==0.982
[pip3] mypy-extensions==0.4.3
[pip3] mypy-protobuf==2.9
[pip3] numpy==1.23.4
[pip3] numpy-quaternion==2022.4.2
[pip3] numpydoc==1.5.0
[pip3] oldest-supported-numpy==2022.5.28
[pip3] pytorch-lightning==1.7.7
[pip3] torchaudio==0.12.1+58da317
[pip3] torchfile==0.1.0
[pip3] torchmetrics==0.10.0
[pip3] torchvision==0.14.0a0
[conda] Could not collect
```

cc @malfet @seemethere