66 lines
1.9 KiB
Rust
66 lines
1.9 KiB
Rust
//! Performance metrics and results for autotuning.
|
|
|
|
use std::collections::HashMap;
|
|
use std::time::Duration;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// Performance measurement result
|
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
pub struct PerformanceMetrics {
|
|
pub execution_time: Duration,
|
|
pub gflops: f64,
|
|
pub memory_bandwidth: f64,
|
|
pub occupancy: f64,
|
|
pub energy_efficiency: f64,
|
|
}
|
|
|
|
/// Statistical analysis of performance measurements
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct PerformanceStatistics {
|
|
pub mean: f64,
|
|
pub std_dev: f64,
|
|
pub confidence_interval: (f64, f64),
|
|
pub sample_count: usize,
|
|
pub outliers_detected: Option<bool>,
|
|
}
|
|
|
|
/// Gaussian process prediction
|
|
#[derive(Debug, Clone)]
|
|
pub struct GPPrediction {
|
|
pub mean: f64,
|
|
pub variance: f64,
|
|
pub confidence_interval: (f64, f64),
|
|
pub multi_objective_score: Option<f64>,
|
|
}
|
|
|
|
/// Observation for Bayesian optimization
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Observation {
|
|
pub parameters: HashMap<String, i32>,
|
|
pub metrics: PerformanceMetrics,
|
|
pub timestamp: Duration, // Using Duration for serialization
|
|
pub hardware_hash: u64,
|
|
}
|
|
|
|
/// Acquisition history entry
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct AcquisitionHistoryEntry {
|
|
pub parameters: HashMap<String, i32>,
|
|
pub metrics: PerformanceMetrics,
|
|
pub acquisition_value: f64,
|
|
pub iteration: usize,
|
|
}
|
|
|
|
/// Tuning result with optimal parameters and metrics
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct TuningResult {
|
|
pub optimal_parameters: HashMap<String, i32>,
|
|
pub best_metrics: PerformanceMetrics,
|
|
pub iterations_completed: usize,
|
|
pub total_time: Duration,
|
|
pub convergence_achieved: bool,
|
|
pub pareto_frontier: Option<Vec<(HashMap<String, i32>, PerformanceMetrics)>>,
|
|
pub acquisition_history: Option<Vec<AcquisitionHistoryEntry>>,
|
|
}
|