Repository navigation
[FEA] Expose graph/node IDs as ints #3332
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
base: main
Are you sure you want to change the base?
Changes from all commits
c0e3166
ec60763
ecff4a6
d17f369
84f8dc8
2439fd9
527debf
45c9a18
e4f844e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,8 @@ from cuda.core._rt cimport ( | |
| create_graph_node_handle, | ||
| ) | ||
| from cuda.core._utils.cuda_utils cimport HANDLE_RETURN | ||
| IF CUDA_CORE_BUILD_MAJOR >= 13: | ||
| from cuda.core._utils.version cimport cy_driver_version | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
|
|
@@ -145,6 +147,23 @@ cdef class GraphDefinition: | |
| def __hash__(self) -> int: | ||
| return hash(<uintptr_t>self._h_graph.get()) | ||
|
|
||
| @property | ||
| def id(self) -> int: | ||
| """The driver-assigned graph ID, as used in GraphViz DOT output. | ||
|
|
||
| Requires CUDA 13 build and driver 13.1+ | ||
| """ | ||
| GD_check_valid(self) | ||
| IF CUDA_CORE_BUILD_MAJOR >= 13: | ||
| cdef unsigned int graph_id | ||
| if cy_driver_version() < (13, 1, 0): | ||
| raise NotImplementedError("Graph IDs require CUDA driver 13.1 or newer") | ||
| with nogil: | ||
| HANDLE_RETURN(cydriver.cuGraphGetId(as_cu(self._h_graph), &graph_id)) | ||
| return graph_id | ||
| ELSE: | ||
| raise NotImplementedError("Graph IDs require CUDA driver 13.1 or newer") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. important: State the build requirement in the unsupported-build error. On a CUDA 12 build, |
||
|
|
||
| @property | ||
| def is_valid(self) -> bool: | ||
| """Whether this graph definition remains valid.""" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,6 +154,15 @@ CPU overhead. Graphs can be constructed in two ways: | |
| edges. Both produce an executable :class:`~graph.Graph` that can be | ||
| launched on a :class:`Stream`. | ||
|
|
||
| With CUDA >= 13.1, graph definitions and | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: State the CUDA 13 build requirement for these properties. On a CUDA 12 build, the ID properties raise As per coding guidelines, “Keep user-facing behaviors coherent with docs and samples.” As per path instructions, “Check that public behavior changes have corresponding tests, documentation and release notes.” Sources: Coding guidelines, Path instructions |
||
| executable graphs expose a read-only integer, ``id``. Nodes expose ``local_id`` | ||
| (unique within their graph) and ``tools_id`` (for profiler correlation). | ||
| Use ``node.graph`` to obtain the containing graph definition; this view | ||
| shares ownership of the underlying graph. IDs are ephemeral, driver-assigned. | ||
|
|
||
| ``kernel.attributes.device_node_update_supported`` reports whether a kernel | ||
| supports device-side node updates. It requires CUDA >= 13.3. | ||
|
|
||
| .. currentmodule:: cuda.core | ||
|
|
||
| .. autosummary:: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
important: Include the CUDA 13 build requirement in the error.
On a CUDA 12 build with a 13.3 or newer driver, this error says a newer driver is required even though the driver meets that requirement. State that the property also requires a CUDA 13 build.