tensorflow/mlir-hlo

mhlo.xor folding bug when lhs == rhs

benvanik opened this issue · 2 comments

(cc @rsuderman)

Looks like the way the 0 value is being created here is wrong:

https://github.com/tensorflow/tensorflow/blob/02f317584da257aafd262e3c1488b96b7722246e/tensorflow/compiler/mlir/hlo/lib/Dialect/mhlo/IR/hlo_ops.cc#L1363-L1366

Repro:

    func @bools_rgn_dispatch_0(%arg0: tensor<4xi1>) -> tensor<4xi1> {
      %0 = mhlo.xor %arg0, %arg0: tensor<4xi1>
      return %0 : tensor<4xi1>
    }

Results in this assert:

Assertion failed: ::isValidIntOrFloat(type.getElementType(), dataEltSize, isInt, isSigned), file D:\Dev\iree\third_party\llvm-project\mlir\lib\IR\Attributes.cpp, line 1114

Should be using builder.getZeroAttr(rType) instead.

Fixed shortly after bug logged. Closing due to fix over a year ago.

@burmako close please.