Skip to content

Commit 97d5721

Browse files
committed
inline broadcast
1 parent c8aab0e commit 97d5721

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
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.7"
4+
version = "0.12.8"
55

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

src/broadcast.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ end
409409
doaddref!(ls, storeop)
410410
resize!(ls.loop_order, num_loops(ls)) # num_loops may be greater than N, eg Product
411411
# return ls
412-
Expr(:block, setup_call(ls, :(Base.Broadcast.materialize!(dest, bc)), LineNumberNode(0), inline, false, u₁, u₂, threads%Int), :dest)
412+
Expr(:block, Expr(:meta,:inline), setup_call(ls, :(Base.Broadcast.materialize!(dest, bc)), LineNumberNode(0), inline, false, u₁, u₂, threads%Int), :dest)
413413
end
414414
@generated function vmaterialize!(
415415
dest′::Union{Adjoint{T,A},Transpose{T,A}}, bc::BC, ::Val{Mod}, ::Val{UNROLL}
@@ -428,7 +428,7 @@ end
428428
storeop = add_simple_store!(ls, :dest, ArrayReference(:dest, reverse(loopsyms)), elementbytes)
429429
doaddref!(ls, storeop)
430430
resize!(ls.loop_order, num_loops(ls)) # num_loops may be greater than N, eg Product
431-
Expr(:block, setup_call(ls, :(Base.Broadcast.materialize!(dest′, bc)), LineNumberNode(0), inline, false, u₁, u₂, threads%Int), :dest′)
431+
Expr(:block, Expr(:meta,:inline), setup_call(ls, :(Base.Broadcast.materialize!(dest′, bc)), LineNumberNode(0), inline, false, u₁, u₂, threads%Int), :dest′)
432432
end
433433
# these are marked `@inline` so the `@avx` itself can choose whether or not to inline.
434434
@generated function vmaterialize!(

src/constructors.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,21 @@ function check_macro_kwarg(arg, inline::Bool, check_empty::Bool, u₁::Int8, u
105105
end
106106
inline, check_empty, u₁, u₂, threads
107107
end
108-
function avx_macro(mod, src, q, args...)
109-
q = macroexpand(mod, q)
110-
inline = false; check_empty = false; u₁ = zero(Int8); u₂ = zero(Int8); threads = 1;
108+
function process_args(args; inline = false, check_empty = false, u₁ = zero(Int8), u₂ = zero(Int8), threads = 1)
111109
for arg args
112110
inline, check_empty, u₁, u₂, threads = check_macro_kwarg(arg, inline, check_empty, u₁, u₂, threads)
113111
end
112+
inline, check_empty, u₁, u₂, threads
113+
end
114+
function avx_macro(mod, src, q, args...)
115+
q = macroexpand(mod, q)
116+
114117
if q.head === :for
115118
ls = LoopSet(q, mod)
119+
inline, check_empty, u₁, u₂, threads = process_args(args)
116120
esc(setup_call(ls, q, src, inline, check_empty, u₁, u₂, threads))
117121
else
122+
inline, check_empty, u₁, u₂, threads = process_args(args, inline=true)
118123
substitute_broadcast(q, Symbol(mod), inline, u₁, u₂, threads)
119124
end
120125
end

0 commit comments

Comments
 (0)