[Mlir-commits] [mlir] [mlir][arith] Add more canonicalization and integration tests coverage (PR #92272)

Jacob Yu llvmlistbot at llvm.org
Thu Aug 29 07:14:19 PDT 2024


pingshiyu wrote:

@joker-eph for example, one that I was thinking of was this one: https://github.com/llvm/llvm-project/pull/83248

The bug was from a wrong lowering from arith down to llvm. To prepare the test for this bug, we'd ultimately like a test for the functional "spec" of MLIR (not a full formal spec, which of course don't exist, but rather a small aspect of it. here, it'd be the division behaving correctly on inputs that's at the boundary of int representation), that it contains a desired property we'd like. 

Whilst we could validate that the fold do indeed produce the desired IR, it doesn't seem to me that comparing the produced vs. expected IR is a super clear oracle (i.e. the expected IR being the algorithm implementing the fold using a lower-level IR). In this case I think it is clearer to test the implemented algorithm directly, e.g. by executing it, whether via a constant folder or via the llvm interpreter. Moreover, it also seems to me that there may be many valid lowerings for the same op, and such an IR-comparison oracle would also lead to more overhead during development. 

Overall I think lowerings are where integration tests could provide quite a bit of value!

https://github.com/llvm/llvm-project/pull/92272


More information about the Mlir-commits mailing list