[BUG]: `launch()` rejects `numpy.intc` scalars on Windows

未关闭
#3,504 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
67/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

Start with cuda.core's _kernel_arg_handler.pyx, where the issue says NumPy scalar classes are matched. Reproduce the unsupported-type error using the provided np.intc(5) launch example on Windows with NumPy 2, then compare its handling with np.int32(5) and check the corresponding tests. Done means the accepted scalar reaches the kernel as 5, with coverage for the reported platform and related integer types.

由索引模型根据 Issue 内容生成。

描述

cuda.core
Is this a duplicate?
Type of Bug

Runtime Error

Component

cuda.core

Describe the bug

on windows with numpy 2, np.int32 is np.long, so np.intc ends up as its own class and launch() doesn't recognize it, _kernel_arg_handler.pyx only matches the fixed-width numpy classes. the same should happen with np.longlong on linux

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

d = Device(); d.set_current(); s = d.create_stream()
src = 'extern "C" __global__ void k(int x, int* out){ *out = x; }'
ker = Program(src, "c++").compile("cubin").get_kernel("k")
out = d.allocate(4, stream=s)
launch(s, LaunchConfig(grid=1, block=1), ker, np.intc(5), out)
# TypeError: the argument is of unsupported type: <class 'numpy.intc'>
Expected behavior

same as np.int32(5), the kernel gets 5. I can put up a fix that falls back to the itemsize for np.signedinteger/np.unsignedinteger if you'd like

Operating System

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

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 摘要。