[mlir][gpu] Refactor ConvertGpuLaunchFuncToCudaCalls pass.
authorWen-Heng (Jack) Chung <whchung@gmail.com>
Mon, 18 May 2020 18:01:54 +0000 (13:01 -0500)
committerWen-Heng (Jack) Chung <whchung@gmail.com>
Thu, 21 May 2020 13:53:47 +0000 (08:53 -0500)
commit2cbbc266ec1e489175ee988794c3880075c13d00
tree3eaf68c24f995e993efbf5a872a64ce38be17437
parent1c8f999e0b59731a4214f76528f83e4196e1fcc3
[mlir][gpu] Refactor ConvertGpuLaunchFuncToCudaCalls pass.

Due to similar APIs between CUDA and ROCm (HIP),
ConvertGpuLaunchFuncToCudaCalls pass could be used on both platforms with some
refactoring.

In this commit:

- Migrate ConvertLaunchFuncToCudaCalls from GPUToCUDA to GPUCommon, and rename.
- Rename runtime wrapper APIs be platform-neutral.
- Let GPU binary annotation attribute be specifiable as a PassOption.
- Naming changes within the implementation and tests.

Subsequent patches would introduce ROCm-specific tests and runtime wrapper
APIs.

Differential Revision: https://reviews.llvm.org/D80167
mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h [new file with mode: 0644]
mlir/include/mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h
mlir/include/mlir/Conversion/Passes.td
mlir/include/mlir/InitAllPasses.h
mlir/lib/Conversion/CMakeLists.txt
mlir/lib/Conversion/GPUCommon/CMakeLists.txt [new file with mode: 0644]
mlir/lib/Conversion/GPUCommon/ConvertLaunchFuncToRuntimeCalls.cpp [moved from mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp with 68% similarity]
mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
mlir/test/Conversion/GPUCommon/lower-launch-func-to-gpu-runtime-calls.mlir [moved from mlir/test/Conversion/GPUToCUDA/lower-launch-func-to-cuda.mlir with 57% similarity]
mlir/tools/mlir-cuda-runner/cuda-runtime-wrappers.cpp
mlir/tools/mlir-cuda-runner/mlir-cuda-runner.cpp