Possible new false positive on Julia 1.10.0-beta2
kbarros opened this issue · comments
The following detects a runtime dispatch on Julia 1.10.0-beta2, but did not on beta1.
using StaticArrays, JET
const Vec3 = SVector{3, Float64}
const μ = Array{Vec3, 4}
function f(μ)
return reinterpret(reshape, Float64, μ)
end
@report_opt f(μ)
I get
═════ 1 possible error found ═════
┌ f(μ::Type{Array{SVector{3, Float64}, 4}}) @ Main ./REPL[5]:2
│ runtime dispatch detected: reinterpret(reshape, Float64, μ::Type{Array{SVector{3, Float64}, 4}})
└────────────────────
Tested with JET v0.8.11 and
Julia Version 1.10.0-beta2
Commit a468aa198d0 (2023-08-17 06:27 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (arm64-apple-darwin22.4.0)
CPU: 8 × Apple M1 Pro
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 on 6 virtual cores
It looks like this is true positive, as it will actually result in a method error:
julia> f(μ)
ERROR: MethodError: no method matching reinterpret(::typeof(reshape), ::Type{Float64}, ::Type{Array{SVector{3, Float64}, 4}})
Closest candidates are:
reinterpret(::typeof(reshape), ::Type{T}, ::Base.ReinterpretArray{T, N, S, A, true} where {T, N, S, A<:(AbstractArray{S})}) where T
@ Base reinterpretarray.jl:160
reinterpret(::typeof(reshape), ::Type{T}, ::AbstractArray{T}) where T
@ Base reinterpretarray.jl:114
reinterpret(::typeof(reshape), ::Type{T}, ::A) where {T, S, A<:(AbstractArray{S})}
@ Base reinterpretarray.jl:82
...
Stacktrace:
[1] f(μ::Type)
@ Main ./REPL[6]:2
[2] top-level scope
@ REPL[10]:1
Sorry, I had a mistake in the definition of μ
. Could you please give it another try with this fixed version?
using StaticArrays, JET
const Vec3 = SVector{3, Float64}
const μ = zeros(Vec3, 2, 3, 4, 5)
function f(μ)
return reinterpret(reshape, Float64, μ)
end
f(μ) # runs now
@report_opt f(μ) # runtime dispatch detected in 1.10.0-beta2 only
Yeah, confirmed. Thanks!
It seems like this is now fixed, and the issue can be closed.
Sorry for being late here and thanks for confirming it's now fixed. Let me investigate the root problem of this, and I will close this issue once confirming it is not on JET-side.
I confirmed that this issue no longer reproduces on:
Julia Version 1.10.0-beta2
Commit a468aa198d (2023-08-17 06:27 UTC)
Build Info:
Note: This is an unofficial build, please report bugs to the project
responsible for this build and not to the Julia project unless you can
reproduce the issue using official builds available at https://julialang.org/downloads
Platform Info:
OS: macOS (arm64-apple-darwin23.0.0)
CPU: 10 × Apple M2 Pro
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 on 6 virtual cores
It seems the core problem originated from StaticArrays.jl. Given this, I'll close this issue as no further action appears required on the JET side.