cornell-zhang / hcl-dialect

HeteroCL-MLIR dialect for accelerator design
https://cornell-zhang.github.io/heterocl/index.html
Other
37 stars 15 forks source link

[BUG] updateCallOp: result type is not memref #193

Closed chhzh123 closed 1 year ago

chhzh123 commented 1 year ago

When the following function goes through the lower_fixed_to_int pass, it will raise an error:

loc("-":17:12): error: updateCallOp: result type is not memref

It seems there are some problems in the function interface testing, although there are no fixed points in this function.

module {
  func.func @foo(%arg0: i32) -> i32 attributes {itypes = "s", otypes = "s"} {
    %0 = arith.extsi %arg0 : i32 to i33
    %c1_i32 = arith.constant 1 : i32
    %1 = arith.extsi %c1_i32 : i32 to i33
    %2 = arith.addi %0, %1 : i33
    %3 = arith.trunci %2 : i33 to i32
    return %3 : i32
  }
  func.func @kernel(%arg0: memref<10xi32>) -> memref<10xi32> attributes {itypes = "s", otypes = "s"} {
    %alloc = memref.alloc() {name = "B"} : memref<10xi32>
    %c0_i32 = arith.constant 0 : i32
    linalg.fill ins(%c0_i32 : i32) outs(%alloc : memref<10xi32>)
    affine.for %arg1 = 0 to 10 {
      %0 = affine.load %arg0[%arg1] {from = "A"} : memref<10xi32>
      %1 = func.call @foo(%0) : (i32) -> i32
      affine.store %1, %alloc[%arg1] {to = "B"} : memref<10xi32>
    } {loop_name = "i", op_name = "S_i_0"}
    return %alloc : memref<10xi32>
  }
}