✨ Allow `stepBackward` past a `measure` and `reset q[i]`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
調査の方向性
src/backend/dd/DDSimDebug.cpp から始め、特に ddsimStepForward と、q[i] の測定およびリセットのパスを確認します。previousInstructionStack と DD state がどのように保存・復元されるかを追跡し、その後、既存のデバッガーのステップバック動作を調べます。両方の操作をまたいで後方にステップしたときに、量子状態と影響を受けた古典ビットが復元され、前方リプレイの動作が解決されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
🤖 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).
- 主要言語
- C++
- スター
- 21
- フォーク
- 8
- 平均マージ
- 8時間 43分
- マージ済み PR(30日)
- 25
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
munich-quantum-toolkit/debugger のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 84/100
munich-quantum-toolkit/debugger#469 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 66/100
munich-quantum-toolkit/debugger#468 ·
メンテナーはふだん 1 日以内に返信
-
✨ Improve CLI UX: line editing, function-key shortcuts, and help bar対応中かも @rturrado が 30 日前に担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
munich-quantum-toolkit/debugger#467 ·
メンテナーはふだん 1 日以内に返信
-
c++ enhancement help wanted
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
munich-quantum-toolkit/debugger#168 ·
メンテナーはふだん 1 日以内に返信
-
Dependency Dashboardオープンdependencies
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
munich-quantum-toolkit/debugger#55 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
munich-quantum-toolkit/debugger の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
FriendsofECCE/ECCE#336 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
bitcoin-core/gui-qml#1030 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
tesseract-robotics/tesseract#1384 ·
-
Fix the silent drop of oversized clusters in the plain EuclideanClusterObjectDetector対応中かも @xmfcx が今日担当しました。 オープンcomponent:perception type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
autowarefoundation/autoware_core#1497 ·
メンテナーはふだん 2 日以内に返信