Skip to main content

Crate cliffy_gpu

Crate cliffy_gpu 

Source
Expand description

§Cliffy GPU

WebGPU compute shaders and SIMD-optimized CPU operations for geometric algebra.

This crate provides hardware-accelerated geometric algebra operations using:

  • WebGPU: Massive parallel computation on GPU
  • SIMD: CPU-optimized operations using portable SIMD intrinsics

§Overview

Every browser becomes a compute node with cliffy-gpu:

use cliffy_gpu::{GpuContext, GpuMultivector, AutoDispatcher};
use cliffy_core::GA3;

// Initialize auto dispatcher (chooses GPU or SIMD-CPU based on batch size)
let dispatcher = AutoDispatcher::new().await;

// Batch geometric products - automatically dispatched
let a_batch: Vec<GA3> = vec![...];
let b_batch: Vec<GA3> = vec![...];
let results = dispatcher.geometric_product(&a_batch, &b_batch).await?;

§Features

  • Batch Operations: Process thousands of multivectors in parallel
  • Auto Dispatch: Automatic CPU/GPU selection based on batch size
  • SIMD Fallback: Optimized CPU operations when GPU unavailable
  • WASM Support: Works in browsers with WebGPU
  • Compute Shaders: WGSL shaders for geometric product, sandwich, exp, slerp

Re-exports§

pub use simd::addition_simd;
pub use simd::geometric_product_simd;
pub use simd::sandwich_simd;
pub use simd::SimdBatch;

Modules§

simd
SIMD-optimized CPU operations for geometric algebra.

Structs§

AutoDispatcher
Automatic dispatcher that chooses CPU (SIMD) or GPU based on batch size.
GpuContext
GPU compute context for geometric algebra operations.
GpuMultivector
GPU-compatible multivector representation.

Enums§

GpuError
Errors that can occur during GPU operations.

Constants§

GPU_DISPATCH_THRESHOLD
Threshold for automatic GPU dispatch. Below this count, CPU is often faster due to GPU overhead.