-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
effects: add effects analysis for array construction #46015
Conversation
8688442
to
9af7f1c
Compare
Can you check whether this improves the time for allocating small arrays Iref
|
It shouldn't impact the time to allocate arrays. This is mostly for dead code elimination. |
9af7f1c
to
ea377eb
Compare
I would prefer if these used the existing capability to annotate effects on |
I found something like Array{T,1}(::UndefInitializer, m::Int) where {T} = (@_total_but_inconsistent_meta;
ccall(:jl_alloc_array_1d, Array{T,1}, (Any, Int), Array{T,1}, m)) is wrong as |
ea377eb
to
ff38b41
Compare
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
ff38b41
to
f3a13af
Compare
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
f3a13af
to
416f0f2
Compare
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
15ca11c
to
db391cc
Compare
@nanosoldier |
516ee0a
to
23a3935
Compare
This commit implements an infrastructure to analyze effects of `:foreigncall` expression, and especially implements effects analysis for array constructions. Some improvements: ```julia julia> @noinline construct_array(@nospecialize(T), args...) = Array{T}(undef, args...); julia> function check_dims(T, dims) construct_array(T, dims...) return nothing end; ``` ```julia julia> code_typed() do check_dims(Int, (1,2,3)) end ``` ```diff diff --git a/_master b/_pr index b0ed0eaac1..38e2d3553d 100644 --- a/_master +++ b/_pr @@ -1,6 +1,4 @@ 1-element Vector{Any}: CodeInfo( -1 ─ invoke Main.construct_array(Int64::Any, -1::Int64, 2::Vararg{Int64}, 3)::Any -│ %2 = Main.nothing::Nothing -└── return %2 +1 ─ return nothing ) => Nothing ``` ```julia julia> code_typed() do check_dims(Int, (-1,2,3)) end ``` ```diff diff --git a/_master b/_pr index b0ed0eaac1..e5e724db10 100644 --- a/_master +++ b/_pr @@ -1,6 +1,5 @@ 1-element Vector{Any}: CodeInfo( -1 ─ invoke Main.construct_array(Int64::Any, -1::Int64, 2::Vararg{Int64}, 3)::Any -│ %2 = Main.nothing::Nothing -└── return %2 -) => Nothing +1 ─ invoke Main.check_dims(Main.Int::Type, (-1, 2, 3)::Tuple{Int64, Int64, Int64})::Union{} +└── unreachable +) => Union{} ```
23a3935
to
6dc0ff5
Compare
Test failures look unrelated. |
@aviatesk It looks like this PR introduced some new |
This reverts commit 01c0778.
This commit implements an infrastructure to analyze effects of `:foreigncall` expression, and especially implements effects analysis for array constructions. Some improvements: ```julia julia> @noinline construct_array(@nospecialize(T), args...) = Array{T}(undef, args...); julia> function check_dims(T, dims) construct_array(T, dims...) return nothing end; ``` ```julia julia> code_typed() do check_dims(Int, (1,2,3)) end ``` ```diff diff --git a/_master b/_pr index b0ed0eaac1..38e2d3553d 100644 --- a/_master +++ b/_pr @@ -1,6 +1,4 @@ 1-element Vector{Any}: CodeInfo( -1 ─ invoke Main.construct_array(Int64::Any, -1::Int64, 2::Vararg{Int64}, 3)::Any -│ %2 = Main.nothing::Nothing -└── return %2 +1 ─ return nothing ) => Nothing ``` ```julia julia> code_typed() do check_dims(Int, (-1,2,3)) end ``` ```diff diff --git a/_master b/_pr index b0ed0eaac1..e5e724db10 100644 --- a/_master +++ b/_pr @@ -1,6 +1,5 @@ 1-element Vector{Any}: CodeInfo( -1 ─ invoke Main.construct_array(Int64::Any, -1::Int64, 2::Vararg{Int64}, 3)::Any -│ %2 = Main.nothing::Nothing -└── return %2 -) => Nothing +1 ─ invoke Main.check_dims(Main.Int::Type, (-1, 2, 3)::Tuple{Int64, Int64, Int64})::Union{} +└── unreachable +) => Union{} ```
This commit implements an infrastructure to analyze effects of `:foreigncall` expression, and especially implements effects analysis for array constructions. Some improvements: ```julia julia> @noinline construct_array(@nospecialize(T), args...) = Array{T}(undef, args...); julia> function check_dims(T, dims) construct_array(T, dims...) return nothing end; ``` ```julia julia> code_typed() do check_dims(Int, (1,2,3)) end ``` ```diff diff --git a/_master b/_pr index b0ed0eaac1..38e2d3553d 100644 --- a/_master +++ b/_pr @@ -1,6 +1,4 @@ 1-element Vector{Any}: CodeInfo( -1 ─ invoke Main.construct_array(Int64::Any, -1::Int64, 2::Vararg{Int64}, 3)::Any -│ %2 = Main.nothing::Nothing -└── return %2 +1 ─ return nothing ) => Nothing ``` ```julia julia> code_typed() do check_dims(Int, (-1,2,3)) end ``` ```diff diff --git a/_master b/_pr index b0ed0eaac1..e5e724db10 100644 --- a/_master +++ b/_pr @@ -1,6 +1,5 @@ 1-element Vector{Any}: CodeInfo( -1 ─ invoke Main.construct_array(Int64::Any, -1::Int64, 2::Vararg{Int64}, 3)::Any -│ %2 = Main.nothing::Nothing -└── return %2 -) => Nothing +1 ─ invoke Main.check_dims(Main.Int::Type, (-1, 2, 3)::Tuple{Int64, Int64, Int64})::Union{} +└── unreachable +) => Union{} ```
This commit implements an infrastructure to analyze effects of
:foreigncall
expression, and especially implements effectsanalysis for array constructions.
Some improvements: