Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Native Gates page #487

Merged
merged 30 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8d15635
Create conditional-reset.ipynb
abbycross Dec 6, 2023
195b304
Initial edits
beckykd Dec 14, 2023
3c8bea6
update multiq for runtime
beckykd Dec 14, 2023
b8d6fc1
some code changes
beckykd Dec 14, 2023
68d19fd
Create native-gates.mdx
abbycross Jan 18, 2024
ebcfa08
move to run and add to toc
abbycross Jan 18, 2024
f530898
New page outline
abbycross Jan 18, 2024
74c06ff
move notes into new file, delete old
abbycross Jan 18, 2024
49973f3
reorg
abbycross Jan 18, 2024
7c7cfcc
notes
abbycross Jan 22, 2024
845a173
add code from Kevin
abbycross Jan 22, 2024
56d2176
add links and processor families
abbycross Jan 23, 2024
d207565
clean up notes
abbycross Jan 23, 2024
4ac046e
add text and table
abbycross Jan 24, 2024
58cd885
add info to processor types pg
abbycross Jan 24, 2024
12afef7
link to processor types page
abbycross Jan 25, 2024
3e1076b
clarification
abbycross Jan 25, 2024
1345ac8
link back to native gates pg
abbycross Jan 25, 2024
b6ddb6a
gate set not gateset
abbycross Jan 25, 2024
d628e7e
address basis gate terminology
abbycross Jan 25, 2024
01beefc
reword
abbycross Jan 25, 2024
e358f2f
separate out into three tables, code review
abbycross Jan 25, 2024
c0bb287
reorg order of tables
abbycross Jan 25, 2024
8574b94
code review
abbycross Jan 26, 2024
6171774
code review
abbycross Jan 26, 2024
db71346
code review
abbycross Jan 29, 2024
ad6813d
code review
abbycross Jan 29, 2024
589e948
point to submit transpiled circs tutorial
abbycross Jan 29, 2024
f246d3d
update from Abby's suggestion
abbycross Jan 30, 2024
304498f
superfluous quotation marks
abbycross Jan 30, 2024
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
4 changes: 4 additions & 0 deletions docs/run/_toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
"title": "Get backend information with Qiskit",
"url": "/run/get-backend-information"
},
{
"title": "Native gates and operations",
"url": "/run/native-gates"
},
{
"title": "Retired systems",
"url": "/run/retired-systems"
Expand Down
104 changes: 104 additions & 0 deletions docs/run/native-gates.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
title: Native gates and operations
description: Summary of the native gates and operations supported by IBM Quantum systems

---

# Native gates and operations

Each [processor family](processor-types) has a native gate set. By default, the systems in each family only support running the gates and operations in the native gate set. Thus, every gate in the circuit must be translated (by the transpiler) to the elements of this set.

You can view the native gates and operations for a system either [with Qiskit](#native-gates-with-qiskit) or on the IBM Quantum Platform [Compute resources page](#native-gates-on-platform).

<Admonition type="note" title="Basis gates">
The terms native gates and basis gates are often used interchangeably. However, you can specify a different set of basis gates to use, while the native gate set never changes. For information about changing the basis gates, see the [Represent quantum computers](../transpile/representing_quantum_computers#basis-gates) topic in the Transpile section.
abbycross marked this conversation as resolved.
Show resolved Hide resolved
</Admonition>

## Find the native gate set for a system

<span id="native-gates-with-qiskit"></span>
### With Qiskit

```python

from qiskit_ibm_runtime import QiskitRuntimeService

service = QiskitRuntimeService(channel="ibm_quantum")

for backend in service.backends():
config = backend.configuration()
if "simulator" in config.backend_name:
continue
print(f"Backend: {config.backend_name}")
print(f" Processor type: {config.processor_type}")
print(f" Supported instructions:")
for instruction in config.supported_instructions:
print(f" {instruction}")
print()
```

<span id="native-gates-on-platform"></span>
### On IBM Quantum Platform

Select any system on the [Compute resources](https://quantum.ibm.com/services/resources) tab. The default gates for that system are listed under Details. Note that the non-unitary operations are not listed here; use the method in Qiskit described above to see all native gates and operations for a system.

## Tables of gates and operations, by processor family

### Heron

| Name | Notes |
| :--- | :--- |
| [CZ](/api/qiskit/qiskit.circuit.library.CZGate) | two-qubit gate |
| [RZ](/api/qiskit/qiskit.circuit.library.RZGate) | single-qubit gate |
| [SX](/api/qiskit/qiskit.circuit.library.SXGate) |single-qubit gate |
| [X](/api/qiskit/qiskit.circuit.library.XGate) | single-qubit gate |
| [ID](/api/qiskit/qiskit.circuit.library.IGate) | single-qubit gate wait cycle |
| [reset](/api/qiskit/qiskit.circuit.library.Reset) | single-qubit gate, non-unitary; not the same as the initialization done at the start of a circuit to prepare the all 0's state |
| [if_else](/api/qiskit/qiskit.circuit.IfElseOp) | control flow for classical feedforward |
| [for_loop](/api/qiskit/qiskit.circuit.ForLoopOp) | control flow for classical feedforward |
| [switch_case](/api/qiskit/qiskit.circuit.SwitchCaseOp) | control flow for classical feedforward |
| [measure](/api/qiskit/qiskit.circuit.library.Measure) | |
| [delay](/api/qiskit/qiskit.circuit.Delay) | |

### Eagle

| Name | Notes |
| :--- | :--- |
| [ECR](/api/qiskit/qiskit.circuit.library.ECRGate) | two-qubit gate |
| [RZ](/api/qiskit/qiskit.circuit.library.RZGate) | single-qubit gate |
| [SX](/api/qiskit/qiskit.circuit.library.SXGate) |single-qubit gate |
| [X](/api/qiskit/qiskit.circuit.library.XGate) | single-qubit gate |
| [ID](/api/qiskit/qiskit.circuit.library.IGate) | single-qubit gate wait cycle |
| [reset](/api/qiskit/qiskit.circuit.library.Reset) | single-qubit gate, non-unitary; not the same as the initialization done at the start of a circuit to prepare the all 0's state |
| [if_else](/api/qiskit/qiskit.circuit.IfElseOp) | control flow for classical feedforward |
| [for_loop](/api/qiskit/qiskit.circuit.ForLoopOp) | control flow for classical feedforward |
| [switch_case](/api/qiskit/qiskit.circuit.SwitchCaseOp) | control flow for classical feedforward |
| [measure](/api/qiskit/qiskit.circuit.library.Measure) | |
| [delay](/api/qiskit/qiskit.circuit.Delay) | |

### Falcon

| Name | Notes |
| :--- | :--- |
| [CX](/api/qiskit/qiskit.circuit.library.CXGate) | two-qubit gate |
| [RZ](/api/qiskit/qiskit.circuit.library.RZGate) | single-qubit gate |
| [ID](/api/qiskit/qiskit.circuit.library.IGate) | single-qubit gate wait cycle |
| [reset](/api/qiskit/qiskit.circuit.library.Reset) | single-qubit gate, non-unitary; not the same as the initialization done at the start of a circuit to prepare the all 0's state |
| [if_else](/api/qiskit/qiskit.circuit.IfElseOp) | control flow for classical feedforward |
| [for_loop](/api/qiskit/qiskit.circuit.ForLoopOp) | control flow for classical feedforward |
| [switch_case](/api/qiskit/qiskit.circuit.SwitchCaseOp) | control flow for classical feedforward |
| [measure](/api/qiskit/qiskit.circuit.library.Measure) | |
| [delay](/api/qiskit/qiskit.circuit.Delay) | |


<Admonition type="tip" title="The init_qubits flag">

By default, the `init_qubits` flag is set to True. If the `init_qubits` flag is set to False, you must insert [resets](/api/qiskit/qiskit.circuit.library.Reset) at the start of your circuit to start your qubits in the ground state. Otherwise, if your job consists of multiple circuits, the qubits will begin in their state from the previous shot. (If a job consists of multiple circuits, the shots will be executed in a "round-robin" fashion. That is, one shot will be collected from every circuit, and then the next shot will be collected from every circuit, and so on.)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By default, the `init_qubits` flag is set to True. If the `init_qubits` flag is set to False, you must insert [resets](/api/qiskit/qiskit.circuit.library.Reset) at the start of your circuit to start your qubits in the ground state. Otherwise, if your job consists of multiple circuits, the qubits will begin in their state from the previous shot. (If a job consists of multiple circuits, the shots will be executed in a "round-robin" fashion. That is, one shot will be collected from every circuit, and then the next shot will be collected from every circuit, and so on.)
The `init_qubits` flag controls whether qubits are reset to the zero state at the start of each circuit. Its default value is True, indicating that the qubits should be reset. If False, the qubits will begin in the final state from the previous shot, and you must manually insert [resets](/api/qiskit/qiskit.circuit.library.Reset) if you want to reset them to the zero state. If a job consists of multiple circuits, then the shots are executed in a "round-robin" fashion. That is, each circuit will be executed in sequence to obtain one shot from each circuit. This process is then repeated until the requested number of shots has been obtained from all circuits.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we include this note, we have to mention what function the init_qubits flag is an argument of. A quick search of the source code suggests it is from assemble. But is this function even mentioned elsewhere in the docs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that it is also from execute(). I found this from API docs old release notes:

A new kwarg for init_qubits has been added to assemble() and execute(). For backends that support this feature init_qubits can be used to control whether the backend executing the circuits inserts any initialization sequences at the start of each shot. By default this is set to True meaning that all qubits can assumed to be in the ground state at the start of each shot. However, when init_qubits is set to False qubits will be uninitialized at the start of each experiment and between shots. Note, that the backend running the circuits has to support this feature for this flag to have any effect.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the Conditional Reset page (which has been removed) had this pph:

Note: If init_qubits is set to false and you want qubits to start in the ground state, you must insert resets at the start of your circuit. Otherwise, qubits will begin with their state from the previous shot (after undergoing some thermalization process for the interval between shots as set by rep_delay). Note that the first shot of the first circuit may still be in the thermal ground state due to a longer delay existing during the loading of your job to hardware.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that's what I'm working with. Blake specifically mentioned the init_qubits flag, as long as it is supported by Sampler (which it is)... does it feel too much like it comes out of nowhere?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The note seems to presuppose that the user already knows about the init_qubits flag. Without further explanation, I would expect the init_qubits text to be a hyperlink pointing to a documentation page explaining its syntax, or to the function that has it as an argument. From reading the note, it's not clear to me in what sense the init_qubits flag is supported by Sampler. Is it Sampler(init_qubits=False)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From reading the note, it's not clear to me in what sense the init_qubits flag is supported by Sampler. Is it Sampler(init_qubits=False)?

You specify it as an execution option: ExecutionOptions(shots=4000, init_qubits=True https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/qiskit_ibm_runtime.options.ExecutionOptions

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, the note should say that.

</Admonition>

## Next steps

<Admonition type="tip" title="Recommendations">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one of our goals is to have every docs page include a link to a learning platform topic where users can start using these concepts in practice, can you add a link to a sensible learning platform course/tutorial here please?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about the Submit transpiled circuits tutorial? Or we could do something broader like "Try one of the workflow example tutorials."

- Read about basis gates in the [Represent quantum computers](../transpile/representing_quantum_computers#basis-gates) topic.
</Admonition>
abbycross marked this conversation as resolved.
Show resolved Hide resolved

6 changes: 6 additions & 0 deletions docs/run/processor-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ At 133 qubits, Heron is an [Eagle](#eagle)-sized upgrade to [Egret](#egret) that

* [View available Heron systems](https://quantum.ibm.com/services/resources?tab=systems&type=Heron)

* [Native gates and operations](native-gates): `cz, id, delay, measure, reset, rz, sx, x, if_else, for_loop, switch_case`

## Osprey

![Osprey processor icon](/images/migration/osprey.svg)
Expand All @@ -43,6 +45,8 @@ See [this blog post](https://research.ibm.com/blog/127-qubit-quantum-processor-e

* [View available Eagle systems](https://quantum.ibm.com/services/resources?tab=systems&type=Eagle)

* [Native gates and operations](native-gates): `ecr, id, delay, measure, reset, rz, sx, x, if_else, for_loop, switch_case`

<Admonition type="info" title="Revisions">
`r3` (December 2022) Eagle r3 is a version of the 127-qubit processor with enhanced coherence properties but otherwise similar design parameters to Eagle r1.

Expand Down Expand Up @@ -91,6 +95,8 @@ The Falcon family of devices offers a valuable platform for medium-scale circuit

* [View available Falcon systems](https://quantum.ibm.com/services/resources?tab=systems&type=Falcon)

* [Native gates and operations](native-gates): `cx, id, delay, measure, reset, rz, sx, x, if_else, for_loop, switch_case`

<Admonition type="info" title="Revisions">
`r8` (September 2021) In addition to the features of r5.11, Falcon r8 has enhanced coherence properties.

Expand Down
Loading