@@ -113,11 +113,11 @@ function _build_function(target::JuliaTarget, op, args...;
113
113
expr = if cse
114
114
fun = Func (dargs, [], Code. cse (unwrap (op)))
115
115
(wrap_code != = nothing ) && (fun = wrap_code (fun))
116
- toexpr (fun, states)
116
+ conv (fun, states)
117
117
else
118
118
fun = Func (dargs, [], op)
119
119
(wrap_code != = nothing ) && (fun = wrap_code (fun))
120
- toexpr (fun, states)
120
+ conv (fun, states)
121
121
end
122
122
123
123
if expression == Val{true }
@@ -142,14 +142,14 @@ function _build_function(target::JuliaTarget, op::Union{Arr, ArrayOp}, args...;
142
142
Symbol (" ˍ₋arg$(x[1 ]) " )), enumerate ([args... ]))
143
143
144
144
expr = if cse
145
- toexpr (Func (dargs, [], Code. cse (unwrap (op))), states)
145
+ conv (Func (dargs, [], Code. cse (unwrap (op))), states)
146
146
else
147
- toexpr (Func (dargs, [], op), states)
147
+ conv (Func (dargs, [], op), states)
148
148
end
149
149
150
150
outsym = Symbol (" ˍ₋out" )
151
151
body = inplace_expr (unwrap (op), outsym)
152
- oop_expr = toexpr (Func ([outsym, dargs... ], [], body), states)
152
+ oop_expr = conv (Func ([outsym, dargs... ], [], body), states)
153
153
154
154
N = length (shape (op))
155
155
op = unwrap (op)
@@ -161,7 +161,7 @@ function _build_function(target::JuliaTarget, op::Union{Arr, ArrayOp}, args...;
161
161
$ outsym
162
162
end ) |> LiteralExpr
163
163
end
164
- ip_expr = toexpr (Func (dargs, [], op_body), states)
164
+ ip_expr = conv (Func (dargs, [], op_body), states)
165
165
if expression == Val{true }
166
166
oop_expr, ip_expr
167
167
else
@@ -194,11 +194,28 @@ function fill_array_with_zero!(x::AbstractArray)
194
194
end
195
195
196
196
"""
197
+ _build_function(target::JuliaTarget, rhss::AbstractArray, args...;
198
+ conv=toexpr,
199
+ expression = Val{true},
200
+ expression_module = @__MODULE__(),
201
+ checkbounds = false,
202
+ postprocess_fbody=ex -> ex,
203
+ linenumbers = false,
204
+ outputidxs=nothing,
205
+ skipzeros = false,
206
+ force_SA = false,
207
+ wrap_code = (nothing, nothing),
208
+ fillzeros = skipzeros && !(rhss isa SparseMatrixCSC),
209
+ states = LazyState(),
210
+ iip_config = (true, true),
211
+ parallel=nothing, cse = false, kwargs...)
212
+
197
213
Build function target: `JuliaTarget`
198
214
199
215
```julia
200
216
function _build_function(target::JuliaTarget, rhss, args...;
201
- conv = toexpr, expression = Val{true},
217
+ conv = toexpr,
218
+ expression = Val{true},
202
219
checkbounds = false,
203
220
linenumbers = false,
204
221
headerfun = addheader, outputidxs=nothing,
@@ -250,6 +267,7 @@ Special Keyword Arguments:
250
267
safety with `skipzeros`.
251
268
"""
252
269
function _build_function (target:: JuliaTarget , rhss:: AbstractArray , args... ;
270
+ conv= toexpr,
253
271
expression = Val{true },
254
272
expression_module = @__MODULE__ (),
255
273
checkbounds = false ,
@@ -303,10 +321,10 @@ function _build_function(target::JuliaTarget, rhss::AbstractArray, args...;
303
321
end
304
322
305
323
if expression == Val{true }
306
- return toexpr (oop_expr, states), toexpr (ip_expr, states)
324
+ return conv (oop_expr, states), conv (ip_expr, states)
307
325
else
308
- return _build_and_inject_function (expression_module, toexpr (oop_expr, states)),
309
- _build_and_inject_function (expression_module, toexpr (ip_expr, states))
326
+ return _build_and_inject_function (expression_module, conv (oop_expr, states)),
327
+ _build_and_inject_function (expression_module, conv (ip_expr, states))
310
328
end
311
329
end
312
330
0 commit comments