From 3a534bdd40307670ff442ee70fc5ccd63fb69d51 Mon Sep 17 00:00:00 2001 From: Thomas Viehmann Date: Tue, 5 Nov 2019 11:25:18 +0100 Subject: [PATCH] Require LLVM >= 9 for AMDGPU backend (#4253) 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/codegen/llvm/codegen_amdgpu.cc b/src/codegen/llvm/codegen_amdgpu.cc index 0b9b8e3c905b..28b2deb3f2b7 100644 --- a/src/codegen/llvm/codegen_amdgpu.cc +++ b/src/codegen/llvm/codegen_amdgpu.cc @@ -183,6 +183,11 @@ inline int DetectROCMComputeVersion(const std::string& target) { } runtime::Module BuildAMDGPU(Array 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");