wrongtest commented on code in PR #11287:
URL: https://github.com/apache/tvm/pull/11287#discussion_r881451562
##########
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:
I agree! This is where we should be careful. In `CheckMapping` with
surjective mode when padding exists, we check `padded // LCM` and `padded %
LCM`(or it's sub-splits) must not both exists. The case below depict this check:
```python
sum = 80 + y
dom_map = var_dom([(y, 176)])
# (80 + y) // 32 itself could be surjective
assert_iter_sum_pattern(
{fld(sum, 32): (6, 2, 1)},
dom_map,
)
# (80 + y) % 2, ((80 + y) // 2) % 16) could be surjective,
# since they can be seen as sub-splits of (80 + y) % 32
assert_iter_sum_pattern(
{flm(fld(sum, 2), 16): (16, 0, 1), flm(sum, 2): (2, 0, 1)},
dom_map,
)
# but (80 + y) // 32, (80 + y) % 32 are not surjective
assert_iter_sum_failure({fld(sum, 32), flm(sum, 32)}, dom_map)
```
Other kinds of negatives like `(80 + y) // 32, (80 + y) // 4` would be
banned by existing checking rule.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]