-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Const Assignment Map Fusion: If two maps assign the same value for every element in a subset of the underlying array (and the subset is not dependent on the array in any way), then we can often fuse the two maps (not always possible) #1685
Draft
pratyai
wants to merge
29
commits into
spcl:main
Choose a base branch
from
pratyai:const-assignment-fusion
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
CPU Results (comment might be updated)
|
GPU Results (comment might be updated)
|
pratyai
force-pushed
the
const-assignment-fusion
branch
from
October 24, 2024 11:30
1c96bf4
to
e1bf9a6
Compare
pratyai
force-pushed
the
const-assignment-fusion
branch
from
October 26, 2024 09:30
e1bf9a6
to
db94444
Compare
The PR contains all the working ideas I had about the constant assignment map fusion:
If it is too many feature at once, I can remove the non-essential pieces for future PRs too. Please let me know if you'd see more tests, different implementation or organization etc. |
depends on the map parameters.
grid-stride loop as a guard.
maps, create empty ones.
pratyai
force-pushed
the
const-assignment-fusion
branch
from
October 29, 2024 15:36
0cd919f
to
f2771d5
Compare
pratyai
force-pushed
the
const-assignment-fusion
branch
from
October 29, 2024 16:20
f2771d5
to
23f2689
Compare
pratyai
changed the title
Const assignment map fusion
Const Assignment Map Fusion: If two maps assign the same value for every element in a subset of the underlying array (and the subset is not dependent on the array in any way), then we can often fuse the two maps (not always possible)
Oct 29, 2024
hand-crafted graphs.
cover more cases in the state fusion.
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.
Since scheduling multiple map kernels with very little internal operation can have a large overhead, sometimes we would like to fuse two such maps if possible. Constant assignment maps are such a case. If two maps assign the same value for every element in a subset of the underlying array (and the subset is not dependent on the array in any way), then:
Motivating Example
Consider the following graphs, all representing a computation that assigns
1
to the boundary of a 2D domain. The first table represents the graphs scheduled for CPU, the second for GPU.Performance
We have profiled a 2D and a 3D boundary initialization, both on CPU and GPU (both on Davinci cluster).
Benchmark scripts and reports are to be found in https://github.com/pratyai/dace/tree/bench-const-assignment-fusion
I will be quoting the performance summaries in further comments.
Comment on GPU performance
The GPU transformation adds additional operation copying the entire array to and from GPU memory, resulting in
O(n^d)
main <=> GPU movement, whereas the assignment itself only touchesO(n^{d-1})
elements. However, this is because the benchmark itself does not do anything else but the assignment. In real computations, we would likely need to move the entire array anyway.Because of this, it is probably better to just focus on the combined performance of the map kernels here.