Require LLVM >= 9 for AMDGPU backend (#4253)
authorThomas Viehmann <tv.code@beamnet.de>
Tue, 5 Nov 2019 10:25:18 +0000 (11:25 +0100)
committermasahi <masahi129@gmail.com>
Tue, 5 Nov 2019 10:25:18 +0000 (19:25 +0900)
LLVM 8 will crash when loading the bitcodes

This is a runtime check as the file will be compiled in even when
USE_ROCM OFF is used in the configuration if ROCM is installed
in the default location.

Fixes: #4087

src/codegen/llvm/codegen_amdgpu.cc

index 0b9b8e3..28b2deb 100644 (file)
@@ -183,6 +183,11 @@ inline int DetectROCMComputeVersion(const std::string& target) {
 }
 
 runtime::Module BuildAMDGPU(Array<LoweredFunc> funcs, std::string target) {
+#if TVM_LLVM_VERSION < 90
+  LOG(FATAL) << "AMDGPU backend requires at least LLVM 9";
+  // Lower versions will crash when loading the bitcode, see
+  // issue #4087 for a discussion
+#endif
   InitializeLLVM();
   CHECK(target.length() >= 4 &&
         target.substr(0, 4) == "rocm");