aetheric-gpu 0.1.0-alpha

Aetheric Silicon: turn this host's RAM into a Digital GPU endpoint
//! Benchmarks for the digital-gpu crate.
//!
//! Run with: `cargo bench -p digital-gpu`
//!
//! These benchmarks demonstrate the practical value of the project:
//!   - 1 GB physical RAM → 32 GB virtual VRAM (binary GEMM expansion)
//!   - Effective allocation: 4 GB virtual from < 128 MB physical
//!   - Slow-hill curve lookup is constant-time O(1)

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use digital_gpu::{GpuHandle, GpuSpec, CompressionMode};

fn bench_curve_sample(c: &mut Criterion) {
    let gpu = GpuHandle::boot(GpuSpec::new().effective_gb(64))
        .expect("boot");

    c.bench_function("curve_sample_32gb_100pts", |b| {
        b.iter(|| {
            gpu.curve_sample(
                black_box(32 * 1024 * 1024 * 1024),
                black_box(100),
            )
        });
    });
}

fn bench_bandwidth_query(c: &mut Criterion) {
    let gpu = GpuHandle::boot(GpuSpec::new().effective_gb(64))
        .expect("boot");

    c.bench_function("bandwidth_at_1gb", |b| {
        b.iter(|| {
            gpu.bandwidth_at_effective(black_box(1024 * 1024 * 1024))
        });
    });
}

fn bench_compression_alloc(c: &mut Criterion) {
    let gpu = GpuHandle::boot(GpuSpec::new()
        .physical_gb(6)
        .effective_gb(192))  // 32× binary GEMM expansion
        .expect("boot");

    c.bench_function("allocate_4gb_via_32x_compression", |b| {
        b.iter(|| {
            if let Some(arena) = gpu.compressed_arena() {
                let _ = black_box(arena.allocate_effective(4 * 1024 * 1024 * 1024));
            }
        });
    });
}

fn bench_boot(c: &mut Criterion) {
    c.bench_function("boot_8gb_digital_gpu", |b| {
        b.iter(|| {
            let _ = GpuHandle::boot(GpuSpec::new().effective_gb(8));
        });
    });
}

criterion_group!(
    benches,
    bench_curve_sample,
    bench_bandwidth_query,
    bench_compression_alloc,
    bench_boot
);
criterion_main!(benches);