You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KernelAbstractions currently creates kernels that look like:
```
if __validindex(ctx)
# Body
end
```
This is problematic due to the convergence requirement on
`@synchronize`.
@@ -60,6 +60,7 @@ This allows for two different configurations:
60
60
61
61
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.
62
62
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
64
64
65
- [`@context`](@ref)
65
66
@@ -68,9 +69,10 @@ This allows for two different configurations:
68
69
"""
69
70
macrokernel(ex...)
70
71
iflength(ex) ==1
71
-
return__kernel(ex[1], true, false)
72
+
return__kernel(ex[1], true, false, false)
72
73
else
73
74
generate_cpu =true
75
+
unsafe_indicies =false
74
76
force_inbounds =false
75
77
for i in1:(length(ex) -1)
76
78
if ex[i] isa Expr && ex[i].head == :(=) &&
@@ -79,16 +81,20 @@ macro kernel(ex...)
79
81
elseif ex[i] isa Expr && ex[i].head == :(=) &&
80
82
ex[i].args[1] ==:inbounds&& ex[i].args[2] isa Bool
81
83
force_inbounds = ex[i].args[2]
84
+
elseif ex[i] isa Expr && ex[i].head == :(=) &&
85
+
ex[i].args[1] ==:unsafe_indicies&& ex[i].args[2] isa Bool
0 commit comments