[MLIR][ROCDL] add gpu to rocdl erf support

This commit adds lowering of lib func
call to support erf in rocdl.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D150355
This commit is contained in:
Manupa Karunaratne
2023-05-15 14:41:49 +00:00
committed by Krzysztof Drewniak
parent 1365ff74cb
commit 8c3a8d17c8
2 changed files with 17 additions and 0 deletions

View File

@@ -280,6 +280,8 @@ void mlir::populateGpuToROCDLConversionPatterns(
"__ocml_tanh_f64");
populateOpPatterns<math::TanOp>(converter, patterns, "__ocml_tan_f32",
"__ocml_tan_f64");
populateOpPatterns<math::ErfOp>(converter, patterns, "__ocml_erf_f32",
"__ocml_erf_f64");
}
std::unique_ptr<OperationPass<gpu::GPUModuleOp>>

View File

@@ -437,6 +437,21 @@ gpu.module @test_module {
// -----
gpu.module @test_module {
// CHECK: llvm.func @__ocml_erf_f32(f32) -> f32
// CHECK: llvm.func @__ocml_erf_f64(f64) -> f64
// CHECK-LABEL: func @gpu_erf
func.func @gpu_erf(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) {
%result32 = math.erf %arg_f32 : f32
// CHECK: llvm.call @__ocml_erf_f32(%{{.*}}) : (f32) -> f32
%result64 = math.erf %arg_f64 : f64
// CHECK: llvm.call @__ocml_erf_f64(%{{.*}}) : (f64) -> f64
func.return %result32, %result64 : f32, f64
}
}
// -----
gpu.module @test_module {
// CHECK-LABEL: func @gpu_unroll
func.func @gpu_unroll(%arg0 : vector<4xf32>) -> vector<4xf32> {