From 2bf345814ca2936a083bc4ed31d28a2c5fb58888 Mon Sep 17 00:00:00 2001 From: Denis Khalikov Date: Thu, 28 Feb 2019 01:38:01 +0300 Subject: [PATCH] [CODEGEN LLVM GPU] Initialize llvm before lookup for the target (#2683) --- python/tvm/contrib/nvcc.py | 2 +- src/codegen/llvm/codegen_amdgpu.cc | 1 + src/codegen/llvm/codegen_nvptx.cc | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python/tvm/contrib/nvcc.py b/python/tvm/contrib/nvcc.py index 99cea18d1487..f9970f6bceb2 100644 --- a/python/tvm/contrib/nvcc.py +++ b/python/tvm/contrib/nvcc.py @@ -151,7 +151,7 @@ def find_libdevice_path(arch): selected_ver = 0 selected_path = None cuda_ver = get_cuda_version(cuda_path) - if cuda_ver in (9.0, 9.1): + if cuda_ver in (9.0, 9.1, 10.0): path = os.path.join(lib_path, "libdevice.10.bc") else: for fn in os.listdir(lib_path): diff --git a/src/codegen/llvm/codegen_amdgpu.cc b/src/codegen/llvm/codegen_amdgpu.cc index d1a0716bc1d9..205d99f1ab65 100644 --- a/src/codegen/llvm/codegen_amdgpu.cc +++ b/src/codegen/llvm/codegen_amdgpu.cc @@ -156,6 +156,7 @@ inline int DetectROCMComputeVersion(const std::string& target) { } runtime::Module BuildAMDGPU(Array funcs, std::string target) { + InitializeLLVM(); CHECK(target.length() >= 4 && target.substr(0, 4) == "rocm"); std::ostringstream config; diff --git a/src/codegen/llvm/codegen_nvptx.cc b/src/codegen/llvm/codegen_nvptx.cc index 2d416d34ea0c..0a9361c57de7 100644 --- a/src/codegen/llvm/codegen_nvptx.cc +++ b/src/codegen/llvm/codegen_nvptx.cc @@ -166,6 +166,7 @@ inline int DetectCUDAComputeVersion() { } runtime::Module BuildNVPTX(Array funcs, std::string target) { + InitializeLLVM(); CHECK(target.length() >= 5 && target.substr(0, 5) == "nvptx"); int compute_ver = DetectCUDAComputeVersion();