-
Notifications
You must be signed in to change notification settings - Fork 424
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
Optimize remote array copies by creating a local copy of the domain when possible (off by default) #24391
Merged
Merged
Optimize remote array copies by creating a local copy of the domain when possible (off by default) #24391
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8601b8f
Draft optimization to localize const domains
bradcray e8766bc
Fix warnings by switching from .domain to .domain._value for locality…
bradcray 6c38924
Merge branch 'main' of https://github.com/chapel-lang/chapel into loc…
bradcray daef0ee
Tighten up debugging output and put under param control, along with o…
bradcray 241e0e9
Update test to support domain-localization optimization as well
bradcray 8de58ec
Only do the localize of domains optimization when running on multiple…
bradcray 4f63a0f
Add test showing that block-distributed domains are not localized
bradcray 65ba777
Localize domain if new array is constant as well
bradcray 011ef25
Add and update comments on domain localization optimization
bradcray 2317ed8
Oops, forgot to turn this off-by-default after testing as intended
bradcray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
writeln("all var"); | ||
{ | ||
var A: [1..10] real; | ||
writeln("After A"); | ||
var B = A; | ||
writeln("After B"); | ||
var C: [1..10] real = A; | ||
writeln("After C"); | ||
on Locales[numLocales-1] { | ||
var D = A; | ||
writeln("After D"); | ||
local { | ||
var sz = D.size; | ||
} | ||
} | ||
} | ||
writeln(); | ||
|
||
writeln("const A, var others"); | ||
{ | ||
const A: [1..10] real; | ||
writeln("After A"); | ||
var B = A; | ||
writeln("After B"); | ||
var C: [1..10] real = A; | ||
writeln("After C"); | ||
on Locales[numLocales-1] { | ||
var D = A; | ||
writeln("After D"); | ||
local { | ||
var sz = D.size; | ||
} | ||
} | ||
} | ||
writeln(); | ||
|
||
writeln("var A, const others"); | ||
{ | ||
var A: [1..10] real; | ||
writeln("After A"); | ||
const B = A; | ||
writeln("After B"); | ||
const C: [1..10] real = A; | ||
writeln("After C"); | ||
on Locales[numLocales-1] { | ||
const D = A; | ||
writeln("After D"); | ||
local { | ||
var sz = D.size; | ||
} | ||
} | ||
} | ||
writeln(); | ||
|
||
writeln("var Dom, var A, const others"); | ||
{ | ||
var Dom = {1..10}; | ||
var A: [Dom] real; | ||
writeln("After A"); | ||
const B = A; | ||
writeln("After B"); | ||
const C: [1..10] real = A; | ||
writeln("After C"); | ||
on Locales[numLocales-1] { | ||
const D = A; | ||
writeln("After D"); | ||
local { | ||
var sz = D.size; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
all var | ||
After A | ||
In initCopy(definedConst=false), domain definedConst: true; taking normal path | ||
After B | ||
After C | ||
In initCopy(definedConst=false), domain definedConst: true; taking normal path | ||
After D | ||
|
||
const A, var others | ||
After A | ||
In initCopy(definedConst=false), domain definedConst: true; taking normal path | ||
After B | ||
After C | ||
In initCopy(definedConst=false), domain definedConst: true; taking normal path | ||
After D | ||
|
||
var A, const others | ||
After A | ||
In initCopy(definedConst=true), domain definedConst: true; taking normal path | ||
After B | ||
After C | ||
In initCopy(definedConst=true), domain definedConst: true; taking normal path | ||
After D | ||
|
||
var Dom, var A, const others | ||
After A | ||
In initCopy(definedConst=true), domain definedConst: false; taking normal path | ||
After B | ||
After C | ||
In initCopy(definedConst=true), domain definedConst: false; taking normal path | ||
After D |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-slocalizeConstDomains=true -sdebugLocalizedConstDomains=true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
all var | ||
After A | ||
In initCopy(definedConst=false), domain definedConst: true; taking normal path | ||
After B | ||
After C | ||
In initCopy(definedConst=false), domain definedConst: true; localizing | ||
After D | ||
|
||
const A, var others | ||
After A | ||
In initCopy(definedConst=false), domain definedConst: true; taking normal path | ||
After B | ||
After C | ||
In initCopy(definedConst=false), domain definedConst: true; localizing | ||
After D | ||
|
||
var A, const others | ||
After A | ||
In initCopy(definedConst=true), domain definedConst: true; taking normal path | ||
After B | ||
After C | ||
In initCopy(definedConst=true), domain definedConst: true; localizing | ||
After D | ||
|
||
var Dom, var A, const others | ||
After A | ||
In initCopy(definedConst=true), domain definedConst: false; taking normal path | ||
After B | ||
After C | ||
In initCopy(definedConst=true), domain definedConst: false; localizing | ||
After D |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use BlockDist; | ||
|
||
const D = {1..10} dmapped new blockDist({1..100}); | ||
|
||
var A: [D] real; | ||
|
||
on Locales[numLocales-1] { | ||
// This should not cause the localization optimization to fire since | ||
// 'A' is distributed | ||
var B = A; | ||
writeln(B); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-slocalizeConstDomains=true -sdebugLocalizedConstDomains=true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
In initCopy(definedConst=false), domain definedConst: false; taking normal path | ||
In initCopy(definedConst=false), domain definedConst: false; taking normal path | ||
In initCopy(definedConst=false), domain definedConst: true; taking normal path | ||
In initCopy(definedConst=false), domain definedConst: false; taking normal path | ||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 |
1 change: 1 addition & 0 deletions
1
test/multilocale/diten/localBlock/needMultiLocales/localBlock5-localize.good
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{a = -2, next = {a = 2, next = {a = 3, next = nil}}} {a = -1, next = {a = 3, next = {a = 4, next = nil}}} {a = 0, next = {a = 4, next = {a = 5, next = nil}}} {a = 1, next = {a = 5, next = {a = 6, next = nil}}} {a = 2, next = {a = 6, next = {a = 7, next = nil}}} |
2 changes: 2 additions & 0 deletions
2
test/multilocale/diten/localBlock/needMultiLocales/localBlock5.compopts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-slocalizeConstDomains=false | ||
-slocalizeConstDomains=true # localBlock5-localize.good |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to add
compiledForSingleLocale()
here as well? This is a param and could avoid a branch when COMM=none. Arguably not important for now and you could probably just log it as future work in #25238There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea. We could even potentially have both param and non-param aspects of this
const
split apart and to have the conditional be something like:s.t. if
paramLocalize
was false, we'd fold the conditional? I like the idea of forking this off to its own PR, primarily to keep working on things that aren't done yet and adding it to the follow-on issue if you're good with that (though of all the things on that issue, I may do it first—possibly even tomorrow if time permits).