Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c2671d0
feat(sweeper): preserve engine request controls
jasonqinzhou Aug 19, 2026
7ce0460
feat(sweeper): pin forward-pass estimator inputs [AIC-1770]
jasonqinzhou Aug 26, 2026
f15b838
Merge main and expose AIC engine controls
jasonqinzhou Aug 26, 2026
410c7ff
refactor(perfmodel): unify estimator construction [AIC-1770]
jasonqinzhou Aug 26, 2026
633ea00
Merge origin/main into AIC-1770 estimator construction
jasonqinzhou Aug 31, 2026
b88ebcb
fix(sweeper): resolve exact estimator configs
jasonqinzhou Aug 31, 2026
d71c9a2
refactor(perfmodel): unify estimator selection and configuration
tedzhouhk Sep 17, 2026
09111ef
Merge remote-tracking branch 'origin/main' into hzhou-codex/pr13-esti…
tedzhouhk Sep 17, 2026
2e591ec
test(perfmodel): align merged fixtures with canonical API
tedzhouhk Sep 17, 2026
56db663
fix(perfmodel): validate search estimator controls before execution
tedzhouhk Sep 17, 2026
8140fc9
fix(perfmodel): pin native replay identity and reject trailing config…
tedzhouhk Sep 17, 2026
2f72e02
fix(replay): retain rank-level memory controls in canonical timing co…
tedzhouhk Sep 17, 2026
b927ff9
fix(perfmodel): preserve estimator contracts across replay and search
tedzhouhk Sep 17, 2026
3cf3d33
fix(perfmodel): validate availability and preserve resolved estimator…
tedzhouhk Sep 17, 2026
a58055e
fix(perfmodel): close configuration and release contract gaps
tedzhouhk Sep 17, 2026
521f528
chore(ci): merge main and preserve release gating
tedzhouhk Sep 17, 2026
057c66e
feat(sweeper): preserve engine request controls on canonical estimato…
jasonqinzhou Sep 17, 2026
6d6eb3f
Merge origin/main and preserve downstream publication gate
tedzhouhk Sep 18, 2026
1b1aba2
fix(perfmodel): enforce readiness and preserve role configuration
tedzhouhk Sep 18, 2026
41fc547
Merge main resource supervision and retain estimator regression tests
tedzhouhk Sep 18, 2026
1291c77
fix(ci): validate migration gates for the publication target
tedzhouhk Sep 18, 2026
a01b1ae
Merge current PR 242 into engine request controls
jasonqinzhou Sep 18, 2026
85421f2
feat(cli): add native timing and source detail reports
jasonqinzhou Sep 18, 2026
16a05e6
fix(perfmodel): reject overflowing diagnostic token shapes
jasonqinzhou Sep 18, 2026
bd6d242
Merge main to focus engine-controls PR on remaining changes
jasonqinzhou Sep 18, 2026
49aa6cc
Merge main and adapt engine controls to consolidated Python packages
jasonqinzhou Sep 18, 2026
638028a
Fix review findings in engine controls, FPM readiness and replay vali…
jasonqinzhou Sep 18, 2026
d3e5003
Align default MoE backend semantics and document synthetic prefix bounds
jasonqinzhou Sep 18, 2026
0b4cca8
fix(replay): preserve explicit model controls across compatibility gates
jasonqinzhou Sep 18, 2026
ba103e6
Merge remote-tracking branch 'origin/main' into codex/pr269-refresh-m…
jasonqinzhou Sep 18, 2026
fc3d734
Merge updated engine-controls base into timing and source reports
jasonqinzhou Sep 18, 2026
4e5cef6
fix(replay): require support for explicit MTP acceptance
jasonqinzhou Sep 18, 2026
8e885d5
fix(cli): validate diagnostic evidence and preserve partial provenance
jasonqinzhou Sep 18, 2026
ae9d49c
Merge current engine-controls parent for final validation
jasonqinzhou Sep 18, 2026
270f029
test(cli): verify diagnostic validation uses the CLI error exit
jasonqinzhou Sep 18, 2026
adda786
fix(api): publish the native phase diagnostics type signature
jasonqinzhou Sep 18, 2026
d3a10c4
fix(replay): reject unsupported controls at direct AFD boundary
jasonqinzhou Sep 18, 2026
8dff89a
Merge remote-tracking branch 'origin/main' into codex/pr269-refresh-m…
jasonqinzhou Sep 18, 2026
01b4de5
fix(diagnostics): retain specific SOL absence reasons
jasonqinzhou Sep 18, 2026
02b7750
test(sweeper): assert fractional MTP acceptance forwarding
jasonqinzhou Sep 18, 2026
6996377
test(fpm): expect corrupt system YAML to fail closed
jasonqinzhou Sep 18, 2026
767c20a
Merge remote-tracking branch 'origin/main' into codex/pr269-refresh-m…
jasonqinzhou Sep 18, 2026
6faa82e
Merge remote-tracking branch 'origin/main' into codex/pr269-refresh-m…
jasonqinzhou Sep 18, 2026
e22e03f
Merge commit '6faa82ebb9cc264c717a6cfff56e05ffb90a52d4' into codex/pr…
jasonqinzhou Sep 18, 2026
33942fc
test(fpm): expect corrupt system YAML to fail closed
jasonqinzhou Sep 18, 2026
8c93993
Merge commit '33942fc8d5a172a8b3fd1dbd86b1055f674a11b4' into codex/pr…
jasonqinzhou Sep 19, 2026
c45da2c
fix(diagnostics): align native and schema validation contracts
jasonqinzhou Sep 19, 2026
7301939
Merge current main into PR 269
jasonqinzhou Sep 19, 2026
8686276
fix(engine): reject unsupported decoder replay
jasonqinzhou Sep 19, 2026
4cb1eae
Merge commit '7301939e0efc2c919b090102306240b9c64789e1' into codex/pr…
jasonqinzhou Sep 19, 2026
9282f93
style(tests): sort runner imports
jasonqinzhou Sep 19, 2026
6eab22f
style(config): format decoder replay validation
jasonqinzhou Sep 19, 2026
ef9d16f
Merge commit '6eab22fc8a2c38fd941d98344e98318be6c77c29' into codex/pr…
jasonqinzhou Sep 19, 2026
5735cd2
fix(config): preserve lightweight supervision imports
jasonqinzhou Sep 19, 2026
92866bf
Merge validated parent into timing and source reports
jasonqinzhou Sep 19, 2026
ebc898e
Record merged parent ancestry without changing reviewed tree
jasonqinzhou Sep 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
215 changes: 214 additions & 1 deletion crates/core/src/engine/timing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pub struct TimingOperationEvidence {
pub latency_ms: f64,
pub covered_latency_ms: f64,
pub source: TimingEvidenceSource,
pub details: Option<crate::perfmodel::engine::diagnostics::OperationDetails>,
}

impl TimingOperationEvidence {
Expand All @@ -88,13 +89,14 @@ impl TimingOperationEvidence {
latency_ms,
covered_latency_ms,
source,
details: None,
}
.canonicalized()
}

fn canonicalized(mut self) -> Result<Self> {
ensure!(
!self.name.is_empty(),
!self.name.trim().is_empty(),
"timing evidence operation name cannot be empty"
);
ensure!(
Expand All @@ -119,6 +121,44 @@ impl TimingOperationEvidence {
self.covered_latency_ms,
self.latency_ms
);
if let Some(details) = &self.details {
ensure!(
details.sol.is_some() != details.sol_unavailable_reason.is_some(),
"SOL evidence requires exactly one of a value or an unavailable reason"
);
ensure!(
details
.sol_unavailable_reason
.as_ref()
.is_none_or(|reason| !reason.trim().is_empty()),
"SOL unavailable reason cannot be empty"
);
if let Some(sol) = &details.sol {
ensure!(
[sol.latency_ms, sol.math_ms, sol.memory_ms]
.iter()
.all(|v| v.is_finite() && *v >= 0.0),
"invalid SOL evidence"
);
}
for fallback in &details.fallbacks {
ensure!(
matches!(fallback.inference_phase.as_str(), "context" | "generation"),
"invalid fallback inference phase"
);
ensure!(
!fallback.comm_backend.trim().is_empty(),
"fallback comm backend cannot be empty"
);
ensure!(
fallback.requested_ep_size > 0
&& fallback.requested_node_num > 0
&& fallback.measurement_ep_size > 0
&& fallback.measurement_node_num > 0,
"fallback topology sizes must be positive"
);
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
self.energy_wms = self.energy_wms.filter(|energy| *energy > 0.0);
if self.energy_wms.is_none() {
self.covered_latency_ms = 0.0;
Expand All @@ -137,6 +177,39 @@ impl TimingOperationEvidence {
(None, None) => None,
};
combined.source = combined.source.merge(other.source);
combined.details = match (combined.details, other.details) {
(Some(mut left), Some(right)) => {
left.sol = match (left.sol, right.sol) {
(Some(mut a), Some(b)) => {
a.latency_ms += b.latency_ms;
a.math_ms += b.math_ms;
a.memory_ms += b.memory_ms;
Some(a)
}
_ => None,
};
if left.sol.is_none() {
left.sol_unavailable_reason = left
.sol_unavailable_reason
.or(right.sol_unavailable_reason)
.or_else(|| Some("some accumulated operations lack SOL evidence".into()));
}
for fallback in right.fallbacks {
if !left.fallbacks.contains(&fallback) {
left.fallbacks.push(fallback);
}
}
Some(left)
}
(Some(mut details), None) | (None, Some(mut details)) => {
details.sol = None;
details.sol_unavailable_reason.get_or_insert_with(|| {
"some accumulated operations lack diagnostic evidence".into()
});
Some(details)
}
(None, None) => None,
};
Comment thread
coderabbitai[bot] marked this conversation as resolved.
*self = combined.canonicalized()?;
Ok(())
}
Expand Down Expand Up @@ -606,6 +679,145 @@ mod tests {
assert_eq!(phase.operations[1].energy_wms, None);
}

#[test]
fn sol_evidence_requires_one_explicit_availability_state() {
use crate::perfmodel::engine::diagnostics::{OperationDetails, SolDiagnostics};
for (has_sol, reason, valid) in [
(false, None, false),
(false, Some(""), false),
(false, Some(" "), false),
(false, Some("unsupported operation"), true),
(true, Some("unsupported operation"), false),
(true, None, true),
] {
let mut op =
TimingOperationEvidence::new("test", 2.0, None, TimingEvidenceSource::Estimated)
.unwrap();
op.details = Some(OperationDetails {
sol: has_sol.then_some(SolDiagnostics {
latency_ms: 1.0,
math_ms: 0.0,
memory_ms: 1.0,
}),
sol_unavailable_reason: reason.map(str::to_string),
fallbacks: Vec::new(),
});
assert_eq!(
TimingPhaseEvidence::try_from_operations(vec![op]).is_ok(),
valid
);
}
}

#[test]
fn diagnostic_fallback_records_are_validated_at_the_public_boundary() {
use crate::perfmodel::engine::diagnostics::{ExecutedFallback, OperationDetails};
for name in ["", " \t\n"] {
assert!(
TimingOperationEvidence::new(name, 2.0, None, TimingEvidenceSource::Estimated)
.is_err()
);
}
let valid = ExecutedFallback {
inference_phase: "context".into(),
comm_backend: "deepep_ll".into(),
requested_ep_size: 16,
requested_node_num: 2,
measurement_ep_size: 8,
measurement_node_num: 1,
};
let mut records = vec![(valid.clone(), true)];
for (key, value) in [
("inference_phase", serde_json::json!("generation")),
("inference_phase", serde_json::json!("invalid")),
("comm_backend", serde_json::json!(" \t\n")),
("requested_ep_size", serde_json::json!(0)),
("requested_node_num", serde_json::json!(0)),
("measurement_ep_size", serde_json::json!(0)),
("measurement_node_num", serde_json::json!(0)),
] {
let mut record = serde_json::to_value(&valid).unwrap();
record[key] = value.clone();
records.push((
serde_json::from_value(record).unwrap(),
value == serde_json::json!("generation"),
));
}
for (fallback, expected_valid) in records {
let mut operation = TimingOperationEvidence::new(
"dispatch",
2.0,
None,
TimingEvidenceSource::Estimated,
)
.unwrap();
operation.details = Some(OperationDetails {
sol: None,
sol_unavailable_reason: Some("unsupported operation".into()),
fallbacks: vec![valid.clone(), fallback],
});
assert_eq!(
TimingPhaseEvidence::try_from_operations(vec![operation]).is_ok(),
expected_valid
);
}
}

#[test]
fn mixed_diagnostics_preserve_known_fallbacks_in_both_orders() {
use crate::perfmodel::engine::diagnostics::{
ExecutedFallback, OperationDetails, SolDiagnostics,
};
let plain =
TimingOperationEvidence::new("dispatch", 2.0, None, TimingEvidenceSource::Estimated)
.unwrap();
let mut detailed = plain.clone();
detailed.details = Some(OperationDetails {
sol: Some(SolDiagnostics {
latency_ms: 1.0,
math_ms: 0.0,
memory_ms: 1.0,
}),
sol_unavailable_reason: None,
fallbacks: vec![ExecutedFallback {
inference_phase: "generation".into(),
comm_backend: "deepep_ll".into(),
requested_ep_size: 16,
requested_node_num: 2,
measurement_ep_size: 8,
measurement_node_num: 1,
}],
});
for prior_reason in [None, Some("unsupported shape")] {
let mut detailed = detailed.clone();
if let Some(reason) = prior_reason {
let details = detailed.details.as_mut().unwrap();
details.sol = None;
details.sol_unavailable_reason = Some(reason.into());
}
for ops in [
vec![plain.clone(), detailed.clone()],
vec![detailed.clone(), plain.clone()],
] {
let phase = TimingPhaseEvidence::try_from_operations(ops).unwrap();
assert_eq!(phase.latency_ms, 4.0);
let details = phase.operations[0].details.as_ref().unwrap();
assert_eq!(
details.fallbacks,
detailed.details.as_ref().unwrap().fallbacks
);
assert!(details.sol.is_none());
assert_eq!(
details.sol_unavailable_reason.as_deref(),
Some(
prior_reason
.unwrap_or("some accumulated operations lack diagnostic evidence")
)
);
}
}
}

#[test]
fn zero_energy_is_canonicalized_to_missing() {
let operation = TimingOperationEvidence::new(
Expand Down Expand Up @@ -659,6 +871,7 @@ mod tests {
latency_ms: 10.0,
covered_latency_ms: 10.0,
source: TimingEvidenceSource::Empirical,
details: None,
};

let raw_phase = TimingPhaseEvidence {
Expand Down
39 changes: 39 additions & 0 deletions crates/core/src/perfmodel/engine/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//! Evidence for one native static phase, before online correction.
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SolDiagnostics {
pub latency_ms: f64,
pub math_ms: f64,
pub memory_ms: f64,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ExecutedFallback {
pub inference_phase: String,
pub comm_backend: String,
pub requested_ep_size: u32,
pub requested_node_num: u32,
pub measurement_ep_size: u32,
pub measurement_node_num: u32,
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct OperationDetails {
pub sol: Option<SolDiagnostics>,
pub sol_unavailable_reason: Option<String>,
/// Executed measurement substitutions; empty means no recorded substitution.
pub fallbacks: Vec<ExecutedFallback>,
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct StaticOperationDiagnostics {
pub name: String,
pub latency_ms: f64,
pub energy_wms: f64,
pub source: String,
pub details: OperationDetails,
}
1 change: 1 addition & 0 deletions crates/core/src/perfmodel/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//! static-inference composition. PyO3 bindings over `Engine` live in
//! [`crate::py`].

pub mod diagnostics;
mod readiness;
pub mod runtime;
pub mod spec;
Expand Down
Loading
Loading