[BUG]: Compiling PTX with undefined extern succeeds and produces empty kernel
Nobody has claimed this yet.
- Dominant language
- Cython
- Stars
- 3.4k
- Forks
- 329
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 116
Description
Is this a duplicate?
- I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct
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.
Expected behavior
An exception or some other error raised by Program.compile()
Operating System
Ubuntu Linux
nvidia-smi output
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached cudapy.py and the cuda.core.experimental Program.compile("cubin") entry point, then compare its behavior with ptxas on the same PTX. Trace how undefined extern functions are handled during compilation. Done means Program.compile() raises an error or otherwise reports the unresolved extern instead of producing an empty cubin.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100