[BUG]: the `__cuda_stream__` deprecation warning points to `Stream(obj)`, which always raises

オープン 初心者向け
#3,505 コメント 3 件 リアクション 1 件 担当者 1 名 GitHub で見る

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

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

2026年11月20日 から。

  • #3522 @Iamsohungrynow による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
86/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

issue では _stream.pyx が該当箇所として示されており、__cuda_stream__ を持つオブジェクトを渡すと、誤った警告は launch() から出ると説明されています。警告文を読み、再現例に示されている動作する呼び出し Device.create_stream(obj) と比較してください。警告がそのサポート対象の呼び出しを示せば完了です。issue ではこれを1行の変更と説明しています。

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

説明

bug cuda.core P1
Is this a duplicate?
Type of Bug

Something else

Component

cuda.core

Describe the bug

passing an object with __cuda_stream__ to launch() warns and says to wrap it with Stream(obj). Stream.__init__ always raises though, so following the warning doesn't work, Device.create_stream(obj) is the call that does

How to Reproduce
import numpy as np
from cuda.core import Device, Program, LaunchConfig, Stream, launch

d = Device(); d.set_current(); s = d.create_stream()
ker = Program('extern "C" __global__ void k(int x){}', "c++").compile("cubin").get_kernel("k")

class W:
    def __cuda_stream__(self):
        return (0, int(s.handle))

launch(W(), LaunchConfig(grid=1, block=1), ker, np.int32(1))  # warning says to use Stream(obj)
d.create_stream(W())  # works
Stream(W())  # RuntimeError: Stream objects cannot be instantiated directly...
Expected behavior

the warning names Device.create_stream(obj). it's a one line change in _stream.pyx, glad to send it if someone assigns this to me

Operating System

Windows 11, RTX 4060 Ti, cuda.core built from main (84e50ca49)

nvidia-smi output

No response

主要言語
Cython
スター
3.4k
フォーク
353
平均マージ
2日 3時間
マージ済み PR(30日)
163

環境構築

はじめの一歩

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

NVIDIA/cuda-python のほかの issue

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

似ている issue

Backend & API Design の issue をもっと見る

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

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