Skip to content

Add PTX helpers #686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add PTX helpers #686

wants to merge 1 commit into from

Conversation

leofang
Copy link
Member

@leofang leofang commented Jun 6, 2025

Description

Close #653.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@leofang leofang added this to the cuda-python 12-next, 11-next milestone Jun 6, 2025
@leofang leofang self-assigned this Jun 6, 2025
@github-project-automation github-project-automation bot moved this to Todo in CCCL Jun 6, 2025
Copy link
Contributor

copy-pr-bot bot commented Jun 6, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@leofang leofang added P0 High priority - Must do! feature New feature or request cuda.bindings Everything related to the cuda.bindings module labels Jun 6, 2025
}


def get_minimal_required_driver_ver_from_ptx_ver(ptx_version: str) -> int:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of driver_ver should we call this cuda_ver? Since someone could be using nvjitlink instead?

Comment on lines +89 to +90
# Regex pattern to match .version directive and capture the version number
_ptx_ver_pattern = re.compile(r'\.version\s+([0-9]+\.[0-9]+)')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a future note that this will slow down import time which some people care about and that we could potentially lazily initialize this instead if needed?

>>> get_ptx_ver(ptx)
'8.8'
"""
m = _ptx_ver_pattern.search(ptx)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on https://docs.nvidia.com/cuda/parallel-thread-execution/#source-format, the first line is always going to be .version, so we'd probably be better off avoiding the regular expression and always just look at the beginning of the string?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda.bindings Everything related to the cuda.bindings module feature New feature or request P0 High priority - Must do!
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

Add a helper function to map PTX ISA versions to the corresponding CTK versions
2 participants