diff options
author | 2021-04-12 09:52:45 +0000 | |
---|---|---|
committer | 2021-04-12 09:52:45 +0000 | |
commit | 350cb28bdb7455d9846128aad09051606b81d4c9 (patch) | |
tree | 84f9a8d91eb24338e23d369b03bbb1e0f3055fe7 | |
parent | [AMDGPU] Save VGPR of whole wave when spilling (diff) | |
parent | 不知道为啥在最新的master分支上删掉了一个必要的函数,... (diff) | |
download | llvm-project-dev-newmaster.tar.gz llvm-project-dev-newmaster.tar.bz2 llvm-project-dev-newmaster.zip |
Merge branch 'dev-newmaster' of http://crdev2.corerain.com/software/llvm-project into dev-newmasterdev-newmaster
-rw-r--r-- | mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h | 3 | ||||
-rw-r--r-- | mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h b/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h index 708a3fe0b23e..42d06f301ad5 100644 --- a/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h +++ b/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h @@ -52,6 +52,9 @@ using LoweringCallback = std::function<std::unique_ptr<llvm::Module>( /// typed ABI on top of GPU runtimes such as CUDA or ROCm (HIP). std::unique_ptr<OperationPass<ModuleOp>> createGpuToLLVMConversionPass(); +void populateGpuToLLVMConversionPatterns(LLVMTypeConverter &converter, + OwningRewritePatternList &patterns); + } // namespace mlir #endif // MLIR_CONVERSION_GPUCOMMON_GPUCOMMONPASS_H_ diff --git a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp index 60a47a9d7bef..67921aec9b47 100644 --- a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp +++ b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp @@ -798,3 +798,22 @@ std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>> mlir::createGpuToLLVMConversionPass() { return std::make_unique<GpuToLLVMConversionPass>(); } + +void mlir::populateGpuToLLVMConversionPatterns( + LLVMTypeConverter &converter, OwningRewritePatternList &patterns) { + auto gpuBinaryAnnotation = gpu::getDefaultGpuBinaryAnnotation(); + converter.addConversion( + [context = &converter.getContext()](gpu::AsyncTokenType type) -> Type { + return LLVM::LLVMPointerType::get(IntegerType::get(context, 8)); + }); + patterns.add<ConvertAllocOpToGpuRuntimeCallPattern, + ConvertDeallocOpToGpuRuntimeCallPattern, + ConvertHostRegisterOpToGpuRuntimeCallPattern, + ConvertMemcpyOpToGpuRuntimeCallPattern, + ConvertWaitAsyncOpToGpuRuntimeCallPattern, + ConvertWaitOpToGpuRuntimeCallPattern, + ConvertAsyncYieldToGpuRuntimeCallPattern>(converter); + patterns.add<ConvertLaunchFuncOpToGpuRuntimeCallPattern>(converter, + gpuBinaryAnnotation); + patterns.add<EraseGpuModuleOpPattern>(&converter.getContext()); +} |