Halide icon indicating copy to clipboard operation
Halide copied to clipboard

[HVX] InjectHexagonRpc breaks CSE

Open rootjalex opened this issue 3 years ago • 0 comments

The InjectHexagonRpc mutator inserts Let nodes that label Load names instead of Variable names, specifically in the definition of state_var(). This breaks let substitutions (i.e. RemoveLets() in CSE.cpp), as Let is defined to only relate to Variable nodes: https://github.com/halide/Halide/blob/b9a33561d38a4a59b9d4c08eb09253892b418a38/src/IR.h#L259-#L262

There are two solutions that I see:

  • Allow Let nodes to label any name (i.e. load names). This makes substitution messier though, because you can't substitute Let values into Loads.
  • InjectHexagonRpc should create state_vars in some other way - is there another way to represent pointer dereference?

This bug was discovered via #6884, which called CSE quite late in lowering.

rootjalex avatar Jul 28 '22 17:07 rootjalex