-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Description
We are missing significant optimization opportunity for small constant-size loops. For such loops it is not profitable to generate run-time alias checks, but we still loose significant performance due to lack of vectorization. I'm proposing introducing a macro to annotate variables that are known not to alias, similar to restrict in C. My initial thought is something like this.
@assert_nolias a::Array # Implies that `a` does not share memory with any other variable in the current scope
For generic structs:
@assert_noalias b::Foo # morally equivalent to
for i in nfields(typeof(b))
@assert_noalias getfield(b, i)
end
I think these semantics are pretty strong and may be weakened over time, but it seems like an ok place to start. Eventually we may want to introduce more first class support for non-aliasing arrays (which array almost are, were it not for sharing by reshaping etc).
Motivating benchmark is jeff-regier/Celeste.jl#483
AzamatB
Metadata
Metadata
Assignees
Labels
No labels