diff --git a/docs/src/index.md b/docs/src/index.md index df9dc1380..f8bb81f58 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -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) diff --git a/src/KernelAbstractions.jl b/src/KernelAbstractions.jl index f6292192b..997ab7709 100644 --- a/src/KernelAbstractions.jl +++ b/src/KernelAbstractions.jl @@ -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 diff --git a/src/macros.jl b/src/macros.jl index c70f7b964..fc8ddca8c 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -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] @@ -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 diff --git a/test/localmem.jl b/test/localmem.jl index a2904e313..fe47d2a5a 100644 --- a/test/localmem.jl +++ b/test/localmem.jl @@ -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)