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

Offen
#3,504 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
67/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
backend

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
Cython
Sterne
3.4k
Forks
353
Ø Merge
2 T. 3 Std.
Gemergte PRs (30 T.)
163

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus NVIDIA/cuda-python

Alle Issues in NVIDIA/cuda-python

Ähnliche Issues

Weitere Issues zu Backend & API Design

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.