Skip to content

Commit bbed0ce

Browse files
committed
Make @avxt on broadcast not error, support element types of pointers not defined in LV module
1 parent c18ef74 commit bbed0ce

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LoopVectorization"
22
uuid = "bdcacae8-1622-11e9-2a5c-532679323890"
33
authors = ["Chris Elrod <[email protected]>"]
4-
version = "0.12.3"
4+
version = "0.12.4"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/condense_loopset.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ end
303303
::StaticInt{RS}, ::StaticInt{AR}, ::StaticInt{NT},
304304
::StaticInt{CLS}, ::StaticInt{L1}, ::StaticInt{L2}, ::StaticInt{L3}
305305
) where {inline,u₁,u₂,thread,W,RS,AR,CLS,L1,L2,L3,NT}
306-
nt = min(thread, NT % UInt)
306+
nt = min(thread % UInt, NT % UInt)
307307
t = Expr(:tuple, inline, u₁, u₂, W, RS, AR, CLS, L1,L2,L3, nt)
308308
Expr(:call, Expr(:curly, :Val, t))
309309
end

src/reconstruct_loopset.jl

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,6 @@ function rank_to_sortperm(R::NTuple{N,Int}) where {N}
171171
end
172172
sp
173173
end
174-
# sptrs::Expr, ls::LoopSet, ar::ArrayReferenceMeta, @nospecialize(_::Type{Core.LLVMPtr{T,0}}),
175-
function add_mref!(
176-
sptrs::Expr, ls::LoopSet, ar::ArrayReferenceMeta, @nospecialize(_::Type{Ptr{T}}),
177-
C::Int, B::Int, sp::NTuple{N,Int}, name::Symbol
178-
) where {T,N}
179-
Tsym::Symbol = get(VectorizationBase.JULIA_TYPES, T) do
180-
Symbol(T)
181-
end
182-
add_mref_ptr!(sptrs, ls, ar, Tsym, C, B, sp, name)
183-
end
184174
function loop_indexes_bit!(ls::LoopSet, ar::ArrayReferenceMeta)
185175
li = ar.loopedindex;
186176
ind = first(getindices(ar))
@@ -189,17 +179,17 @@ function loop_indexes_bit!(ls::LoopSet, ar::ArrayReferenceMeta)
189179
ls.loopindexesbit[getloopid(ls,ind)] = true
190180
nothing
191181
end
192-
function add_mref_ptr!(
193-
sptrs::Expr, ls::LoopSet, ar::ArrayReferenceMeta, Tsym::Symbol,
182+
function add_mref!(
183+
sptrs::Expr, ls::LoopSet, ar::ArrayReferenceMeta, @nospecialize(_::Type{Ptr{T}}),
194184
C::Int, B::Int, sp::NTuple{N,Int}, name::Symbol
195-
) where {N}
185+
) where {T,N}
196186
@assert B 0 "Batched arrays not supported yet."
197187
# maybe no change needed? -- optimize common case
198188
column_major = ntuple(identity, N)
199189
li = ar.loopedindex;
200190
if sp === column_major || isone(length(li))
201191
# don't set `bit` to true if our vector width is ≥ 8
202-
((Tsym === :Bit) && (ls.vector_width[] < 8)) && loop_indexes_bit!(ls, ar)
192+
((T === VectorizationBase.Bit) && (ls.vector_width[] < 8)) && loop_indexes_bit!(ls, ar)
203193
return extract_gsp!(sptrs, name)
204194
end
205195
permute_mref!(ar, C, sp)
@@ -216,8 +206,8 @@ function add_mref_ptr!(
216206
push!(strd_tup.args, Expr(:call, gf, strides, p, false))
217207
push!(offsets_tup.args, Expr(:call, gf, offsets, p, false))
218208
end
219-
#TODO: fix for `Tsym === Bit`.
220-
sptype = Expr(:curly, lv(:StridedPointer), Tsym, N, (C == -1 ? -1 : 1), B, column_major)
209+
#TODO: fix for `T === Bit`.
210+
sptype = Expr(:curly, lv(:StridedPointer), T, N, (C == -1 ? -1 : 1), B, column_major)
221211
sptr = Expr(:call, sptype, Expr(:call, :pointer, tmpsp), strd_tup, offsets_tup)
222212
pushpreamble!(ls, Expr(:(=), name, sptr))
223213
nothing

0 commit comments

Comments
 (0)