Skip to content
Open
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
58 changes: 39 additions & 19 deletions source/qdk_package/qdk/qre/models/qubits/_msft.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the MIT License.

from dataclasses import KW_ONLY, dataclass, field
from typing import cast, Optional

from ..._architecture import Architecture, ISAContext
from ...instruction_ids import (
Expand All @@ -20,15 +21,22 @@
class Majorana(Architecture):
"""
This class models physical instructions that may be relevant for future
Majorana qubits. For these qubits, we assume that measurements
and the physical T gate each take 1 µs. Owing to topological protection in
the hardware, we assume single and two-qubit measurement error rates
(Clifford error rates) in $10^{-4}$, $10^{-5}$, and $10^{-6}$ as a range
between realistic and optimistic targets. Non-Clifford operations in this
Majorana qubits. For these qubits, we assume that measurements and the
physical T gate each take 1 µs. Owing to topological protection in the
hardware, we assume single and two-qubit measurement error rates (Clifford
error rates) in $10^{-4}$, $10^{-5}$, and $10^{-6}$ as a range between
realistic and optimistic targets. Non-Clifford operations in this
architecture do not have topological protection, so we assume a 5%, 1.5%,
and 1% error rate for non-Clifford physical T gates for the three cases,
respectively.

Attributes:
error_rate: The error rate for physical Clifford operations (state
preparation and measurement). Defaults to 1e-5, with a domain of
[1e-4, 1e-5, 1e-6] for use in design space exploration.
time: The time (in ns) for physical Clifford operations and the T gate.
Defaults to 1000 ns (1 µs).

References:

- Torsten Karzig, Christina Knapp, Roman M. Lutchyn, Parsa Bonderson,
Expand All @@ -46,25 +54,37 @@ class Majorana(Architecture):

_: KW_ONLY
error_rate: float = field(default=1e-5, metadata={"domain": [1e-4, 1e-5, 1e-6]})
time: int = 1_000
t_error_rate: Optional[float] = None

def provided_isa(self, ctx: ISAContext) -> ISA:
if abs(self.error_rate - 1e-4) <= 1e-8:
t_error_rate = 0.05
elif abs(self.error_rate - 1e-5) <= 1e-8:
t_error_rate = 0.015
elif abs(self.error_rate - 1e-6) <= 1e-8:
t_error_rate = 0.01
def __post_init__(self) -> None:
if self.t_error_rate is None:
if abs(self.error_rate - 1e-4) <= 1e-8:
self.t_error_rate = 0.05
elif abs(self.error_rate - 1e-5) <= 1e-8:
self.t_error_rate = 0.015
elif abs(self.error_rate - 1e-6) <= 1e-8:
self.t_error_rate = 0.01
else:
raise ValueError(
"Invalid error_rate value. Must be one of [1e-4, 1e-5, 1e-6]."
)

def provided_isa(self, ctx: ISAContext) -> ISA:
return ctx.make_isa(
ctx.add_instruction(PREP_X, time=1000, error_rate=self.error_rate),
ctx.add_instruction(PREP_Z, time=1000, error_rate=self.error_rate),
ctx.add_instruction(PREP_X, time=self.time, error_rate=self.error_rate),
ctx.add_instruction(PREP_Z, time=self.time, error_rate=self.error_rate),
ctx.add_instruction(
MEAS_XX, arity=2, time=self.time, error_rate=self.error_rate
),
ctx.add_instruction(
MEAS_XX, arity=2, time=1000, error_rate=self.error_rate
MEAS_ZZ, arity=2, time=self.time, error_rate=self.error_rate
),
ctx.add_instruction(MEAS_X, time=self.time, error_rate=self.error_rate),
ctx.add_instruction(MEAS_Z, time=self.time, error_rate=self.error_rate),
# NOTE From __post_init__, t_error_rate is guaranteed to be non-None
# if error_rate is valid, so we can safely cast it to float here.
ctx.add_instruction(
MEAS_ZZ, arity=2, time=1000, error_rate=self.error_rate
T, time=self.time, error_rate=cast(float, self.t_error_rate)
),
ctx.add_instruction(MEAS_X, time=1000, error_rate=self.error_rate),
ctx.add_instruction(MEAS_Z, time=1000, error_rate=self.error_rate),
ctx.add_instruction(T, time=1000, error_rate=t_error_rate),
)
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ def provided_isa(self, ctx: ISAContext) -> ISA:
T,
encoding=Encoding.PHYSICAL,
arity=1,
time=0,
# NOTE: We assume a time of 0, however, some transforms may use
# the time in arithmetic expressions, which require its value to
# be non-zero. Setting it to 1 leads to no or at most
# negligible contributions to the overall resource estimates.
time=1,
error_rate=0.00001,
),
ctx.add_instruction(
Expand Down
5 changes: 3 additions & 2 deletions source/qdk_package/qdk/qre/property_keys.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ DISTANCE: int
SURFACE_CODE_ONE_QUBIT_TIME_FACTOR: int
SURFACE_CODE_TWO_QUBIT_TIME_FACTOR: int
ACCELERATION: int
ATOM_SPACING: int
VELOCITY: int
NUM_TS_PER_ROTATION: int
EXPECTED_SHOTS: int
RUNTIME_SINGLE_SHOT: int
Expand All @@ -23,6 +21,9 @@ NAME: int
LOSS: int
LOGICAL_CYCLE_TIME: int
CODE_CYCLE_TIME: int
ATOM_SPACING: int
VELOCITY: int
ASSUMPTIONS: int
FEASIBILITY: int
TARGET_YEAR: int
BLOCK_SIZE: int
5 changes: 3 additions & 2 deletions source/qdk_package/src/qre.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1623,8 +1623,6 @@ fn add_property_keys(m: &Bound<'_, PyModule>) -> PyResult<()> {
SURFACE_CODE_ONE_QUBIT_TIME_FACTOR,
SURFACE_CODE_TWO_QUBIT_TIME_FACTOR,
ACCELERATION,
ATOM_SPACING,
VELOCITY,
NUM_TS_PER_ROTATION,
EXPECTED_SHOTS,
RUNTIME_SINGLE_SHOT,
Expand All @@ -1641,9 +1639,12 @@ fn add_property_keys(m: &Bound<'_, PyModule>) -> PyResult<()> {
LOSS,
LOGICAL_CYCLE_TIME,
CODE_CYCLE_TIME,
ATOM_SPACING,
VELOCITY,
ASSUMPTIONS,
FEASIBILITY,
TARGET_YEAR,
BLOCK_SIZE,
);

m.add_submodule(&property_keys)?;
Expand Down
5 changes: 3 additions & 2 deletions source/qre/src/isa/property_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ define_properties! {
SURFACE_CODE_ONE_QUBIT_TIME_FACTOR,
SURFACE_CODE_TWO_QUBIT_TIME_FACTOR,
ACCELERATION,
ATOM_SPACING,
VELOCITY,
NUM_TS_PER_ROTATION,
RUNTIME_SINGLE_SHOT,
EXPECTED_SHOTS,
Expand All @@ -68,7 +66,10 @@ define_properties! {
LOSS,
LOGICAL_CYCLE_TIME,
CODE_CYCLE_TIME,
ATOM_SPACING,
VELOCITY,
ASSUMPTIONS,
FEASIBILITY,
TARGET_YEAR,
BLOCK_SIZE,
}
Loading