File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -207,10 +207,9 @@ const _kernel_instances = Dict{UInt, Any}()
207207
208208# # kernel launching and argument encoding
209209
210- @inline @generated function encode_arguments! (cce, kernel, args... )
211- ex = quote
212- bufs = MTLBuffer[]
213- end
210+ @inline @generated function encode_arguments! (cce, kernel, args:: Vararg{Any,N} ) where {N}
211+ ex = quote end
212+ buffers = []
214213
215214 # the arguments passed into this function have not been `mtlconvert`ed, because we need
216215 # to retain the top-level MTLBuffer and MtlPtr objects. eager conversion of nested
@@ -230,17 +229,18 @@ const _kernel_instances = Dict{UInt, Any}()
230229 continue
231230 else
232231 # everything else is passed by reference, in an argument buffer
232+ buf = gensym (" buffer" )
233233 append! (ex. args, (quote
234- buf = encode_argument! (kernel, mtlconvert ($ (argex), cce))
235- set_buffer! (cce, buf, 0 , $ idx)
236- push! (bufs, buf)
234+ $ buf = encode_argument! (kernel, mtlconvert ($ (argex), cce))
235+ set_buffer! (cce, $ buf, 0 , $ idx)
237236 end ). args)
237+ push! (buffers, buf)
238238 end
239239 idx += 1
240240 end
241241
242242 append! (ex. args, (quote
243- return bufs
243+ return ( $ (buffers ... ),)
244244 end ). args)
245245
246246 ex
You can’t perform that action at this time.
0 commit comments