Skip to content

Commit 86c18fc

Browse files
committed
Format
1 parent 8861658 commit 86c18fc

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

src/KernelAbstractions.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,8 @@ end
248248
Declare storage that is local to a workgroup.
249249
"""
250250
macro localmem(T, dims)
251-
# Stay in sync with CUDAnative
252-
# id = gensym("static_shmem")
253-
254251
return quote
255-
$SharedMemory($(esc(T)), Val($(esc(dims))))#, Val($(QuoteNode(id))))
252+
$SharedMemory($(esc(T)), Val($(esc(dims))))
256253
end
257254
end
258255

src/intrinsics.jl

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ Declare memory that is local to a workgroup.
6666
```
6767
As well as the on-device functionality.
6868
"""
69-
localmemory(::Type{T}, dims) where T = localmemory(T, Val(dims))
70-
# @inline localmemory(::Type{T}, dims::Val{Dims}) where {T, Dims} = localmemory(T, dims, Val(gensym("static_shmem")))
69+
localmemory(::Type{T}, dims) where {T} = localmemory(T, Val(dims))
7170

7271
"""
7372
barrier()
@@ -110,7 +109,6 @@ end
110109
end
111110

112111

113-
114112
"""
115113
KIKernel{Backend, BKern}
116114
@@ -235,7 +233,7 @@ There are a few keyword arguments that influence the behavior of `@kikernel`:
235233
"""
236234
macro kikernel(backend, ex...)
237235
call = ex[end]
238-
kwargs = map(ex[1:end-1]) do kwarg
236+
kwargs = map(ex[1:(end - 1)]) do kwarg
239237
if kwarg isa Symbol
240238
:($kwarg = $kwarg)
241239
elseif Meta.isexpr(kwarg, :(=))
@@ -257,14 +255,14 @@ macro kikernel(backend, ex...)
257255
macro_kwargs, compiler_kwargs, call_kwargs, other_kwargs =
258256
split_kwargs(kwargs, MACRO_KWARGS, COMPILER_KWARGS, LAUNCH_KWARGS)
259257
if !isempty(other_kwargs)
260-
key,val = first(other_kwargs).args
258+
key, val = first(other_kwargs).args
261259
throw(ArgumentError("Unsupported keyword argument '$key'"))
262260
end
263261

264262
# handle keyword arguments that influence the macro's behavior
265263
launch = true
266264
for kwarg in macro_kwargs
267-
key,val = kwarg.args
265+
key, val = kwarg.args
268266
if key === :launch
269267
isa(val, Bool) || throw(ArgumentError("`launch` keyword argument to @kikern should be a Bool"))
270268
launch = val::Bool
@@ -282,7 +280,8 @@ macro kikernel(backend, ex...)
282280

283281
# convert the arguments, call the compiler and launch the kernel
284282
# while keeping the original arguments alive
285-
push!(code.args,
283+
push!(
284+
code.args,
286285
quote
287286
$f_var = $f
288287
GC.@preserve $(vars...) $f_var begin
@@ -295,13 +294,16 @@ macro kikernel(backend, ex...)
295294
end
296295
$kernel
297296
end
298-
end)
297+
end
298+
)
299299

300-
return esc(quote
301-
let
302-
$code
300+
return esc(
301+
quote
302+
let
303+
$code
304+
end
303305
end
304-
end)
306+
)
305307
end
306308

307309
end

src/pocl/backend.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,32 +141,32 @@ end
141141

142142
KI.kiconvert(::POCLBackend, arg) = clconvert(arg)
143143

144-
function KI.kifunction(::POCLBackend, f::F, tt::TT=Tuple{}; name=nothing, kwargs...) where {F,TT}
144+
function KI.kifunction(::POCLBackend, f::F, tt::TT = Tuple{}; name=nothing, kwargs...) where {F, TT}
145145
kern = clfunction(f, tt; name, kwargs...)
146146
KI.KIKernel{POCLBackend, typeof(kern)}(POCLBackend(), kern)
147147
end
148148

149-
function (obj::KI.KIKernel{POCLBackend})(args...; numworkgroups=nothing, workgroupsize=nothing)
149+
function (obj::KI.KIKernel{POCLBackend})(args...; numworkgroups = nothing, workgroupsize = nothing)
150150
local_size = isnothing(workgroupsize) ? 1 : workgroupsize
151151
global_size = if isnothing(numworkgroups)
152152
1
153153
else
154-
numworkgroups*local_size
154+
numworkgroups * local_size
155155
end
156156

157-
obj.kern(args...; local_size, global_size)
157+
return obj.kern(args...; local_size, global_size)
158158
end
159159

160160

161-
function KI.kernel_max_work_group_size(::POCLBackend, kikern::KI.KIKernel{<:POCLBackend}; max_work_items::Int=typemax(Int))::Int
161+
function KI.kernel_max_work_group_size(::POCLBackend, kikern::KI.KIKernel{<:POCLBackend}; max_work_items::Int = typemax(Int))::Int
162162
wginfo = cl.work_group_info(kikern.kern.fun, device())
163-
Int(min(wginfo.size, max_work_items))
163+
return Int(min(wginfo.size, max_work_items))
164164
end
165165
function KI.max_work_group_size(::POCLBackend)::Int
166-
Int(device().max_work_group_size)
166+
return Int(device().max_work_group_size)
167167
end
168168
function KI.multiprocessor_count(::POCLBackend)::Int
169-
Int(device().max_compute_units)
169+
return Int(device().max_compute_units)
170170
end
171171

172172
## Indexing Functions

test/intrinsics.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ function intrinsics_testsuite(backend, AT)
3030
# Test with small kernel
3131
N = 16
3232
results = AT(zeros(Int, 6, N))
33-
kernel = KI.@kikernel backend() launch=false test_intrinsics_kernel(results)
33+
kernel = KI.@kikernel backend() launch = false test_intrinsics_kernel(results)
3434

3535
@test KI.kernel_max_work_group_size(backend(), kernel) isa Int
36-
@test KI.kernel_max_work_group_size(backend(), kernel; max_work_items=1) == 1
36+
@test KI.kernel_max_work_group_size(backend(), kernel; max_work_items = 1) == 1
3737

3838
kernel(results, workgroupsize = 4, numworkgroups = 4)
3939
KernelAbstractions.synchronize(backend())
@@ -66,4 +66,5 @@ function intrinsics_testsuite(backend, AT)
6666
end
6767
end
6868
end
69+
return nothing
6970
end

0 commit comments

Comments
 (0)