I am attempting to build Pytorch/XLA on a new Windows 11 laptop (16″ Lenovo AMD Ryzen Ideapad 5 pro to be specific) under WSL (Ubuntu 22.04) following the Linux instructions at github.com/pytorch/pytorch#from-source
However, no matter what I try I get compilation errors (mostly warnings that are promoted to errors).
If I try out of the steps out of the box
cmake install cmake ninja
pip install -r requirements.txt
conda install mkl mkl-include
git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
python setup.py develop
I get errors like the following:
In function ‘__m512i _mm512_slli_epi32(__m512i, unsigned int)’,
inlined from ‘void fbgemm::{anonymous}::Bfloat16ToFloatKernelAvx512(const fbgemm::bfloat16*, float*)’ at /home/pytorch/third_party/fbgemm/src/FbgemmBfloat16ConvertAvx512.cc:37:38,
inlined from ‘void fbgemm::Bfloat16ToFloat_avx512(const bfloat16*, float*, size_t)’ at /home/pytorch/third_party/fbgemm/src/FbgemmBfloat16ConvertAvx512.cc:54:32:
/usr/lib/gcc/x86_64-linux-gnu/12/include/avx512fintrin.h:1242:50: error: ‘__Y’ may be used uninitialized [-Werror=maybe-uninitialized]
1242 | return (__m512i) __builtin_ia32_pslldi512_mask ((__v16si) __A, __B,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
1243 | (__v16si)
| ~~~~~~~~~
1244 | _mm512_undefined_epi32 (),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
1245 | (__mmask16) -1);
| ~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/include/avx512fintrin.h: In function ‘void fbgemm::Bfloat16ToFloat_avx512(const bfloat16*, float*, size_t)’:
/usr/lib/gcc/x86_64-linux-gnu/12/include/avx512fintrin.h:206:11: note: ‘__Y’ was declared here
206 | __m512i __Y = __Y;
| ^~~
cc1plus: all warnings being treated as errors
If I read notes on the self-initialized variables. This looks like an idiom to suppress that warning message in g++, but instead it is causing it. And I’ve tried numerous things (not including editing the source) to turn that warning off, none of which have had any effect.
If I try to switch to Clang via ENV variables (which works for building LLVM and MLIR):
export CC=clang
export CXX=clang++
I can’t even get the cmake configuration process to run:
Change Dir: /home/pytorch/build/CMakeFiles/CMakeTmp
Run Build Command(s):/home/cfclark/anaconda3/bin/ninja cmTC_6fa39 && [1/2] Building CXX object CMakeFiles/cmTC_6fa39.dir/testCXXCompiler.cxx.o
[2/2] Linking CXX executable cmTC_6fa39
FAILED: cmTC_6fa39
: && /usr/bin/clang++ CMakeFiles/cmTC_6fa39.dir/testCXXCompiler.cxx.o -o cmTC_6fa39 && :
/usr/bin/ld: cannot find -lstdc++: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Read more here: Source link