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
* Add runtime generated KA support
* Add KA tests
* Remove kwargs concrete_input_type and closures_size and related functions
* Remove return_type from FunctionCalls
Copy file name to clipboardExpand all lines: docs/src/lib/internals/code_gen.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,6 @@ Order = [:type, :constant, :function]
8
8
```
9
9
10
10
## Function Generation
11
-
Implementations for generation of a callable function. A function generated this way cannot immediately be called. One Julia World Age has to pass before this is possible, which happens when the global Julia scope advances. If the DAG and therefore the generated function becomes too large, use the tape machine instead, since compiling large functions becomes infeasible.
Copy file name to clipboardExpand all lines: docs/src/manual.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ When the CDAG is ready, it can be compiled for the machine you're running on.
31
31
32
32
Now, [`compute_function`](@ref) can be used to create a function that can be called on inputs. [`compute_function`](@ref) supports and in some cases requires keyword arguments, please refer to its documentation for more information.
33
33
34
-
Alternatively, GPU kernels can be generated by using [`kernel`](@ref) instead of [`compute_function`](@ref). This is implemented for several GPU backends and produces a regular function for the given backend. Since RuntimeGeneratedFunctions.jl does not support GPU kernels at this time, this function will only be callable if the world age has been increased since its generation. Furthermore, the compute functions in the graph need to comply with all the normal requirements for GPU kernels, such as not calling dynamic functions.
34
+
Alternatively, [KernelAbstractions](https://juliagpu.github.io/KernelAbstractions.jl/stable/) kernels can be generated by using [`kernel`](@ref) instead of [`compute_function`](@ref). The returned value is a KernelAbstractions kernel object that can be called like any such kernel by giving it a backend and block size. The compute functions in the graph need to comply with all the normal requirements for GPU kernels, such as not calling dynamic functions. For more details, refer to the function's docs.
A wrapper around a KernelAbstractions kernel. Takes the `kernel::T` and an `ID::Val`.
5
+
6
+
This is necessary to insert the id to the KernelAbstractions kernel without needing the user to do it manually.
7
+
The Val itself is necessary to be able to define multiple different kernels working on the same input type. It is used in the expression cache as the key, and dispatched on in the `@generated` function.
8
+
"""
9
+
struct KAWrapper{T, ID}
10
+
kernel::T
11
+
id::ID
12
+
end
13
+
14
+
"""
15
+
KAWrapperKernel{T, ID, Args, KWArgs}
16
+
17
+
The second level of wrapping, to imitate the way that KernelAbstractions kernels are called: `kernel(<kernel config/backend>)(<runtime arguments>)`.
18
+
"""
19
+
struct KAWrapperKernel{T, ID, Args, KWArgs}
20
+
kernel::T
21
+
id::ID
22
+
args::Args
23
+
kwargs::KWArgs
24
+
end
25
+
26
+
# initial level, args and kwargs are the kernel config, stored in the KAWrapperKernel
27
+
@inlinefunction (k::KAWrapper{T, ID})(args...; kwargs...) where {T, ID}
0 commit comments