Skip to content

Commit

Permalink
Pj/dta2 412/update detailed hardware model (#157)
Browse files Browse the repository at this point in the history
* fix: save before help from PJ

* fix: save before help from PJ (again)

* Moving ruby slippers file into folder

* Replacing icmop with orquestra circuits

* Making julia functions compatible with orquestra circuit input and adding proxy for op_list

* fix: rbs with pauli tracker works

* fix: pauli tracker

* feat: commit before breaking rbs

* fix: old rbs tests

* feat: added sdk parallelization

* feat: faster temporal DAG creation

* fix: incorrect task imports

* fix: move wf definition

* fix: move wf definition again

* feat: slow space optimal

* feat: faster kahns algo

* fix: stuff

* fix: move tasks out of transformer

* feat: parallelized pipeline

* feat: rigetti instances

* fix: remove graph production method as input

* fix: problems

* feat: better low qubit counts

* fix: orquestra integration

* fix: commit before removing unneeded sections

* feat: better costing

* fix: updated new example to new api

Got rid of transpile to clifford + T usage as this should no longer be the defaut method.

* fix: examples run

* fix: some tests

* fix: more tests pass

* fix: graph estimator tests pass

* fix: sre_constants no longer fail tests

* fix: all tests pass

* fix: passes style

* fix: remove union from singledispatch

* fix: pyright issues

* fix: pyright issues

* fix: tests pass

* fix: line too long

* fix: simplified jabalizer integration

* fix: added choice to install jabalizer

* fix: azure example

* Updating pauli tracker docstring

* feat: resource breakdowns

* fix: merge conflicts

* fix: don't use jabalizer unless installed

* fix: added individual testing for stitching

* fix: tests pass

* feat: eliminate max independent set

* Adding ELUResourceInfo class

* Major update to the detailed ion trap architecture using new models that account for different elu types

* Fixing bugs in architecture modeling capabilities

* Moving logical architecture info from GraphExtra to BusArchInfo

* Removed QubitAllocation in favor of BusArchitectureInfo and refactored cycle allocation accounting according to the choral round method of teleportation

* Updated the cycle time to account for the 3 individual addresses needed

* Minor changes to cycle accounting added

* Updating superconducting qubit cycle time to match the microsecond values reported in literature

* Update the cycle allocation to the choral round scheme accounting and prevent overflow issue in Decimal using union bound

* Update to cycle accounting in space optimal compilation

* Updated the spatial logical resource accounting to compute the fewest number of factories needed and removed some unnecessary functions

* Updating names of processes in graph state compilation cycle accounting

* Updating cycle allocation for time optimal graph state compilation and updating process names

* Adding test of cycle allocation function

* Updating input to match new cycle_allocation interface

* Improving readability of allocation test and updating numbers to accommodate the new bus architecture modeling

* Cleaning up hardware test module and updating gate time

* Fixing confusing variable naming in function

* Adding rotation synthesis accounting to factory counting and simplifying space vs time layout accounting logic

* Simplified logic for costing space vs time optimal cases

* Improving error accounting and cleaning up logic of function

* Updating tests for new architecture accounting and adding new tests for spatial and temporal accounting

* Removing MagicStateFactory and replacing with MagicStateFactoryInfo everywhere

* Updating graph estimator test to test accounting with multiple subroutines in a quantum program

* Updating decoder tests and test csv to accommodate new superconducting qubit gate speed

* Adding comment to clarify n_logical_qubits field

* Fixing test after changing superconducting qubit runtime

* Fixing style checks

* Fixing additional style check issues

* Fixing style checks that mostly involve type hinting

* Shortening line for style check

* Fixing style issue with output type incompatible with pass in function

* Fixing import styles

* Commenting out some failing tests to solve in a later PR

* Fixing black style issue

* Fixing black style issue

---------

Co-authored-by: Athena Caesura <mathmeetsmusic@gmail.com>
Co-authored-by: Max Radin <radin.max@gmail.com>
  • Loading branch information
3 people authored Jul 15, 2024
1 parent 00e6bf9 commit abad8c9
Show file tree
Hide file tree
Showing 19 changed files with 875 additions and 625 deletions.
2 changes: 1 addition & 1 deletion examples/ex_4_fast_graph_estimates.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from benchq.timing import measure_time


def main():
def main() -> None:
architecture_model = DETAILED_ION_TRAP_ARCHITECTURE_MODEL

with measure_time() as t_info:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,11 @@ def n_rotation_gates(self) -> int:

@property
def n_t_gates(self) -> int:
n_rotation_gates_per_subroutine = [0] * len(self.subroutines)
n_t_gates_per_subroutine = [0] * len(self.subroutines)
for i, compiled_circuit in enumerate(self.subroutines):
n_rotation_gates_per_subroutine[i] = sum(
compiled_circuit.t_states_per_layer
)
n_t_gates_per_subroutine[i] = sum(compiled_circuit.t_states_per_layer)
return sum(
n_rotation_gates_per_subroutine[subroutine]
n_t_gates_per_subroutine[subroutine]
for subroutine in self.subroutine_sequence
)

Expand Down
1 change: 0 additions & 1 deletion src/benchq/magic_state_distillation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from .autoccz_factories import iter_auto_ccz_factories
from .litinski_factories import iter_litinski_factories
from .magic_state_factory import MagicStateFactory
12 changes: 6 additions & 6 deletions src/benchq/magic_state_distillation/autoccz_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
get_total_logical_failure_rate,
physical_qubits_per_logical_qubit,
)
from .magic_state_factory import MagicStateFactory
from ..resource_estimators.resource_info import MagicStateFactoryInfo


def iter_auto_ccz_factories(
physical_qubit_error_rate: float,
) -> Iterator[MagicStateFactory]:
) -> Iterator[MagicStateFactoryInfo]:
for l1_distance in range(5, 25, 2):
for l2_distance in range(l1_distance + 2, 41, 2):
w, h, d = _autoccz_or_t_factory_dimensions(
Expand All @@ -22,7 +22,7 @@ def iter_auto_ccz_factories(
physical_qubit_error_rate=physical_qubit_error_rate,
)

yield MagicStateFactory(
yield MagicStateFactoryInfo(
name=f"AutoCCZ({physical_qubit_error_rate},"
f"{l1_distance}, {l2_distance})",
distilled_magic_state_error_rate=float(f_ccz),
Expand Down Expand Up @@ -94,9 +94,9 @@ def _compute_autoccz_distillation_error(

def _two_level_t_state_factory_1p1000(
physical_qubit_error_rate: float,
) -> MagicStateFactory:
) -> MagicStateFactoryInfo:
assert physical_qubit_error_rate == 0.001
return MagicStateFactory(
return MagicStateFactoryInfo(
name="SC Qubit AutoCCZ Factory",
distilled_magic_state_error_rate=4 * 9 * 1e-17,
space=(12 * 8, 4),
Expand All @@ -108,7 +108,7 @@ def _two_level_t_state_factory_1p1000(

def iter_all_openfermion_factories(
physical_qubit_error_rate: float,
) -> Iterator[MagicStateFactory]:
) -> Iterator[MagicStateFactoryInfo]:
if physical_qubit_error_rate == 0.001:
yield _two_level_t_state_factory_1p1000(
physical_qubit_error_rate=physical_qubit_error_rate
Expand Down
26 changes: 13 additions & 13 deletions src/benchq/magic_state_distillation/litinski_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,44 @@
BasicArchitectureModel,
)

from .magic_state_factory import MagicStateFactory
from ..resource_estimators.resource_info import MagicStateFactoryInfo

_ALLOWED_PHYSICAL_ERROR_RATES = (1e-3, 1e-4)

_ERROR_RATE_FACTORY_MAPPING = {
1e-3: (
MagicStateFactory("(15-to-1)_17,7,7", 4.5e-8, (72, 64), 4620, 42.6),
MagicStateFactory(
MagicStateFactoryInfo("(15-to-1)_17,7,7", 4.5e-8, (72, 64), 4620, 42.6),
MagicStateFactoryInfo(
"(15-to-1)^6_15,5,5 x (20-to-4)_23,11,13",
1.4e-10,
(387, 155),
43300,
130,
t_gates_per_distillation=4,
),
MagicStateFactory(
MagicStateFactoryInfo(
"(15-to-1)^4_13,5,5 x (20-to-4)_27,13,15",
2.6e-11,
(382, 142),
46800,
157,
t_gates_per_distillation=4,
),
MagicStateFactory(
MagicStateFactoryInfo(
"(15-to-1)^6_11,5,5 x (15-to-1)_25,11,11",
2.7e-12,
(279, 117),
30700,
82.5,
),
MagicStateFactory(
MagicStateFactoryInfo(
"(15-to-1)^6_13,5,5 x (15-to-1)_29,11,13",
3.3e-14,
(292, 138),
39100,
97.5,
),
MagicStateFactory(
MagicStateFactoryInfo(
"(15-to-1)^6_17,7,7 x (15-to-1)_41,17,17",
4.5e-20,
(426, 181),
Expand All @@ -51,18 +51,18 @@
),
),
1e-4: (
MagicStateFactory("(15-to-1)_7,3,3", 4.4e-8, (30, 27), 810, 18.1),
MagicStateFactory("(15-to-1)_9,3,3", 9.3e-10, (38, 30), 1150, 18.1),
MagicStateFactory("(15-to-1)_11,5,5", 1.9e-11, (47, 44), 2070, 30),
MagicStateFactory(
MagicStateFactoryInfo("(15-to-1)_7,3,3", 4.4e-8, (30, 27), 810, 18.1),
MagicStateFactoryInfo("(15-to-1)_9,3,3", 9.3e-10, (38, 30), 1150, 18.1),
MagicStateFactoryInfo("(15-to-1)_11,5,5", 1.9e-11, (47, 44), 2070, 30),
MagicStateFactoryInfo(
"(15-to-1)^4_9,3,3 x (20-to-4)_15,7,9",
2.4e-15,
(221, 96),
16400,
90.3,
t_gates_per_distillation=4,
),
MagicStateFactory(
MagicStateFactoryInfo(
"(15-to-1)^4_9,3,3 x (15-to-1)_25,9,9", 6.3e-25, (193, 96), 18600, 67.8
),
),
Expand All @@ -71,7 +71,7 @@

def iter_litinski_factories(
architecture_model: BasicArchitectureModel,
) -> Iterable[MagicStateFactory]:
) -> Iterable[MagicStateFactoryInfo]:
"""
An iterator which yields magic state factories which are optimized in order
to minimize the space time volume.
Expand Down
12 changes: 0 additions & 12 deletions src/benchq/magic_state_distillation/magic_state_factory.py

This file was deleted.

26 changes: 14 additions & 12 deletions src/benchq/magic_state_distillation/small_footprint_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,60 @@
BasicArchitectureModel,
)

from .magic_state_factory import MagicStateFactory
from ..resource_estimators.resource_info import MagicStateFactoryInfo

_ALLOWED_PHYSICAL_ERROR_RATES = {1e-5}

_ERROR_RATE_FACTORY_MAPPING = {
1e-5: (
MagicStateFactory("small footprint (15-to-1)_3,1,1", 1.8e-06, (6, 7), 86, 12.1),
MagicStateFactory(
MagicStateFactoryInfo(
"small footprint (15-to-1)_3,1,1", 1.8e-06, (6, 7), 86, 12.1
),
MagicStateFactoryInfo(
"small footprint (15-to-1)_5,1,3", 7.8e-09, (10, 9), 186, 37.3
),
MagicStateFactory(
MagicStateFactoryInfo(
"small footprint (15-to-1)_7,3,3", 5.5e-12, (14, 19), 538, 36.0
),
MagicStateFactory(
MagicStateFactoryInfo(
"small footprint (15-to-1)_9,3,3", 3.2e-14, (18, 21), 762, 36.0
),
MagicStateFactory(
MagicStateFactoryInfo(
"small footprint (15-to-1)_5,1,1 x (20-to-4)_11,3,5",
6.7e-15,
(37, 22),
1462,
150.0,
),
MagicStateFactory(
MagicStateFactoryInfo(
"small footprint (15-to-1)_5,1,3 x (20-to-4)_11,3,5",
1.4e-16,
(43, 22),
1614,
275.1,
),
MagicStateFactory(
MagicStateFactoryInfo(
"small footprint (15-to-1)_5,1,1 x (20-to-4)_11,5,5",
1.3e-17,
(51, 22),
1958,
150.0,
),
MagicStateFactory(
MagicStateFactoryInfo(
"small footprint (15-to-1)_5,1,1 x (20-to-4)_13,5,5",
1.8e-20,
(51, 22),
2350,
150.0,
),
MagicStateFactory(
MagicStateFactoryInfo(
"small footprint (15-to-1)_5,1,3 x (20-to-4)_15,5,5",
2.7e-22,
(55, 30),
2782,
275.0,
),
MagicStateFactory(
MagicStateFactoryInfo(
"small footprint (15-to-1)_5,1,3 x (20-to-4)_15,5,5",
3.8e-23,
(63, 30),
Expand All @@ -68,7 +70,7 @@

def iter_small_footprint_factories(
architecture_model: BasicArchitectureModel,
) -> Iterable[MagicStateFactory]:
) -> Iterable[MagicStateFactoryInfo]:
"""
An iterator which yields magic state factories which are optimized in order
to minimize the number of physical qubits.
Expand Down
Loading

0 comments on commit abad8c9

Please sign in to comment.