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

cudaq.sample's feedback rejection is entry-kernel-only: measurement branching inside a called sub-kernel is not rejected

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

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

@stannum13 がすでに取り組んでいます。

2026年9月23日 から。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp, python

調査の方向性

まず cudaq.sample のフィードバック拒否チェックを追跡し、direct_feedback カーネルと wrapped_feedback カーネルを再現用として使用して cudaq.run と比較します。チェックが呼び出されたカーネルを推移的にたどること、またエントリーポイントでのフィードバックとネストされた測定フィードバックの両方が、文書化された run へのリダイレクトエラーを生成することを確認します。cudaq.run が引き続きフィードバックカーネルを正しく処理することを確認します。

索引モデルが issue の本文から書いたものです。

説明

stale-notified

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

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

NVIDIA/cuda-quantum のほかの issue

NVIDIA/cuda-quantum の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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