cgpu 0.1.0

A tunable GPU compute executor with automatic CPU fallback, byte-based batching, and inline shader generation.
Documentation
use crate::batch::BatchSpan;

#[derive(Clone, Debug, PartialEq)]
pub struct JobReport<T> {
    pub outputs: Vec<T>,
    pub execution_path: ExecutionPath,
    pub batches: Vec<BatchReport>,
    pub total_ms: f64,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ExecutionPath {
    GpuOnly,
    GpuWithFallback,
    CpuOnly,
    Mixed,
}

#[derive(Clone, Debug, PartialEq)]
pub struct BatchReport {
    pub span: BatchSpan,
    pub path: BatchPath,
    pub pack_ms: f64,
    pub execute_ms: f64,
    pub readback_ms: f64,
    pub post_ms: f64,
    pub bytes_in: usize,
    pub bytes_out: usize,
    pub error: Option<String>,
}

impl BatchReport {
    pub fn new(span: BatchSpan, path: BatchPath) -> Self {
        let bytes_in = span.bytes_in;
        let bytes_out = span.bytes_out;
        Self {
            span,
            path,
            pack_ms: 0.0,
            execute_ms: 0.0,
            readback_ms: 0.0,
            post_ms: 0.0,
            bytes_in,
            bytes_out,
            error: None,
        }
    }
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum BatchPath {
    Gpu,
    CpuFallback,
    Skipped,
}