Skip to content

Commit 537325b

Browse files
committed
Pass functions that aren't part of LoopVectorization into _avx_! as arguments instead of referencing them as (externalmod).func.
1 parent ccaf9fe commit 537325b

13 files changed

+99
-38
lines changed

src/add_constants.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function add_constant!(ls::LoopSet, var::Symbol, elementbytes::Int = 8)
1+
function add_constant!(ls::LoopSet, var::Symbol, elementbytes::Int)
22
op = Operation(length(operations(ls)), var, elementbytes, LOOPCONSTANT, constant, NODEPENDENCY, Symbol[], NOPARENTS)
33
pushpreamble!(ls, op, var)
44
pushop!(ls, op, var)
@@ -20,20 +20,20 @@ end
2020
# value is what will get assigned within the loop.
2121
# assignedsym will be assigned to value within the preamble
2222
function add_constant!(
23-
ls::LoopSet, value::Symbol, deps::Vector{Symbol}, assignedsym::Symbol = gensym(:constant), elementbytes::Int = 8, f::Symbol = Symbol("")
23+
ls::LoopSet, value::Symbol, deps::Vector{Symbol}, assignedsym::Symbol, elementbytes::Int, f::Symbol = Symbol("")
2424
)
2525
op = Operation(length(operations(ls)), assignedsym, elementbytes, Instruction(f, value), constant, deps, NODEPENDENCY, NOPARENTS)
2626
pushop!(ls, op, assignedsym)
2727
end
2828
function add_constant!(
29-
ls::LoopSet, value, deps::Vector{Symbol}, assignedsym::Symbol = gensym(:constant), elementbytes::Int = 8, f::Symbol = Symbol("")
29+
ls::LoopSet, value, deps::Vector{Symbol}, assignedsym::Symbol, elementbytes::Int, f::Symbol = Symbol("")
3030
)
3131
intermediary = gensym(:intermediate) # hack, passing meta info here
3232
pushpreamble!(ls, Expr(:(=), intermediary, value))
3333
add_constant!(ls, intermediary, deps, assignedsym, f, elementbytes)
3434
end
3535
function add_constant!(
36-
ls::LoopSet, value::Number, deps::Vector{Symbol}, assignedsym::Symbol = gensym(:constant), elementbytes::Int = 8
36+
ls::LoopSet, value::Number, deps::Vector{Symbol}, assignedsym::Symbol, elementbytes::Int
3737
)
3838
op = add_constant!(ls, gensym(Symbol(value)), deps, assignedsym, elementbytes, :numericconstant)
3939
if iszero(value)

src/add_ifelse.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function add_andblock!(ls::LoopSet, condop::Operation, LHS, RHS::Expr, elementby
3434
add_andblock!(ls, condop, LHS, rhsop, elementbytes, position)
3535
end
3636
function add_andblock!(ls::LoopSet, condop::Operation, LHS, RHS, elementbytes::Int, position::Int)
37-
rhsop = getop(ls, RHS)
37+
rhsop = getop(ls, RHS, elementbytes)
3838
add_andblock!(ls, condop, LHS, rhsop, elementbytes, position)
3939
end
4040
function add_andblock!(ls::LoopSet, condexpr::Expr, condeval::Expr, elementbytes::Int, position::Int)

src/add_loads.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
function add_load!(
3-
ls::LoopSet, var::Symbol, array::Symbol, rawindices, elementbytes::Int = 8
3+
ls::LoopSet, var::Symbol, array::Symbol, rawindices, elementbytes::Int
44
)
55
mpref = array_reference_meta!(ls, array, rawindices, elementbytes)
66
add_load!(ls, var, mpref, elementbytes)
77
end
88
function add_load!(
9-
ls::LoopSet, var::Symbol, mpref::ArrayReferenceMetaPosition, elementbytes::Int = 8
9+
ls::LoopSet, var::Symbol, mpref::ArrayReferenceMetaPosition, elementbytes::Int
1010
)
1111
length(mpref.loopdependencies) == 0 && return add_constant!(ls, var, mpref, elementbytes)
1212
ref = mpref.mref
@@ -27,7 +27,7 @@ end
2727

2828
# for use with broadcasting
2929
function add_simple_load!(
30-
ls::LoopSet, var::Symbol, ref::ArrayReference, elementbytes::Int = 8
30+
ls::LoopSet, var::Symbol, ref::ArrayReference, elementbytes::Int
3131
)
3232
loopdeps = Symbol[s for s ref.indices]
3333
mref = ArrayReferenceMeta(
@@ -41,11 +41,11 @@ function add_simple_load!(
4141
add_vptr!(ls, op)
4242
pushop!(ls, op, var)
4343
end
44-
function add_load_ref!(ls::LoopSet, var::Symbol, ex::Expr, elementbytes::Int = 8)
44+
function add_load_ref!(ls::LoopSet, var::Symbol, ex::Expr, elementbytes::Int)
4545
array, rawindices = ref_from_ref(ex)
4646
add_load!(ls, var, array, rawindices, elementbytes)
4747
end
48-
function add_load_getindex!(ls::LoopSet, var::Symbol, ex::Expr, elementbytes::Int = 8)
48+
function add_load_getindex!(ls::LoopSet, var::Symbol, ex::Expr, elementbytes::Int)
4949
array, rawindices = ref_from_getindex(ex)
5050
add_load!(ls, var, array, rawindices, elementbytes)
5151
end

src/add_stores.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function add_copystore!(
2121
end
2222

2323
function add_store!(
24-
ls::LoopSet, var::Symbol, mpref::ArrayReferenceMetaPosition, elementbytes::Int = 8, parent = getop(ls, var, mpref.loopdependencies, elementbytes)
24+
ls::LoopSet, var::Symbol, mpref::ArrayReferenceMetaPosition, elementbytes::Int, parent = getop(ls, var, mpref.loopdependencies, elementbytes)
2525
)
2626
isload(parent) && return add_copystore!(ls, parent, mpref, elementbytes)
2727
parents = mpref.parents
@@ -51,12 +51,12 @@ function add_store!(
5151
end
5252

5353
function add_store!(
54-
ls::LoopSet, var::Symbol, array::Symbol, rawindices, elementbytes::Int = 8
54+
ls::LoopSet, var::Symbol, array::Symbol, rawindices, elementbytes::Int
5555
)
5656
mpref = array_reference_meta!(ls, array, rawindices, elementbytes)
5757
add_store!(ls, var, mpref, elementbytes)
5858
end
59-
function add_simple_store!(ls::LoopSet, var::Symbol, ref::ArrayReference, elementbytes::Int = 8)
59+
function add_simple_store!(ls::LoopSet, var::Symbol, ref::ArrayReference, elementbytes::Int)
6060
mref = ArrayReferenceMeta(
6161
ref, fill(true, length(getindices(ref)))
6262
)
@@ -65,19 +65,19 @@ function add_simple_store!(ls::LoopSet, var::Symbol, ref::ArrayReference, elemen
6565
op = Operation( ls, name(mref), elementbytes, :setindex!, memstore, ldref, NODEPENDENCY, parents, mref )
6666
add_unique_store!(ls, op)
6767
end
68-
function add_store_ref!(ls::LoopSet, var::Symbol, ex::Expr, elementbytes::Int = 8)
68+
function add_store_ref!(ls::LoopSet, var::Symbol, ex::Expr, elementbytes::Int)
6969
array, raw_indices = ref_from_ref(ex)
7070
add_store!(ls, var, array, raw_indices, elementbytes)
7171
end
72-
function add_store_ref!(ls::LoopSet, var, ex::Expr, elementbytes::Int = 8)
72+
function add_store_ref!(ls::LoopSet, var, ex::Expr, elementbytes::Int)
7373
# array, raw_indices = ref_from_ref(ex)
7474
# mpref = array_reference_meta!(ls, array, raw_indices, elementbytes)
7575
# c = add_constant!(ls, var, loopdependencies(mpref), gensym(:storeconst), elementbytes)
7676
# add_store!(ls, name(c), mpref, elementbytes)
7777
c = add_constant!(ls, var, elementbytes)
7878
add_store_ref!(ls, name(c), ex, elementbytes)
7979
end
80-
function add_store_setindex!(ls::LoopSet, ex::Expr, elementbytes::Int = 8)
80+
function add_store_setindex!(ls::LoopSet, ex::Expr, elementbytes::Int)
8181
array, raw_indices = ref_from_setindex(ex)
8282
add_store!(ls, (ex.args[2])::Symbol, array, rawindices, elementbytes)
8383
end

src/broadcast.jl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ end
4141
# TODO: Need to make this handle A or B being (1 or 2)-D broadcast objects.
4242
function add_broadcast!(
4343
ls::LoopSet, mC::Symbol, bcname::Symbol, loopsyms::Vector{Symbol},
44-
::Type{Product{A,B}}, elementbytes::Int = 8
44+
::Type{Product{A,B}}, elementbytes::Int
4545
) where {A, B}
4646
K = gensym(:K)
4747
mA = gensym(:Aₘₖ)
@@ -97,52 +97,52 @@ function LowDimArray{D}(data::A) where {D,T,N,A <: AbstractArray{T,N}}
9797
end
9898
function add_broadcast!(
9999
ls::LoopSet, destname::Symbol, bcname::Symbol, loopsyms::Vector{Symbol},
100-
::Type{<:LowDimArray{D,T,N}}, elementbytes::Int = 8
100+
::Type{<:LowDimArray{D,T,N}}, elementbytes::Int
101101
) where {D,T,N}
102102
fulldims = Symbol[loopsyms[n] for n 1:N if D[n]]
103103
ref = ArrayReference(bcname, fulldims)
104104
add_simple_load!(ls, destname, ref, elementbytes )::Operation
105105
end
106106
function add_broadcast_adjoint_array!(
107-
ls::LoopSet, destname::Symbol, bcname::Symbol, loopsyms::Vector{Symbol}, ::Type{A}, elementbytes::Int = 8
107+
ls::LoopSet, destname::Symbol, bcname::Symbol, loopsyms::Vector{Symbol}, ::Type{A}, elementbytes::Int
108108
) where {T,N,A<:AbstractArray{T,N}}
109109
parent = gensym(:parent)
110110
pushpreamble!(ls, Expr(:(=), parent, Expr(:call, :parent, bcname)))
111111
ref = ArrayReference(parent, Symbol[loopsyms[N + 1 - n] for n 1:N])
112112
add_simple_load!( ls, destname, ref, elementbytes )::Operation
113113
end
114114
function add_broadcast_adjoint_array!(
115-
ls::LoopSet, destname::Symbol, bcname::Symbol, loopsyms::Vector{Symbol}, ::Type{<:AbstractVector}, elementbytes::Int = 8
115+
ls::LoopSet, destname::Symbol, bcname::Symbol, loopsyms::Vector{Symbol}, ::Type{<:AbstractVector}, elementbytes::Int
116116
)
117117
ref = ArrayReference(bcname, Symbol[loopsyms[2]])
118118
add_simple_load!( ls, destname, ref, elementbytes )
119119
end
120120
function add_broadcast!(
121121
ls::LoopSet, destname::Symbol, bcname::Symbol, loopsyms::Vector{Symbol},
122-
::Type{Adjoint{T,A}}, elementbytes::Int = 8
122+
::Type{Adjoint{T,A}}, elementbytes::Int
123123
) where {T, A <: AbstractArray{T}}
124124
add_broadcast_adjoint_array!( ls, destname, bcname, loopsyms, A, elementbytes )
125125
end
126126
function add_broadcast!(
127127
ls::LoopSet, destname::Symbol, bcname::Symbol, loopsyms::Vector{Symbol},
128-
::Type{Transpose{T,A}}, elementbytes::Int = 8
128+
::Type{Transpose{T,A}}, elementbytes::Int
129129
) where {T, A <: AbstractArray{T}}
130130
add_broadcast_adjoint_array!( ls, destname, bcname, loopsyms, A, elementbytes )
131131
end
132132
function add_broadcast!(
133133
ls::LoopSet, destname::Symbol, bcname::Symbol, loopsyms::Vector{Symbol},
134-
::Type{<:AbstractArray{T,N}}, elementbytes::Int = 8
134+
::Type{<:AbstractArray{T,N}}, elementbytes::Int
135135
) where {T,N}
136136
add_simple_load!(ls, destname, ArrayReference(bcname, @view(loopsyms[1:N])), elementbytes)
137137
end
138138
function add_broadcast!(
139-
ls::LoopSet, ::Symbol, bcname::Symbol, loopsyms::Vector{Symbol}, ::Type{T}, elementbytes::Int = 8
139+
ls::LoopSet, ::Symbol, bcname::Symbol, loopsyms::Vector{Symbol}, ::Type{T}, elementbytes::Int
140140
) where {T<:Number}
141141
add_constant!(ls, bcname, elementbytes) # or replace elementbytes with sizeof(T) ? u
142142
end
143143
function add_broadcast!(
144144
ls::LoopSet, destname::Symbol, bcname::Symbol, loopsyms::Vector{Symbol},
145-
::Type{SubArray{T,N,A,S,B}}, elementbytes::Int = 8
145+
::Type{SubArray{T,N,A,S,B}}, elementbytes::Int
146146
) where {T,N,N2,A<:AbstractArray{T,N2},B,N3,S <: Tuple{Int,Vararg{Any,N3}}}
147147
inds = Vector{Symbol}(undef, N+1)
148148
inds[1] = Symbol("##DISCONTIGUOUSSUBARRAY##")
@@ -152,10 +152,12 @@ end
152152
function add_broadcast!(
153153
ls::LoopSet, destname::Symbol, bcname::Symbol, loopsyms::Vector{Symbol},
154154
::Type{Broadcasted{S,Nothing,F,A}},
155-
elementbytes::Int = 8
155+
elementbytes::Int
156156
) where {N,S<:Base.Broadcast.AbstractArrayStyle{N},F,A}
157157
instr = get(FUNCTIONSYMBOLS, F) do
158-
Instruction(bcname, :f)
158+
f = gensym(:func)
159+
pushpreamble!(ls, Expr(:(=), f, Expr(:(.), bcname, QuoteNode(:f))))
160+
Instruction(Symbol(""), f)
159161
end
160162
args = A.parameters
161163
Nargs = length(args)

src/condense_loopset.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,16 @@ function add_reassigned_syms!(q::Expr, ls::LoopSet)
167167
end
168168
end
169169
end
170+
function add_external_functions!(q::Expr, ls::LoopSet)
171+
for op operations(ls)
172+
if iscompute(op)
173+
instr = instruction(op)
174+
if instr.mod !== :LoopVectorization
175+
push!(q.args, Expr(:(.), instr.mod, QuoteNode(instr.instr)))
176+
end
177+
end
178+
end
179+
end
170180

171181
# Try to condense in type stable manner
172182
function generate_call(ls::LoopSet, IUT)
@@ -189,6 +199,7 @@ function generate_call(ls::LoopSet, IUT)
189199
foreach(is -> push!(q.args, last(is)), ls.preamble_symsym)
190200
append!(q.args, arraysymbolinds)
191201
add_reassigned_syms!(q, ls)
202+
add_external_functions!(q, ls)
192203
q
193204
end
194205

src/costs.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ struct Instruction
1313
end
1414
Instruction(instr::Symbol) = Instruction(:LoopVectorization, instr)
1515
Base.convert(::Type{Instruction}, instr::Symbol) = Instruction(instr)
16-
lower(instr::Instruction) = Expr(:(.), instr.mod, QuoteNode(instr.instr))
17-
Base.Expr(instr::Instruction, args...) = Expr(:call, lower(instr), args...)::Expr
16+
# lower(instr::Instruction) = Expr(:(.), instr.mod, QuoteNode(instr.instr))
17+
function Base.Expr(instr::Instruction, args...)
18+
if instr.mod === :LoopVectorization
19+
Expr(:call, lv(instr.instr), args...)::Expr
20+
else
21+
Expr(:call, instr.instr, args...)::Expr
22+
end
23+
end
1824
Base.hash(instr::Instruction, h::UInt64) = hash(instr.instr, hash(instr.mod, h))
1925
function Base.isless(instr1::Instruction, instr2::Instruction)
2026
if instr1.mod === instr2.mod
@@ -122,6 +128,9 @@ const COST = Dict{Instruction,InstructionCost}(
122128
Instruction(:(<)) => InstructionCost(1, 0.5),
123129
Instruction(:(>=)) => InstructionCost(1, 0.5),
124130
Instruction(:(<=)) => InstructionCost(1, 0.5),
131+
Instruction(:>>) => InstructionCost(1, 0.5),
132+
Instruction(:>>>) => InstructionCost(1, 0.5),
133+
Instruction(:<<) => InstructionCost(1, 0.5),
125134
Instruction(:ifelse) => InstructionCost(1, 0.5),
126135
Instruction(:vifelse) => InstructionCost(1, 0.5),
127136
Instruction(:inv) => InstructionCost(13,4.0,-2.0,1),
@@ -159,7 +168,7 @@ const COST = Dict{Instruction,InstructionCost}(
159168
Instruction(:sincospi_fast) => InstructionCost(25,22.0,70.0,26),
160169
Instruction(:identity) => InstructionCost(0,0.0,0.0,0),
161170
Instruction(:adjoint) => InstructionCost(0,0.0,0.0,0),
162-
Instruction(:transpose) => InstructionCost(0,0.0,0.0,0),
171+
Instruction(:transpose) => InstructionCost(0,0.0,0.0,0)
163172
# Symbol("##CONSTANT##") => InstructionCost(0,0.0)
164173
)
165174

src/graphs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@ Base.length(ls::LoopSet, s::Symbol) = length(getloop(ls, s))
257257
isstaticloop(ls::LoopSet, s::Symbol) = isstaticloop(getloop(ls,s))
258258
looprangehint(ls::LoopSet, s::Symbol) = length(getloop(ls, s))
259259
looprangesym(ls::LoopSet, s::Symbol) = getloop(ls, s).rangesym
260-
function getop(ls::LoopSet, var::Symbol, elementbytes::Int = 8)
260+
function getop(ls::LoopSet, var::Symbol, elementbytes::Int)
261261
get!(ls.opdict, var) do
262262
add_constant!(ls, var, elementbytes)
263263
end
264264
end
265-
function getop(ls::LoopSet, var::Symbol, deps, elementbytes::Int = 8)
265+
function getop(ls::LoopSet, var::Symbol, deps, elementbytes::Int)
266266
get!(ls.opdict, var) do
267267
add_constant!(ls, var, deps, gensym(:constant), elementbytes)
268268
end

src/lowering.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function gc_preserve(ls::LoopSet, q::Expr)
209209
for array ls.includedarrays
210210
push!(gcp.args, array)
211211
end
212-
push!(q.args, nothing)
212+
q.head === :block && push!(q.args, nothing)
213213
push!(gcp.args, q)
214214
Expr(:block, gcp)
215215
end

src/memory_ops_common.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function array_reference_meta!(ls::LoopSet, array::Symbol, rawindices, elementby
6060
mref = ArrayReferenceMeta(ArrayReference( array, indices ), loopedindex, vptrarray)
6161
ArrayReferenceMetaPosition(mref, parents, loopdependencies, reduceddeps)
6262
end
63-
function tryrefconvert(ls::LoopSet, ex::Expr, elementbytes::Int = 8)::Tuple{Bool,ArrayReferenceMetaPosition}
63+
function tryrefconvert(ls::LoopSet, ex::Expr, elementbytes::Int)::Tuple{Bool,ArrayReferenceMetaPosition}
6464
ya, yinds = if ex.head === :ref
6565
ref_from_ref(ex)
6666
elseif ex.head === :call

src/operation_evaluation_order.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11

2+
# struct ParentsBeforeChildrenIterator
3+
# ops::Vector{Operation}
4+
# visited::Vector{Bool}
5+
# end
6+
# function iterate(pbci::ParentsBeforeChildrenIterator)
7+
# for (i,op) ∈ enumerate(pbci.ops)
8+
# if iszero(length(parents(op)))
9+
# pbci.visited[i] = true
10+
# return op, pbci
11+
# end
12+
# end
13+
# nothing
14+
# end
15+
# function iterate()
16+
17+
# end
18+
219
function set_upstream_family!(adal::Vector{T}, op::Operation, val::T, ld::Vector{Symbol}, id::Int) where {T}
320
adal[identifier(op)] == val && return # must already have been set
421
# ld != loopdependencies(op) &&

src/reconstruct_loopset.jl

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ end
113113
function num_parameters(AM)
114114
num_param::Int = AM[1]
115115
num_param += length(AM[2].parameters)
116-
num_param + length(AM[4].parameters)
116+
num_param + length(AM[3].parameters)
117117
end
118118
function process_metadata!(ls::LoopSet, AM, num_arrays::Int)::Vector{Symbol}
119119
num_asi = (AM[1])::Int
@@ -122,7 +122,7 @@ function process_metadata!(ls::LoopSet, AM, num_arrays::Int)::Vector{Symbol}
122122
for (i,si) enumerate(AM[3].parameters)
123123
sii = si::Int
124124
s = gensym(:symlicm)
125-
push!(ls.preamble_symsym, (si,s))
125+
push!(ls.preamble_symsym, (si, s))
126126
pushpreamble!(ls, Expr(:(=), s, Expr(:macrocall, Symbol("@inbounds"), LineNumberNode(@__LINE__,@__FILE__), Expr(:ref, :vargs, num_arrays + i))))
127127
end
128128
append!(ls.preamble_symint, AM[4].parameters)
@@ -179,6 +179,7 @@ function add_parents_to_ops!(ls::LoopSet, ops::Vector{OperationStruct}, constoff
179179
end
180180
end
181181
end
182+
constoffset
182183
end
183184
function add_ops!(
184185
ls::LoopSet, instr::Vector{Instruction}, ops::Vector{OperationStruct}, mrefs::Vector{ArrayReferenceMeta}, opsymbols::Vector{Symbol}, constoffset::Int, elementbytes::Int
@@ -200,6 +201,18 @@ function add_array_symbols!(ls::LoopSet, arraysymbolinds::Vector{Symbol}, offset
200201
pushpreamble!(ls, Expr(:(=), as, Expr(:macrocall, Symbol("@inbounds"), LineNumberNode(@__LINE__, @__FILE__), Expr(:ref, :vargs, i + offset))))
201202
end
202203
end
204+
function extract_external_functions!(ls::LoopSet, offset::Int)
205+
for op operations(ls)
206+
if iscompute(op)
207+
instr = instruction(op)
208+
if instr.mod != :LoopVectorization
209+
offset += 1
210+
pushpreamble!(ls, Expr(:(=), instr.instr, Expr(:macrocall, Symbol("@inbounds"), LineNumberNode(@__LINE__, @__FILE__), Expr(:ref, :vargs, offset))))
211+
end
212+
end
213+
end
214+
offset
215+
end
203216
function sizeofeltypes(v, num_arrays)::Int
204217
T = typeeltype(v[1])
205218
for i 2:num_arrays
@@ -219,8 +232,11 @@ function avx_body(IUT, instr, ops, arf, AM, LB, vargs)
219232
opsymbols = [gensym(:op) for _ eachindex(ops)]
220233
mrefs = create_mrefs!(ls, arf, arraysymbolinds, opsymbols, vargs)
221234
pushpreamble!(ls, Expr(:(=), ls.T, Expr(:call, :promote_type, [Expr(:call, :eltype, vptr(mref)) for mref mrefs]...)))
222-
add_ops!(ls, instr, ops, mrefs, opsymbols, num_arrays + num_parameters(AM), elementbytes)
235+
num_params = num_arrays + num_parameters(AM)
236+
num_params = add_ops!(ls, instr, ops, mrefs, opsymbols, num_params, elementbytes)
223237
add_array_symbols!(ls, arraysymbolinds, num_arrays + length(ls.preamble_symsym))
238+
num_params
239+
num_params = extract_external_functions!(ls, num_params)
224240
inline, U, T = IUT
225241
q = iszero(U) ? lower(ls, inline) : lower(ls, U, T, inline)
226242
length(ls.outer_reductions) == 0 ? push!(q.args, nothing) : push!(q.args, loopset_return_value(ls, Val(true)))

0 commit comments

Comments
 (0)