Simulate the gates before the first mid-circuit measurement only once

Aperta
#12 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
56/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
performance

Direzione di ricerca

Start at the shortcut: note in src/circuit.rs:408 and trace how instructions are simulated for each shot, stopping at the first Measure or Reset. Then inspect the QuantumBackend implementations to see how CPU and GPU state buffers are managed. Done means the cached prefix is reused when two states fit in memory, with the current behavior retained when they do not.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
What you want to do

A circuit that measures part-way is simulated from scratch for every shot, including all the gates
before the first measurement, whose result is the same every time. For a deep state-preparation
circuit followed by one mid-circuit measurement, almost all of the time goes on repeating that
prefix. src/circuit.rs:408 notes this as a shortcut:.

Implementation notes
  • Run the instructions up to the first Measure / Reset once, keep a copy of that state, and
    start each shot from the copy instead of collapse_to(0).
  • This needs a "copy this state" primitive on QuantumBackend. CPU: copy the Vec. GPU:
    copy_buffer_to_buffer into a second buffer, which stays on the GPU.
  • This doubles memory, so skip the cache when two states would not fit (for example above 29 qubits
    on the CPU), and fall back to the current behaviour.
  • A further step is to also sample the first measurement's outcome from the cached state and only
    branch from there.
What it could look like
No API change.
Contributing
  • I would like to open a pull request for this (see CONTRIBUTING.md).
Lingua principale
Rust
Stelle
1
Fork
0
Merge medio
12m
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di kaiwave/qsengine

Tutte le issue di kaiwave/qsengine

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.