forked from chapel-lang/chapel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Denorm return by ref (chapel-lang#24519)
This PR adds an option `--no-return-by-ref` that undoes the return-by-ref representation for most functions where it is used, see below. The exception is made for homogenous tuples because of a current restriction in codegen. Another exception is made for virtual functions as handling those would requite additional effort. This PR also collapses prim-moves from: def temp1 move temp1, expr move temp2, temp1 into move temp2, expr As a result, given a Chapel function `f()` that returns a record `R`, the generated code is simplified from: void f(R* _retArg) { .... *_retArg = something; return; } f(&ret_tmp); call_tmp = ret_tmp; into R f() { .... return something; } call_tmp = f(); The above changes are done as part of the `denormalize` pass. The undo-return-by-ref transformation is off by default because it can decrease performance. Move-collapsing is always on because it should be harmless. Other changes: Add a test of this flag by running it on the main version of SSCA2. Extend the suggestion for simplifying the generated code for debugging to include also `--no-return-by-ref --no-inline`. Reset the performance playground. While there, add a previously-missing `addFlag(FLAG_RVV)` for consistency. While there, also enable the `--no-` form of the `--iterator-contexts` option and move its definition so it is more alphabetically-ordered in driver.cpp. Potential next steps: * Look into the 7% slowdown caused by --no-return-by-ref in "Submitted Fannkuch-Redux Shootout Benchmark (n=12)". * Move the return-by-ref transformation in the compiler down to codegen, to simplify some of the earlier passes and debugging the IR. * Change the micro-pass `collapseTrivialMoves()` from whole-program to per-function. Implement it using an AstVisitor. Have this visitor also eliminate vacuous gotos, which I was still observing. Move this collapsing to the start of per-function processing, ex. next to/after removeUnnecessaryGotos() and undoReturnByRef(). This earlier location might obviate the need to vetting of the prim_moves, see canCollapseMoveBetween() and okSymbol(). Still, continue to keep prim_moves into config, export, and extern vars. This collapsing could also be run after inlining and lowerIterators() as those generate additional pass-through moves. Testing: as of this PR, the entire paratest with `-compopts --no-return-by-ref` passes in {target=gnu,llvm}*{comm=none,gasnet} configurations. r: @dlongnecke-cray
- Loading branch information
Showing
20 changed files
with
294 additions
and
12 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
--no-return-by-ref |
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 @@ | ||
SSCA2_main.dir/SSCA2_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SSCA2_main.dir/SSCA2_main.1Dtorus.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 @@ | ||
SSCA2_main.dir/SSCA2_main.2Dtorus.good |
Oops, something went wrong.