[Mlir-commits] [mlir] 4acf380 - [MLIR] Split out GPU ops library from Transforms

Uday Bondhugula llvmlistbot at llvm.org
Tue Jul 6 22:59:44 PDT 2021


Author: Uday Bondhugula
Date: 2021-07-07T11:26:49+05:30
New Revision: 4acf3807e35805548074b95a93fe441f4dd20fa1

URL: https://github.com/llvm/llvm-project/commit/4acf3807e35805548074b95a93fe441f4dd20fa1
DIFF: https://github.com/llvm/llvm-project/commit/4acf3807e35805548074b95a93fe441f4dd20fa1.diff

LOG: [MLIR] Split out GPU ops library from Transforms

Split out GPU ops library from GPU transforms. This allows libraries to
depend on GPU Ops without needing/building its transforms.

Differential Revision: https://reviews.llvm.org/D105472

Added: 
    

Modified: 
    mlir/lib/CAPI/Dialect/CMakeLists.txt
    mlir/lib/Conversion/GPUCommon/CMakeLists.txt
    mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
    mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
    mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
    mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
    mlir/lib/Conversion/SCFToGPU/CMakeLists.txt
    mlir/lib/Conversion/SPIRVToLLVM/CMakeLists.txt
    mlir/lib/Conversion/VectorToGPU/CMakeLists.txt
    mlir/lib/Dialect/GPU/CMakeLists.txt
    mlir/test/lib/Dialect/GPU/CMakeLists.txt
    mlir/test/lib/Dialect/Linalg/CMakeLists.txt
    mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
    mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt
    mlir/tools/mlir-vulkan-runner/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/lib/CAPI/Dialect/CMakeLists.txt b/mlir/lib/CAPI/Dialect/CMakeLists.txt
index ab8ac73c7c53b..801b0f77a0e78 100644
--- a/mlir/lib/CAPI/Dialect/CMakeLists.txt
+++ b/mlir/lib/CAPI/Dialect/CMakeLists.txt
@@ -23,7 +23,7 @@ add_mlir_public_c_api_library(MLIRCAPIGPU
 
   LINK_LIBS PUBLIC
   MLIRCAPIIR
-  MLIRGPU
+  MLIRGPUTransforms
   MLIRPass
 )
 

diff  --git a/mlir/lib/Conversion/GPUCommon/CMakeLists.txt b/mlir/lib/Conversion/GPUCommon/CMakeLists.txt
index 4cc3bcec5a0c5..71694bf925188 100644
--- a/mlir/lib/Conversion/GPUCommon/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUCommon/CMakeLists.txt
@@ -30,7 +30,7 @@ add_mlir_conversion_library(MLIRGPUToGPURuntimeTransforms
 
   LINK_LIBS PUBLIC
   MLIRAsyncToLLVM
-  MLIRGPU
+  MLIRGPUTransforms
   MLIRIR
   MLIRLLVMIR
   MLIRPass

diff  --git a/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt b/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
index 040b220135180..6abeda7ecdb87 100644
--- a/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
@@ -11,7 +11,7 @@ add_mlir_conversion_library(MLIRGPUToNVVMTransforms
   MLIRGPUToNVVMIncGen
 
   LINK_LIBS PUBLIC
-  MLIRGPU
+  MLIRGPUOps
   MLIRGPUToGPURuntimeTransforms
   MLIRLLVMIR
   MLIRMemRef

diff  --git a/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt b/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
index ad270645648ef..df89509b73080 100644
--- a/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
@@ -10,7 +10,7 @@ add_mlir_conversion_library(MLIRGPUToROCDLTransforms
   MLIRGPUToROCDLIncGen
 
   LINK_LIBS PUBLIC
-  MLIRGPU
+  MLIRGPUOps
   MLIRGPUToGPURuntimeTransforms
   MLIRLLVMIR
   MLIRROCDLIR

diff  --git a/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
index 3dc53c2a845a5..b7b46b6d060c2 100644
--- a/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
@@ -6,7 +6,7 @@ add_mlir_conversion_library(MLIRGPUToSPIRV
   MLIRConversionPassIncGen
 
   LINK_LIBS PUBLIC
-  MLIRGPU
+  MLIRGPUOps
   MLIRIR
   MLIRPass
   MLIRSCFToSPIRV

diff  --git a/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt b/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
index 65733523531ad..c2249ae8333e8 100644
--- a/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
@@ -6,7 +6,7 @@ add_mlir_conversion_library(MLIRGPUToVulkanTransforms
   MLIRConversionPassIncGen
 
   LINK_LIBS PUBLIC
-  MLIRGPU
+  MLIRGPUOps
   MLIRIR
   MLIRLLVMIR
   MLIRPass

diff  --git a/mlir/lib/Conversion/SCFToGPU/CMakeLists.txt b/mlir/lib/Conversion/SCFToGPU/CMakeLists.txt
index 6329161eb4585..3e2387fe7cedf 100644
--- a/mlir/lib/Conversion/SCFToGPU/CMakeLists.txt
+++ b/mlir/lib/Conversion/SCFToGPU/CMakeLists.txt
@@ -12,7 +12,7 @@ add_mlir_conversion_library(MLIRSCFToGPU
   MLIRAffine
   MLIRAffineToStandard
   MLIRComplex
-  MLIRGPU
+  MLIRGPUTransforms
   MLIRIR
   MLIRLinalg
   MLIRMemRef

diff  --git a/mlir/lib/Conversion/SPIRVToLLVM/CMakeLists.txt b/mlir/lib/Conversion/SPIRVToLLVM/CMakeLists.txt
index f57e42cff29e9..9f9f2a9c800dc 100644
--- a/mlir/lib/Conversion/SPIRVToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/SPIRVToLLVM/CMakeLists.txt
@@ -11,7 +11,7 @@ add_mlir_conversion_library(MLIRSPIRVToLLVM
   intrinsics_gen
 
   LINK_LIBS PUBLIC
-  MLIRGPU
+  MLIRGPUOps
   MLIRSPIRV
   MLIRSPIRVUtils
   MLIRLLVMIR

diff  --git a/mlir/lib/Conversion/VectorToGPU/CMakeLists.txt b/mlir/lib/Conversion/VectorToGPU/CMakeLists.txt
index 484ad5451fc00..0e73e31d10b9f 100644
--- a/mlir/lib/Conversion/VectorToGPU/CMakeLists.txt
+++ b/mlir/lib/Conversion/VectorToGPU/CMakeLists.txt
@@ -8,7 +8,7 @@ add_mlir_conversion_library(MLIRVectorToGPU
   Core
 
   LINK_LIBS PUBLIC
-  MLIRGPU
+  MLIRGPUOps
   MLIRLLVMIR
   MLIRMemRef
   MLIRTransforms

diff  --git a/mlir/lib/Dialect/GPU/CMakeLists.txt b/mlir/lib/Dialect/GPU/CMakeLists.txt
index 75be2165c344a..dcb8d69a65c16 100644
--- a/mlir/lib/Dialect/GPU/CMakeLists.txt
+++ b/mlir/lib/Dialect/GPU/CMakeLists.txt
@@ -16,8 +16,25 @@ if (MLIR_ENABLE_ROCM_CONVERSIONS)
   )
 endif()
 
-add_mlir_dialect_library(MLIRGPU
+add_mlir_dialect_library(MLIRGPUOps
   IR/GPUDialect.cpp
+
+  ADDITIONAL_HEADER_DIRS
+  ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/GPU
+
+  DEPENDS
+  MLIRGPUOpsIncGen
+  MLIRGPUOpInterfacesIncGen
+
+  LINK_LIBS PUBLIC
+  MLIRDLTI
+  MLIRIR
+  MLIRMemRef
+  MLIRSideEffectInterfaces
+  MLIRSupport
+  )
+
+add_mlir_dialect_library(MLIRGPUTransforms
   Transforms/AllReduceLowering.cpp
   Transforms/AsyncRegionRewriter.cpp
   Transforms/KernelOutlining.cpp
@@ -37,8 +54,6 @@ add_mlir_dialect_library(MLIRGPU
   ${AMDGPU_LIBS}
 
   DEPENDS
-  MLIRGPUOpsIncGen
-  MLIRGPUOpInterfacesIncGen
   MLIRGPUPassIncGen
   MLIRParallelLoopMapperAttrGen
   MLIRParallelLoopMapperEnumsGen
@@ -46,14 +61,13 @@ add_mlir_dialect_library(MLIRGPU
   LINK_LIBS PUBLIC
   MLIRAsync
   MLIRDataLayoutInterfaces
-  MLIRDLTI
+  MLIRGPUOps
   MLIRIR
-  MLIRMemRef
   MLIRLLVMIR
   MLIRLLVMToLLVMIRTranslation
-  MLIRSCF
+  MLIRMemRef
   MLIRPass
-  MLIRSideEffectInterfaces
+  MLIRSCF
   MLIRStandard
   MLIRSupport
   MLIRTransformUtils
@@ -77,20 +91,20 @@ if(MLIR_ENABLE_CUDA_RUNNER)
   endif()
 
   # Enable gpu-to-cubin pass.
-  target_compile_definitions(obj.MLIRGPU
+  target_compile_definitions(obj.MLIRGPUTransforms
     PRIVATE
     MLIR_GPU_TO_CUBIN_PASS_ENABLE=1
   )
 
   # Add CUDA headers includes and the libcuda.so library.
-  target_include_directories(obj.MLIRGPU
+  target_include_directories(obj.MLIRGPUTransforms
     PRIVATE
     ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
   )
 
   find_library(CUDA_DRIVER_LIBRARY cuda)
 
-  target_link_libraries(MLIRGPU
+  target_link_libraries(MLIRGPUTransforms
     PRIVATE
     MLIRNVVMToLLVMIRTranslation
     ${CUDA_DRIVER_LIBRARY}
@@ -126,21 +140,21 @@ if(MLIR_ENABLE_ROCM_RUNNER)
     message(STATUS "ROCm HIP version: ${HIP_VERSION}")
   endif()
 
-  target_compile_definitions(obj.MLIRGPU
+  target_compile_definitions(obj.MLIRGPUOps
     PRIVATE
     __HIP_PLATFORM_HCC__
     __ROCM_PATH__="${ROCM_PATH}"
     MLIR_GPU_TO_HSACO_PASS_ENABLE=1
   )
 
-  target_include_directories(obj.MLIRGPU
+  target_include_directories(obj.MLIRGPUOps
     PRIVATE
     ${MLIR_SOURCE_DIR}/../lld/include
     ${HIP_PATH}/include
     ${ROCM_PATH}/include
   )
 
-  target_link_libraries(MLIRGPU
+  target_link_libraries(MLIRGPUOps
     PRIVATE
     lldELF
     MLIRROCDLToLLVMIRTranslation

diff  --git a/mlir/test/lib/Dialect/GPU/CMakeLists.txt b/mlir/test/lib/Dialect/GPU/CMakeLists.txt
index 6a79e2f443345..a3cf36b028407 100644
--- a/mlir/test/lib/Dialect/GPU/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/GPU/CMakeLists.txt
@@ -10,7 +10,7 @@ add_mlir_library(MLIRGPUTestPasses
 
   LINK_LIBS PUBLIC
   MLIRAffine
-  MLIRGPU
+  MLIRGPUOps
   MLIRGPUToGPURuntimeTransforms
   MLIRLLVMToLLVMIRTranslation
   MLIRNVVMIR

diff  --git a/mlir/test/lib/Dialect/Linalg/CMakeLists.txt b/mlir/test/lib/Dialect/Linalg/CMakeLists.txt
index b66ba26a8a844..6bd45c8aedde2 100644
--- a/mlir/test/lib/Dialect/Linalg/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/Linalg/CMakeLists.txt
@@ -12,7 +12,7 @@ add_mlir_library(MLIRLinalgTestPasses
 
   LINK_LIBS PUBLIC
   MLIRAffine
-  MLIRGPU
+  MLIRGPUTransforms
   MLIRLinalg
   MLIRLinalgTransforms
   MLIRLLVMToLLVMIRTranslation

diff  --git a/mlir/test/lib/Dialect/SPIRV/CMakeLists.txt b/mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
index 856e5eb7f40da..2348ecd8f9873 100644
--- a/mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
@@ -12,7 +12,7 @@ add_mlir_library(MLIRSPIRVTestPasses
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
 
   LINK_LIBS PUBLIC
-  MLIRGPU
+  MLIRGPUOps
   MLIRIR
   MLIRPass
   MLIRSPIRV

diff  --git a/mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt b/mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt
index 1e81456412882..99d0fc80f9a6a 100644
--- a/mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt
@@ -17,7 +17,7 @@ if (MLIR_SPIRV_CPU_RUNNER_ENABLED)
     ${conversion_libs}
     MLIRAnalysis
     MLIRExecutionEngine
-    MLIRGPU
+    MLIRGPUOps
     MLIRIR
     MLIRJitRunner
     MLIRLLVMIR

diff  --git a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
index 58cfdbea85fcb..6f94756346daa 100644
--- a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
@@ -57,7 +57,7 @@ if (MLIR_ENABLE_VULKAN_RUNNER)
     ${conversion_libs}
     MLIRAnalysis
     MLIRExecutionEngine
-    MLIRGPU
+    MLIRGPUOps
     MLIRIR
     MLIRJitRunner
     MLIRLLVMIR


        


More information about the Mlir-commits mailing list