Skip to main content

tpt_gpu_primitives/
lib.rs

1//! # TPT Primitives (tptp-core)
2//!
3//! GPU compute primitives for the TPT GPU platform.
4//! Provides high-level Rust wrappers for GEMM, Attention, Conv2D, Conv3D,
5//! LayerNorm, BatchNorm, GroupNorm, RMSNorm, Softmax, elementwise activations,
6//! Embedding lookup, and 2D Pooling kernels with TPTIR compilation and vendor dispatch.
7
8pub mod error;
9pub mod ffi;
10pub mod kernel;
11pub mod kernels;
12pub mod memory;
13pub mod tptir;
14pub mod vendor;
15
16pub use error::{TptpError, TptpResult};
17pub use kernel::{KernelBuilder, KernelConfig, KernelDispatch, KernelResult, PrimitiveKernel};
18pub use kernels::attention::AttentionParams;
19pub use kernels::batchnorm::BatchNormParams;
20pub use kernels::conv2d::Conv2DParams;
21pub use kernels::conv3d::Conv3DParams;
22pub use kernels::elementwise::ElementwiseParams;
23pub use kernels::embedding::EmbeddingParams;
24pub use kernels::gemm::GemmParams;
25pub use kernels::groupnorm::GroupNormParams;
26pub use kernels::layernorm::LayerNormParams;
27pub use kernels::pooling::PoolingParams;
28pub use kernels::quant_gemm::DEFAULT_GROUP_SIZE;
29pub use kernels::rmsnorm::RmsNormParams;
30pub use kernels::softmax::SoftmaxParams;
31pub use kernels::{
32    ActivationKind, AttentionKernel, AvgPool2DKernel, BatchNormKernel, Conv2DKernel, Conv3DKernel,
33    ElementwiseKernel, EmbeddingKernel, FusedActivation, FusedGemmKernel, FusedGemmParams,
34    GemmKernel, GroupNormKernel, LayerNormKernel, MaxPool2DKernel, QuantGemmKernel, RmsNormKernel,
35    SoftmaxKernel,
36};
37pub use memory::{BufferFlags, DType, GpuBuffer};
38pub use tptir::{CompilationOptions, CompilationTarget, TptirCompiler};
39pub use vendor::{VendorBackend, VendorLibrary};
40
41/// Re-export commonly used types
42pub mod prelude {
43    pub use crate::kernel::{KernelBuilder, KernelConfig, KernelResult, PrimitiveKernel};
44    pub use crate::kernels::{
45        ActivationKind, AttentionKernel, AvgPool2DKernel, BatchNormKernel, Conv2DKernel,
46        Conv3DKernel, ElementwiseKernel, EmbeddingKernel, GemmKernel, GroupNormKernel,
47        LayerNormKernel, MaxPool2DKernel, RmsNormKernel, SoftmaxKernel,
48    };
49    pub use crate::vendor::VendorBackend;
50    pub use crate::{BufferFlags, DType, GpuBuffer, TptpError, TptpResult};
51}
52
53/// Crate version
54pub const VERSION: &str = env!("CARGO_PKG_VERSION");
55
56/// Crate name
57pub const NAME: &str = env!("CARGO_PKG_NAME");