RuntimeCompiler
RuntimeCompiler
Section titled “RuntimeCompiler”#include <rtcompiler.hh>class RuntimeCompilerDefined in src/lib/ncarray/jit/host/rtcompiler.hh:61
List of all members
Section titled “List of all members”| Name | Kind | Owner |
|---|---|---|
dtype_to_typeid |
function |
Declared here |
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 |
|---|---|---|
asmjit::TypeId |
dtype_to_typeid |
Convert the ncarray type system to corresponding asmjit type system. |
ExprKernelFunc |
get_expr_kernel |
Get the compiled funcion/kernel for evaluation of the lineriazable expression created by the layouts and instructions passed in. |
dtype_to_typeid
Section titled “dtype_to_typeid”asmjit::TypeId dtype_to_typeid(DType dtype)Defined in src/lib/ncarray/jit/host/rtcompiler.hh:78
Convert the ncarray type system to corresponding asmjit type system.
This function only handles scalar datatypes. E.g. complex and vector types must be constructed using combinations of the returned type for their unit types (a complex
A char_ is converted to signed integer kInt8. A bool_ is converted to unsigned integer kUInt8, as these do not have corresponding types in asmjit.
Parameters
Section titled “Parameters”dtypeThe ncarray datatype to convert.
Returns
Section titled “Returns”typeid The asmjit TypeId that corresponds to the ncarray DType.
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:101
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.
Parameters
Section titled “Parameters”-
dest_tThe final output datatype. -
src_tThe input datatype of the arrays. -
work_tThe 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_layoutThe destination/result Layout to write into. -
instrsThe instructions (packed index + OpCode) for the expression. -
layoutsThe layouts of the arrays involved. -
scalarsAny scalar constants involved. -
expr_is_soarrWhether the arrays are SOArray* or NCArray*.
Returns
Section titled “Returns”k_func The function to evaluate the expression.
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:63
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:174
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:111
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:132
Compile the function to evaluate an expression, for the x86 architecture.
After compiling, the function will be written to disk.
Parameters
Section titled “Parameters”-
cache_pathThe path to write the compiled function to, for on-disk storage. -
dest_tThe final output datatype. -
src_tThe input datatype of the arrays. -
work_tThe 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_layoutThe destination/result Layout to write into. -
instrsThe instructions (packed index + OpCode) for the expression. -
layoutsThe layouts of the arrays involved. -
scalarsAny scalar constants involved. -
expr_is_soarrWhether 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:161
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”-
cache_pathThe path to write the compiled function to, for on-disk storage. -
dest_tThe final output datatype. -
src_tThe input datatype of the arrays. -
work_tThe 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_layoutThe destination/result Layout to write into. -
instrsThe instructions (packed index + OpCode) for the expression. -
layoutsThe layouts of the arrays involved. -
scalarsAny scalar constants involved. -
expr_is_soarrWhether the arrays are SOArray* or NCArray*.