✨ Allow `stepBackward` past a `measure` and `reset q[i]`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Empieza en src/backend/dd/DDSimDebug.cpp, especialmente en ddsimStepForward y en las rutas de medición y reset de q[i]. Sigue cómo se almacenan y restauran previousInstructionStack y el estado DD, y después inspecciona el comportamiento existente de retroceso paso a paso del depurador. Se considera terminado cuando retroceder a través de ambas operaciones restaura el estado cuántico y los bits clásicos afectados, y el comportamiento de reproducción hacia delante queda resuelto.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🤖 AI text below 🤖
Problem statement
Once a measure has been executed, the debugger refuses to step backward past it. ddsimStepForward in src/backend/dd/DDSimDebug.cpp clears previousInstructionStack after a measurement with the comment // after measurements, we can no longer step back.. The user loses access to the pre-measurement state, both the quantum superposition and the previous value of the target classical bit.
The reset q[i] operation (which performs a measurement internally) follows the same pattern and is also un-stepbackable.
Surfaced during the follow-up work on issue #168 (PR #456) and again during the review of PR #463.
Proposed solution
Applying the inverse of a measurement does not restore the pre-collapse superposition. The operation is genuinely irreversible in a physical sense, and the current code acknowledges this by blocking step back after a measure. Snapshot the state instead: before the measurement writes, save the quantum state together with the previous value of every classical bit it is about to touch. On step back, restore the snapshot. In the DD backend this is cheap because decision diagrams share structure through internal tables, so a snapshot is a pointer rather than a full state-vector copy.
Also drop the previousInstructionStack.clear() calls on the measure path and the reset q[i] path so the step-back path is actually reachable.
Open question
After stepping back past a measurement, the next stepForward can either re-sample the measurement (probabilistic: the operation runs again on the restored superposition and may give a different outcome) or force the previous outcome (deterministic replay: reproduces the original run bit-for-bit, at the cost of storing the outcome and/or the random-number generator state alongside the snapshot).
My preference would be probabilistic: it matches the simulator's natural semantics, requires no extra state beyond the snapshot already needed, and lines up with what a user would see on real hardware. Deterministic replay reads more like a separate feature (a "record-and-replay" mode) than an inherent part of step-back.
Final call is yours; happy to go the other way if you prefer.
Out of scope
- Broader changes to the debugger's history model (call/return stacks, breakpoint state, etc.).
- Persisting classical bit values across code reloads.
- Restoring classical bits after non-measurement operations that write to them (there are currently none in the debugger's front-end).
- Lenguaje dominante
- C++
- Estrellas
- 21
- Forks
- 8
- Merge medio
- 5 h 17 min
- PR fusionados (30 d)
- 21
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de munich-quantum-toolkit/debugger
-
Dificultad 3/5 1-2 días Aptitud para principiantes 84/100
munich-quantum-toolkit/debugger#469 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 66/100
munich-quantum-toolkit/debugger#468 ·
Los mantenedores suelen responder en 1 día
-
✨ Improve CLI UX: line editing, function-key shortcuts, and help barPosiblemente ocupada @rturrado la tomó hace 30 días. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
munich-quantum-toolkit/debugger#467 ·
Los mantenedores suelen responder en 1 día
-
c++ enhancement help wanted
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
munich-quantum-toolkit/debugger#168 ·
Los mantenedores suelen responder en 1 día
-
Dependency DashboardAbiertodependencies
Dificultad 5/5 Más de una semana Aptitud para principiantes 10/100
munich-quantum-toolkit/debugger#55 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
Todos los issues de munich-quantum-toolkit/debugger
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
FriendsofECCE/ECCE#336 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
bitcoin-core/gui-qml#1030 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
tesseract-robotics/tesseract#1384 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
NVIDIA/nccl-extensions#26 ·