Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions quon_na/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ pub use qec_schedule::{round_barrier_cuts, run_from_qec_workload};
pub use report::{
AtomLossBudget, BottleneckKind, ErrorBudgetContributions, RESOURCE_REPORT_EVIDENCE_DISCLAIMER,
RESOURCE_REPORT_EVIDENCE_KIND, ReportError, ResourceReport, ScheduleOptimality,
TemporalAtomMetrics, attach_qec_error_budget, build_resource_report,
require_target_error_model, resource_report_to_json, resource_report_to_markdown,
simultaneous_layer_time,
TargetReportOverlay, TemporalAtomMetrics, attach_qec_error_budget, build_resource_report,
overlay_target_report, require_target_error_model, resource_report_to_json,
resource_report_to_markdown, simultaneous_layer_time,
};
pub use schedule::{
AtomMove, EntanglingAction, LocalGateKind, MeasurementBasis, MovementGroup, NeutralAtomAction,
Expand Down
52 changes: 18 additions & 34 deletions quon_na/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//! 2. **`schedule_from_graph`** → **`schedule_entangling_layers`**
//! 3. **Zoned** (`schedule_zoned`) **or** flat AOD (`place` + `plan_aod_movement`)
//! 4. **Optional compaction** ([`compact_schedule`], fail-closed)
//! 5. **Resource report** ([`build_resource_report`])
//! 5. **Resource report** ([`build_resource_report`], then [`overlay_target_report`])
//!
//! Fixed (OpenQASM) physical passes live in `mlir_bridge::pipeline`.

Expand All @@ -25,7 +25,9 @@ use crate::graph::{InteractionGraph, LogicalQubitId};
use crate::layout::AtomId;
use crate::movement::MovementParams;
use crate::placement::PlacementStrategy;
use crate::report::{ResourceReport, attach_qec_error_budget, build_resource_report};
use crate::report::{
ResourceReport, TargetReportOverlay, build_resource_report, overlay_target_report,
};
use crate::schedule::{MeasurementBasis, NeutralAtomAction, ScheduleLayer};
use crate::schedule_entry::{GraphScheduleRequest, schedule_from_graph};
use crate::stats::{CompactionConfig, EffectiveConfig, NaStats, StageTimingsUs};
Expand Down Expand Up @@ -782,38 +784,20 @@ fn finish_pipeline(

let stage_started = Instant::now();
let report = build_resource_report(&req.layers, None, Some(logical_qubits.max(1)))?;
let report = match aware_search_status {
Some((completed, fell_back)) => report.with_aware_search_status(completed, fell_back),
None => report,
};
let report = match schedule_optimality {
Some(optimality) => report.with_schedule_optimality(optimality),
None => report,
};
let report = report.with_agnostic_placer_mechanism(agnostic_placer_mechanism);
// Production path: attach analytic error_budget whenever the target carries
// an error_model (ADR-0017). `--emit-resource-report` in quonc additionally
// hard-requires the model so missing budgets fail at emit time.
let report = match na.error_model.as_ref() {
Some(model) => attach_qec_error_budget(report, Some(model))?,
None => report,
};
// Analytic end-to-end fidelity estimate (Enola Eq. (1), issue #305).
// Unlike `error_model`, `NeutralAtomTarget::fidelity` is a mandatory
// field, so this overlay always applies once a target is available —
// `gate_fidelity_product`/`estimated_fidelity` are `Some` on every
// production report from this pipeline.
let report = report.with_fidelity_estimate(&req.layers, &na.fidelity);
// Analytic per-atom movement-heating / atom-loss budget (issue #310,
// \[Atomique\] Eqs. (1)–(2)). Optional like `error_model`: attached only
// when the target carries `atom_loss_model`, else the section is omitted.
// Distance is measured against the zoned schedule's layout (the real
// √-law travel); `req.layout` is `None` only for non-zoned hand-built
// schedules, in which case the budget is emitted zeroed (observable).
let report = match na.atom_loss_model.as_ref() {
Some(model) => report.with_atom_loss_budget(&req.layers, req.layout.as_ref(), model),
None => report,
};
// Shared with `qec_schedule::schedule_expanded` (issue #468): error
// budget, fidelity, atom-loss, and the diagnostic labels. Emit-time
// `--emit-resource-report` still hard-requires `error_model` separately.
let report = overlay_target_report(
report,
&TargetReportOverlay {
layers: &req.layers,
layout: req.layout.as_ref(),
target: na,
aware_search: aware_search_status,
agnostic_placer_mechanism,
schedule_optimality,
},
)?;
let resource_report_us = elapsed_us(stage_started);

let stats = NaStats {
Expand Down
42 changes: 17 additions & 25 deletions quon_na/src/qec_schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
//! 2. Per round: Misra–Gries entangling → place→move (or zoned) → terminals
//! 3. Append a durable [`NeutralAtomAction::Wait`] after each memory round
//! 4. Concatenate rounds; compact with Barrier cuts at Wait markers (fail-closed)
//! 5. Resource report sized from code blocks + memory-round metadata
//! 5. Resource report sized from code blocks + memory-round metadata, then
//! [`crate::report::overlay_target_report`]

use std::time::Instant;

Expand Down Expand Up @@ -35,7 +36,7 @@ use crate::plan::{QecStageAccumulator, plan_backend};
use crate::qec::code_blocks_from_expanded;
#[cfg(feature = "solver")]
use crate::report::ScheduleOptimality;
use crate::report::{attach_qec_error_budget, build_resource_report};
use crate::report::{TargetReportOverlay, build_resource_report, overlay_target_report};
use crate::schedule::{LocalGateKind, MeasurementBasis, NeutralAtomAction, ScheduleLayer};
use crate::schedule_entry::{GraphScheduleRequest, schedule_from_graph};
use crate::stats::{CompactionConfig, EffectiveConfig, NaStats, StageTimingsUs};
Expand Down Expand Up @@ -222,33 +223,24 @@ fn schedule_expanded(
let mut report = build_resource_report(&req.layers, Some(&code_blocks), None)?;
// Distance ownership: `with_code_blocks` via `CodeFamily::distance()`.
report.memory_rounds = Some(expanded.memory_round_count() as u64);
// Magic-state-consuming logical operation counts (issue #283).
// Magic-state-consuming logical operation counts (issue #283). These
// stay here: the flat pipeline has no workload to size them from.
report.t_count = Some(expanded.t_count() as u64);
report.tdag_count = Some(expanded.tdag_count() as u64);
report.ccz_count = Some(expanded.ccz_count() as u64);
report.magic_state_demand = Some(expanded.magic_state_demand() as u64);
let report = match na.error_model.as_ref() {
Some(model) => attach_qec_error_budget(report, Some(model))?,
None => report,
};
// Analytic end-to-end fidelity estimate (Enola Eq. (1), issue #305) —
// same unconditional overlay as the flat/zoned pipeline
// (`pipeline::finish_pipeline`); `NeutralAtomTarget::fidelity` is
// mandatory, so this always applies once a target is available.
let report = report.with_fidelity_estimate(&req.layers, &na.fidelity);
// Analytic per-atom movement-heating / atom-loss budget (issue #310,
// \[Atomique\] Eqs. (1)–(2)). Optional like `error_model`: attached only
// when the target carries `atom_loss_model`; distance measured against
// the zoned schedule's layout (real √-law travel), else zeroed/omitted.
let report = match na.atom_loss_model.as_ref() {
Some(model) => report.with_atom_loss_budget(&req.layers, req.layout.as_ref(), model),
None => report,
};
let report = report.with_agnostic_placer_mechanism(stage_acc.agnostic_placer_mechanism);
let report = match stage_acc.schedule_optimality {
Some(optimality) => report.with_schedule_optimality(optimality),
None => report,
};
// Shared with `pipeline::finish_pipeline` (issue #468).
let report = overlay_target_report(
report,
&TargetReportOverlay {
layers: &req.layers,
layout: req.layout.as_ref(),
target: na,
aware_search: None,
agnostic_placer_mechanism: stage_acc.agnostic_placer_mechanism,
schedule_optimality: stage_acc.schedule_optimality,
},
)?;
let resource_report_us = elapsed_us(stage_started);

let req = project_request_to_logical(req);
Expand Down
Loading
Loading