Lux GPU Core 0.2.0
Lightweight plugin-based GPU acceleration for blockchain and ML
Loading...
Searching...
No Matches
Lux GPU Core

Lightweight plugin-based GPU acceleration library for blockchain and ML workloads.

Overview

Lux GPU Core provides a unified C API for GPU acceleration with runtime-switchable backends. The library is designed for high-performance cryptographic operations (ZK proofs, FHE, BLS signatures) and tensor computations.

Key Features

  • Plugin Architecture: Backends are dynamically loaded at runtime
  • Stable ABI: Plugin interface versioned for compatibility
  • Multiple Backends: Metal, CUDA, WebGPU, and CPU fallback
  • Cryptographic Operations: BLS12-381, BN254, Poseidon2, KZG commitments
  • FHE Support: NTT, TFHE bootstrap, key switching
  • Tensor Operations: GEMM, reductions, activations, normalization

Supported Backends

Backend Platform GPU Type Status
Metal macOS arm64 Apple Silicon Production
CUDA Linux/Windows NVIDIA Production
WebGPU Cross-platform Any Experimental
CPU All SIMD Fallback

Quick Start

#include <lux/gpu.h>
int main() {
// Create GPU context (auto-selects best backend)
// Create tensors
int64_t shape[] = {1024, 1024};
LuxTensor* a = lux_tensor_ones(gpu, shape, 2, LUX_FLOAT32);
LuxTensor* b = lux_tensor_ones(gpu, shape, 2, LUX_FLOAT32);
// Matrix multiplication
LuxTensor* c = lux_tensor_matmul(gpu, a, b);
// Synchronize and read results
// Cleanup
return 0;
}
void lux_gpu_destroy(LuxGPU *gpu)
struct LuxTensor LuxTensor
Definition gpu.h:93
LuxGPU * lux_gpu_create(void)
LuxError lux_gpu_sync(LuxGPU *gpu)
LuxTensor * lux_tensor_matmul(LuxGPU *gpu, LuxTensor *a, LuxTensor *b)
@ LUX_FLOAT32
Definition gpu.h:57
void lux_tensor_destroy(LuxTensor *tensor)
LuxTensor * lux_tensor_ones(LuxGPU *gpu, const int64_t *shape, int ndim, LuxDtype dtype)
struct LuxGPU LuxGPU
Definition gpu.h:92

Architecture

+------------------+
| Application |
+------------------+
|
lux/gpu.h (C API)
|
+------------------+
| Core Library | Plugin Loader + Dispatch
+------------------+
|
backend_plugin.h (ABI)
|
+--------+--------+--------+--------+
| Metal | CUDA | WebGPU | CPU |
+--------+--------+--------+--------+

The core library provides:

Backends are separate shared libraries loaded at runtime.

Documentation

License

BSD-3-Clause-Eco