[PATCH] D74592: Do not build the CUBIN conversion pass when NVPTX Backend isn't configured
Mehdi Amini via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 14 01:36:41 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG850cb135a3b8: Do not build the CUBIN conversion pass when NVPTX Backend isn't configured (authored by joker-eph-DISABLED).
Changed prior to commit:
https://reviews.llvm.org/D74592?vs=244585&id=244587#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74592/new/
https://reviews.llvm.org/D74592
Files:
mlir/CMakeLists.txt
mlir/include/mlir/InitAllPasses.h
mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp
Index: mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp
===================================================================
--- mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp
+++ mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp
@@ -57,9 +57,10 @@
gpu::GPUModuleOp module = getOperation();
// Make sure the NVPTX target is initialized.
- llvm::InitializeAllTargets();
- llvm::InitializeAllTargetMCs();
- llvm::InitializeAllAsmPrinters();
+ LLVMInitializeNVPTXTarget();
+ LLVMInitializeNVPTXTargetInfo();
+ LLVMInitializeNVPTXTargetMC();
+ LLVMInitializeNVPTXAsmPrinter();
auto llvmModule = translateModuleToNVVMIR(module);
if (!llvmModule)
Index: mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
===================================================================
--- mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
+++ mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
@@ -1,7 +1,16 @@
-add_llvm_library(MLIRGPUtoCUDATransforms
+set(LLVM_OPTIONAL_SOURCES
ConvertKernelFuncToCubin.cpp
+)
+
+set(SOURCES
ConvertLaunchFuncToCudaCalls.cpp
)
+
+if (MLIR_CUDA_CONVERSIONS_ENABLED)
+ list(APPEND SOURCES "ConvertKernelFuncToCubin.cpp")
+endif()
+
+add_llvm_library(MLIRGPUtoCUDATransforms ${SOURCES})
target_link_libraries(MLIRGPUtoCUDATransforms
MLIRGPU
MLIRLLVMIR
Index: mlir/include/mlir/InitAllPasses.h
===================================================================
--- mlir/include/mlir/InitAllPasses.h
+++ mlir/include/mlir/InitAllPasses.h
@@ -90,8 +90,10 @@
// CUDA
createConvertGpuLaunchFuncToCudaCallsPass();
+#if MLIR_CUDA_CONVERSIONS_ENABLED
createConvertGPUKernelToCubinPass(
[](const std::string &, Location, StringRef) { return nullptr; });
+#endif
createLowerGpuOpsToNVVMOpsPass();
// Linalg
Index: mlir/CMakeLists.txt
===================================================================
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -44,6 +44,8 @@
else()
set(MLIR_CUDA_CONVERSIONS_ENABLED 0)
endif()
+# TODO: we should use a config.h file like LLVM does
+add_definitions(-DMLIR_CUDA_CONVERSIONS_ENABLED=${MLIR_CUDA_CONVERSIONS_ENABLED})
set(MLIR_CUDA_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir CUDA runner")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74592.244587.patch
Type: text/x-patch
Size: 2252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200214/03bebb33/attachment.bin>
More information about the llvm-commits
mailing list