-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15895 from ronawho/dom-arr-list-to-chpl__hashtable
Switch the domain's list of arrays to a hashtable [codeveloped with @mppf] Domains keep track of the arrays declared over them so that when a domain is resized it can resize all the arrays declared over it. Previously, we used a simple LinkedList to store the arrays, which had performance issues because removal from a linked list is O(n). For the most part we got lucky and removal happened in reverse insertion order so removal was effectively O(1). This was because we did serial init and deinit of arrays-of-arrays, but there are still cases where the insertion or removal was parallel, which killed performance. This includes creating arrays in a task-intent clause (#11333) and having a distributed array of arrays (#9414). This significantly improves the performance of those cases, and does not hurt serial insertion/deletion performance. We have long wanted to use a set/hashtable to store a domain's arrays, but previously we couldn't because using an associative array inside BaseDom and BaseDist would result in a circular dependency. Now that chpl__hashtable has been split out we can just use that. This creates a simple set wrapper over hashtable. We do this instead of using the standard library set to have more control and to avoid bringing in all of set code to hopefully limit the impact on compilation speed. This improves startup/teardown for a single node forall loop using array-of-arrays task intents. There's a 75x speedup for ri-a2-AoA.chpl, which is a reproducer #11333. This also improves deinit for a block dist array-of-arrays by 500x at 512 nodes (improves non-kernel scalability for isx -- #9414) Additionally, this will allow us to parallelize array initialization for all types and array deinitialization in a future PR. Some technical notes: - I had to comment out some `key` printing in chpl__hashtble to avoid dynamic dispatch trying to stamp out read/writeThis methods for all array types. This resulted in trying to print our arrays of sync and we don't support writing syncs. - Removing an element that isn't in the set is a noop. This is required for optimizations/bulkcomm/bharshbarg/arrayViews, but I made inserting an existing element an assertion failure. - rootLocaleInitialized is now used earlier, so I moved it to ChapelBase. Resolves #9414 Resolves #11333 Resolves Cray/chapel-private#1036 Closes Cray/chapel-private#1063
- Loading branch information
Showing
24 changed files
with
98 additions
and
38 deletions.
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
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
breakList.chpl:21: In function 'bar': | ||
breakList.chpl:24: error: multiple overload sets are applicable to this call | ||
breakList.chpl:4: note: the best-matching candidate is here | ||
breakList.chpl:2: note: ... defined in this module | ||
breakList.chpl:23: In function 'bar': | ||
breakList.chpl:26: error: multiple overload sets are applicable to this call | ||
breakList.chpl:6: note: the best-matching candidate is here | ||
breakList.chpl:3: note: ... defined in this module | ||
$CHPL_HOME/modules/standard/LinkedLists.chpl:nnnn: note: even though the candidate here is also available | ||
$CHPL_HOME/modules/standard/LinkedLists.chpl:nnnn: note: ... defined in this module | ||
breakList.chpl:24: note: use --no-overload-sets-checks to disable overload sets errors | ||
breakList.chpl:26: note: use --no-overload-sets-checks to disable overload sets errors |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
module Structure { | ||
use LinkedLists; | ||
|
||
class GrandParent { | ||
var gp_field: int; | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
use LinkedLists; | ||
|
||
class R { | ||
var l: LinkedList(?t); | ||
} | ||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
queryGenericField.chpl:2: error: Query expressions are not currently supported in this context | ||
queryGenericField.chpl:4: error: Query expressions are not currently supported in this context |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use IO, Collection; | ||
use IO, Collection, LinkedLists; | ||
|
||
param bp = b"brad"; | ||
var b = b"brad"; | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use IO; | ||
use IO, LinkedLists; | ||
|
||
record MyRecord { | ||
var numbers:LinkedList(int); // could it be [1..0] int ? | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
use LinkedLists; | ||
|
||
var s = makeList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); | ||
|
||
writeln(s); | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
use LinkedLists; | ||
|
||
var l = makeList((1, 2), (3, 4)); | ||
|
||
writeln(l); | ||
|
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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
// no use List; | ||
// this test is checking that scoped access to a symbol in an | ||
// internal module works correctly. | ||
import LinkedLists; | ||
|
||
var x = LinkedLists.makeList(1,2,3); | ||
writeln(x); |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
================================================================================================================= | ||
Allocated Memory (Bytes) Number Size Total Description Address | ||
================================================================================================================= | ||
printMemAllocs2.chpl:4 32 8 256 array elements 0xnnnnnnnn | ||
printMemAllocs2.chpl:4 32 8 256 array elements 0xnnnnnnnn | ||
printMemAllocs2.chpl:4 32 8 256 array elements 0xnnnnnnnn | ||
printMemAllocs2.chpl:4 32 8 256 array elements 0xnnnnnnnn | ||
printMemAllocs2.chpl:4 320 8 2560 array elements 0xnnnnnnnn | ||
printMemAllocs2.chpl:4 320 8 2560 array elements 0xnnnnnnnn | ||
printMemAllocs2.chpl:4 320 8 2560 array elements 0xnnnnnnnn | ||
printMemAllocs2.chpl:4 320 8 2560 array elements 0xnnnnnnnn | ||
================================================================================================================= | ||
|
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
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
2 changes: 1 addition & 1 deletion
2
test/optimizations/deadCodeElimination/elliot/countDeadModules.comm-ofi.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 |
---|---|---|
@@ -1 +1 @@ | ||
Removed 27 dead modules. | ||
Removed 26 dead modules. |
2 changes: 1 addition & 1 deletion
2
test/optimizations/deadCodeElimination/elliot/countDeadModules.comm-ugni.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 |
---|---|---|
@@ -1 +1 @@ | ||
Removed 27 dead modules. | ||
Removed 26 dead modules. |
2 changes: 1 addition & 1 deletion
2
test/optimizations/deadCodeElimination/elliot/countDeadModules.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 |
---|---|---|
@@ -1 +1 @@ | ||
Removed 27 dead modules. | ||
Removed 26 dead modules. |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
use LinkedLists; | ||
|
||
enum color { red, green, blue }; | ||
|
||
var D: domain(real); | ||
|