Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

✨ Allow `stepBackward` past a `measure` and `reset q[i]`

オープン
#465 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp
領域
backend, devtools

調査の方向性

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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

munich-quantum-toolkit/debugger のほかの issue

munich-quantum-toolkit/debugger の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。