Skip to content

Pytorch fails to compile on Intel Mac #85956

@singingwolfboy

Description

@singingwolfboy

🐛 Describe the bug

Pytorch fails to compile on Intel Mac computers. See this traceback in the Homebrew repo for a full traceback with error messages. I believe that this error started occurring with the release of LLVM 14 (macOS Command Line Tools version 2395). When running cmake, we get the following error messages:

 [ 20%] Building C object confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/f32-vlrelu/gen/vlrelu-avx-x16.c.o
  cd /tmp/libtorch-20220926-10919-1nu5egq/build/confu-deps/XNNPACK && /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -DCPUINFO_SUPPORTED_PLATFORM=1 -DFXDIV_USE_INLINE_ASSEMBLY=0 -DXNN_ENABLE_ASSEMBLY=1 -DXNN_ENABLE_JIT=0 -DXNN_ENABLE_MEMOPT=1 -DXNN_ENABLE_SPARSE=1 -DXNN_LOG_LEVEL=0 -I/tmp/libtorch-20220926-10919-1nu5egq/third_party/XNNPACK/include -I/tmp/libtorch-20220926-10919-1nu5egq/third_party/XNNPACK/src -I/tmp/libtorch-20220926-10919-1nu5egq/third_party/cpuinfo/deps/clog/include -I/tmp/libtorch-20220926-10919-1nu5egq/third_party/cpuinfo/include -I/tmp/libtorch-20220926-10919-1nu5egq/third_party/pthreadpool/include -I/tmp/libtorch-20220926-10919-1nu5egq/third_party/FXdiv/include -I/tmp/libtorch-20220926-10919-1nu5egq/third_party/FP16/include -isystem /tmp/libtorch-20220926-10919-1nu5egq/third_party/gemmlowp -isystem /tmp/libtorch-20220926-10919-1nu5egq/third_party/neon2sse -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -fPIC -std=gnu99  -fno-math-errno  -mavx  -O2  -MD -MT confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/f32-vlrelu/gen/vlrelu-avx-x16.c.o -MF CMakeFiles/XNNPACK.dir/src/f32-vlrelu/gen/vlrelu-avx-x16.c.o.d -o CMakeFiles/XNNPACK.dir/src/f32-vlrelu/gen/vlrelu-avx-x16.c.o -c /tmp/libtorch-20220926-10919-1nu5egq/third_party/XNNPACK/src/f32-vlrelu/gen/vlrelu-avx-x16.c
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:14:7: error: unknown use of instruction mnemonic without a size suffix
        "mov r14, %[gp]\t\n"
        ^
  <inline asm>:1:2: note: instantiated into assembly here
          mov r14, -48(%rbp)      
          ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:22:8: error: brackets expression not supported on this target
        "mov r8, [r14 + 0]\t\n"
         ^
  <inline asm>:2:9: note: instantiated into assembly here
  mov r8, [r14 + 0]       
          ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:23:8: error: ambiguous instructions require an explicit suffix (could be 'decb', 'decw', 'decl', or 'decq')
        "dec r8\t\n"
         ^
  <inline asm>:3:1: note: instantiated into assembly here
  dec r8  
  ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:25:8: error: brackets expression not supported on this target
        "mov r9, [r14 + 8]\t\n"
         ^
  <inline asm>:4:9: note: instantiated into assembly here
  mov r9, [r14 + 8]       
          ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:27:8: error: brackets expression not supported on this target
        "mov r10, [r14 + 16]\t\n"
         ^
  <inline asm>:5:10: note: instantiated into assembly here
  mov r10, [r14 + 16]     
           ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:29:8: error: brackets expression not supported on this target
        "lea r15, [r14 + 24]\t\n"
         ^
  <inline asm>:6:10: note: instantiated into assembly here
  lea r15, [r14 + 24]     
           ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:31:8: error: brackets expression not supported on this target
        "mov r12, [r14 + 32]\t\n"
         ^
  <inline asm>:7:10: note: instantiated into assembly here
  mov r12, [r14 + 32]     
           ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:33:8: error: brackets expression not supported on this target
        "mov r13, [r14 + 40]\t\n"
         ^
  <inline asm>:8:10: note: instantiated into assembly here
  mov r13, [r14 + 40]     
           ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:35:8: error: brackets expression not supported on this target
        "mov rdi, [r14 + 48]\t\n"
         ^
  <inline asm>:9:10: note: instantiated into assembly here
  mov rdi, [r14 + 48]     
           ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:37:8: error: brackets expression not supported on this target
        "mov rsi, [r14 + 56]\t\n"
         ^
  <inline asm>:10:10: note: instantiated into assembly here
  mov rsi, [r14 + 56]     
           ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:40:8: error: unknown use of instruction mnemonic without a size suffix
        "mov rax, r9\t\n"
         ^
  <inline asm>:11:1: note: instantiated into assembly here
  mov rax, r9     
  ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:41:8: error: unknown use of instruction mnemonic without a size suffix
        "mov rcx, r12\t\n"
         ^
  <inline asm>:12:1: note: instantiated into assembly here
  mov rcx, r12    
  ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:43:8: error: unknown use of instruction mnemonic without a size suffix
        "xor ebx, ebx\t\n"
         ^
  <inline asm>:13:1: note: instantiated into assembly here
  xor ebx, ebx    
  ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:45:8: error: unknown use of instruction mnemonic without a size suffix
        "mov r14, r8\t\n"
         ^
  <inline asm>:15:1: note: instantiated into assembly here
  mov r14, r8     
  ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:46:8: error: unexpected token in argument list
        "vbroadcastss zmm31,DWORD PTR [r15]\t\n"
         ^
  <inline asm>:16:26: note: instantiated into assembly here
  vbroadcastss zmm31,DWORD PTR [r15]      
                           ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:47:8: error: unexpected token in argument list
        "vcvtph2ps zmm3,YMMWORD PTR [r10 + 0]\t\n"
         ^
  <inline asm>:17:24: note: instantiated into assembly here
  vcvtph2ps zmm3,YMMWORD PTR [r10 + 0]    
                         ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:48:8: error: unexpected token in argument list
        "vcvtph2ps zmm4,YMMWORD PTR [r10 + 32]\t\n"
         ^
  <inline asm>:18:24: note: instantiated into assembly here
  vcvtph2ps zmm4,YMMWORD PTR [r10 + 32]   
                         ^
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:49:8: error: invalid operand for instruction
        "vxorps xmm0, xmm0, xmm0\t\n"
         ^
  <inline asm>:19:14: note: instantiated into assembly here
  vxorps xmm0, xmm0, xmm0 
               ^~~~~
  /tmp/libtorch-20220926-10919-1nu5egq/third_party/fbgemm/src/FbgemmFP16UKernelsAvx512.cc:50:8: error: invalid operand for instruction
        "vcomiss xmm31, xmm0\t\n"
         ^
  <inline asm>:20:16: note: instantiated into assembly here
  vcomiss xmm31, xmm0     
                 ^~~~
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.

Versions

This is when trying to compile the latest stable Pytorch: version 1.12.1, Git commit 664058f.

cc @malfet @seemethere @albanD

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: buildBuild system issuesmodule: macosMac OS related issuestriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions