@@ -185,50 +185,50 @@ void set_deallocation_stream(const DevicePtrHandle& h, StreamHandle h_stream);
185185// Overloaded helper functions to extract raw resources from handles
186186// ============================================================================
187187
188- // cu () - extract the raw CUDA handle
189- inline CUcontext cu (const ContextHandle& h) noexcept {
188+ // as_cu () - extract the raw CUDA handle
189+ inline CUcontext as_cu (const ContextHandle& h) noexcept {
190190 return h ? *h : nullptr ;
191191}
192192
193- inline CUstream cu (const StreamHandle& h) noexcept {
193+ inline CUstream as_cu (const StreamHandle& h) noexcept {
194194 return h ? *h : nullptr ;
195195}
196196
197- inline CUevent cu (const EventHandle& h) noexcept {
197+ inline CUevent as_cu (const EventHandle& h) noexcept {
198198 return h ? *h : nullptr ;
199199}
200200
201- inline CUmemoryPool cu (const MemoryPoolHandle& h) noexcept {
201+ inline CUmemoryPool as_cu (const MemoryPoolHandle& h) noexcept {
202202 return h ? *h : nullptr ;
203203}
204204
205- inline CUdeviceptr cu (const DevicePtrHandle& h) noexcept {
205+ inline CUdeviceptr as_cu (const DevicePtrHandle& h) noexcept {
206206 return h ? *h : 0 ;
207207}
208208
209- // intptr () - extract handle as intptr_t for Python interop
209+ // as_intptr () - extract handle as intptr_t for Python interop
210210// Using signed intptr_t per C standard convention and issue #1342
211- inline std::intptr_t intptr (const ContextHandle& h) noexcept {
212- return reinterpret_cast <std::intptr_t >(cu (h));
211+ inline std::intptr_t as_intptr (const ContextHandle& h) noexcept {
212+ return reinterpret_cast <std::intptr_t >(as_cu (h));
213213}
214214
215- inline std::intptr_t intptr (const StreamHandle& h) noexcept {
216- return reinterpret_cast <std::intptr_t >(cu (h));
215+ inline std::intptr_t as_intptr (const StreamHandle& h) noexcept {
216+ return reinterpret_cast <std::intptr_t >(as_cu (h));
217217}
218218
219- inline std::intptr_t intptr (const EventHandle& h) noexcept {
220- return reinterpret_cast <std::intptr_t >(cu (h));
219+ inline std::intptr_t as_intptr (const EventHandle& h) noexcept {
220+ return reinterpret_cast <std::intptr_t >(as_cu (h));
221221}
222222
223- inline std::intptr_t intptr (const MemoryPoolHandle& h) noexcept {
224- return reinterpret_cast <std::intptr_t >(cu (h));
223+ inline std::intptr_t as_intptr (const MemoryPoolHandle& h) noexcept {
224+ return reinterpret_cast <std::intptr_t >(as_cu (h));
225225}
226226
227- inline std::intptr_t intptr (const DevicePtrHandle& h) noexcept {
228- return static_cast <std::intptr_t >(cu (h));
227+ inline std::intptr_t as_intptr (const DevicePtrHandle& h) noexcept {
228+ return static_cast <std::intptr_t >(as_cu (h));
229229}
230230
231- // py () - convert handle to Python driver wrapper object (returns new reference)
231+ // as_py () - convert handle to Python driver wrapper object (returns new reference)
232232namespace detail {
233233// n.b. class lookup is not cached to avoid deadlock hazard, see DESIGN.md
234234inline PyObject* make_py (const char * class_name, std::intptr_t value) {
@@ -243,24 +243,24 @@ inline PyObject* make_py(const char* class_name, std::intptr_t value) {
243243}
244244} // namespace detail
245245
246- inline PyObject* py (const ContextHandle& h) {
247- return detail::make_py (" CUcontext" , intptr (h));
246+ inline PyObject* as_py (const ContextHandle& h) {
247+ return detail::make_py (" CUcontext" , as_intptr (h));
248248}
249249
250- inline PyObject* py (const StreamHandle& h) {
251- return detail::make_py (" CUstream" , intptr (h));
250+ inline PyObject* as_py (const StreamHandle& h) {
251+ return detail::make_py (" CUstream" , as_intptr (h));
252252}
253253
254- inline PyObject* py (const EventHandle& h) {
255- return detail::make_py (" CUevent" , intptr (h));
254+ inline PyObject* as_py (const EventHandle& h) {
255+ return detail::make_py (" CUevent" , as_intptr (h));
256256}
257257
258- inline PyObject* py (const MemoryPoolHandle& h) {
259- return detail::make_py (" CUmemoryPool" , intptr (h));
258+ inline PyObject* as_py (const MemoryPoolHandle& h) {
259+ return detail::make_py (" CUmemoryPool" , as_intptr (h));
260260}
261261
262- inline PyObject* py (const DevicePtrHandle& h) {
263- return detail::make_py (" CUdeviceptr" , intptr (h));
262+ inline PyObject* as_py (const DevicePtrHandle& h) {
263+ return detail::make_py (" CUdeviceptr" , as_intptr (h));
264264}
265265
266266} // namespace cuda_core
0 commit comments