Skip to main content

Crate atomr_accel

Crate atomr_accel 

Source
Expand description

§atomr-accel

Actor-shaped face for compute-acceleration backends, on top of the atomr actor runtime. NVIDIA CUDA is the first shipping implementation (atomr-accel-cuda); the same trait surface accommodates AMD ROCm, Apple Metal, Intel oneAPI, and Vulkan compute when those land.

[dependencies]
atomr-accel      = "0.1"
atomr-accel-cuda = "0.1"   # active backend
use atomr_accel::prelude::*;
use atomr_accel_cuda as cuda;

§What this crate is

A thin core that names the abstractions every backend has to satisfy:

  • AccelBackend — marker trait identifying a backend, with associated Device, Stream, Event, Error types.
  • AccelDtype / DType — backend-agnostic numeric data-type trait + discriminant. Backends layer their own *Dtype trait on top with FFI mappings.
  • AccelRef — generation-validated typed device pointer parametric over the backend.
  • AccelError — typed error enum, #[non_exhaustive] so backends can add LibraryError variants without breaking core.
  • CompletionStrategy — async wakeup contract for kernel completion (host-fn callback, sync, polled).
  • KernelOp — marker trait for typed op envelopes (Sgemm, RngFillUniform, etc.).

The core deliberately ships no concrete actors. Each backend crate (atomr-accel-cuda, future atomr-accel-rocm, atomr-accel-metal, …) provides its own DeviceActor, KernelActor family, and library wrappers, and depends on this crate for the trait surface.

§What this crate is not

  • A least-common-denominator API. Backends expose more than the trait surface — atomr_accel_cuda::kernel::CudnnActor has a richer message set than KernelOp knows about, and that’s fine. The trait surface is for portable code; backend-specific work uses the concrete crate directly.
  • A device-abstraction layer like wgpu or SYCL. We don’t try to compile one shader to many targets. We supervise the right library on the right hardware.

Re-exports§

pub use backend::AccelBackend;
pub use backend::AccelDevice;
pub use backend::AccelStream;
pub use completion::CompletionStrategy;
pub use dtype::AccelDtype;
pub use dtype::DType;
pub use error::AccelError;
pub use gpu_ref::AccelRef;
pub use kernel::KernelOp;

Modules§

backend
Backend identity traits.
completion
CompletionStrategy — async wakeup contract for kernel completion. Promoted to the core so every backend can plug into the same family (host-fn callback, sync block, polled query).
dtype
AccelDtype — backend-agnostic numeric data-type trait.
error
Backend-agnostic error taxonomy.
gpu_ref
AccelRef<T, B> — backend-agnostic typed device pointer.
kernel
KernelOp — marker trait for typed kernel-op envelopes.
prelude
Canonical re-exports. use atomr_accel::prelude::*;.