• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / qiskit / 10065639500
88%

Build:
DEFAULT BRANCH: main
Ran 23 Jul 2024 08:27PM UTC
Jobs 1
Files 851
Run time 3min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

23 Jul 2024 07:30PM UTC coverage: 89.911% (-0.009%) from 89.92%
10065639500

push

github

web-flow
Rebalance `CircuitInstruction` and `PackedInstruction` (#12730)

* Rebalance `CircuitInstruction` and `PackedInstruction`

This is a large overhaul of how circuit instructions are both stored in
Rust (`PackedInstruction`) and how they are presented to Python
(`CircuitInstruction`).  In summary:

* The old `OperationType` enum is now collapsed into a manually managed
  `PackedOperation`.  This is logically equivalent, but stores a
  `PyGate`/`PyInstruction`/`PyOperation` indirectly through a boxed
  pointer, and stores a `StandardGate` inline.  As we expect the vast
  majority of gates to be standard, this hugely reduces the memory
  usage.  The enumeration is manually compressed to a single pointer,
  hiding the discriminant in the low, alignment-required bytes of the
  pointer.

* `PackedOperation::view()` unpacks the operation into a proper
  reference-like enumeration `OperationRef<'a>`, which implements
  `Operation` (though there is also a `try_standard_gate` method to get
  the gate without unpacking the whole enumeration).

* Both `PackedInstruction` and `CircuitInstruction` use this
  `PackedOperation` as the operation storage.

* `PackedInstruction` is now completely the Rust-space format for data,
  and `CircuitInstruction` is purely for communication with Python.

On my machine, this commit brings the utility-scale benchmarks to within
10% of the runtime of 1.1.0 (and some to parity), despite all the
additional overhead.

Changes to accepting and building Python objects
------------------------------------------------

* A `PackedInstruction` is created by copy constructor from a
  `CircuitInstruction` by `CircuitData::pack`.  There is no `pack_owned`
  (really, there never was - the previous method didn't take ownership)
  because there's never owned `CircuitInstruction`s coming in; they're
  Python-space interop, so we never own them (unless we clone them)
  other than when we're unpacking them.

* `PackedInstruction` is currently just cr... (continued)

753 of 800 new or added lines in 17 files covered. (94.13%)

65 existing lines in 9 files now uncovered.

65759 of 73138 relevant lines covered (89.91%)

302131.6 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
80.0
-5.58% crates/circuit/src/dag_node.rs
3
93.94
0.25% crates/accelerate/src/convert_2q_block_matrix.rs
5
89.35
-5.44% crates/circuit/src/circuit_instruction.rs
16
92.52
crates/circuit/src/packed_instruction.rs
22
85.92
0.81% crates/circuit/src/operations.rs

Uncovered Existing Lines

Lines Coverage ∆ File
1
98.18
-1.82% qiskit/circuit/library/standard_gates/swap.py
1
70.27
-2.7% qiskit/circuit/duration.py
1
94.02
-0.24% crates/qasm2/src/expr.rs
1
94.4
-0.11% qiskit/circuit/quantumcircuit.py
3
92.88
1.02% crates/qasm2/src/lex.rs
3
77.78
-6.67% crates/circuit/src/imports.rs
9
85.92
0.81% crates/circuit/src/operations.rs
18
80.0
-5.58% crates/circuit/src/dag_node.rs
28
89.35
-5.44% crates/circuit/src/circuit_instruction.rs
Jobs
ID Job ID Ran Files Coverage
1 10065639500.1 23 Jul 2024 08:27PM UTC 851
89.91
GitHub Action Run
Source Files on build 10065639500
  • Tree
  • List 851
  • Changed 53
  • Source Changed 0
  • Coverage Changed 23
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • cd6757ab on github
  • Prev Build on gh-readonly-queue/main/pr-12804-9d8be7e7553a9336a55ba6f5c755e4accdb2695d (#10059805024)
  • Next Build on main (#10067705422)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc