Custom kernels definition
General rules
Custom kernels can be expressed as lambda functions inside F# quotation. A lambda doesn't require particular solutions to mark it as a kernel, but it must takes ndrange as a first parameter and returns unit. Moreover, only curried format is supported.
1: 2: 3: 4: 5: |
|
Closure
You can also use variables defined outside the kernel lambda itself. When compiled, they will be converted to constant literals.
1: 2: 3: 4: 5: 6: 7: 8: |
|
Generics
Generic kernels also supported.
1: 2: 3: 4: 5: 6: |
|
namespace Brahma
namespace Brahma.FSharp
Multiple items
namespace FSharp
--------------------
namespace Microsoft.FSharp
namespace FSharp
--------------------
namespace Microsoft.FSharp
Multiple items
namespace FSharp.Quotations
--------------------
namespace Microsoft.FSharp.Quotations
namespace FSharp.Quotations
--------------------
namespace Microsoft.FSharp.Quotations
val range : Range1D
Multiple items
type Range1D =
interface INDRange
new : globalWorkSize:int -> Range1D
new : globalWorkSize:int * localWorkSize:int -> Range1D
private new : globalWorkSize:int * localWorkSize:int * __:unit -> Range1D
member GlobalID0 : int
member GlobalWorkSize : int
member LocalID0 : int
member LocalWorkSize : int
static member CreateValid : neededSize:int * localWorkSize:int -> Range1D
--------------------
new : globalWorkSize:int -> Range1D
new : globalWorkSize:int * localWorkSize:int -> Range1D
type Range1D =
interface INDRange
new : globalWorkSize:int -> Range1D
new : globalWorkSize:int * localWorkSize:int -> Range1D
private new : globalWorkSize:int * localWorkSize:int * __:unit -> Range1D
member GlobalID0 : int
member GlobalWorkSize : int
member LocalID0 : int
member LocalWorkSize : int
static member CreateValid : neededSize:int * localWorkSize:int -> Range1D
--------------------
new : globalWorkSize:int -> Range1D
new : globalWorkSize:int * localWorkSize:int -> Range1D
val buffer : clarray<int>
Multiple items
val int : value:'T -> int (requires member op_Explicit)
--------------------
type int = int32
--------------------
type int<'Measure> = int
val int : value:'T -> int (requires member op_Explicit)
--------------------
type int = int32
--------------------
type int<'Measure> = int
type clarray<'a> = ClArray<'a>
val gid : int
property Range1D.GlobalID0: int with get
val constVal : int
val parameterizedKernel : op:Expr<(int -> int -> int)> -> Expr<(Range1D -> clarray<int> -> unit)>
val op : Expr<(int -> int -> int)>
Multiple items
type Expr =
override Equals : obj:obj -> bool
member GetFreeVars : unit -> seq<Var>
member Substitute : substitution:(Var -> Expr option) -> Expr
member ToString : full:bool -> string
member CustomAttributes : Expr list
member Type : Type
static member AddressOf : target:Expr -> Expr
static member AddressSet : target:Expr * value:Expr -> Expr
static member Application : functionExpr:Expr * argument:Expr -> Expr
static member Applications : functionExpr:Expr * arguments:Expr list list -> Expr
...
--------------------
type Expr<'T> =
inherit Expr
member Raw : Expr
type Expr =
override Equals : obj:obj -> bool
member GetFreeVars : unit -> seq<Var>
member Substitute : substitution:(Var -> Expr option) -> Expr
member ToString : full:bool -> string
member CustomAttributes : Expr list
member Type : Type
static member AddressOf : target:Expr -> Expr
static member AddressSet : target:Expr * value:Expr -> Expr
static member Application : functionExpr:Expr * argument:Expr -> Expr
static member Applications : functionExpr:Expr * arguments:Expr list list -> Expr
...
--------------------
type Expr<'T> =
inherit Expr
member Raw : Expr
val genericKernel : op:('a -> 'a) -> Expr<(Range1D -> clarray<'a> -> unit)>
val op : ('a -> 'a)
val buffer : clarray<'a>