https://github.com/halide/Halide
Revision b87238a8666b61d53ba062eab25d677587fcd247 authored by Andrew Adams on 22 March 2020, 22:15:15 UTC, committed by Andrew Adams on 22 March 2020, 22:15:15 UTC
TL;DR: This is an improvement from #3037 / #4713 that can be tested and
checked in independently. It removes one type of magic name usage.

Allocation bounds inference (well, boxes_touched) relies on magic names
in its handling of getting the min/max out of a bounds query result. It
just lifts them out of their containing scope (see the deleted code in
Bounds.cpp below), assuming a bounds query buffer of the same name also
exists in the containing scope, and also assuming that the result of
that outer bounds query was a valid interval containing the result of
the inner bounds query. Yuck. I removed that special handling from
boxes_touched, and instead explicitly clamped the inner bounds query
result to be within the outer region required, which comes from the
outer bounds query. That gives boxes_touched a way to bound the impure
call with something.

So now if we have a misbehaving extern stage, which lies in its outer
bounds query and says it's going to ask for less than it does in the
inner bounds query, it simply doesn't get what it asks for in the inner
bounds query. It gets the intersection of the outer bounds query result
and the inner bounds query result. Too bad. This behavior is illustrated
in the new test. Formerly I'm not sure what happened, because we were
just assuming that it couldn't occur. I guess that's UB. One of the
tests in storage_folding actually broke this rule, but it didn't matter
before because it never actually accessed the input.

Storage folding needed adjusting because it incorrectly didn't even try
to fold now that the bound seems to be pure (it's a .outer_min Variable,
whereas before it was the get_min call referencing the outer bounds
query result).
1 parent d397e34
History
Tip revision: b87238a8666b61d53ba062eab25d677587fcd247 authored by Andrew Adams on 22 March 2020, 22:15:15 UTC
Instead of just assuming bounds query results can be lifted, enforce nesting
Tip revision: b87238a
File Mode Size
.github
apps
cmake
python_bindings
src
test
tools
tutorial
util
.clang-format -rw-r--r-- 1.5 KB
.clang-format-ignore -rw-r--r-- 265 bytes
.clang-tidy -rw-r--r-- 452 bytes
.gitattributes -rw-r--r-- 342 bytes
.gitignore -rw-r--r-- 1.0 KB
.gitmodules -rw-r--r-- 0 bytes
.travis.yml -rw-r--r-- 1.7 KB
CMakeLists.txt -rw-r--r-- 17.4 KB
CODE_OF_CONDUCT.md -rw-r--r-- 3.4 KB
Doxyfile -rw-r--r-- 103.6 KB
Doxyfile.in -rw-r--r-- 64.3 KB
LICENSE.txt -rw-r--r-- 3.2 KB
Makefile -rw-r--r-- 95.1 KB
README.md -rw-r--r-- 15.8 KB
README_cmake.md -rw-r--r-- 9.9 KB
README_rungen.md -rw-r--r-- 12.1 KB
README_webassembly.md -rw-r--r-- 10.5 KB
halide.cmake -rw-r--r-- 30.1 KB

README.md

back to top