Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Since this transformation can be disruptive, user can now opt out of the implici
but users must avoid the use of `@index(Global)` and instead use their own derivation based on `@index(Group)` and `@index(Local)`.

```julia
@kernel unsafe_indicies=false function localmem(A)
@kernel unsafe_indicies=true function localmem(A)
N = @uniform prod(@groupsize())
gI = @index(Group, Linear)
i = @index(Local, Linear)
Expand Down
6 changes: 3 additions & 3 deletions src/KernelAbstractions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ macro kernel(ex...)
else
error(
"Configuration should be of form:\n" *
"* `cpu=true`\n" *
"* `inbounds=false`\n" *
"* `unsafe_indicies=false`\n" *
"* `cpu=false`\n" *
"* `inbounds=true`\n" *
"* `unsafe_indicies=true`\n" *
"got `", ex[i], "`",
)
end
Expand Down
7 changes: 4 additions & 3 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function find_return(stmt)
end

# XXX: Proper errors
function __kernel(expr, generate_cpu = true, force_inbounds = false, unsafe_indicies = true)
function __kernel(expr, generate_cpu = true, force_inbounds = false, unsafe_indicies = false)
def = splitdef(expr)
name = def[:name]
args = def[:args]
Expand Down Expand Up @@ -88,9 +88,10 @@ function transform_gpu!(def, constargs, force_inbounds, unsafe_indicies)
pushfirst!(def[:args], :__ctx__)
new_stmts = Expr[]
body = MacroTools.flatten(def[:body])
stmts = body.args
push!(new_stmts, Expr(:aliasscope))
push!(new_stmts, :(__active_lane__ = $__validindex(__ctx__)))
if !unsafe_indicies
push!(new_stmts, :(__active_lane__ = $__validindex(__ctx__)))
end
if force_inbounds
push!(new_stmts, Expr(:inbounds, true))
end
Expand Down
2 changes: 1 addition & 1 deletion test/localmem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ end
end
end

@kernel unsafe_indicies = false function localmem_unsafe_indicies(A)
@kernel unsafe_indicies = true function localmem_unsafe_indicies(A)
N = @uniform prod(@groupsize())
gI = @index(Group, Linear)
i = @index(Local, Linear)
Expand Down
Loading