Skip to main content

bitnet_quantize/kernels/
mod.rs

1//! GPU kernels for BitNet operations.
2//!
3//! This module provides CubeCL-based GPU kernels for efficient
4//! ternary weight x INT8 activation matrix multiplication.
5//!
6//! Requires the `cuda` feature to be enabled.
7
8#[cfg(feature = "cuda")]
9mod cubecl;
10
11#[cfg(feature = "cuda")]
12pub use cubecl::*;
13
14/// Check if CUDA kernels are available.
15#[must_use]
16pub fn cuda_available() -> bool {
17    #[cfg(feature = "cuda")]
18    {
19        // Check for CUDA device
20        candle_core::Device::cuda_if_available(0).is_ok()
21    }
22
23    #[cfg(not(feature = "cuda"))]
24    {
25        false
26    }
27}