Skip to content

Commit 1516dce

Browse files
authored
Fix indicies->indices typo everywhere (#567)
1 parent dff7afe commit 1516dce

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

Diff for: docs/src/design.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- `ldg` on the GPU
99
- `@aliasscopes` on the CPU
1010

11-
- Cartesian or Linear indicies supported
11+
- Cartesian or Linear indices supported
1212
- `@index(Linear)
1313
- `@index(Cartesian)
1414
- `@synchronize` for inserting workgroup-level synchronization

Diff for: docs/src/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The `CPU` backend always had this limitation and upon investigation the CUDA bac
5858
but allows for a wider set of valid kernels.
5959

6060
This highlighted a design flaw in KernelAbstractions. Most GPU implementations execute KernelAbstraction workgroups on static blocks
61-
This means a kernel with `ndrange=(32, 30)` might be executed on a static block of `(32,32)`. In order to block these extra indicies,
61+
This means a kernel with `ndrange=(32, 30)` might be executed on a static block of `(32,32)`. In order to block these extra indices,
6262
KernelAbstraction would insert a dynamic boundscheck.
6363

6464
Prior to v0.9.34 a kernel like
@@ -118,7 +118,7 @@ Since this transformation can be disruptive, user can now opt out of the implici
118118
but users must avoid the use of `@index(Global)` and instead use their own derivation based on `@index(Group)` and `@index(Local)`.
119119

120120
```julia
121-
@kernel unsafe_indicies=true function localmem(A)
121+
@kernel unsafe_indices=true function localmem(A)
122122
N = @uniform prod(@groupsize())
123123
gI = @index(Group, Linear)
124124
i = @index(Local, Linear)

Diff for: src/KernelAbstractions.jl

+7-7
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ synchronize(backend)
5050
```
5151
"""
5252
macro kernel(expr)
53-
return __kernel(expr, #=generate_cpu=# true, #=force_inbounds=# false, #=unsafe_indicies=# false)
53+
return __kernel(expr, #=generate_cpu=# true, #=force_inbounds=# false, #=unsafe_indices=# false)
5454
end
5555

5656
"""
@@ -60,7 +60,7 @@ This allows for two different configurations:
6060
6161
1. `cpu={true, false}`: Disables code-generation of the CPU function. This relaxes semantics such that KernelAbstractions primitives can be used in non-kernel functions.
6262
2. `inbounds={false, true}`: Enables a forced `@inbounds` macro around the function definition in the case the user is using too many `@inbounds` already in their kernel. Note that this can lead to incorrect results, crashes, etc and is fundamentally unsafe. Be careful!
63-
3. `unsafe_indicies={false, true}`: Disables the implicit validation of indicies, users must avoid `@index(Global)`.
63+
3. `unsafe_indices={false, true}`: Disables the implicit validation of indices, users must avoid `@index(Global)`.
6464
6565
- [`@context`](@ref)
6666
@@ -72,7 +72,7 @@ macro kernel(ex...)
7272
return __kernel(ex[1], true, false, false)
7373
else
7474
generate_cpu = true
75-
unsafe_indicies = false
75+
unsafe_indices = false
7676
force_inbounds = false
7777
for i in 1:(length(ex) - 1)
7878
if ex[i] isa Expr && ex[i].head == :(=) &&
@@ -82,19 +82,19 @@ macro kernel(ex...)
8282
ex[i].args[1] == :inbounds && ex[i].args[2] isa Bool
8383
force_inbounds = ex[i].args[2]
8484
elseif ex[i] isa Expr && ex[i].head == :(=) &&
85-
ex[i].args[1] == :unsafe_indicies && ex[i].args[2] isa Bool
86-
unsafe_indicies = ex[i].args[2]
85+
ex[i].args[1] == :unsafe_indices && ex[i].args[2] isa Bool
86+
unsafe_indices = ex[i].args[2]
8787
else
8888
error(
8989
"Configuration should be of form:\n" *
9090
"* `cpu=false`\n" *
9191
"* `inbounds=true`\n" *
92-
"* `unsafe_indicies=true`\n" *
92+
"* `unsafe_indices=true`\n" *
9393
"got `", ex[i], "`",
9494
)
9595
end
9696
end
97-
return __kernel(ex[end], generate_cpu, force_inbounds, unsafe_indicies)
97+
return __kernel(ex[end], generate_cpu, force_inbounds, unsafe_indices)
9898
end
9999
end
100100

Diff for: src/macros.jl

+15-15
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function find_return(stmt)
1010
end
1111

1212
# XXX: Proper errors
13-
function __kernel(expr, generate_cpu = true, force_inbounds = false, unsafe_indicies = false)
13+
function __kernel(expr, generate_cpu = true, force_inbounds = false, unsafe_indices = false)
1414
def = splitdef(expr)
1515
name = def[:name]
1616
args = def[:args]
@@ -46,7 +46,7 @@ function __kernel(expr, generate_cpu = true, force_inbounds = false, unsafe_indi
4646

4747
def_gpu = deepcopy(def)
4848
def_gpu[:name] = gpu_name = Symbol(:gpu_, name)
49-
transform_gpu!(def_gpu, constargs, force_inbounds, unsafe_indicies)
49+
transform_gpu!(def_gpu, constargs, force_inbounds, unsafe_indices)
5050
gpu_function = combinedef(def_gpu)
5151

5252
# create constructor functions
@@ -78,7 +78,7 @@ end
7878

7979
# The easy case, transform the function for GPU execution
8080
# - mark constant arguments by applying `constify`.
81-
function transform_gpu!(def, constargs, force_inbounds, unsafe_indicies)
81+
function transform_gpu!(def, constargs, force_inbounds, unsafe_indices)
8282
let_constargs = Expr[]
8383
for (i, arg) in enumerate(def[:args])
8484
if constargs[i]
@@ -89,13 +89,13 @@ function transform_gpu!(def, constargs, force_inbounds, unsafe_indicies)
8989
new_stmts = Expr[]
9090
body = MacroTools.flatten(def[:body])
9191
push!(new_stmts, Expr(:aliasscope))
92-
if !unsafe_indicies
92+
if !unsafe_indices
9393
push!(new_stmts, :(__active_lane__ = $__validindex(__ctx__)))
9494
end
9595
if force_inbounds
9696
push!(new_stmts, Expr(:inbounds, true))
9797
end
98-
if !unsafe_indicies
98+
if !unsafe_indices
9999
append!(new_stmts, split(emit_gpu, body.args))
100100
else
101101
push!(new_stmts, body)
@@ -117,7 +117,7 @@ end
117117
# - mark constant arguments by applying `constify`.
118118
# - insert aliasscope markers
119119
# - insert implied loop bodys
120-
# - handle indicies
120+
# - handle indices
121121
# - hoist workgroup definitions
122122
# - hoist uniform variables
123123
function transform_cpu!(def, constargs, force_inbounds)
@@ -149,7 +149,7 @@ function transform_cpu!(def, constargs, force_inbounds)
149149
end
150150

151151
struct WorkgroupLoop
152-
indicies::Vector{Any}
152+
indices::Vector{Any}
153153
stmts::Vector{Any}
154154
allocations::Vector{Any}
155155
private_allocations::Vector{Any}
@@ -177,7 +177,7 @@ end
177177
function split(
178178
emit,
179179
stmts,
180-
indicies = Any[], private = Set{Symbol}(),
180+
indices = Any[], private = Set{Symbol}(),
181181
)
182182
# 1. Split the code into blocks separated by `@synchronize`
183183
# 2. Aggregate `@index` expressions
@@ -191,7 +191,7 @@ function split(
191191
for stmt in stmts
192192
has_sync = find_sync(stmt)
193193
if has_sync
194-
loop = WorkgroupLoop(deepcopy(indicies), current, allocations, private_allocations, deepcopy(private), is_sync(stmt))
194+
loop = WorkgroupLoop(deepcopy(indices), current, allocations, private_allocations, deepcopy(private), is_sync(stmt))
195195
push!(new_stmts, emit(loop))
196196
allocations = Any[]
197197
private_allocations = Any[]
@@ -206,7 +206,7 @@ function split(
206206
function recurse(expr::Expr)
207207
expr = unblock(expr)
208208
if is_scope_construct(expr) && any(find_sync, expr.args)
209-
new_args = unblock(split(emit, expr.args, deepcopy(indicies), deepcopy(private)))
209+
new_args = unblock(split(emit, expr.args, deepcopy(indices), deepcopy(private)))
210210
return Expr(expr.head, new_args...)
211211
else
212212
return Expr(expr.head, map(recurse, expr.args)...)
@@ -225,7 +225,7 @@ function split(
225225
continue
226226
elseif @capture(stmt, lhs_ = rhs_ | (vs__, lhs_ = rhs_))
227227
if @capture(rhs, @index(args__))
228-
push!(indicies, stmt)
228+
push!(indices, stmt)
229229
continue
230230
elseif @capture(rhs, @localmem(args__) | @uniform(args__))
231231
push!(allocations, stmt)
@@ -249,15 +249,15 @@ function split(
249249

250250
# everything since the last `@synchronize`
251251
if !isempty(current)
252-
loop = WorkgroupLoop(deepcopy(indicies), current, allocations, private_allocations, deepcopy(private), false)
252+
loop = WorkgroupLoop(deepcopy(indices), current, allocations, private_allocations, deepcopy(private), false)
253253
push!(new_stmts, emit(loop))
254254
end
255255
return new_stmts
256256
end
257257

258258
function emit_cpu(loop)
259259
idx = gensym(:I)
260-
for stmt in loop.indicies
260+
for stmt in loop.indices
261261
# splice index into the i = @index(Cartesian, $idx)
262262
@assert stmt.head === :(=)
263263
rhs = stmt.args[2]
@@ -300,7 +300,7 @@ function emit_cpu(loop)
300300
loopexpr = quote
301301
for $idx in $__workitems_iterspace(__ctx__)
302302
$__validindex(__ctx__, $idx) || continue
303-
$(loop.indicies...)
303+
$(loop.indices...)
304304
$(unblock(body))
305305
end
306306
end
@@ -318,7 +318,7 @@ function emit_gpu(loop)
318318
$(loop.allocations...)
319319
$(loop.private_allocations...)
320320
if __active_lane__
321-
$(loop.indicies...)
321+
$(loop.indices...)
322322
$(unblock(body))
323323
end
324324
end

Diff for: test/localmem.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ end
3434
end
3535
end
3636

37-
@kernel unsafe_indicies = true function localmem_unsafe_indicies(A)
37+
@kernel unsafe_indices = true function localmem_unsafe_indices(A)
3838
N = @uniform prod(@groupsize())
3939
gI = @index(Group, Linear)
4040
i = @index(Local, Linear)
@@ -49,7 +49,7 @@ end
4949

5050
function localmem_testsuite(backend, ArrayT)
5151
@testset "kernels" begin
52-
@testset for kernel! in (localmem(backend(), 16), localmem2(backend(), 16), localmem_unsafe_indicies(backend(), 16))
52+
@testset for kernel! in (localmem(backend(), 16), localmem2(backend(), 16), localmem_unsafe_indices(backend(), 16))
5353
A = ArrayT{Int}(undef, 64)
5454
kernel!(A, ndrange = size(A))
5555
synchronize(backend())

0 commit comments

Comments
 (0)