[Mlir-commits] [mlir] 5248047 - MLIR: add SinOp Lowering to __ocml_sin_f32 and __ocml_sin_f64

Adrian Kuegel llvmlistbot at llvm.org
Wed Nov 11 05:39:47 PST 2020


Author: Adrian Kuegel
Date: 2020-11-11T14:38:23+01:00
New Revision: 5248047c939627902bfcdf3d1f6bf1d8716e1483

URL: https://github.com/llvm/llvm-project/commit/5248047c939627902bfcdf3d1f6bf1d8716e1483
DIFF: https://github.com/llvm/llvm-project/commit/5248047c939627902bfcdf3d1f6bf1d8716e1483.diff

LOG: MLIR: add SinOp Lowering to __ocml_sin_f32 and __ocml_sin_f64

This mimics the recent similar patch for GPUToNVVM.

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

Added: 
    

Modified: 
    mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
index 489891e06fcb..c321d8e3badb 100644
--- a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
+++ b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
@@ -72,7 +72,7 @@ struct LowerGpuOpsToROCDLOpsPass
     target.addIllegalDialect<gpu::GPUDialect>();
     target.addIllegalOp<LLVM::CosOp, LLVM::ExpOp, LLVM::FAbsOp, LLVM::FCeilOp,
                         LLVM::FFloorOp, LLVM::LogOp, LLVM::Log10Op,
-                        LLVM::Log2Op>();
+                        LLVM::Log2Op, LLVM::SinOp, LLVM::TanhOp>();
     target.addIllegalOp<FuncOp>();
     target.addLegalDialect<ROCDL::ROCDLDialect>();
     // TODO: Remove once we support replacing non-root ops.
@@ -113,6 +113,8 @@ void mlir::populateGpuToROCDLConversionPatterns(
                                                  "__ocml_log10_f64");
   patterns.insert<OpToFuncCallLowering<Log2Op>>(converter, "__ocml_log2_f32",
                                                 "__ocml_log2_f64");
+  patterns.insert<OpToFuncCallLowering<SinOp>>(converter, "__ocml_sin_f32",
+                                               "__ocml_sin_f64");
   patterns.insert<OpToFuncCallLowering<TanhOp>>(converter, "__ocml_tanh_f32",
                                                 "__ocml_tanh_f64");
 }


        


More information about the Mlir-commits mailing list