numba / numba-rvsdg

Numba compatible RVSDG (Regionalized Value State Dependence Graph) utilities.
https://numba-rvsdg.readthedocs.io/
BSD 2-Clause "Simplified" License
18 stars 7 forks source link

`find_headers_and_entries` in nested region cannot find entries #62

Open sklam opened 1 year ago

sklam commented 1 year ago

Reproducer and SCFG rendering in https://gist.github.com/sklam/f43f7c4eb574a79eaca9d5b4d27ef6ba

When calling find_headers_and_entries in a header loop region that's inside a branch region, it fails to find the entry node.

The usecase is to insert a new block as the new header for the loop.

kc611 commented 1 year ago

I've put in a patch commit in #61 that 'fixes' this. (Finds entries outside of the region using regional hierarchy information).

Note that #61 changes a lot of things, and the equivalent of your insertion case would simply be reduced to adding a new header to the given region rather than trying to insert a new block between blocks spanning multiple regions. Since the regions are addressed by their own unique names, entries would point to the region instead of the block.

Would it be possible for you to try it out for your use case?