Hoist data pointer loads from array allocations#43547
Closed
pchintalapudi wants to merge 22 commits intoJuliaLang:masterfrom
Closed
Hoist data pointer loads from array allocations#43547pchintalapudi wants to merge 22 commits intoJuliaLang:masterfrom
pchintalapudi wants to merge 22 commits intoJuliaLang:masterfrom
Conversation
This was referenced Dec 26, 2021
Member
Author
|
Since my branches are part of a fork, I've created a PR comparing this one and the array length propagation PR immediately before it here: pchintalapudi#3 |
487457a to
00a9b49
Compare
vchuravy
reviewed
Jan 8, 2022
Member
vchuravy
left a comment
There was a problem hiding this comment.
Can you add some unit-test specifically for the new llvm-array-opt pass?
src/ccall.cpp
Outdated
| static_rt); | ||
| if (auto array_alloc = dyn_cast<CallInst>(retval.V)) { | ||
| array_alloc->addAttribute(AttributeList::ReturnIndex, Attribute::NoAlias); | ||
| array_alloc->setMetadata("allocation.array", MDNode::get(jl_LLVMContext, {})); |
Member
There was a problem hiding this comment.
I would prefer this MD to have a julia prefix.
src/llvm-alloc-helpers.cpp
Outdated
| } | ||
| } | ||
|
|
||
| //FIXME: This doesn't actually work on Windows, as Windows inserts a trampoline |
Member
There was a problem hiding this comment.
Comment is outdated now? Should instead explain why metadata is used
pchintalapudi
pushed a commit
to pchintalapudi/julia
that referenced
this pull request
Jan 9, 2022
00a9b49 to
9ed005b
Compare
pchintalapudi
pushed a commit
to pchintalapudi/julia
that referenced
this pull request
Jan 12, 2022
added 10 commits
January 13, 2022 20:20
added 11 commits
January 13, 2022 20:23
943adc5 to
26e793b
Compare
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.
When arrays are indexed into, the data pointer is loaded at the indexing site. Typically GVN moves this data pointer load out of loops, but we can do this more eagerly for 2D/3D array allocations and 1D array allocations that do not escape, enabling more of the optimization pipeline to come into play (e.g. loop vectorization).
This PR depends on #43487 for the initial array identification routine as well as the ArrayOpt pass, and therefore #43057 for the escape analysis improvements.
Example:
#43487 :
Godbolt: https://godbolt.org/z/9sr36nsvq
Benchmark:
PR:
Godbolt: https://godbolt.org/z/8qr8rYv14
Benchmark: