[llvm-branch-commits] [mlir] 4ef38f9 - Add log1p lowering from standard to ROCDL intrinsics

Frederik Gossen via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 21 05:07:16 PST 2021


Author: Frederik Gossen
Date: 2021-01-21T14:02:48+01:00
New Revision: 4ef38f9c1255dcaa3f834cf376e55f8a7bdc5810

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

LOG: Add log1p lowering from standard to ROCDL intrinsics

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

Added: 
    

Modified: 
    mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
    mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
index e87ca62c9b81..7aa8e6021650 100644
--- a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
+++ b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
@@ -121,6 +121,8 @@ void mlir::populateGpuToROCDLConversionPatterns(
                                                "__ocml_log_f64");
   patterns.insert<OpToFuncCallLowering<Log10Op>>(converter, "__ocml_log10_f32",
                                                  "__ocml_log10_f64");
+  patterns.insert<OpToFuncCallLowering<Log1pOp>>(converter, "__ocml_log1p_f32",
+                                                 "__ocml_log1p_f64");
   patterns.insert<OpToFuncCallLowering<Log2Op>>(converter, "__ocml_log2_f32",
                                                 "__ocml_log2_f64");
   patterns.insert<OpToFuncCallLowering<PowFOp>>(converter, "__ocml_pow_f32",

diff  --git a/mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir b/mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir
index b3613503531d..38d75883f2f9 100644
--- a/mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir
+++ b/mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir
@@ -198,6 +198,21 @@ gpu.module @test_module {
 
 // -----
 
+gpu.module @test_module {
+  // CHECK: llvm.func @__ocml_log1p_f32(f32) -> f32
+  // CHECK: llvm.func @__ocml_log1p_f64(f64) -> f64
+  // CHECK-LABEL: func @gpu_log1p
+  func @gpu_log1p(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) {
+    %result32 = std.log1p %arg_f32 : f32
+    // CHECK: llvm.call @__ocml_log1p_f32(%{{.*}}) : (f32) -> f32
+    %result64 = std.log1p %arg_f64 : f64
+    // CHECK: llvm.call @__ocml_log1p_f64(%{{.*}}) : (f64) -> f64
+    std.return %result32, %result64 : f32, f64
+  }
+}
+
+// -----
+
 gpu.module @test_module {
   // CHECK: llvm.func @__ocml_log10_f32(f32) -> f32
   // CHECK: llvm.func @__ocml_log10_f64(f64) -> f64


        


More information about the llvm-branch-commits mailing list