Skip to content
Merged
10 changes: 10 additions & 0 deletions crates/asap-aware-mapping/src/analytical_cost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ pub struct ResourceCalibration {
pub cost_per_retained_byte_second: f64,
#[serde(default = "default_horizon_s")]
pub horizon_s: f64,
/// Milliseconds one CPU operation takes on one core: plan selection's
/// latency check reads it (0: work takes no time).
#[serde(default)]
pub ms_per_cpu_op: f64,
/// Milliseconds scanning one byte takes on one core, for the latency
/// check.
#[serde(default)]
pub ms_per_scan_byte: f64,
pub version: String,
}

Expand All @@ -185,6 +193,8 @@ impl ResourceCalibration {
"cost_per_retained_byte_second",
self.cost_per_retained_byte_second,
),
("ms_per_cpu_op", self.ms_per_cpu_op),
("ms_per_scan_byte", self.ms_per_scan_byte),
] {
if !value.is_finite() || value < 0.0 {
return Err(AnalyticalCostError::InvalidCalibration(name, value));
Expand Down
202 changes: 45 additions & 157 deletions crates/asap-aware-mapping/src/pass/stage1_to_stage3.rs

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions crates/asap-aware-mapping/src/physical_plan_cost_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,8 @@ mod tests {
cost_per_retained_byte: 1.0,
cost_per_retained_byte_second: 0.0,
horizon_s: crate::analytical_cost::DEFAULT_HORIZON_S,
ms_per_cpu_op: 0.0,
ms_per_scan_byte: 0.0,
version: "test-v1".into(),
}
}
Expand Down Expand Up @@ -692,6 +694,8 @@ mod tests {
cost_per_retained_byte: 0.0,
cost_per_retained_byte_second: 0.0,
horizon_s: crate::analytical_cost::DEFAULT_HORIZON_S,
ms_per_cpu_op: 0.0,
ms_per_scan_byte: 0.0,
version: "unused-base-v1".into(),
};
let candidates =
Expand Down Expand Up @@ -821,6 +825,8 @@ mod tests {
cost_per_retained_byte: 0.0,
cost_per_retained_byte_second: 0.0,
horizon_s: crate::analytical_cost::DEFAULT_HORIZON_S,
ms_per_cpu_op: 0.0,
ms_per_scan_byte: 0.0,
version: "handoff-only-v1".into(),
};
let space = crate::replacement::search_workload_with(
Expand Down Expand Up @@ -945,6 +951,8 @@ mod tests {
cost_per_retained_byte: 0.0,
cost_per_retained_byte_second: 0.0,
horizon_s: crate::analytical_cost::DEFAULT_HORIZON_S,
ms_per_cpu_op: 0.0,
ms_per_scan_byte: 0.0,
version: "disk-only-v1".into(),
},
)
Expand Down
6 changes: 3 additions & 3 deletions crates/asap-aware-mapping/src/query_physical_lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2874,8 +2874,8 @@ mod tests {
) {
use crate::physical_operator_statistics::ScalarInputStatistics;
use asap_types::workload::{
AccuracyRequirement, BatchEntry, DataWorkload, Evidence, PlanningWorkload,
Predictability, Query, QueryLanguage, QueryRequirements, QueryWorkload,
BatchEntry, DataWorkload, Evidence, PlanningWorkload, Predictability, Query,
QueryLanguage, QueryRequirements, QueryWorkload,
};
use std::cell::RefCell;

Expand All @@ -2885,7 +2885,7 @@ mod tests {
query_batch: Some(vec![BatchEntry {
query: Query(query.into()),
requirements: QueryRequirements {
accuracy: AccuracyRequirement::Explicit(AccuracyTarget::exact()),
accuracy: AccuracyTarget::exact(),
..Default::default()
},
predictability: Predictability::Unknown,
Expand Down
Loading
Loading