From 27bfb80359d497a03edc51f77406592ea63082dc Mon Sep 17 00:00:00 2001 From: pzq Date: Fri, 26 Nov 2021 03:43:23 +0800 Subject: [PATCH] [BugFix] fix nvptx not supported by device_enabled error (#9585) * [BugFix] fix nvptx not supported by device_enabled error Signed-off-by: ZQPei * [BugFix] shared.dyn support for codegen_nvptx Signed-off-by: ZQPei --- src/runtime/module.cc | 2 +- src/target/llvm/codegen_nvptx.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/module.cc b/src/runtime/module.cc index f9c281ab9d02..393d269222c1 100644 --- a/src/runtime/module.cc +++ b/src/runtime/module.cc @@ -148,7 +148,7 @@ bool RuntimeEnabled(const std::string& target) { } else if (target == "hexagon") { f_name = "device_api.hexagon"; } else if (target.length() >= 5 && target.substr(0, 5) == "nvptx") { - f_name = "device_api.gpu"; + f_name = "device_api.cuda"; } else if (target.length() >= 4 && target.substr(0, 4) == "rocm") { f_name = "device_api.rocm"; } else if (target.length() >= 4 && target.substr(0, 4) == "llvm") { diff --git a/src/target/llvm/codegen_nvptx.cc b/src/target/llvm/codegen_nvptx.cc index ebe6d6d67442..24b7bd2b6acc 100644 --- a/src/target/llvm/codegen_nvptx.cc +++ b/src/target/llvm/codegen_nvptx.cc @@ -138,7 +138,7 @@ class CodeGenNVPTX : public CodeGenLLVM { if (sync == "warp") { // TODO(tqchen) warp sync in CUDA9 return nullptr; - } else if (sync == "shared") { + } else if (sync == "shared" || sync == "shared.dyn") { llvm::Function* f = llvm::Intrinsic::getDeclaration(module_.get(), ::llvm::Intrinsic::nvvm_barrier0); return builder_->CreateCall(f, {});