NVIDIA / NVIDIA/cuda-python

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

Open
#627 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

awaiting-response bug cuda.core
Dominant language
Cython
Stars
3.4k
Forks
329
Avg merge
1d 23h
Merged PRs (30d)
116

Description

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                                                             |
+-----------------------------------------------------------------------------------------+

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided main.py with test.ptx and inspect the cuda.core.experimental ObjectCode.from_ptx and kernel attributes entry points, especially ptx_version(). Done means ptx_version() reports the PTX .version value, 8.8 for this input, while the other reported attributes retain their expected values.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
hpc
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.