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

未關閉 適合新手
#3,505 3 則留言 1 個 reaction 已指派 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 將此描述為一行變更。

由索引模型根據 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 小時
30 天內合併 PR
163

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

NVIDIA/cuda-python 的其他 Issue

查看 NVIDIA/cuda-python 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。