1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! # Hybrid CPU-GPU Processing
//!
//! Adaptive processing that routes workloads to CPU or GPU based on size
//! and characteristics. Small/irregular workloads use CPU (via Rayon),
//! while bulk parallel operations use GPU.
//!
//! ## Decision Heuristics
//!
//! | Workload Size | GPU Overhead | Decision |
//! |---------------|--------------|----------|
//! | < threshold | High | CPU |
//! | >= threshold | Amortized | GPU |
//!
//! For irregular access patterns (sparse updates, random traversal),
//! CPU may outperform GPU even at larger scales.
//!
//! ## Example
//!
//! ```ignore
//! use ringkernel_core::hybrid::*;
//!
//! // Define your workload
//! struct MyWorkload { data: Vec<f32> }
//!
//! impl HybridWorkload for MyWorkload {
//! type Result = Vec<f32>;
//!
//! fn workload_size(&self) -> usize { self.data.len() }
//! fn execute_cpu(&self) -> Self::Result { /* ... */ }
//! fn execute_gpu(&self) -> Result<Self::Result, HybridError> { /* ... */ }
//! }
//!
//! // Create dispatcher and execute
//! let dispatcher = HybridDispatcher::new(HybridConfig::default());
//! let result = dispatcher.execute(&workload);
//! ```
pub use ;
pub use HybridDispatcher;
pub use ;
pub use ;
pub use HybridWorkload;