use crate::op_registry::{CoremlKernel, register_coreml_kernel};
use rlx_ir::Shape;
use std::sync::Arc;
const COLLECTIVE_OPS: &[&str] = &[
"collective.all_reduce",
"collective.all_gather",
"collective.reduce_scatter",
"collective.copy_to_parallel",
"collective.reduce_from_parallel",
"collective.broadcast",
"collective.reduce",
"collective.all_to_all",
"collective.ppermute",
"collective.send",
"collective.recv",
];
#[derive(Debug)]
struct CollectiveHostKernel {
name: &'static str,
}
impl CoremlKernel for CollectiveHostKernel {
fn name(&self) -> &str {
self.name
}
fn execute(
&self,
inputs: &[(&[u8], &Shape)],
output: (&mut [u8], &Shape),
attrs: &[u8],
) -> Result<(), String> {
rlx_cpu::op_registry::run_f32_custom_op_host(self.name, inputs, output, attrs)
}
}
pub fn register() {
for &name in COLLECTIVE_OPS {
register_coreml_kernel(Arc::new(CollectiveHostKernel { name }));
}
}