Skip to content

[Bug][LLVM] TVM fails to compile with LLVM 17 #14313

@supersat

Description

@supersat

This is mostly an FYI/early warning that LLVM 17 seems to have introduced breaking changes.

Expected behavior

TVM compiles as expected.

Actual behavior

The following errors were emitted:

/home/kkoscher/Projects/tvm/src/target/llvm/codegen_amdgpu.cc:45:10: fatal error: 'llvm/Transforms/IPO/PassManagerBuilder.h' file not found
#include <llvm/Transforms/IPO/PassManagerBuilder.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 /home/kkoscher/Projects/tvm/src/target/llvm/codegen_nvptx.cc:48:10: fatal error: 'llvm/Transforms/IPO/PassManagerBuilder.h' file not found
#include <llvm/Transforms/IPO/PassManagerBuilder.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Other LLVM deprecation warnings are also emitted:

/home/kkoscher/Projects/tvm/src/target/llvm/codegen_blob.cc:112:64: warning: 'getABITypeAlignment' is deprecated: use getABITypeAlign instead [-Wdeprecated-declarations]
    auto tvm_dev_mblob_reg_alignment = module->getDataLayout().getABITypeAlignment(int32_ty);
                                                               ^~~~~~~~~~~~~~~~~~~
                                                               getABITypeAlign
/home/kkoscher/Projects/llvm-project/llvm/include/llvm/IR/DataLayout.h:519:3: note: 'getABITypeAlignment' has been explicitly marked deprecated here
  LLVM_DEPRECATED("use getABITypeAlign instead", "getABITypeAlign")
  ^
/home/kkoscher/Projects/llvm-project/llvm/include/llvm/Support/Compiler.h:143:50: note: expanded from macro 'LLVM_DEPRECATED'
#define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
                                                 ^

/home/kkoscher/Projects/tvm/src/target/llvm/codegen_hexagon.cc:89:50: warning: 'getFixedSize' is deprecated: Use getFixedValue() instead [-Wdeprecated-declarations]
    return data_layout_->getTypeSizeInBits(type).getFixedSize();
                                                 ^~~~~~~~~~~~
                                                 getFixedValue
/home/kkoscher/Projects/llvm-project/llvm/include/llvm/Support/TypeSize.h:338:3: note: 'getFixedSize' has been explicitly marked deprecated here
  LLVM_DEPRECATED("Use getFixedValue() instead", "getFixedValue")
  ^
/home/kkoscher/Projects/llvm-project/llvm/include/llvm/Support/Compiler.h:143:50: note: expanded from macro 'LLVM_DEPRECATED'
#define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))

Environment

OS: Ubuntu 20.04
TVM hash: eecc02ad358367bacf461a7b0676231a1be6b6c3
llvm-project hash: 0b70f95c162634a06783081c6eda46d12cbcfd02

Steps to reproduce

Since LLVM 17 is currently in development, you must build LLVM 17 from source.

I used the following commands to build LLVM:

cmake -S llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_PARALLEL_LINK_JOBS=1

cmake --build build

When building TVM, I run cmake with -DUSE_LLVM and -DCMAKE_CXX_COMPILER point to my built LLVM and Clang++ repsectively.

Triage

  • needs-triage
  • backend: llvm
  • backend: nvptx

This also seems to affect AMD GPU (missing header) and Hexagon codegen (deprecation warnings).

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triagePRs or issues that need to be investigated by maintainers to find the right assignees to address ittype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions