cudaq.sample's feedback rejection is entry-kernel-only: measurement branching inside a called sub-kernel is not rejected
メンテナーはふだん 1 日以内に返信
@stannum13 がすでに取り組んでいます。
2026年9月23日 から。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 62/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
まず cudaq.sample のフィードバック拒否チェックを追跡し、direct_feedback カーネルと wrapped_feedback カーネルを再現用として使用して cudaq.run と比較します。チェックが呼び出されたカーネルを推移的にたどること、またエントリーポイントでのフィードバックとネストされた測定フィードバックの両方が、文書化された run へのリダイレクトエラーを生成することを確認します。cudaq.run が引き続きフィードバックカーネルを正しく処理することを確認します。
索引モデルが issue の本文から書いたものです。
説明
cudaq.sample rejects kernels that branch on measurement results with a clear error steering users to cudaq.run. But the check appears to inspect only the entry-point kernel: the identical feedback inside a called kernel passes the check and samples anyway (with a deprecation warning about named measurement results).
Reproducer (cudaq 0.15.1, PyPI wheels, qpp-cpu):
import cudaq
cudaq.set_target("qpp-cpu")
@cudaq.kernel
def erase_and(q: cudaq.qview):
h(q[2])
fired = mz(q[2])
if fired:
z.ctrl(q[0], q[1])
x(q[2])
@cudaq.kernel
def direct_feedback():
q = cudaq.qvector(2)
h(q[0])
fired = mz(q[0])
if fired:
x(q[1])
cudaq.sample(direct_feedback, shots_count=10) # rejected, as documented
@cudaq.kernel
def wrapped_feedback():
q = cudaq.qvector(3)
h(q[0]); h(q[1])
x.ctrl(q[0], q[1], q[2])
erase_and(q) # same feedback, one call level down
mz(q)
cudaq.sample(wrapped_feedback, shots_count=50) # ACCEPTED, returns counts
Context: the rejection itself is clearly deliberate — the error message steers users to cudaq.run, and cudaq.run handles the same feedback kernel correctly (verified: per-shot results as documented, requiring only that the kernel return a value). So this report is purely about the inconsistent enforcement: the check that redirects users to run is applied to the entry kernel only, and the same feedback one call level down samples anyway.
Expected: the check applied transitively over the call graph, with the same redirect-to-run error in both cases. As is, whether a program is rejected depends on how it is factored into kernels, and code the check was written to exclude runs anyway (with unspecified semantics for the sub-register counts it returns).
Severity: consistency/robustness.
- 主要言語
- C++
- スター
- 1.2k
- フォーク
- 485
- 平均マージ
- 1日 6時間
- マージ済み PR(30日)
- 144
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NVIDIA/cuda-quantum のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
NVIDIA/cuda-quantum#5702 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
dfJump variable not initialized before first use in pass UnwindByDataFlow対応中かも @totoschnell が 19 日前に担当しました。 オープンstale-notified
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
NVIDIA/cuda-quantum#5539 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Broadcast sample replaces a scalar argument with zero対応中かも @SashaMIT が 25 日前に担当しました。 オープンstale-notified
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA/cuda-quantum#5518 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Docs] Fix typo in Sphinx extensions description対応中かも @reginaldalfret が 19 日前に担当しました。 オープンstale-notified
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
NVIDIA/cuda-quantum#5492 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
PyKernel.__call__ validates a runtime list argument's length against the wrong quantity対応中かも @udsy19 が 42 日前に担当しました。 オープンstale-notified
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA/cuda-quantum#5424 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
NVIDIA/cuda-quantum の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
KhronosGroup/Vulkan-Tutorial#534 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 2 日以内に返信
-
bug IO
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
MrNeRF/LichtFeld-Studio#3824 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
throneproj/Throne#2043 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
Perchik71/Creation-Kit-Platform-Extended#267 ·
メンテナーはふだん 1 日以内に返信