Skip to content

Commit

Permalink
Update for LoopVectorization 0.12.55, allow Octavian 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Jul 27, 2021
1 parent 18e0030 commit e266376
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "StrideArrays"
uuid = "d1fa6d79-ef01-42a6-86c9-f7c551f8593b"
authors = ["Chris Elrod <[email protected]> and contributors"]
version = "0.1.12"
version = "0.1.13"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Expand All @@ -18,8 +18,8 @@ VectorizedRNG = "33b4df10-0173-11e9-2a0c-851a7edac40e"

[compat]
ArrayInterface = "3"
LoopVectorization = "0.12.54"
Octavian = "0.2.3"
LoopVectorization = "0.12.55"
Octavian = "0.2.3,0.3"
SLEEFPirates = "0.6.13"
Static = "0.2.4, 0.3"
StrideArraysCore = "0.1.3,0.2"
Expand Down
17 changes: 8 additions & 9 deletions src/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ end
# need to construct the LoopSet
loopsyms = [gensym(:n)]
ls = LoopVectorization.LoopSet(:StrideArrays)
(inline, u₁, u₂, isbroadcast, W, rs, rc, cls, l1, l2, l3, threads) = UNROLL
(inline, u₁, u₂, v, isbroadcast, W, rs, rc, cls, l1, l2, l3, threads) = UNROLL
LoopVectorization.set_hw!(ls, rs, rc, cls, l1, l2, l3)
ls.vector_width = W
ls.isbroadcast = isbroadcast;
Expand All @@ -281,19 +281,18 @@ end
resize!(ls.loop_order, LoopVectorization.num_loops(ls)) # num_loops may be greater than N, eg Product
# fallback in case `check_args` fails
fallback = :(copyto!(dest, Base.Broadcast.instantiate(Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{$N}}(bc.f, bc.args, axes(dest)))))
Expr(:block, Expr(:meta, :inline), LoopVectorization.setup_call(ls, fallback, LineNumberNode(0), inline, false, u₁, u₂, threads%Int, 0), :dest)
Expr(:block, Expr(:meta, :inline), LoopVectorization.setup_call(ls, fallback, LineNumberNode(0), inline, false, u₁, u₂, v, threads%Int, 0), :dest)
# ls
end
@generated function _materialize!(
# function _materialize!(
dest::AbstractStrideArray{S,D,T,N,C,B,R}, bc::BC, ::Val{UNROLL}
) where {S, D, T, N, C, B, R, BC <: Union{Base.Broadcast.Broadcasted,StrideArrayProduct}, UNROLL}
# 1+1
# we have an N dimensional loop.
# need to construct the LoopSet
loopsyms = [gensym(:n) for n 1:N]
ls = LoopVectorization.LoopSet(:StrideArrays)
(inline, u₁, u₂, isbroadcast, W, rs, rc, cls, l1, l2, l3, threads) = UNROLL
(inline, u₁, u₂, v, isbroadcast, W, rs, rc, cls, l1, l2, l3, threads) = UNROLL
LoopVectorization.set_hw!(ls, rs, rc, cls, l1, l2, l3)
ls.vector_width = W
ls.isbroadcast = isbroadcast;
Expand Down Expand Up @@ -342,13 +341,13 @@ end
# return ls
# fallback in case `check_args` fails
fallback = :(copyto!(dest, Base.Broadcast.instantiate(Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{$N}}(bc.f, bc.args, axes(dest)))))
Expr(:block, Expr(:meta, :inline), LoopVectorization.setup_call(ls, fallback, LineNumberNode(0), inline, false, u₁, u₂, threads%Int, 0), :dest)
Expr(:block, Expr(:meta, :inline), LoopVectorization.setup_call(ls, fallback, LineNumberNode(0), inline, false, u₁, u₂, v, threads%Int, 0), :dest)
end

@inline function Base.Broadcast.materialize!(
dest::AbstractStrideArray, bc::BC
) where {BC <: Union{Base.Broadcast.Broadcasted,StrideArrayProduct}}
_materialize!(dest, bc, LoopVectorization.avx_config_val(Val((true,zero(Int8),zero(Int8),true,-1%UInt)), pick_vector_width(eltype(dest))))
_materialize!(dest, bc, LoopVectorization.avx_config_val(Val((true,zero(Int8),zero(Int8),zero(Int8),true,-1%UInt)), pick_vector_width(eltype(dest))))
end

# @generated function Base.Broadcast.materialize!(
Expand All @@ -374,12 +373,12 @@ end
# end

@inline function Base.Broadcast.materialize!(dest::AbstractStrideArray{S,D,T,N,C,B,R,X,O}, bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0}, Nothing, typeof(identity), Tuple{T2}}) where {S,D,T,N,C,B,R,X,O,T2<:Number}
fill!(dest, first(bc.args))
fill!(dest, first(bc.args))
end

@inline function Base.Broadcast.materialize(bc::Base.Broadcast.Broadcasted{S}) where {S <: AbstractStrideStyle}
ElType = Base.Broadcast.combine_eltypes(bc.f, bc.args)
Base.Broadcast.materialize!(similar(bc, ElType), bc)
ElType = Base.Broadcast.combine_eltypes(bc.f, bc.args)
Base.Broadcast.materialize!(similar(bc, ElType), bc)
end

@inline LoopVectorization.vmaterialize(bc::Base.Broadcast.Broadcasted{<:AbstractStrideStyle}) = Base.Broadcast.materialize(bc)
Expand Down

2 comments on commit e266376

@chriselrod
Copy link
Member Author

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/41573

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.1.13 -m "<description of version>" e2663766aa5b9c7a1a6b480cbd3b093afd9ebbfe
git push origin v0.1.13

Please sign in to comment.