diff --git a/Project.toml b/Project.toml index 963f0b4c8..01e0c33d6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "LoopVectorization" uuid = "bdcacae8-1622-11e9-2a5c-532679323890" authors = ["Chris Elrod "] -version = "0.12.115" +version = "0.12.116" [deps] ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" diff --git a/src/getconstindexes.jl b/src/getconstindexes.jl index ec2447dd5..dd6d73e4d 100644 --- a/src/getconstindexes.jl +++ b/src/getconstindexes.jl @@ -1,4 +1,5 @@ -for (i, f) ∈ enumerate(( +const EXTRACTFUNS = ( + :first, :second, :third, :fourth, @@ -11,6 +12,34 @@ for (i, f) ∈ enumerate(( :eleventh, :twelfth, :thirteenth, -)) - @eval @inline $f(x) = @inbounds getindex(x, $(i + 1)) + :fourteenth, + :fifteenth, + :sixteenth, + :seventeenth, + :eighteenth, + :nineteenth, + :twentieth, + :twentyfirst, + :twentysecond, + :twentythird, + :twentyfourth, + :twentyfifth, + :twentysixth, + :twentyseventh, + :twentyeighth, + :twentyninth, + :thirtieth, + :thirtyfirst, + :thirtysecond, + :thirtythird, + :thirtyfourth, + :thirtyfifth, + :thirtysixth, + :thirtyseventh, + :thirtyeighth, + :last) + +for (i, f) ∈ enumerate(EXTRACTFUNS) + (i == 1 || i == length(EXTRACTFUNS)) && continue + @eval @inline $f(x) = @inbounds getindex(x, $i) end diff --git a/src/modeling/costs.jl b/src/modeling/costs.jl index b04c9bc0f..423ed8b31 100644 --- a/src/modeling/costs.jl +++ b/src/modeling/costs.jl @@ -253,20 +253,6 @@ const COST = Dict{Symbol,InstructionCost}( :adjoint => InstructionCost(0, 0.0, 0.0, 0), :conj => InstructionCost(0, 0.0, 0.0, 0), :transpose => InstructionCost(0, 0.0, 0.0, 0), - :first => InstructionCost(0, 0.0, 0.0, 0), - :second => InstructionCost(0, 0.0, 0.0, 0), - :third => InstructionCost(0, 0.0, 0.0, 0), - :fourth => InstructionCost(0, 0.0, 0.0, 0), - :fifth => InstructionCost(0, 0.0, 0.0, 0), - :sixth => InstructionCost(0, 0.0, 0.0, 0), - :seventh => InstructionCost(0, 0.0, 0.0, 0), - :eighth => InstructionCost(0, 0.0, 0.0, 0), - :ninth => InstructionCost(0, 0.0, 0.0, 0), - :tenth => InstructionCost(0, 0.0, 0.0, 0), - :eleventh => InstructionCost(0, 0.0, 0.0, 0), - :twelfth => InstructionCost(0, 0.0, 0.0, 0), - :thirteenth => InstructionCost(0, 0.0, 0.0, 0), - :last => InstructionCost(0, 0.0, 0.0, 0), :prefetch => InstructionCost(0, 0.0, 0.0, 0), :prefetch0 => InstructionCost(0, 0.0, 0.0, 0), :prefetch1 => InstructionCost(0, 0.0, 0.0, 0), @@ -280,6 +266,10 @@ const COST = Dict{Symbol,InstructionCost}( :significand => InstructionCost(8, 1.0), ) +for f = EXTRACTFUNS + COST[f] = InstructionCost(0, 0.0, 0.0, 0) +end + # # @inline prefetch0(x::Ptr, i) = VectorizationBase.prefetch(x, Val{3}(), Val{0}()) # @inline prefetch0(x, i) = VectorizationBase.prefetch(gep(stridedpointer(x), (data(i),)), Val{3}(), Val{0}()) # @inline prefetch0(x, I::Tuple) = VectorizationBase.prefetch(gep(x, I), Val{3}(), Val{0}()) diff --git a/src/modeling/graphs.jl b/src/modeling/graphs.jl index 2e076fbbb..4f2788df9 100644 --- a/src/modeling/graphs.jl +++ b/src/modeling/graphs.jl @@ -1528,7 +1528,7 @@ function unpack_tuple!(ls::LoopSet, LHS::Expr, RHS, elementbytes::Int, position: end return last(operations(ls)) # FIXME: dummy end - @assert length(LHS.args) ≤ 14 "Functions returning more than 9 values aren't currently supported." + @assert length(LHS.args) ≤ length(EXTRACTFUNS) "Functions returning more than $(length(EXTRACTFUNS)) values aren't currently supported." lhstemp = gensym!(ls, "lhstuple") vparents = Operation[maybe_const_compute!( ls, @@ -1548,22 +1548,7 @@ function unpack_tuple!( position::Int, ) for i ∈ eachindex(LHS.args) - f = ( - :first, - :second, - :third, - :fourth, - :fifth, - :sixth, - :seventh, - :eighth, - :ninth, - :tenth, - :eleventh, - :twelfth, - :thirteenth, - :last, - )[i] + f = EXTRACTFUNS[i] lhsi = LHS.args[i] if lhsi isa Symbol add_compute!(ls, lhsi, f, vparents, elementbytes)