Skip to content

Commit

Permalink
Update Project.toml (#416)
Browse files Browse the repository at this point in the history
* Update Project.toml

* a few updates toward Static 0.7

* further Static 0.7 updates; drop older ones to reduce chances of regressions

Co-authored-by: Chris Elrod <[email protected]>
  • Loading branch information
Tokazama and chriselrod authored Jun 24, 2022
1 parent 03de201 commit a7f9e1b
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 2,352 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ArrayInterfaceOffsetArrays = "0.1.2"
ArrayInterfaceStaticArrays = "0.1.2"
CPUSummary = "0.1.3 - 0.1.8, 0.1.11"
ChainRulesCore = "1"
CloseOpenIntervals = "0.1.2"
CloseOpenIntervals = "0.1.10"
DocStringExtensions = "0.8, 0.9"
ForwardDiff = "0.9, 0.10"
HostCPUFeatures = "0.1.3"
Expand All @@ -47,7 +47,7 @@ SIMDDualNumbers = "0.1"
SIMDTypes = "0.1"
SLEEFPirates = "0.6.23"
SpecialFunctions = "1, 2"
Static = "0.3.3, 0.4, 0.6"
Static = "0.7"
ThreadingUtilities = "0.5"
UnPack = "1"
VectorizationBase = "0.21.21"
Expand Down
6 changes: 3 additions & 3 deletions src/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function LowDimArray{D0}(data::LowDimArray{D1,T,N,A}) where {D0,T,N,D1,A<:Abstra
end
Base.@propagate_inbounds Base.getindex(
A::LowDimArray,
i::Vararg{Union{Integer,CartesianIndex},K},
i::Vararg{Union{StaticInt,Integer,CartesianIndex},K},
) where {K} = getindex(A.data, i...)
@inline Base.size(A::LowDimArray) = Base.size(A.data)
@inline Base.size(A::LowDimArray, i) = Base.size(A.data, i)
Expand Down Expand Up @@ -238,8 +238,8 @@ function _strides_expr(@nospecialize(s), @nospecialize(x), R::Vector{Int}, D::Ve
q
end
@generated function _strides(
s::Tuple{Vararg{Integer,N}},
x::Tuple{Vararg{Integer,N}},
s::Tuple{Vararg{Union{StaticInt,Integer},N}},
x::Tuple{Vararg{Union{StaticInt,Integer},N}},
::Val{R},
::Val{D},
) where {N,R,D}
Expand Down
6 changes: 3 additions & 3 deletions src/codegen/lower_memory_common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ end
function _addoffset!(
ret::Expr,
vloopstride,
indexstride::Union{Integer,MaybeKnown},
indexstride::Union{Int,MaybeKnown},
index,
offset,
calcbypointeroffset::Bool,
Expand Down Expand Up @@ -90,8 +90,8 @@ function __addoffset!(
end
function __addoffset!(
ret::Expr,
vloopstride::Union{Integer,MaybeKnown},
indexstride::Union{Integer,MaybeKnown},
vloopstride::Union{Int,MaybeKnown},
indexstride::Union{Int,MaybeKnown},
index,
offset,
calcbypointeroffset::Bool,
Expand Down
6 changes: 3 additions & 3 deletions src/condense_loopset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,14 @@ end
val(x) = Expr(:call, Expr(:curly, :Val, x))

@inline gespf1(x, i) = gesp(x, i)
@inline gespf1(x::StridedPointer{T,1}, i::Tuple{I}) where {T,I<:Integer} = gesp(x, i)
@inline gespf1(x::StridedBitPointer{T,1}, i::Tuple{I}) where {T,I<:Integer} = gesp(x, i)
@inline gespf1(x::StridedPointer{T,1}, i::Tuple{I}) where {T,I<:Union{Integer,StaticInt}} = gesp(x, i)
@inline gespf1(x::StridedBitPointer{T,1}, i::Tuple{I}) where {T,I<:Union{Integer,StaticInt}} = gesp(x, i)
@inline gespf1(x::StridedPointer{T,1}, i::Tuple{Zero}) where {T} = x
@inline gespf1(x::StridedBitPointer{T,1}, i::Tuple{Zero}) where {T} = x
@generated function gespf1(
x::AbstractStridedPointer{T,N,C,B,R},
i::Tuple{I},
) where {T,N,I<:Integer,C,B,R}
) where {T,N,I<:Union{Integer,StaticInt},C,B,R}
ri = argmin(R)
quote
$(Expr(:meta, :inline))
Expand Down
43 changes: 17 additions & 26 deletions src/modeling/graphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ function pushexpr!(ex::Expr, mk::MaybeKnown)
end
pushexpr!(ex::Expr, x::Union{Symbol,Expr}) = (push!(ex.args, x); nothing)
pushexpr!(ex::Expr, x::Integer) = (push!(ex.args, staticexpr(convert(Int, x))); nothing)
pushexpr!(ex::Expr, @nospecialize(x::StaticInt)) = (push!(ex.args, x); nothing)
MaybeKnown(x::Integer) = MaybeKnown(convert(Int, x), Symbol("##UNDEFINED##"), true)
MaybeKnown(x::Integer, default::Int) = MaybeKnown(x)
MaybeKnown(x::Symbol, default::Int) = MaybeKnown(default, x, false)
Expand Down Expand Up @@ -926,19 +927,20 @@ function add_block!(ls::LoopSet, ex::Expr, elementbytes::Int, position::Int)
push!(ls, x, elementbytes, position)
end
end
function maybestatic!(expr::Expr)
if expr.head === :call
f = first(expr.args)
if f === :length
expr.args[1] = GlobalRef(ArrayInterface, :static_length)
elseif f === :size && length(expr.args) == 3
i = expr.args[3]
if i isa Integer
expr.args[1] = GlobalRef(ArrayInterface, :size)
expr.args[3] = staticexpr(convert(Int, i)::Int)
function makestatic!(expr)
expr isa Expr || return expr
for i = eachindex(expr.args)
ex = expr.args[i]
if ex isa Int
expr.args[i] = staticexpr(ex)
elseif ex isa Symbol
if ex === :length
expr.args[i] = GlobalRef(ArrayInterface, :static_length)
elseif Base.sym_in(ex, (:axes, :size))
expr.args[i] = GlobalRef(ArrayInterface, ex)
end
else
static_literals!(expr)
elseif ex isa Expr
makestatic!(ex)
end
end
expr
Expand All @@ -957,7 +959,7 @@ function add_loop_bound!(
upper::Bool,
step::Bool,
)::MaybeKnown
maybestatic!(bound)
makestatic!(bound)
N = gensym!(
ls,
string(itersym) *
Expand All @@ -966,17 +968,6 @@ function add_loop_bound!(
pushprepreamble!(ls, Expr(:(=), N, bound))
MaybeKnown(N, upper ? 1024 : 1)
end
static_literals!(s::Symbol) = s
function static_literals!(q::Expr)
for (i, ex) enumerate(q.args)
if ex isa Number
q.args[i] = staticexpr(ex)
elseif ex isa Expr
static_literals!(ex)
end
end
q
end
function range_loop!(
ls::LoopSet,
itersym::Symbol,
Expand Down Expand Up @@ -1021,7 +1012,7 @@ function oneto_loop!(ls::LoopSet, r::Expr, itersym::Symbol)::Loop
rangename = lensym = Symbol("")
MaybeKnown(convert(Int, otN)::Int, 0)
else
otN isa Expr && maybestatic!(otN)
otN isa Expr && makestatic!(otN)
lensym = N = gensym!(ls, "loop" * string(itersym))
rangename = gensym!(ls, "range")
pushprepreamble!(ls, Expr(:(=), N, otN))
Expand Down Expand Up @@ -1084,7 +1075,7 @@ function misc_loop!(
Expr(
:(=),
rangename,
Expr(:call, lv(:canonicalize_range), :(@inbounds $(static_literals!(r)))),
Expr(:call, lv(:canonicalize_range), :(@inbounds $(makestatic!(r)))),
),
)
pushprepreamble!(
Expand Down
Loading

2 comments on commit a7f9e1b

@chriselrod
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/63021

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.12.119 -m "<description of version>" a7f9e1bf91e14fba2c7f65a7c8fbd7e5eeb6f619
git push origin v0.12.119

Please sign in to comment.