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
Disable code-generation of the CPU function. This relaxes semantics such that
63
-
KernelAbstractions primitives can be used in non-kernel functions.
62
+
This allows for two different configurations:
63
+
64
+
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.
65
+
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!
64
66
65
67
- [`@context`](@ref)
66
68
67
69
!!! warn
68
70
This is an experimental feature.
69
71
"""
70
-
macrokernel(config, expr)
71
-
if config isa Expr && config.head == :(=) &&
72
-
config.args[1] ==:cpu&& config.args[2] isa Bool
73
-
generate_cpu = config.args[2]
72
+
macrokernel(ex...)
73
+
iflength(ex) ==1
74
+
__kernel(ex[1], true, false)
74
75
else
75
-
error("Configuration should be of form `cpu=false` got $config")
76
+
generate_cpu =true
77
+
force_inbounds =false
78
+
for i =1:length(ex)-1
79
+
if ex[i] isa Expr && ex[i].head == :(=) &&
80
+
ex[i].args[1] ==:cpu&& ex[i].args[2] isa Bool
81
+
generate_cpu = ex[i].args[2]
82
+
elseif ex[i] isa Expr && ex[i].head == :(=) &&
83
+
ex[i].args[1] ==:inbounds&& ex[i].args[2] isa Bool
0 commit comments