Skip to main content

myelin_accelerator/
lib.rs

1// Copyright 2026 Raul Montoya Cardenas
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4//! Rust/CUDA acceleration primitives for spiking neural networks (SNN) and
5//! neuromorphic workloads: safe Rust wrappers around first-party CUDA kernels
6//! covering spiking-network dynamics, routing, SAT search, and packed ternary
7//! GEMV/GEMM. The `cuda` feature targets `sm_120` (NVIDIA Blackwell); the
8//! default build is CPU-only and needs no CUDA toolkit or device.
9//!
10//! This is a low-level compute layer, not a complete SNN framework or a
11//! general model-compatibility layer.
12pub mod bench;
13pub mod bitpacking;
14pub mod capability;
15mod error;
16pub mod oracle;
17
18#[cfg(not(feature = "cuda"))]
19pub mod gpu_stub;
20#[cfg(not(feature = "cuda"))]
21pub use gpu_stub as gpu;
22#[cfg(feature = "cuda")]
23pub mod gpu;
24
25// Re-export the main public API at the crate root for ergonomic use.
26pub use capability::{
27    Backend, CapabilityFacts, CapabilityReport, ComputeCapability, ExecutionPolicy, FallbackReason,
28    FallbackRecord, KernelAvailability, evaluate_capabilities, probe_capabilities,
29    sanitize_diagnostic,
30};
31#[cfg(feature = "cuda")]
32pub use gpu::{GpuAccelerator, GpuBuffer, GpuContext, GpuError, KernelModule};
33#[cfg(not(feature = "cuda"))]
34pub use gpu_stub::{GpuAccelerator, GpuBuffer, GpuContext, GpuError, KernelModule};
35
36#[cfg(feature = "cuda")]
37pub(crate) fn host_facts() -> capability::CapabilityFacts {
38    gpu::context::host_facts()
39}