Skip to content

RuntimeCompiler

#include <ncarray/jit/host/rtcompiler.hh>
class RuntimeCompiler

Defined in src/lib/ncarray/jit/host/rtcompiler.hh:49

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
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.

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.

k_func The function to evaluate the expression.

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*.
Return Name Description
RuntimeCompiler & instance static

static

static RuntimeCompiler & instance()

Defined in src/lib/ncarray/jit/host/rtcompiler.hh:51

Return Name Description
std::unordered_map< std::string, ExprKernelFunc > m_kernel_cache In memory cache of compiled functions for expression evaluation.

std::unordered_map< std::string, ExprKernelFunc > m_kernel_cache

Defined in src/lib/ncarray/jit/host/rtcompiler.hh:147

In memory cache of compiled functions for expression evaluation.

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()

Defined in src/lib/ncarray/jit/host/rtcompiler.hh:84


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.

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*.

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.

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*.