[llvm-branch-commits] [mlir] 294e254 - Add log1p lowering from standard to NVVM intrinsics

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


Author: Frederik Gossen
Date: 2021-01-21T14:00:38+01:00
New Revision: 294e2544c992de82c180c080f6359db8f02005d0

URL: https://github.com/llvm/llvm-project/commit/294e2544c992de82c180c080f6359db8f02005d0
DIFF: https://github.com/llvm/llvm-project/commit/294e2544c992de82c180c080f6359db8f02005d0.diff

LOG: Add log1p lowering from standard to NVVM intrinsics

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

Added: 
    

Modified: 
    mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
    mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
index a968f9289dac..f99b7cace502 100644
--- a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
+++ b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
@@ -187,6 +187,8 @@ void mlir::populateGpuToNVVMConversionPatterns(
                                                   "__nv_floor");
   patterns.insert<OpToFuncCallLowering<LogOp>>(converter, "__nv_logf",
                                                "__nv_log");
+  patterns.insert<OpToFuncCallLowering<Log1pOp>>(converter, "__nv_log1pf",
+                                                 "__nv_log1p");
   patterns.insert<OpToFuncCallLowering<Log10Op>>(converter, "__nv_log10f",
                                                  "__nv_log10");
   patterns.insert<OpToFuncCallLowering<Log2Op>>(converter, "__nv_log2f",

diff  --git a/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir b/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
index e740aabaee99..f48ee0e3f5e4 100644
--- a/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
+++ b/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
@@ -246,6 +246,21 @@ gpu.module @test_module {
 
 // -----
 
+gpu.module @test_module {
+  // CHECK: llvm.func @__nv_log1pf(f32) -> f32
+  // CHECK: llvm.func @__nv_log1p(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 @__nv_log1pf(%{{.*}}) : (f32) -> f32
+    %result64 = std.log1p %arg_f64 : f64
+    // CHECK: llvm.call @__nv_log1p(%{{.*}}) : (f64) -> f64
+    std.return %result32, %result64 : f32, f64
+  }
+}
+
+// -----
+
 gpu.module @test_module {
   // CHECK: llvm.func @__nv_log2f(f32) -> f32
   // CHECK: llvm.func @__nv_log2(f64) -> f64


        


More information about the llvm-branch-commits mailing list