@@ -51,7 +51,7 @@ synchronize(backend)
5151```
5252"""
5353macro kernel (expr)
54- __kernel (expr, #= generate_cpu=# true , #= force_inbounds=# false )
54+ return __kernel (expr, #= generate_cpu=# true , #= force_inbounds=# false )
5555end
5656
5757"""
@@ -69,7 +69,7 @@ This allows for two different configurations:
6969"""
7070macro kernel (ex... )
7171 if length (ex) == 1
72- __kernel (ex[1 ], true , false )
72+ return __kernel (ex[1 ], true , false )
7373 else
7474 generate_cpu = true
7575 force_inbounds = false
@@ -89,7 +89,7 @@ macro kernel(ex...)
8989 )
9090 end
9191 end
92- __kernel (ex[end ], generate_cpu, force_inbounds)
92+ return __kernel (ex[end ], generate_cpu, force_inbounds)
9393 end
9494end
9595
@@ -167,7 +167,7 @@ a tuple corresponding to kernel configuration. In order to get
167167the total size you can use `prod(@groupsize())`.
168168"""
169169macro groupsize ()
170- quote
170+ return quote
171171 $ groupsize ($ (esc (:__ctx__ )))
172172 end
173173end
@@ -179,7 +179,7 @@ Query the ndrange on the backend. This function returns
179179a tuple corresponding to kernel configuration.
180180"""
181181macro ndrange ()
182- quote
182+ return quote
183183 $ size ($ ndrange ($ (esc (:__ctx__ ))))
184184 end
185185end
@@ -193,7 +193,7 @@ macro localmem(T, dims)
193193 # Stay in sync with CUDAnative
194194 id = gensym (" static_shmem" )
195195
196- quote
196+ return quote
197197 $ SharedMemory ($ (esc (T)), Val ($ (esc (dims))), Val ($ (QuoteNode (id))))
198198 end
199199end
@@ -214,7 +214,7 @@ macro private(T, dims)
214214 if dims isa Integer
215215 dims = (dims,)
216216 end
217- quote
217+ return quote
218218 $ Scratchpad ($ (esc (:__ctx__ )), $ (esc (T)), Val ($ (esc (dims))))
219219 end
220220end
@@ -226,7 +226,7 @@ Creates a private local of `mem` per item in the workgroup. This can be safely u
226226across [`@synchronize`](@ref) statements.
227227"""
228228macro private (expr)
229- esc (expr)
229+ return esc (expr)
230230end
231231
232232"""
236236that span workitems, or are reused across `@synchronize` statements.
237237"""
238238macro uniform (value)
239- esc (value)
239+ return esc (value)
240240end
241241
242242"""
@@ -247,7 +247,7 @@ from each thread in the workgroup are visible in from all other threads in the
247247workgroup.
248248"""
249249macro synchronize ()
250- quote
250+ return quote
251251 $ __synchronize ()
252252 end
253253end
@@ -264,7 +264,7 @@ workgroup. `cond` is not allowed to have any visible sideffects.
264264 - `CPU`: This synchronization will always occur.
265265"""
266266macro synchronize (cond)
267- quote
267+ return quote
268268 $ (esc (cond)) && $ __synchronize ()
269269 end
270270end
289289```
290290"""
291291macro context ()
292- esc (:(__ctx__))
292+ return esc (:(__ctx__))
293293end
294294
295295"""
@@ -329,7 +329,7 @@ macro print(items...)
329329 end
330330 end
331331
332- quote
332+ return quote
333333 $ __print ($ (map (esc, args)... ))
334334 end
335335end
@@ -385,7 +385,7 @@ macro index(locale, args...)
385385 end
386386
387387 index_function = Symbol (:__index_ , locale, :_ , indexkind)
388- Expr (:call , GlobalRef (KernelAbstractions, index_function), esc (:__ctx__ ), map (esc, args)... )
388+ return Expr (:call , GlobalRef (KernelAbstractions, index_function), esc (:__ctx__ ), map (esc, args)... )
389389end
390390
391391# ##
@@ -591,7 +591,7 @@ struct Kernel{Backend, WorkgroupSize <: _Size, NDRange <: _Size, Fun}
591591end
592592
593593function Base. similar (kernel:: Kernel{D, WS, ND} , f:: F ) where {D, WS, ND, F}
594- Kernel {D, WS, ND, F} (kernel. backend, f)
594+ return Kernel {D, WS, ND, F} (kernel. backend, f)
595595end
596596
597597workgroupsize (:: Kernel{D, WorkgroupSize} ) where {D, WorkgroupSize} = WorkgroupSize
701701 push! (args, item)
702702 end
703703
704- quote
704+ return quote
705705 print ($ (args... ))
706706 end
707707end
0 commit comments