Skip to content

Commit d9c3526

Browse files
committed
use CUDA context memoized by stream
1 parent 7ea73f7 commit d9c3526

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

cuda_core/cuda/core/experimental/_graph.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,8 @@ def __cuda_stream__(self) -> tuple[int, int]:
449449
"""Return an instance of a __cuda_stream__ protocol."""
450450
return self.stream.__cuda_stream__()
451451

452-
def _get_conditional_context(self):
453-
driver_ver = handle_return(driver.cuDriverGetVersion())
454-
if driver_ver < 12050:
455-
# Pre 12.5 drivers don't allow querying the stream context during capture.
456-
return handle_return(driver.cuCtxGetCurrent())
457-
else:
458-
return handle_return(driver.cuStreamGetCtx(self._mnff.stream.handle))
452+
def _get_conditional_context(self) -> driver.CUcontext:
453+
return self._mnff.stream.context._handle
459454

460455
def create_conditional_handle(self, default_value=None) -> int:
461456
"""Creates a conditional handle for the graph builder.

0 commit comments

Comments
 (0)