Repository: pytorch
Issue: Pytorch build issues on PowerPC
Labels: module: build,triaged,module: POWER

Pytorch is struggling to compile on PowerPC architecture.

I'd like to compile pytorch without any CUDA or GPU support (the GPUs aren't properly configured).

## Environment

PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: linux (ppc64le)
GCC version: (jovyan-wslcomp4) 10.1.0
Clang version: Could not collect
CMake version: version 3.20.0-rc2

Python version: 3.9 (64-bit runtime)
Is CUDA available: N/A
CUDA runtime version: 11.3.58
GPU models and configuration: 
GPU 0: NVIDIA Tesla V100-SXM2-32GB
GPU 1: NVIDIA Tesla V100-SXM2-32GB
GPU 2: NVIDIA Tesla V100-SXM2-32GB
GPU 3: NVIDIA Tesla V100-SXM2-32GB

Nvidia driver version: 465.19.01
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.20.3
[conda] numpy                     1.20.3                   pypi_0    pypi

## Compiling error:

```console
$ USE_CUDA=0 MAX_JOBS=160 python setup.py install

Building wheel torch-1.9.0a0+git51cd89e
-- Building version 1.9.0a0+git51cd89e
cmake --build . --target install --config Release -- -j 160
[1/1111] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/torch/csrc/autograd/profiler_kineto.cpp.o
FAILED: caffe2/CMakeFiles/torch_cpu.dir/__/torch/csrc/autograd/profiler_kineto.cpp.o 
/opt/mambaforge-pypy3/envs/elyra/bin/powerpc64le-conda-linux-gnu-c++ -DCPUINFO_SUPPORTED_PLATFORM=0 -DFMT_HEADER_ONLY=1 -DHAVE_MALLOC_USABLE_SIZE=1 -DHAVE_MMAP=1 -DHAVE_SHM_OPEN=1 -DHAVE_SHM_UNLINK=1 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DUSE_DISTRIBUTED -DUSE_EXTERNAL_MZCRC -DUSE_RPC -DUSE_TENSORPIPE -D_FILE_OFFSET_BITS=64 -Dtorch_cpu_EXPORTS -Iaten/src -I../aten/src -I. -I../ -I../cmake/../third_party/benchmark/include -Icaffe2/contrib/aten -I../third_party/onnx -Ithird_party/onnx -I../third_party/foxi -Ithird_party/foxi -I../torch/csrc/api -I../torch/csrc/api/include -I../caffe2/aten/src/TH -Icaffe2/aten/src/TH -Icaffe2/aten/src -Icaffe2/../aten/src -Icaffe2/../aten/src/ATen -I../torch/csrc -I../third_party/miniz-2.0.8 -I../third_party/kineto/libkineto/include -I../third_party/kineto/libkineto/src -I../aten/src/TH -I../aten/../third_party/catch/single_include -I../aten/src/ATen/.. -Icaffe2/aten/src/ATen -I../caffe2/core/nomnigraph/include -I../c10/.. -I../third_party/cpuinfo/include -I../third_party/FP16/include -I../third_party/tensorpipe -Ithird_party/tensorpipe -I../third_party/tensorpipe/third_party/libnop/include -I../third_party/fmt/include -isystem third_party/gloo -isystem ../cmake/../third_party/gloo -isystem ../cmake/../third_party/googletest/googlemock/include -isystem ../cmake/../third_party/googletest/googletest/include -isystem ../third_party/protobuf/src -isystem ../cmake/../third_party/eigen -isystem /opt/mambaforge-pypy3/envs/elyra/include/python3.9 -isystem /opt/mambaforge-pypy3/envs/elyra/lib/python3.9/site-packages/numpy/core/include -isystem ../cmake/../third_party/pybind11/include -isystem /usr/local/cuda-11.3/include -isystem include -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -mcpu=power8 -mtune=power8 -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -isystem /opt/mambaforge-pypy3/envs/elyra/include -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -Wno-stringop-overflow -DHAVE_VSX_CPU_DEFINITION -O3 -DNDEBUG -DNDEBUG -fPIC -DCAFFE2_USE_GLOO -DCUDA_HAS_FP16=1 -DUSE_GCC_GET_CPUID -DTH_HAVE_THREAD -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-write-strings -Wno-unknown-pragmas -Wno-missing-braces -Wno-maybe-uninitialized -fvisibility=hidden -O2 -fopenmp -DCAFFE2_BUILD_MAIN_LIB -pthread -std=gnu++14 -MD -MT caffe2/CMakeFiles/torch_cpu.dir/__/torch/csrc/autograd/profiler_kineto.cpp.o -MF caffe2/CMakeFiles/torch_cpu.dir/__/torch/csrc/autograd/profiler_kineto.cpp.o.d -o caffe2/CMakeFiles/torch_cpu.dir/__/torch/csrc/autograd/profiler_kineto.cpp.o -c ../torch/csrc/autograd/profiler_kineto.cpp
../torch/csrc/autograd/profiler_kineto.cpp: In member function 'virtual void torch::autograd::profiler::{anonymous}::KinetoThreadLocalState::reportMemoryUsage(void*, int64_t, c10::Device)':
../torch/csrc/autograd/profiler_kineto.cpp:125:53: error: 'CPU_INSTANT_EVENT' is not a member of 'libkineto::ActivityType'
  125 |         act.activityType = libkineto::ActivityType::CPU_INSTANT_EVENT;
      |                                                     ^~~~~~~~~~~~~~~~~
../torch/csrc/autograd/profiler_kineto.cpp: In member function 'void torch::autograd::profiler::{anonymous}::KinetoThreadLocalState::addTraceEvents(libkineto::ActivityTraceInterface&)':
../torch/csrc/autograd/profiler_kineto.cpp:143:54: error: 'CPU_INSTANT_EVENT' is not a member of 'libkineto::ActivityType'
  143 |           ev_ptr->type() != libkineto::ActivityType::CPU_INSTANT_EVENT
      |                                                      ^~~~~~~~~~~~~~~~~
../torch/csrc/autograd/profiler_kineto.cpp: In member function 'c10::DeviceType torch::autograd::profiler::KinetoEvent::deviceType() const':
../torch/csrc/autograd/profiler_kineto.cpp:501:44: error: 'CPU_INSTANT_EVENT' is not a member of 'libkineto::ActivityType'
  501 |     case (uint8_t)libkineto::ActivityType::CPU_INSTANT_EVENT:
      |                                            ^~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
```

cc @malfet @seemethere @walterddr @ilia-cher @gdankel @ngimel @nbcsm @guotuofeng @guyang3532 @gaoteng-git @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @osalpekar @jiayisuse @agolynski @SciPioneer @H-Huang @mrzzd @cbalioglu @gcramer23