Ana içeriğe geç
NM-RFC-0006

Hedef yetenek kısıtları

Tasarım belgesi · Özgün kaynak

RFC'ler tasarım ve değişiklik kayıtlarıdır. Bir önerinin burada bulunması, özelliğin kullanıma hazır olduğu anlamına gelmez. Güncel dil desteğini incele

Özgün belgedeki durum: Çalışma zamanı deneysel

Bağlı özgün kaynak · SHA-256
aaca668a5c523181db2eee41e83e8df25a45ad78e0ae15539ca58437f4e4753f

Status: runtime-experimental Contract: 0.2.0-runtime-experimental Default: disabled Owner: language / compiler

1. Problem

N/M 0.1 already supports @target and advisory @constraints warnings. Those surfaces help exploration, but they do not let a source artifact fail closed when a selected target lacks a required native gate set, exact topology, or bounded reference error budget. A warning-only profile is insufficient for reproducible compilation policy.

NM-RFC-0006 adds an explicitly negotiated, typed assertion:

nm
module native_bell;
@target("superconducting");
@target_capabilities(profile: "superconducting", gate_set: ["H", "CNOT"], connectivity: "line", max_error: 0.08);

fn main() {
  let q: QReg<2> = qreg[2];
  H(q[0]);
  CNOT(q[0], q[1]);
  return q;
}

Stable N/M 0.1 behavior is unchanged. The annotation is accepted only when experimental.targetCapabilityConstraints=true is negotiated.

2. Fields and bounds

Tablo 1
FieldContract
profileRequired registered target id; ASCII lowercase/digit/hyphen, at most 64 UTF-8 bytes.
gate_setOptional closed-world list of 1–32 unique N/M gates. Every source gate must be declared and every declared/source gate must be native on the profile.
connectivityOptional exact all-to-all, line, or grid; no implicit topology subsumption.
max_errorOptional finite value in [1e-9, 1]; compared with the bounded reference profile estimate.

At least one of gate_set, connectivity, or max_error is required in addition to profile. The annotation is line-oriented, must fit on one source line, is limited to 2,048 UTF-8 bytes, and may occur once.

3. Evidence

Successful analysis publishes a deterministic object containing:

  • contract version, required profile and explicit @target;
  • sorted required, missing, and undeclared source gate sets;
  • required/actual connectivity and exact-match result;
  • maximum/estimated error, evidence source and pass result;
  • aggregate passed state.

The bounded reference error estimate is:

text
1 - (1-p1)^single × (1-p2)^two × (1-p3)^three × (1-pm)^measurement

Reference rates are versioned educational profile data. They are not live hardware calibration, an SLA, a provider claim, or a substitute for signed calibration evidence.

4. Diagnostics

Tablo 2
CodeMeaning
NM-PARSE-064Feature was used without explicit negotiation.
NM-PARSE-065Annotation, field, duplicate, type, or bound is invalid.
NM-TARGET-040Profile is unknown or conflicts with @target.
NM-TARGET-041Closed/native gate-set contract fails.
NM-TARGET-042Exact topology contract fails.
NM-TARGET-043Reference error evidence is unavailable or exceeds the budget.

All failures are errors. The compiler/runtime must not silently lower, infer topology compatibility, substitute a profile, or fabricate error evidence after a failed constraint.

5. Carrier and compatibility

The canonical printer preserves field order: profile, gate_set, connectivity, max_error. JSON IR and the strict OpenQASM 3 sidecar preserve the typed requirement, negotiation version, and evidence. OpenQASM 2 cannot carry this contract and must report the gap.

Unknown fields, profiles, gate names, carrier fields, or future contract versions fail closed. No persistent artifact migration is promised while the feature remains experimental.

6. Non-goals

  • claiming live hardware availability, queue state, fidelity, or SLA;
  • selecting a provider or executing a quantum job;
  • treating one topology as implicitly satisfying another;
  • automatically widening the declared gate set after lowering;
  • signed calibration, attestation, or calibration freshness policy;
  • pulse-level capabilities and dynamic-circuit feature negotiation.