Lunderberg commented on code in PR #11287: URL: https://github.com/apache/tvm/pull/11287#discussion_r880594835
########## src/arith/iter_affine_map.cc: ########## @@ -1062,58 +1099,59 @@ PaddedIterMapResult DetectPaddedIterMap(const Array<PrimExpr>& indices, [](const IterConstraint& a, const IterConstraint& b) { return a.expr_size < b.expr_size; }); IterMapRewriter rewriter(analyzer, constrained_input_iters, simplify_trivial_iterators, - &result.errors); + &result->errors); // Step0.0: rewrite constraints in the order from size-small ones to size-big ones for (const IterConstraint& constraint : constraints) { auto res = rewriter.RewriteIterConstraint(constraint.iter, constraint.lower_bound, constraint.upper_bound); - if (result.errors.size()) { - return result; + if (result->errors.size()) { + return result_obj; } } if (!rewriter.CheckConstraints()) { - result.errors.push_back("Invalid constraints."); - return result; + result->errors.push_back("Invalid constraints."); + return result_obj; } // Step0.1: Check each index to determine required padding - bool allow_padding = !require_bijective; + bool allow_padding = check_level != IterMapLevel::Bijective; Review Comment: Good point, and that does maintain surjectivity for a single index. I'm not entirely sure for the case of two indices, though. For the same `x ∈ [0,8)`, the indices `[(x+7)//8, (x+7)%8]` would have the same padding `left_pad=7` and `right_pad=1`. Even though each individual index can take any value in the output (`(x+7)//8 ∈[0,2)` and `(x+7)%8 ∈ [0,8)`), there are some coordinate pairs that cannot be generated for any value of `x` (e.g. `[0,0]` and `[1,7]`). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org