Skip to content

[BUG]: cuda-core: attributes.ptx_version() returns .target field, not .version from ptx file #627

@capybara-club

Description

@capybara-club

Is this a duplicate?

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

No one assigned

    Labels

    awaiting-responseFurther information is requestedcuda.coreEverything related to the cuda.core moduletriageNeeds the team's attention

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions