[Mlir-commits] [mlir] [mlir] allow inlining complex ops (PR #77514)
Kai Sasaki
llvmlistbot at llvm.org
Tue Jan 9 18:37:34 PST 2024
================
@@ -28,6 +41,7 @@ void complex::ComplexDialect::initialize() {
#include "mlir/Dialect/Complex/IR/ComplexAttributes.cpp.inc"
>();
declarePromisedInterface<ComplexDialect, ConvertToLLVMPatternInterface>();
+ addInterfaces<ComplexInlinerInterface>();
----------------
Lewuathe wrote:
Could you add the test case checking the inlining correctly for complex dialects?
It looks like something like this test can cover the inlining.
```mlir
// RUN: mlir-opt -allow-unregistered-dialect %s -inline="default-pipeline=''" | FileCheck %s
// Basic test that functions within affine operations are inlined.
func.func @double_complex(%cplx: complex<f32>) -> complex<f32> {
%double = complex.add %cplx, %cplx : complex<f32>
return %double : complex<f32>
}
// CHECK-LABEL: func @inline_with_complex_ops
func.func @inline_with_complex_ops() -> complex<f32> {
%c1 = arith.constant 1.0 : f32
%c2 = arith.constant 2.0 : f32
%c = complex.create %c1, %c2 : complex<f32>
// CHECK: complex.add
// CHECK-NOT: call
%r = call @double_complex(%c) : (complex<f32>) -> (complex<f32>)
return %r : complex<f32>
}
```
https://github.com/llvm/llvm-project/pull/77514
More information about the Mlir-commits
mailing list