https://github.com/halide/Halide
Revision 63cfd9daa3d3da08ef4bfbd42040faf8fda389fa authored by Andrew Adams on 12 October 2021, 20:52:24 UTC, committed by GitHub on 12 October 2021, 20:52:24 UTC
* Look through lets in find_intrinsics

If an Expr like: narrow((widen(x) + y + 1)/2) gets lifted into a let,
the simplifier will then substitute things in like so: let foo =
widen(x) + y in narrow(foo + 1)/2, potentially breaking a pattern. This
is a general problem for patterns that widen, do some math, and then
narrow.

They will always get cut at the widening operation, so this PR just
substitutes in all widening operations. This can't cause combinatorial
blow-up, because each substitution has a wider type than the values that
it depends on, so the chains can be at most 2-3 lets deep.

* Make substituting in widening lets a prepass instead

* Move find_intrinsics a little earlier in lowering

* Handle impure subexpressions

by leaving them behind at the original let site

* FindIntrinsics must be after the last simplification pass
1 parent a351021
Raw File
Tip revision: 63cfd9daa3d3da08ef4bfbd42040faf8fda389fa authored by Andrew Adams on 12 October 2021, 20:52:24 UTC
Substitute in all widening lets prior to find_intrinsics (#6307)
Tip revision: 63cfd9d
.gitattributes
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.cpp text
*.c text
*.h text

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.tiff binary
back to top