Skip to main content

axonml_core/
lib.rs

1//! Foundation layer for the AxonML deep learning framework.
2//!
3//! Provides the `Device` enum (CPU, CUDA, Vulkan, Metal, WebGPU) with runtime
4//! capability queries, the `Scalar`/`Numeric`/`Float` trait hierarchy for
5//! generic type-safe dispatch, reference-counted `Storage<T>` with pooled GPU
6//! allocations, and five compute backends: CPU (rayon-parallel GEMM/GEMV via
7//! matrixmultiply), CUDA (cuBLAS + 15 custom PTX kernel modules covering
8//! elementwise ops, activations, attention, Q4_K/Q6_K dequant-in-shader
9//! matmul, softmax, layernorm, RMSNorm, transpose, and embedding gather),
10//! Vulkan (ash + gpu-allocator, full buffer/pipeline/dispatch), Metal
11//! (full buffer/pipeline/dispatch on Apple Silicon), and WebGPU (wgpu,
12//! full buffer/pipeline/dispatch for browser targets).
13//!
14//! # File
15//! `crates/axonml-core/src/lib.rs`
16//!
17//! # Author
18//! Andrew Jewell Sr. — AutomataNexus LLC
19//! ORCID: 0009-0005-2158-7060
20//!
21//! # Updated
22//! April 14, 2026 11:15 PM EST
23//!
24//! # Disclaimer
25//! Use at own risk. This software is provided "as is", without warranty of any
26//! kind, express or implied. The author and AutomataNexus shall not be held
27//! liable for any damages arising from the use of this software.
28
29#![cfg_attr(not(feature = "std"), no_std)]
30#![warn(missing_docs)]
31#![warn(clippy::all)]
32#![warn(clippy::pedantic)]
33// ML/tensor-specific allowances
34#![allow(clippy::cast_possible_truncation)]
35#![allow(clippy::cast_sign_loss)]
36#![allow(clippy::cast_precision_loss)]
37#![allow(clippy::cast_possible_wrap)]
38#![allow(clippy::missing_errors_doc)]
39#![allow(clippy::missing_panics_doc)]
40#![allow(clippy::must_use_candidate)]
41#![allow(clippy::module_name_repetitions)]
42#![allow(clippy::similar_names)]
43#![allow(clippy::many_single_char_names)]
44#![allow(clippy::too_many_arguments)]
45#![allow(clippy::doc_markdown)]
46#![allow(clippy::cast_lossless)]
47#![allow(clippy::needless_pass_by_value)]
48#![allow(clippy::redundant_closure_for_method_calls)]
49#![allow(clippy::uninlined_format_args)]
50#![allow(clippy::ptr_arg)]
51#![allow(clippy::return_self_not_must_use)]
52#![allow(clippy::not_unsafe_ptr_arg_deref)]
53#![allow(clippy::items_after_statements)]
54#![allow(clippy::unreadable_literal)]
55#![allow(clippy::if_same_then_else)]
56#![allow(clippy::needless_range_loop)]
57#![allow(clippy::trivially_copy_pass_by_ref)]
58#![allow(clippy::unnecessary_wraps)]
59#![allow(clippy::match_same_arms)]
60#![allow(clippy::unused_self)]
61#![allow(clippy::too_many_lines)]
62#![allow(clippy::single_match_else)]
63#![allow(clippy::fn_params_excessive_bools)]
64#![allow(clippy::struct_excessive_bools)]
65#![allow(clippy::format_push_string)]
66#![allow(clippy::erasing_op)]
67#![allow(clippy::type_repetition_in_bounds)]
68#![allow(clippy::iter_without_into_iter)]
69#![allow(clippy::should_implement_trait)]
70#![allow(clippy::use_debug)]
71#![allow(clippy::case_sensitive_file_extension_comparisons)]
72#![allow(clippy::large_enum_variant)]
73#![allow(clippy::panic)]
74#![allow(clippy::struct_field_names)]
75#![allow(clippy::missing_fields_in_debug)]
76#![allow(clippy::upper_case_acronyms)]
77#![allow(clippy::assigning_clones)]
78#![allow(clippy::option_if_let_else)]
79#![allow(clippy::manual_let_else)]
80#![allow(clippy::explicit_iter_loop)]
81#![allow(clippy::default_trait_access)]
82#![allow(clippy::only_used_in_recursion)]
83#![allow(clippy::manual_clamp)]
84#![allow(clippy::ref_option)]
85#![allow(clippy::multiple_bound_locations)]
86#![allow(clippy::comparison_chain)]
87#![allow(clippy::manual_assert)]
88#![allow(clippy::unnecessary_debug_formatting)]
89
90// =============================================================================
91// Modules
92// =============================================================================
93
94pub mod allocator;
95pub mod backends;
96pub mod device;
97pub mod dtype;
98pub mod error;
99pub mod storage;
100
101// =============================================================================
102// Re-exports
103// =============================================================================
104
105pub use allocator::{Allocator, DefaultAllocator};
106pub use device::Device;
107pub use dtype::{DType, Float, Numeric, Scalar};
108pub use error::{Error, Result};
109pub use storage::Storage;
110
111// =============================================================================
112// Prelude
113// =============================================================================
114
115/// Convenient imports for common usage.
116pub mod prelude {
117    pub use crate::device::Device;
118    pub use crate::dtype::{DType, Float, Numeric, Scalar};
119    pub use crate::error::{Error, Result};
120    pub use crate::storage::Storage;
121}