Skip to content

Commit e51fb7f

Browse files
authored
Revert SMResource splitting fix, the problem was the test (#2321)
1 parent c918891 commit e51fb7f

4 files changed

Lines changed: 18 additions & 8 deletions

File tree

cuda_core/cuda/core/_device_resources.pxd

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
cimport cython
6-
75
from cuda.bindings cimport cydriver
86
from cuda.core._resource_handles cimport ContextHandle, GreenCtxHandle
97

@@ -17,7 +15,6 @@ cdef class SMResource:
1715
unsigned int _flags
1816
bint _is_usable
1917
object __weakref__
20-
cython.pymutex _split_mutex
2118

2219
@staticmethod
2320
cdef SMResource _from_dev_resource(cydriver.CUdevResource res, int device_id)

cuda_core/cuda/core/_device_resources.pyx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,10 @@ cdef class SMResource:
520520
)
521521
_resolve_group_count(opts)
522522
_check_green_ctx_support()
523-
with self._split_mutex:
524-
if _can_use_structured_sm_split():
525-
return _split_with_general_api(self, opts, dry_run)
526-
# SplitByCount requires the same 12.4+ as green ctx support (already checked above)
527-
return _split_with_count_api(self, opts, dry_run)
523+
if _can_use_structured_sm_split():
524+
return _split_with_general_api(self, opts, dry_run)
525+
# SplitByCount requires the same 12.4+ as green ctx support (already checked above)
526+
return _split_with_count_api(self, opts, dry_run)
528527

529528

530529
cdef class WorkqueueResource:

cuda_core/tests/conftest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,18 @@ def wrapper(*args, **kwargs):
131131
kwargs["mempool_device_x2"] = _mempool_device_impl(2)
132132
if "mempool_device_x3" in kwargs:
133133
kwargs["mempool_device_x3"] = _mempool_device_impl(3)
134+
135+
# These are used by test_green_context.py. The original fixtures include
136+
# pytest.skip() but that should have correctly fired by this time.
137+
if "sm_resource" in kwargs:
138+
kwargs["sm_resource"] = device.resources.sm
139+
if "wq_resource" in kwargs:
140+
kwargs["wq_resource"] = device.resources.workqueue
141+
if "green_ctx" in kwargs:
142+
from cuda.core import ContextOptions, SMResourceOptions
143+
144+
groups, _ = device.resources.sm.split(SMResourceOptions(count=None))
145+
kwargs["green_ctx"] = device.create_context(ContextOptions(resources=[groups[0]]))
134146
return func(*args, **kwargs)
135147

136148
wrapper._cuda_core_worker_cuda_wrapped = True

cuda_core/tests/test_green_context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
# ---------------------------------------------------------------------------
4242
# Fixtures
4343
# ---------------------------------------------------------------------------
44+
# Note that the following fixtures (except fill_kernel) require per-thread setup
45+
# and are currently special cased to work with pytest-run-parallel in conftest.
4446

4547

4648
# Resource queries (dev.resources.sm, dev.resources.workqueue) can fail in

0 commit comments

Comments
 (0)