cornell-zhang / hcl-dialect

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

[Binding][Codegen] Support PowOp #12

Closed chhzh123 closed 2 years ago

chhzh123 commented 2 years ago

Current MLIR has two issues that prevent us from supporting PowOp in a clean way:

  1. The math dialect does not inherently support the power of integers. There is only a math.powf operation. See the discussion here.
  2. The llvm dialect has a powi operation but it does not provide Python binding.
chhzh123 commented 2 years ago

The solution is to cast those input operands from integers to floating points and then cast them back from floating points to integers after the calculation.