dace icon indicating copy to clipboard operation
dace copied to clipboard

Add if extraction transformation

Open luigifusco opened this issue 1 year ago • 4 comments

As part of the series of SDFG rewriting transformations, IfExtraction targets nested SDFGs that begin with an if statement whose condition is independent of symbols defined or updated in the outer state (these are either writes to arrays or definitions in maps). The if is "extracted": the outers state is duplicated and a new if guard is created in the outer SDFG with the appropriately translated condition. If the edges contain symbol definitions these become definitions in the nested SDFG symbol_mapping.

Example of application: image becomes: image

luigifusco avatar Sep 06 '24 12:09 luigifusco

Agreeing with @phschaad here - tests for when this applies and when it does not apply are needed. Apart from that, it LGTM.

acalotoiu avatar Sep 09 '24 07:09 acalotoiu

In general happy to accept this, but we need at least one or two unit tests

Added more unit tests, added more explanation. PTAL.

pratyai avatar Oct 29 '24 00:10 pratyai

Thank you for continuing this @pratyai :-) As with #1639, I would prefer to briefly discuss this in the DaCe meeting before accepting, for the same reasons listed in #1639. However, in general this looks good and I am happy to add this contribution to DaCe.

phschaad avatar Oct 29 '24 17:10 phschaad

Leaving a note here to revisit this transformation for slight adaptation after https://github.com/spcl/dace/pull/1676 is merged.

phschaad avatar Nov 25 '24 09:11 phschaad