Skip to content
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

Soft link CUDA Runtime & lazy import Jitify #7929

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
fix for cudaGraphInstantiate signature change in CUDA 12
  • Loading branch information
kmaehashi committed Oct 13, 2023
commit 546d0b599aae0e9cf1b83b320d872c585a5bb87e
4 changes: 2 additions & 2 deletions cupy_backends/cuda/api/_runtime_extern.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 345,8 @@ cdef F_cudaGraphDestroy cudaGraphDestroy
ctypedef int (*F_cudaGraphExecDestroy)(GraphExec graph) nogil
cdef F_cudaGraphExecDestroy cudaGraphExecDestroy

ctypedef int (*F_cudaGraphInstantiate)(
GraphExec*, Graph, GraphNode*, char*, size_t) nogil
# N.B. The signature has been changed in CUDA 12. (#7834)
ctypedef int (*F_cudaGraphInstantiate)(GraphExec*, Graph, ...) nogil
cdef F_cudaGraphInstantiate cudaGraphInstantiate

ctypedef int (*F_cudaGraphLaunch)(GraphExec, driver.Stream) nogil
Expand Down
12 changes: 10 additions & 2 deletions cupy_backends/cuda/api/runtime.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1176,9 1176,17 @@ cpdef intptr_t graphInstantiate(intptr_t graph) except? 0:
initialize()
# TODO(leofang): support reporting error log?
cdef GraphExec ge

cdef bint old_api = _is_hip_environment or runtimeGetVersion() < 12000
with nogil:
status = cudaGraphInstantiate(<GraphExec*>(&ge), <Graph>graph,
NULL, NULL, 0)
if old_api:
status = cudaGraphInstantiate(
<GraphExec*>(&ge), <Graph>graph,
<void*>NULL, <char*>NULL, <size_t>0)
else:
status = cudaGraphInstantiate(
<GraphExec*>(&ge), <Graph>graph,
<unsigned long long>0)
check_status(status)
return <intptr_t>ge

Expand Down