pub struct QuantizationSystem { /* private fields */ }Expand description
Comprehensive quantization system that coordinates all quantization functionality
This struct provides a high-level interface to the quantization subsystem, coordinating hardware detection, operation selection, calibration, and benchmarking.
Implementations§
Source§impl QuantizationSystem
impl QuantizationSystem
Sourcepub fn new(device: Device) -> BackendResult<Self>
pub fn new(device: Device) -> BackendResult<Self>
Create a new quantization system for the specified device
Sourcepub fn hardware_features(&self) -> &QuantizationHardwareFeatures
pub fn hardware_features(&self) -> &QuantizationHardwareFeatures
Get hardware features for this system
Sourcepub fn has_acceleration(&self) -> bool
pub fn has_acceleration(&self) -> bool
Check if advanced acceleration is available
Sourcepub fn get_recommendations(
&self,
workload: &QuantizationWorkload,
) -> QuantizationRecommendations
pub fn get_recommendations( &self, workload: &QuantizationWorkload, ) -> QuantizationRecommendations
Get performance recommendations for the given workload
Sourcepub fn calibrate_from_samples(
&mut self,
samples: Vec<Vec<f32>>,
dtype: QuantizedDType,
method: CalibrationMethod,
) -> BackendResult<QuantizationParams>
pub fn calibrate_from_samples( &mut self, samples: Vec<Vec<f32>>, dtype: QuantizedDType, method: CalibrationMethod, ) -> BackendResult<QuantizationParams>
Calibrate quantization parameters from sample data
Sourcepub fn auto_tune(
&mut self,
workload: &QuantizationWorkload,
) -> BackendResult<OptimalQuantizationConfig>
pub fn auto_tune( &mut self, workload: &QuantizationWorkload, ) -> BackendResult<OptimalQuantizationConfig>
Auto-tune quantization parameters for optimal performance
Sourcepub fn benchmark_operations(&mut self) -> BackendResult<BenchmarkSummary>
pub fn benchmark_operations(&mut self) -> BackendResult<BenchmarkSummary>
Benchmark quantization operations
Sourcepub fn quantize_f32(
&self,
input: &[f32],
params: &QuantizationParams,
) -> BackendResult<Vec<u8>>
pub fn quantize_f32( &self, input: &[f32], params: &QuantizationParams, ) -> BackendResult<Vec<u8>>
Perform quantization using the optimal operations for this hardware
Sourcepub fn dequantize_f32(
&self,
input: &[u8],
params: &QuantizationParams,
) -> BackendResult<Vec<f32>>
pub fn dequantize_f32( &self, input: &[u8], params: &QuantizationParams, ) -> BackendResult<Vec<f32>>
Perform dequantization using the optimal operations for this hardware
Sourcepub fn qmatmul(
&self,
a: &QuantizedTensor,
b: &QuantizedTensor,
) -> BackendResult<QuantizedTensor>
pub fn qmatmul( &self, a: &QuantizedTensor, b: &QuantizedTensor, ) -> BackendResult<QuantizedTensor>
Perform quantized matrix multiplication
Sourcepub fn create_quantized_tensor(
&self,
shape: Vec<usize>,
params: QuantizationParams,
) -> QuantizedTensor
pub fn create_quantized_tensor( &self, shape: Vec<usize>, params: QuantizationParams, ) -> QuantizedTensor
Create a quantized tensor with optimal memory layout
Sourcepub fn optimal_block_size(&self) -> usize
pub fn optimal_block_size(&self) -> usize
Get optimal block size for operations on this hardware
Sourcepub fn performance_hints(&self) -> QuantizationPerformanceHints
pub fn performance_hints(&self) -> QuantizationPerformanceHints
Get performance hints for this hardware
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for QuantizationSystem
impl !Send for QuantizationSystem
impl !Sync for QuantizationSystem
impl !UnwindSafe for QuantizationSystem
impl Freeze for QuantizationSystem
impl Unpin for QuantizationSystem
impl UnsafeUnpin for QuantizationSystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more