Skip to content

feat(cuda.core): support CU_LAUNCH_ATTRIBUTE_PRIORITY in LaunchConfig - #2706

Open
ichensun wants to merge 1 commit into
NVIDIA:mainfrom
ichensun:feat/issue-2631-launch-priority
Open

feat(cuda.core): support CU_LAUNCH_ATTRIBUTE_PRIORITY in LaunchConfig#2706
ichensun wants to merge 1 commit into
NVIDIA:mainfrom
ichensun:feat/issue-2631-launch-priority

Conversation

@ichensun

Copy link
Copy Markdown

Description

issues #2631

Adds a priority attribute to LaunchConfig that maps to
CU_LAUNCH_ATTRIBUTE_PRIORITY,
following the same pattern used for programmatic_stream_serialization (#1334).

  • priority: int | None = None (default None) — when omitted, the launch
    uses the stream's priority, matching existing LaunchConfig attribute
    conventions.
  • Lower numbers represent higher priority; 0 and negative values are valid,
    meaningful priorities, not sentinels for "unset". Because of this, the
    attribute is stored as a nullable object (not a C int) internally, and
    both native-config conversion paths (LaunchConfig._to_native_launch_config
    and the module-level _to_native_launch_config) check is not None rather
    than truthiness, so priority=0 is set correctly instead of being dropped.
  • No additional device-capability validation is added (unlike
    is_cooperative), since the driver accepts any priority within the
    device's stream-priority range and clamps/errors on its own.

@copy-pr-bot

copy-pr-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Aug 26, 2026
@lijinf2

lijinf2 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

/ok to test b963404

@lijinf2 lijinf2 added the feature New feature or request label Aug 27, 2026
@lijinf2 lijinf2 added this to the cuda.core next milestone Aug 27, 2026
@github-actions

Copy link
Copy Markdown

Whether to allow programmatic stream serialization (PDL). When True,
the kernel may overlap with a previous kernel in the same stream that
signals completion via programmatic means.
priority : int, optional

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have a range for the value we can set? It cannot be any number.
CUDA doc should provide guidance on what value to set. Let's include the guidance in docstring.

shmem_size: int
is_cooperative: bool
programmatic_stream_serialization: bool
priority: object

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's define type as "int" here to be consistent with line 42.

attr.value.programmaticStreamSerializationAllowed = 1
self._attrs.push_back(attr)

if self.priority is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's follow cuda.core.Stream(priority) value checking and default behavior here to stay consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants