use bb_ir::proto::onnx::NodeProto;
use bb_runtime::atomic::DispatchResult;
use bb_runtime::bus::OpError;
use bb_runtime::registry::OpRegistration;
use bb_runtime::runtime::RuntimeResourceRef;
use bb_runtime::slot_value::SlotValue;
pub use bb_ir::syscall_ids::OP_PASS_THROUGH as OP_TYPE;
pub use bb_ir::syscall_ids::SYSCALL_DOMAIN as DOMAIN;
pub struct PassThroughOp;
pub fn invoke(
_node: &NodeProto,
inputs: &[(&str, &dyn SlotValue)],
_ctx: &mut RuntimeResourceRef<'_>,
) -> Result<DispatchResult, OpError> {
let Some((_, input)) = inputs.first() else {
return Err(OpError {
detail: "PassThrough requires one input".to_string(),
..Default::default()
});
};
Ok(DispatchResult::Immediate(vec![(
"value".to_string(),
input.clone_boxed(),
)]))
}
inventory::submit! {
OpRegistration {
domain: DOMAIN,
op_type: OP_TYPE,
invoke,
kind: bb_runtime::registry::RegistrationKind::Syscall,
}
}