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

Abierto
#12 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
56/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust
Área
performance

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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).
Lenguaje dominante
Rust
Estrellas
1
Forks
0
Merge medio
12 min
PR fusionados (30 d)
4

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de kaiwave/qsengine

Todos los issues de kaiwave/qsengine

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.