NVIDIA / NVIDIA/cuda-python

[BUG]: Compiling PTX with undefined extern succeeds and produces empty kernel

Offen
#920 9 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

awaiting-response bug cuda.core
Vorherrschende Sprache
Cython
Sterne
3.4k
Forks
329
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
116

Beschreibung

Is this a duplicate?
Type of Bug

Silent Failure

Component

cuda.core

Describe the bug

Attempting to compile PTX with an undefined extern function seems to succeed and produce a cubin with an empty kernel. I am doing this like:

from cuda.core.experimental import Program, ProgramOptions

options = ProgramOptions(arch="sm_75")
program = Program(code, code_type="ptx", options=options)
cubin = program.compile("cubin")

The same PTX compiled with ptxas results in a failure to compile:

$ ptxas -arch sm_75 add_float16.ptx 
ptxas fatal   : Unresolved extern function '_ZplRK6__halfS1__1'

Am I using the Program.compile() interface incorrectly?

How to Reproduce

Run the attached file:

python cudapy.py

This will produce a cubin with an empty kernel, and show ptxas raises an error for the same PTX.

cudapy.py

Expected behavior

An exception or some other error raised by Program.compile()

Operating System

Ubuntu Linux

nvidia-smi output

No response

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der angehängten cudapy.py und dem Einstiegspunkt cuda.core.experimental Program.compile("cubin"), und vergleiche dann dessen Verhalten mit ptxas bei demselben PTX. Verfolge, wie undefinierte externe Funktionen während der Kompilierung behandelt werden. Als erledigt gilt die Aufgabe, wenn Program.compile() einen Fehler auslöst oder die nicht aufgelöste externe Funktion anderweitig meldet, anstatt ein leeres cubin zu erzeugen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
compilers
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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