[Mlir-commits] [mlir] [mlir][affine] Modify assertion into a user visible diagnostic (PR #136474)
Prakhar Dixit
llvmlistbot at llvm.org
Sun Apr 20 07:03:51 PDT 2025
================
@@ -141,8 +141,14 @@ static AffineMap makePermutationMap(
unsigned countInvariantIndices = 0;
for (unsigned dim = 0; dim < numIndices; ++dim) {
if (!invariants.count(indices[dim])) {
- assert(perm[kvp.second] == getAffineConstantExpr(0, context) &&
- "permutationMap already has an entry along dim");
+ if (perm[kvp.second] != getAffineConstantExpr(0, context)) {
+ auto loopOp = cast<affine::AffineForOp>(kvp.first);
+ loopOp->emitError(
+ "loop induction variable is used in multiple indices, which is "
+ "unsupported for vectorization. Consider using nested loops "
+ "instead of a single loop with affine.apply.");
----------------
Prakhar-Dixit wrote:
I guess I may be a bit off in my approach. I just want to know the ideal way of emitting a user-visible diagnostic and also not performing the transformation at the same time?
Since this is the main idea behind this PR.
https://github.com/llvm/llvm-project/pull/136474
More information about the Mlir-commits
mailing list