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

Feature request: Data structure to hide details of graph rendering #64

Open sklam opened 1 year ago

sklam commented 1 year ago

Graph rendering code can be messy. Sometimes we need viz-backend specific logic. It's also hard to test.

The suggestion is to add a AbstractDataType for hiding the details of graph rendering. All it needs is really a set of nodes, edges and node grouping for regions.

Sample implementation in: https://github.com/numba/numba/blob/edfc1b95bf633abb346fbbe265acf2bb20560a6e/numba/core/frontend2/regionrenderer.py#L56

Such a class will also allow us to exercise graph rendering in tests. For instance, the sample implementation has a .verify() method to ensure the graph is wellformed; e.g. edges points to existing locations.

This ADT will allow backend specific code to be isolated: https://github.com/numba/numba/blob/edfc1b95bf633abb346fbbe265acf2bb20560a6e/numba/core/frontend2/regionrenderer.py#L127 Testing for this will be hard to automate but now it's contained in one place without mixing with other logic.