[mlir][Python] Add checking process before create an AffineMap from a permutation.
authorzhanghb97 <hongbin2019@iscas.ac.cn>
Tue, 12 Jan 2021 13:40:27 +0000 (21:40 +0800)
committerzhanghb97 <hongbin2019@iscas.ac.cn>
Wed, 13 Jan 2021 01:32:32 +0000 (09:32 +0800)
commitc0f3ea8a08ca9a9ec473f6e9072ccf30dad5def8
tree8df91d8ab5471fc0942b9d1720c759f77dc14a2a
parent25b3921f2fcd8fb3241c2f79e488f25a6374b99f
[mlir][Python] Add checking process before create an AffineMap from a permutation.

An invalid permutation will trigger a C++ assertion when attempting to create an AffineMap from the permutation.
This patch adds an `isPermutation` function to check the given permutation before creating the AffineMap.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D94492
mlir/lib/Bindings/Python/IRModules.cpp
mlir/test/Bindings/Python/ir_affine_map.py