iqm-pulla 9.0.0__tar.gz → 9.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/CHANGELOG.rst +8 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/PKG-INFO +1 -1
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/Custom Gates and Implementations.ipynb +1 -1
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/Example - Executing QIR programs.ipynb +3 -17
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/pulla/utils_qir.py +37 -8
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm_pulla.egg-info/PKG-INFO +1 -1
- iqm_pulla-9.1.0/version.txt +1 -0
- iqm_pulla-9.0.0/version.txt +0 -1
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/AUTHORS.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/LICENSE.txt +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/MANIFEST.in +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/README.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/API.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/Compilation Stages.ipynb +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/Configuration and Usage.ipynb +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/Example - Compilation With Local Calibration Set.ipynb +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/Example - Measuring T1.ipynb +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/Example - Randomized Benchmarking.ipynb +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/Example - Simple Dynamical Decoupling.ipynb +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/Quick Start.ipynb +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/_static/images/favicon.ico +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/_static/images/logo.png +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/_templates/autosummary-class-template.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/_templates/autosummary-module-template.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/authors.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/changelog.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/common_errors.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/conf.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/examples.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/index.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/license.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/migration_guide.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/readme.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/references.bib +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/references.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/user_guides.rst +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/pyproject.toml +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/requirements/base.in +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/requirements/base.txt +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/requirements/notebook.in +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/requirements/notebook.txt +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/requirements/qir.in +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/requirements/qir.txt +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/requirements/qiskit.in +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/requirements/qiskit.txt +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/setup.cfg +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/setup.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/cpc/__init__.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/cpc/compiler/__init__.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/cpc/compiler/circuit_compilation_request_handler.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/cpc/compiler/compiler.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/cpc/compiler/dd.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/cpc/compiler/errors.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/cpc/compiler/standard_stages.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/cpc/compiler/station_settings.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/cpc/interface/__init__.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/cpc/interface/compiler.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/cpc/py.typed +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/pulla/__init__.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/pulla/calibration.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/pulla/interface.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/pulla/pulla.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/pulla/py.typed +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/pulla/quantum_architecture.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/pulla/utils.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/pulla/utils_cirq.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/pulla/utils_dd.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/pulla/utils_qiskit.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm_pulla.egg-info/SOURCES.txt +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm_pulla.egg-info/dependency_links.txt +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm_pulla.egg-info/requires.txt +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm_pulla.egg-info/top_level.txt +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/tests/.pylintrc +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/tests/__init__.py +0 -0
- {iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/tests/conftest.py +0 -0
|
@@ -589,7 +589,7 @@
|
|
|
589
589
|
"outputs": [],
|
|
590
590
|
"source": [
|
|
591
591
|
"circuits, compiler = qiskit_to_pulla(p, backend, example_qiskit_circuit())\n",
|
|
592
|
-
"compiler.add_implementation('custom_x', 'StretchedX', StretchedX, quantum_op=QuantumOp(params=('angle_t', 'phase_t')))\n",
|
|
592
|
+
"compiler.add_implementation('custom_x', 'StretchedX', StretchedX, quantum_op=QuantumOp('custom_x', params=('angle_t', 'phase_t')))\n",
|
|
593
593
|
"\n",
|
|
594
594
|
"c = circuits[0]\n",
|
|
595
595
|
"for inst in c.instructions:\n",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"from iqm.qiskit_iqm import IQMProvider\n",
|
|
22
22
|
"from iqm.pulla.pulla import Pulla\n",
|
|
23
23
|
"from iqm.pulla.utils_qiskit import station_control_result_to_qiskit\n",
|
|
24
|
-
"from iqm.pulla.utils_qir import qir_to_pulla\n",
|
|
24
|
+
"from iqm.pulla.utils_qir import qir_to_pulla, generate_qiskit_qir_qubit_mapping\n",
|
|
25
25
|
"from qiskit_qir import to_qir_module"
|
|
26
26
|
]
|
|
27
27
|
},
|
|
@@ -158,21 +158,7 @@
|
|
|
158
158
|
"outputs": [],
|
|
159
159
|
"source": [
|
|
160
160
|
"# qiskit-qir has a bug, which causes qubit pointers to not be generated correctly\n",
|
|
161
|
-
"
|
|
162
|
-
"# Then we assign qiskit-qir index to the qiskit logic qubit idx.\n",
|
|
163
|
-
"\n",
|
|
164
|
-
"# For simplicity, reverse the mapping\n",
|
|
165
|
-
"layout_reverse_mapping = {bit: idx for idx, bit in qc_transpiled.layout.final_layout.get_physical_bits().items()}\n",
|
|
166
|
-
"qiskit_qir_mapping = {}\n",
|
|
167
|
-
"# Replicate qiskit-qir logic for defining qubit pointer indices\n",
|
|
168
|
-
"for register in qc_transpiled.qregs:\n",
|
|
169
|
-
" qiskit_qir_mapping.update(\n",
|
|
170
|
-
" {layout_reverse_mapping[bit]: n + len(qiskit_qir_mapping) for n, bit in enumerate(register)}\n",
|
|
171
|
-
")\n",
|
|
172
|
-
"\n",
|
|
173
|
-
"# In the generated QIR qubit pointers will use qiskit-qir qubit labels,\n",
|
|
174
|
-
"# but we already know how to map them to IQM physical qubits, through qiskit logical qubit indices.\n",
|
|
175
|
-
"qubits_mapping = {qiskit_qir_mapping[i]: backend.index_to_qubit_name(i) for i in range(qc_transpiled.num_qubits)}"
|
|
161
|
+
"qubits_mapping = generate_qiskit_qir_qubit_mapping(qc_transpiled, backend)"
|
|
176
162
|
]
|
|
177
163
|
},
|
|
178
164
|
{
|
|
@@ -221,7 +207,7 @@
|
|
|
221
207
|
"p = Pulla(station_control_url)\n",
|
|
222
208
|
"# Pass qubit mapping to qir_to_pulla coverter to correctly interpret opaque qubit pointer indices in QIR\n",
|
|
223
209
|
"# and convert them to physical IQM qubit names.\n",
|
|
224
|
-
"circuits, compiler = qir_to_pulla(p, qir, qubits_mapping)\n",
|
|
210
|
+
"circuits, compiler = qir_to_pulla(p.get_standard_compiler(), qir, qubits_mapping)\n",
|
|
225
211
|
"\n",
|
|
226
212
|
"playlist, context = compiler.compile(circuits)\n",
|
|
227
213
|
"\n",
|
|
@@ -34,10 +34,11 @@ from pyqir import (
|
|
|
34
34
|
required_num_results,
|
|
35
35
|
result_id,
|
|
36
36
|
)
|
|
37
|
+
from qiskit import QuantumCircuit
|
|
38
|
+
from qiskit.providers import BackendV2
|
|
37
39
|
|
|
38
40
|
from iqm.cpc.compiler.compiler import Compiler
|
|
39
41
|
from iqm.cpc.interface.compiler import Circuit as CPC_Circuit
|
|
40
|
-
from iqm.pulla.pulla import Pulla
|
|
41
42
|
from iqm.pulse.builder import CircuitOperation
|
|
42
43
|
|
|
43
44
|
qir_logger = logging.getLogger(__name__)
|
|
@@ -147,19 +148,20 @@ def _parse_double(value: str) -> float:
|
|
|
147
148
|
|
|
148
149
|
|
|
149
150
|
def qir_to_pulla( # noqa: PLR0915, PLR0912
|
|
150
|
-
|
|
151
|
+
compiler: Compiler, qir: str | bytes, qubit_mapping: dict[str, str] | None = None
|
|
151
152
|
) -> tuple[list[CPC_Circuit], Compiler]:
|
|
152
153
|
"""Convert a QIR module to a CPC circuit.
|
|
153
154
|
|
|
154
155
|
Args:
|
|
155
|
-
|
|
156
|
+
compiler: compiler to use
|
|
156
157
|
qir: The QIR source or bitcode to convert to a circuit.
|
|
157
158
|
qubit_mapping: A dictionary mapping QIR qubit indexes to physical qubit names,
|
|
158
159
|
None will assume opaque pointers match physical names.
|
|
159
160
|
|
|
160
161
|
Returns:
|
|
161
162
|
str: The QIR program name,
|
|
162
|
-
tuple[
|
|
163
|
+
tuple[list[Circuit], Compiler]:
|
|
164
|
+
Circuits extracted from the QIR module and the compiler with updated component_mapping
|
|
163
165
|
|
|
164
166
|
Raises:
|
|
165
167
|
ValueError: If the QIR program has more than one basic block.
|
|
@@ -240,14 +242,11 @@ def qir_to_pulla( # noqa: PLR0915, PLR0912
|
|
|
240
242
|
circuits = [CPC_Circuit(name=name, instructions=circuit_instructions)]
|
|
241
243
|
qir_logger.debug("Converted circuit: %s", circuits)
|
|
242
244
|
|
|
243
|
-
# Create a compiler containing all the required station information
|
|
244
|
-
compiler = pulla.get_standard_compiler()
|
|
245
|
-
|
|
246
245
|
if qubit_mapping:
|
|
247
246
|
# QIR programs reference to qubits as opaque pointer indexes,
|
|
248
247
|
# however, for example qiskit is using logical names for qubits,
|
|
249
248
|
# so we need to map these indexes to physical qubit names
|
|
250
|
-
compiler.component_mapping = {f"{i}": qubit_mapping[i] for i in range(_required_num_qubits)}
|
|
249
|
+
compiler.component_mapping = {f"{i}": qubit_mapping[str(i)] for i in range(_required_num_qubits)}
|
|
251
250
|
else:
|
|
252
251
|
# QIR programs reference to qubits as opaque pointer indexes,
|
|
253
252
|
# we expect these indexes to match physical qubit names,
|
|
@@ -256,3 +255,33 @@ def qir_to_pulla( # noqa: PLR0915, PLR0912
|
|
|
256
255
|
compiler.component_mapping = {f"{i}": f"QB{i + 1}" for i in range(_required_num_qubits)}
|
|
257
256
|
|
|
258
257
|
return circuits, compiler
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def generate_qiskit_qir_qubit_mapping(qiskit_circuit: QuantumCircuit, qiskit_backend: BackendV2) -> dict[str, str]:
|
|
261
|
+
"""qiskit-qir has a bug, which causes qubit pointers to not be generated correctly
|
|
262
|
+
according to the final_layout. So we replicate this logic here and generate a new mapping.
|
|
263
|
+
Then we assign qiskit-qir index to the qiskit logic qubit idx.
|
|
264
|
+
|
|
265
|
+
Args:
|
|
266
|
+
qiskit_circuit: Qiskit circuit to generate the mapping for.
|
|
267
|
+
qiskit_backend: Qiskit backend object to be used for qubit name generation.
|
|
268
|
+
|
|
269
|
+
Returns:
|
|
270
|
+
A dictionary mapping Qiskit qubit indices to QIR qubit pointers.
|
|
271
|
+
|
|
272
|
+
"""
|
|
273
|
+
# For simplicity, reverse the mapping
|
|
274
|
+
layout_reverse_mapping = {bit: idx for idx, bit in qiskit_circuit.layout.final_layout.get_physical_bits().items()}
|
|
275
|
+
qiskit_qir_mapping: dict[int, int] = {}
|
|
276
|
+
|
|
277
|
+
# Replicate qiskit-qir logic for defining qubit pointer indices
|
|
278
|
+
for register in qiskit_circuit.qregs:
|
|
279
|
+
qiskit_qir_mapping.update(
|
|
280
|
+
{layout_reverse_mapping[bit]: n + len(qiskit_qir_mapping) for n, bit in enumerate(register)}
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
# In the generated QIR qubit pointers will use qiskit-qir qubit labels,
|
|
284
|
+
# but we already know how to map them to IQM physical qubits, through qiskit logical qubit indices.
|
|
285
|
+
return {
|
|
286
|
+
str(qiskit_qir_mapping[i]): str(qiskit_backend.index_to_qubit_name(i)) for i in range(qiskit_circuit.num_qubits)
|
|
287
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
9.1.0
|
iqm_pulla-9.0.0/version.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
9.0.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/docs/Example - Compilation With Local Calibration Set.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iqm_pulla-9.0.0 → iqm_pulla-9.1.0}/src/iqm/cpc/compiler/circuit_compilation_request_handler.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|