Remove Views Pass#2335
Open
ThrudPrimrose wants to merge 4 commits into
Open
Conversation
Collaborator
|
What cases does your pass remove that the existing view removal transformations in array elimination doesn’t cover? |
Collaborator
Author
I compared
|
tbennun
requested changes
Apr 30, 2026
Collaborator
tbennun
left a comment
There was a problem hiding this comment.
Please add to simplification pipeline
Comment on lines
+12
to
+14
| Two strategies are used depending on the view kind: | ||
|
|
||
| Four strategies are tried in order until one succeeds: |
| @@ -206,9 +201,6 @@ def _delinearize_flat(flat, astrides: List[int], array_shape: List[int]): | |||
| return [(flat // astr) % shp for astr, shp in zip(astrides, array_shape)] | |||
Collaborator
There was a problem hiding this comment.
can you explain how this works, especially with complex permutations?
tbennun
requested changes
May 12, 2026
| from dace.sdfg import nodes as nd, utils as sdutil, graph as gr | ||
| from dace.transformation import pass_pipeline as ppl, transformation | ||
|
|
||
| _PASS = 'RemoveViews' |
| from dace.transformation import pass_pipeline as ppl, transformation | ||
|
|
||
| _PASS = 'RemoveViews' | ||
| _DEBUGPRINT = config.Config.get('debugprint') in (True, '1', 'true', 'yes') |
Collaborator
There was a problem hiding this comment.
this does not work. Also this does not conform to our API.
- It will only read it on import, so someone who sets the config temporarily will not observe this change.
- Call
config.Config.get_bool('debugprint')
So just call this function in the only place it is used.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a pass that removes views from the SDFG by folding them into the access patterns of the arrays they view.
Context: Reduced SDFG IR
This is the first PR toward a Reduced IR. A simplified subset of the full SDFG IR that limits the number of features transformations that need support. The Reduced IR eliminates views, WCR edges, other_subset on edges, dynamic thread-block maps, and persistent device maps by lowering each to a smaller set of primitives (e.g., WCR becomes a reduction library node, other_subset requiring copies becomes explicit copy nodes).
The goal of this PR is to be part of many to provide a lower pipeline from the full IR to the Reduced IR, removing as many of these features as possible. Alongside this pass, I have also extended the Copy library node and implemented a pass that inserts explicit copies where needed. (Separate PR)
What this pass does
The pass tries to remove as many views as possible by absorbing them into surrounding memlets. For example, a view that selects a strided column from a row-major array:
is removed with the following subset:
(It supports many other patterns as well).