File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -838,6 +838,12 @@ inline std::intptr_t as_intptr(const LibraryHandle& h) noexcept {
838838 return reinterpret_cast <std::intptr_t >(as_cu (h));
839839}
840840
841+ // Regular pointer (CUmodule), not a shared_ptr: lifetime is owned by the
842+ // CUlibrary it was retrieved from.
843+ inline std::intptr_t as_intptr (const CUmodule& h) noexcept {
844+ return reinterpret_cast <std::intptr_t >(h);
845+ }
846+
841847inline std::intptr_t as_intptr (const KernelHandle& h) noexcept {
842848 return reinterpret_cast <std::intptr_t >(as_cu (h));
843849}
@@ -968,10 +974,8 @@ inline PyObject* as_py(const LibraryHandle& h) noexcept {
968974 return detail::make_py (" cuda.bindings.driver" , " CUlibrary" , as_intptr (h));
969975}
970976
971- // Regular pointer (CUmodule), not a shared_ptr: lifetime is owned by the
972- // CUlibrary it was retrieved from.
973977inline PyObject* as_py (const CUmodule& h) noexcept {
974- return detail::make_py (" cuda.bindings.driver" , " CUmodule" , reinterpret_cast <std:: intptr_t > (h));
978+ return detail::make_py (" cuda.bindings.driver" , " CUmodule" , as_intptr (h));
975979}
976980
977981inline PyObject* as_py (const KernelHandle& h) noexcept {
Original file line number Diff line number Diff line change @@ -107,6 +107,7 @@ cdef extern from "_cpp/resource_handles.hpp" namespace "cuda_core":
107107 intptr_t as_intptr(MemoryPoolHandle h) noexcept nogil
108108 intptr_t as_intptr(DevicePtrHandle h) noexcept nogil
109109 intptr_t as_intptr(LibraryHandle h) noexcept nogil
110+ intptr_t as_intptr(const cydriver.CUmodule& h) noexcept nogil
110111 intptr_t as_intptr(KernelHandle h) noexcept nogil
111112 intptr_t as_intptr(GraphHandle h) noexcept nogil
112113 intptr_t as_intptr(GraphExecHandle h) noexcept nogil
You can’t perform that action at this time.
0 commit comments