RuntimeCompiler
RuntimeCompiler
Section titled “RuntimeCompiler”#include <ncarray/jit/host/rtcompiler.hh>class RuntimeCompilerDefined in src/lib/ncarray/jit/host/rtcompiler.hh:49
List of all members
Section titled “List of all members”| Name | Kind | Owner |
|---|---|---|
get_expr_kernel |
function |
Declared here |
instance |
function |
Declared here |
m_kernel_cache |
variable |
Declared here |
RuntimeCompiler |
function |
Declared here |
compile_x86_expr_kernel |
function |
Declared here |
compile_a64_expr_kernel |
function |
Declared here |
Public Methods
Section titled “Public Methods”| Return | Name | Description |
|---|---|---|
ExprKernelFunc |
get_expr_kernel |
Get the compiled funcion/kernel for evaluation of the lineriazable expression created by the layouts and instructions passed in. |
get_expr_kernel
Section titled “get_expr_kernel”ExprKernelFunc get_expr_kernel(DType dest_t, DType src_t, DType work_t, const SOArrayPolicy & dest_layout, const std::vector< Instruction > & instrs, const std::vector< SOArrayPolicy > & layouts, const std::vector< Scalar > & scalars, bool expr_is_soarr = false)Defined in src/lib/ncarray/jit/host/rtcompiler.hh:74
Get the compiled funcion/kernel for evaluation of the lineriazable expression created by the layouts and instructions passed in.
If the function is in memory, it will be returned from the in-memory cache, otherwise, if it has previously been compiled, it will be loaded from disk, or, compiled and written to disk, before being returned.
Returns
Section titled “Returns”k_func The function to evaluate the expression.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
dest_t |
[DType](api-ncarray.md#dtype) |
The final output datatype. |
src_t |
[DType](api-ncarray.md#dtype) |
The input datatype of the arrays. |
work_t |
[DType](api-ncarray.md#dtype) |
The datatype to use for intermediate calculations. This may or may not be equivalent to dest_t. E.g. a long expression may use float/int64 while performing intermediate operations, while the final result of the expression is a comparison returning bool. |
dest_layout |
const [SOArrayPolicy](api-ncarray-SOArrayPolicy.md#soarraypolicy) & |
The destination/result Layout to write into. |
instrs |
const std::vector< [Instruction](api-ncarray.md#instruction) > & |
The instructions (packed index + OpCode) for the expression. |
layouts |
const std::vector< [SOArrayPolicy](api-ncarray-SOArrayPolicy.md#soarraypolicy) > & |
The layouts of the arrays involved. |
scalars |
const std::vector< [Scalar](api-ncarray.md#scalar) > & |
Any scalar constants involved. |
expr_is_soarr |
bool |
Whether the arrays are SOArray* or NCArray*. |
Public Static Methods
Section titled “Public Static Methods”| Return | Name | Description |
|---|---|---|
RuntimeCompiler & |
instance static |
instance
Section titled “instance”static
static RuntimeCompiler & instance()Defined in src/lib/ncarray/jit/host/rtcompiler.hh:51
Private Attributes
Section titled “Private Attributes”| Return | Name | Description |
|---|---|---|
std::unordered_map< std::string, ExprKernelFunc > |
m_kernel_cache |
In memory cache of compiled functions for expression evaluation. |
m_kernel_cache
Section titled “m_kernel_cache”std::unordered_map< std::string, ExprKernelFunc > m_kernel_cacheDefined in src/lib/ncarray/jit/host/rtcompiler.hh:147
In memory cache of compiled functions for expression evaluation.
Private Methods
Section titled “Private Methods”| Return | Name | Description |
|---|---|---|
RuntimeCompiler |
||
void |
compile_x86_expr_kernel |
Compile the function to evaluate an expression, for the x86 architecture. |
void |
compile_a64_expr_kernel |
Compile the function to evaluate an expression, for the a64 (ARM) architecture. |
RuntimeCompiler
Section titled “RuntimeCompiler”RuntimeCompiler()Defined in src/lib/ncarray/jit/host/rtcompiler.hh:84
compile_x86_expr_kernel
Section titled “compile_x86_expr_kernel”void compile_x86_expr_kernel(fs::path cache_path, DType dest_t, DType src_t, DType work_t, const SOArrayPolicy & dest_layout, const std::vector< Instruction > & instrs, const std::vector< SOArrayPolicy > & layouts, const std::vector< Scalar > & scalars, bool expr_is_soarr = false)Defined in src/lib/ncarray/jit/host/rtcompiler.hh:105
Compile the function to evaluate an expression, for the x86 architecture.
After compiling, the function will be written to disk.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
cache_path |
fs::path |
The path to write the compiled function to, for on-disk storage. |
dest_t |
[DType](api-ncarray.md#dtype) |
The final output datatype. |
src_t |
[DType](api-ncarray.md#dtype) |
The input datatype of the arrays. |
work_t |
[DType](api-ncarray.md#dtype) |
The datatype to use for intermediate calculations. This may or may not be equivalent to dest_t. E.g. a long expression may use float/int64 while performing intermediate operations, while the final result of the expression is a comparison returning bool. |
dest_layout |
const [SOArrayPolicy](api-ncarray-SOArrayPolicy.md#soarraypolicy) & |
The destination/result Layout to write into. |
instrs |
const std::vector< [Instruction](api-ncarray.md#instruction) > & |
The instructions (packed index + OpCode) for the expression. |
layouts |
const std::vector< [SOArrayPolicy](api-ncarray-SOArrayPolicy.md#soarraypolicy) > & |
The layouts of the arrays involved. |
scalars |
const std::vector< [Scalar](api-ncarray.md#scalar) > & |
Any scalar constants involved. |
expr_is_soarr |
bool |
Whether the arrays are SOArray* or NCArray*. |
compile_a64_expr_kernel
Section titled “compile_a64_expr_kernel”void compile_a64_expr_kernel(fs::path cache_path, DType dest_t, DType src_t, DType work_t, const SOArrayPolicy & dest_layout, const std::vector< Instruction > & instrs, const std::vector< SOArrayPolicy > & layouts, const std::vector< Scalar > & scalars, bool expr_is_soarr = false)Defined in src/lib/ncarray/jit/host/rtcompiler.hh:134
Compile the function to evaluate an expression, for the a64 (ARM) architecture.
After compiling, the function will be written to disk.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
cache_path |
fs::path |
The path to write the compiled function to, for on-disk storage. |
dest_t |
[DType](api-ncarray.md#dtype) |
The final output datatype. |
src_t |
[DType](api-ncarray.md#dtype) |
The input datatype of the arrays. |
work_t |
[DType](api-ncarray.md#dtype) |
The datatype to use for intermediate calculations. This may or may not be equivalent to dest_t. E.g. a long expression may use float/int64 while performing intermediate operations, while the final result of the expression is a comparison returning bool. |
dest_layout |
const [SOArrayPolicy](api-ncarray-SOArrayPolicy.md#soarraypolicy) & |
The destination/result Layout to write into. |
instrs |
const std::vector< [Instruction](api-ncarray.md#instruction) > & |
The instructions (packed index + OpCode) for the expression. |
layouts |
const std::vector< [SOArrayPolicy](api-ncarray-SOArrayPolicy.md#soarraypolicy) > & |
The layouts of the arrays involved. |
scalars |
const std::vector< [Scalar](api-ncarray.md#scalar) > & |
Any scalar constants involved. |
expr_is_soarr |
bool |
Whether the arrays are SOArray* or NCArray*. |