Repository navigation
Open
Labels
awaiting-responseFurther information is requestedFurther information is requestedbugSomething isn't workingSomething isn't workingcuda.coreEverything related to the cuda.core moduleEverything related to the cuda.core modulestale
Milestone
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
Something else
Component
cuda.core
Describe the bug
test.ptx
.version 8.8
.target sm_86
.address_size 64
.visible .entry test_kernel()
{
ret;
}
main.py
from cuda.core.experimental import Device, LaunchConfig, Program, ProgramOptions, launch, ObjectCode
dev = Device()
dev.set_current()
s = dev.create_stream()
mod = ObjectCode.from_ptx('test.ptx')
print(mod.get_kernel('test_kernel').attributes.num_regs())
print(mod.get_kernel('test_kernel').attributes.ptx_version())
print(mod.get_kernel('test_kernel').attributes.binary_version())Prints
4
86
89
An aside, I am so excited for this library!
How to Reproduce
Run the above code
Expected behavior
I would expect ptx_version() to return the .version field from the ptx source.
Operating System
Ubuntu Linux 24.04
nvidia-smi output
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 575.51.03 Driver Version: 576.28 CUDA Version: 12.9 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 4090 On | 00000000:01:00.0 On | Off |
| 0% 45C P3 72W / 450W | 2921MiB / 24564MiB | 1% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+
Metadata
Metadata
Assignees
Labels
awaiting-responseFurther information is requestedFurther information is requestedbugSomething isn't workingSomething isn't workingcuda.coreEverything related to the cuda.core moduleEverything related to the cuda.core modulestale
Activity
leofang commentedon May 12, 2025
Hi @capybara-club
Thank you for your kind words! 🙏
I made the same mistake due to this admittedly confusing naming earlier. The underlying C attribute doc for
.ptx_version()is not super clear about this, but it is the compute capability (-arch=compute_XX) used to generate the PTX. This corresponds to the.targetfield in your PTX.We could consider renaming
.ptx_version()to.target_architecture()or.compute_capability()as suggested in NVIDIA/cccl#4081. Let me know what you think.AFAIK (others from our team can correct me if I am mistaken), there is no programmatic way to retrieve the PTX ISA version (
.version 8.8in your case). This bits of the PTX ISA doc is relevant: https://docs.nvidia.com/cuda/parallel-thread-execution/#ptx-module-directives.FWIW, since you use RTX 4090 the CC for which the PTX was loaded/JIT'd is 89, which is given by
.binary_version().capybara-club commentedon May 13, 2025
Yeah, that's hard because even target_architecture might be a better name for binary_version knowing that binary_version comes from the device and not the ObjectCode object (i.e. 89 could be the architecture you're targeting).
I do have a strange case just to maybe give you an anecdote. I'm going to try to avoid CUDAExtension and wheels and cu310,cu311 etc... So I'm planning on just precompiling ptx for sm80 to hit 11.8, 12.x and then use this to keep a pure python library for a user. I think this means I need to build it with ptx version 7.8 (from 11.8). Anyway that's why I tried to access ptx_version() expecting 8.8 or 8.0 or 7.8.
It's a shame there might be a new generation of users using this library that never try setuptools, pybind11 and CUDAExtension that just have no idea what fun they're missing.
github-actions commentedon Nov 4, 2026
This issue has waited 7 days for the information we asked for. It will close in 7 days unless there is a reply. Comment here to keep it open.
leofang commentedon Nov 4, 2026
Keep this.