Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cuda_core/cuda/core/_device_resources.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# SPDX-License-Identifier: Apache-2.0

cimport cython

from cuda.bindings cimport cydriver
from cuda.core._resource_handles cimport ContextHandle, GreenCtxHandle

Expand All @@ -15,6 +17,7 @@ cdef class SMResource:
unsigned int _flags
bint _is_usable
object __weakref__
cython.pymutex _split_mutex

@staticmethod
cdef SMResource _from_dev_resource(cydriver.CUdevResource res, int device_id)
Expand Down
9 changes: 5 additions & 4 deletions cuda_core/cuda/core/_device_resources.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,11 @@ cdef class SMResource:
)
_resolve_group_count(opts)
_check_green_ctx_support()
if _can_use_structured_sm_split():
return _split_with_general_api(self, opts, dry_run)
# SplitByCount requires the same 12.4+ as green ctx support (already checked above)
return _split_with_count_api(self, opts, dry_run)
with self._split_mutex:
if _can_use_structured_sm_split():
return _split_with_general_api(self, opts, dry_run)
# SplitByCount requires the same 12.4+ as green ctx support (already checked above)
return _split_with_count_api(self, opts, dry_run)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Pointing this out inline, because this is probably the thing I am least sure about. Should SMResource.split() be thread-safe if called on the same resource from multiple threads?



cdef class WorkqueueResource:
Expand Down
5 changes: 3 additions & 2 deletions cuda_core/cuda/core/graph/_graph_node.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,11 @@ cdef class GraphNode:
cdef cydriver.CUgraphNode node = as_cu(self._h_node)
if node == NULL:
return
with nogil:
HANDLE_RETURN(cydriver.cuGraphDestroyNode(node))

_node_registry.pop(<uintptr_t>self._h_node.get(), None)
invalidate_graph_node(self._h_node)
with nogil:
HANDLE_RETURN(cydriver.cuGraphDestroyNode(node))

@property
def pred(self) -> AdjacencySetProxy:
Expand Down
Loading