Skip to content

Commit 39e3293

Browse files
authored
[FEA] Add from_handle() methods for Kernel. (#1413)
* wip * adding thread safety * cleanup work * updating docstrings * removing experimental namespace * clean up * adding more unit test to cover edge cases * removing unneeded import * removing broken tests * pre-commit changes * clean up * Removing Object.from_handle and Program.from_handle * whitespace * adding function memoization * accessing Kernel directly * feedback * precommit
1 parent 1b67e7b commit 39e3293

File tree

4 files changed

+273
-107
lines changed

4 files changed

+273
-107
lines changed

cuda_bindings/pixi.lock

Lines changed: 40 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cuda_core/cuda/core/_launcher.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ def launch(stream: Stream | GraphBuilder | IsStreamT, config: LaunchConfig, kern
7878
cdef void** args_ptr = <void**><uintptr_t>(ker_args.ptr)
7979

8080
# TODO: cythonize Module/Kernel/...
81-
# Note: CUfunction and CUkernel are interchangeable
81+
# Note: We now use CUkernel handles exclusively (CUDA 12+), but they can be cast to
82+
# CUfunction for use with cuLaunchKernel, as both handle types are interchangeable
83+
# for kernel launch purposes.
8284
cdef cydriver.CUfunction func_handle = <cydriver.CUfunction>(<uintptr_t>(kernel._handle))
8385

84-
# Note: CUkernel can still be launched via the old cuLaunchKernel and we do not care
85-
# about the CUfunction/CUkernel difference (which depends on whether the "old" or
86-
# "new" module loading APIs are in use). We check both binding & driver versions here
87-
# mainly to see if the "Ex" API is available and if so we use it, as it's more feature
88-
# rich.
86+
# Note: CUkernel can still be launched via cuLaunchKernel (not just cuLaunchKernelEx).
87+
# We check both binding & driver versions here mainly to see if the "Ex" API is
88+
# available and if so we use it, as it's more feature rich.
8989
if _use_ex:
9090
drv_cfg = conf._to_native_launch_config()
9191
drv_cfg.hStream = as_cu(s._h_stream)

0 commit comments

Comments
 (0)