Oakfield API Documentation 1.0.0
Numerical core APIs
Loading...
Searching...
No Matches
neural_infer.h File Reference

Neural inference operator scaffolding. More...

#include "oakfield/operator_split.h"
#include <stdbool.h>
#include <stddef.h>
Include dependency graph for neural_infer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SimNeuralInferenceRequest
 Inference request metadata passed to neural callbacks. More...
 
struct  SimNeuralBaseConfig
 Shared base configuration for neural operators. More...
 

Macros

#define SIM_NEURAL_MODEL_ID_MAX   63U
 

Typedefs

typedef struct SimNeuralInferenceRequest SimNeuralInferenceRequest
 Inference request metadata passed to neural callbacks.
 
typedef SimResult(* SimNeuralInferenceFn) (void *userdata, const SimField *input, SimField *output, const SimNeuralInferenceRequest *request)
 Callback surface for pluggable neural inference backends.
 
typedef struct SimNeuralBaseConfig SimNeuralBaseConfig
 Shared base configuration for neural operators.
 
typedef SimNeuralBaseConfig SimNeuralInferOperatorConfig
 Configuration for inference-only neural operator.
 

Functions

SimResult sim_add_neural_infer_operator (struct SimContext *context, const SimNeuralInferOperatorConfig *config, size_t *out_index)
 Register an inference-only neural operator.
 
SimResult sim_neural_infer_config (struct SimContext *context, size_t operator_index, SimNeuralInferOperatorConfig *out_config)
 Copy the current neural inference configuration from a registered operator.
 
SimResult sim_neural_infer_update (struct SimContext *context, size_t operator_index, const SimNeuralInferOperatorConfig *config)
 Replace the configuration of a registered neural inference operator.
 

Detailed Description

Neural inference operator scaffolding.

Macro Definition Documentation

◆ SIM_NEURAL_MODEL_ID_MAX

#define SIM_NEURAL_MODEL_ID_MAX   63U

Maximum model identifier length (excluding null terminator).

Typedef Documentation

◆ SimNeuralInferenceFn

typedef SimResult(* SimNeuralInferenceFn) (void *userdata, const SimField *input, SimField *output, const SimNeuralInferenceRequest *request)

Callback surface for pluggable neural inference backends.

Implementations write model outputs into output using the same shape and element type as configured fields.

Parameters
userdataOpaque backend pointer from the operator configuration.
inputSource field snapshot for the inference request.
[out]outputField storage that receives model predictions.
requestNormalized inference request metadata.
Returns
SIM_RESULT_OK on success or an error code reported by the backend.

Function Documentation

◆ sim_add_neural_infer_operator()

SimResult sim_add_neural_infer_operator ( struct SimContext context,
const SimNeuralInferOperatorConfig config,
size_t *  out_index 
)

Register an inference-only neural operator.

Parameters
contextSimulation context that will own the operator.
configOptional neural inference configuration; NULL selects normalized defaults.
[out]out_indexOptional destination for the registered operator index.
Returns
SIM_RESULT_OK on success, or an error code from argument validation, field compatibility checks, allocation, or split registration.

◆ sim_neural_infer_config()

SimResult sim_neural_infer_config ( struct SimContext context,
size_t  operator_index,
SimNeuralInferOperatorConfig out_config 
)

Copy the current neural inference configuration from a registered operator.

Parameters
contextSimulation context containing the operator.
operator_indexIndex returned by sim_add_neural_infer_operator().
[out]out_configReceives the normalized configuration.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL pointers, SIM_RESULT_NOT_FOUND for a missing operator, or SIM_RESULT_INVALID_STATE when the operator has no neural state.

◆ sim_neural_infer_update()

SimResult sim_neural_infer_update ( struct SimContext context,
size_t  operator_index,
const SimNeuralInferOperatorConfig config 
)

Replace the configuration of a registered neural inference operator.

config is required. The replacement is normalized and field/shape compatibility is checked before storing it.

Parameters
contextSimulation context containing the operator.
operator_indexIndex of the neural inference operator to update.
configReplacement neural inference configuration.
Returns
SIM_RESULT_OK on success, or an error code from argument validation, lookup, field compatibility checks, or state validation.