Reorder image and param checks - #9337
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9337 +/- ##
==========================================
- Coverage 69.96% 69.80% -0.16%
==========================================
Files 258 258
Lines 78338 78349 +11
Branches 19066 19068 +2
==========================================
- Hits 54806 54694 -112
- Misses 17844 17846 +2
- Partials 5688 5809 +121 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…fixed here. Move image checks below the user-defined requirements.
…ifier was simplifying it down to "false".
36d375d to
608d23c
Compare
|
I don't think it's actually safe to assume the requirements outside the scope at which we know it's not a bounds query. When you're doing a bounds query you may pass buffers that do not obey requirements yet, and you expect the pipeline to, e.g. round up the stride of a buffer to satisfy the requirement and return it. set_stride(stride()/16*16) is not just a constraint. it's a recipe for how to make a buffer conform. This is why it's in the form of an assignment. If that expression is simplified by a requirement it's going to make Halide return a buffer that fails to obey the contraints. This is probably what's happening in the onnx test. |
|
So, |
|
@abadams Do you think it's acceptable to execute the reordering (as in this PR) if bounds queries are disabled? It cleans up the asserts preamble massively if you have a few add_requirements(). |
|
The issue is that the add_requirement is strictly weaker. If you have code that uses that version, the minute you need a bounds query for some reason you need to change it to the other form anyway. There should be one way to do it. If the other form is ugly, maybe we need a method specifically to say "this extent/stride/min of this input/output buffer is aligned" |
Adding in a regression test that should have been part of #9333, revealed another issue with the alignment propagation.
When going the
add_requirement()route, those asserts ended up below the ImageChecks asserts. So bounds inference (and thus none of those asserts) were aware of any of the user-specified preconditions.I fixed this by peeling off the existing asserts before placing the injection markers.
Drive-by fix to have the generated string for a failed
add_requirements()to actually print the condition, instead of the to-false-simplified failed condition expression.Fixes #9328 again.
Breaking changes
Not really breaking: but the only test that broke was the one checking error codes under certain artificially constructed scenarios. Because the asserts are reordered, a few of those artificially constructed error scenarios were now failing on a reordered assert that in the original test came later.
Checklist