@@ -171,15 +171,15 @@ struct ContextBox {
171171};
172172} // namespace
173173
174- ContextHandle create_context_handle_ref (CUcontext ctx) noexcept {
174+ ContextHandle create_context_handle_ref (CUcontext ctx) {
175175 auto box = std::make_shared<const ContextBox>(ContextBox{ctx});
176176 return ContextHandle (box, &box->resource );
177177}
178178
179179// Thread-local cache of primary contexts indexed by device ID
180180static thread_local std::vector<ContextHandle> primary_context_cache;
181181
182- ContextHandle get_primary_context (int device_id) noexcept {
182+ ContextHandle get_primary_context (int device_id) {
183183 // Check thread-local cache
184184 if (static_cast <size_t >(device_id) < primary_context_cache.size ()) {
185185 if (auto cached = primary_context_cache[device_id]) {
@@ -212,7 +212,7 @@ ContextHandle get_primary_context(int device_id) noexcept {
212212 return h;
213213}
214214
215- ContextHandle get_current_context () noexcept {
215+ ContextHandle get_current_context () {
216216 GILReleaseGuard gil;
217217 CUcontext ctx = nullptr ;
218218 if (CUDA_SUCCESS != (err = p_cuCtxGetCurrent (&ctx))) {
@@ -234,7 +234,7 @@ struct StreamBox {
234234};
235235} // namespace
236236
237- StreamHandle create_stream_handle (ContextHandle h_ctx, unsigned int flags, int priority) noexcept {
237+ StreamHandle create_stream_handle (ContextHandle h_ctx, unsigned int flags, int priority) {
238238 GILReleaseGuard gil;
239239 CUstream stream;
240240 if (CUDA_SUCCESS != (err = p_cuStreamCreateWithPriority (&stream, flags, priority))) {
@@ -252,12 +252,12 @@ StreamHandle create_stream_handle(ContextHandle h_ctx, unsigned int flags, int p
252252 return StreamHandle (box, &box->resource );
253253}
254254
255- StreamHandle create_stream_handle_ref (CUstream stream) noexcept {
255+ StreamHandle create_stream_handle_ref (CUstream stream) {
256256 auto box = std::make_shared<const StreamBox>(StreamBox{stream});
257257 return StreamHandle (box, &box->resource );
258258}
259259
260- StreamHandle create_stream_handle_with_owner (CUstream stream, PyObject* owner) noexcept {
260+ StreamHandle create_stream_handle_with_owner (CUstream stream, PyObject* owner) {
261261 if (!owner) {
262262 return create_stream_handle_ref (stream);
263263 }
@@ -281,12 +281,12 @@ StreamHandle create_stream_handle_with_owner(CUstream stream, PyObject* owner) n
281281 return StreamHandle (box, &box->resource );
282282}
283283
284- StreamHandle get_legacy_stream () noexcept {
284+ StreamHandle get_legacy_stream () {
285285 static StreamHandle handle = create_stream_handle_ref (CU_STREAM_LEGACY );
286286 return handle;
287287}
288288
289- StreamHandle get_per_thread_stream () noexcept {
289+ StreamHandle get_per_thread_stream () {
290290 static StreamHandle handle = create_stream_handle_ref (CU_STREAM_PER_THREAD );
291291 return handle;
292292}
@@ -301,7 +301,7 @@ struct EventBox {
301301};
302302} // namespace
303303
304- EventHandle create_event_handle (ContextHandle h_ctx, unsigned int flags) noexcept {
304+ EventHandle create_event_handle (ContextHandle h_ctx, unsigned int flags) {
305305 GILReleaseGuard gil;
306306 CUevent event;
307307 if (CUDA_SUCCESS != (err = p_cuEventCreate (&event, flags))) {
@@ -319,11 +319,11 @@ EventHandle create_event_handle(ContextHandle h_ctx, unsigned int flags) noexcep
319319 return EventHandle (box, &box->resource );
320320}
321321
322- EventHandle create_event_handle_noctx (unsigned int flags) noexcept {
322+ EventHandle create_event_handle_noctx (unsigned int flags) {
323323 return create_event_handle (ContextHandle{}, flags);
324324}
325325
326- EventHandle create_event_handle_ipc (const CUipcEventHandle& ipc_handle) noexcept {
326+ EventHandle create_event_handle_ipc (const CUipcEventHandle& ipc_handle) {
327327 GILReleaseGuard gil;
328328 CUevent event;
329329 if (CUDA_SUCCESS != (err = p_cuIpcOpenEventHandle (&event, ipc_handle))) {
@@ -381,7 +381,7 @@ static MemoryPoolHandle wrap_mempool_owned(CUmemoryPool pool) {
381381 return MemoryPoolHandle (box, &box->resource );
382382}
383383
384- MemoryPoolHandle create_mempool_handle (const CUmemPoolProps& props) noexcept {
384+ MemoryPoolHandle create_mempool_handle (const CUmemPoolProps& props) {
385385 GILReleaseGuard gil;
386386 CUmemoryPool pool;
387387 if (CUDA_SUCCESS != (err = p_cuMemPoolCreate (&pool, &props))) {
@@ -390,12 +390,12 @@ MemoryPoolHandle create_mempool_handle(const CUmemPoolProps& props) noexcept {
390390 return wrap_mempool_owned (pool);
391391}
392392
393- MemoryPoolHandle create_mempool_handle_ref (CUmemoryPool pool) noexcept {
393+ MemoryPoolHandle create_mempool_handle_ref (CUmemoryPool pool) {
394394 auto box = std::make_shared<const MemoryPoolBox>(MemoryPoolBox{pool});
395395 return MemoryPoolHandle (box, &box->resource );
396396}
397397
398- MemoryPoolHandle get_device_mempool (int device_id) noexcept {
398+ MemoryPoolHandle get_device_mempool (int device_id) {
399399 GILReleaseGuard gil;
400400 CUmemoryPool pool;
401401 if (CUDA_SUCCESS != (err = p_cuDeviceGetMemPool (&pool, device_id))) {
@@ -404,7 +404,7 @@ MemoryPoolHandle get_device_mempool(int device_id) noexcept {
404404 return create_mempool_handle_ref (pool);
405405}
406406
407- MemoryPoolHandle create_mempool_handle_ipc (int fd, CUmemAllocationHandleType handle_type) noexcept {
407+ MemoryPoolHandle create_mempool_handle_ipc (int fd, CUmemAllocationHandleType handle_type) {
408408 GILReleaseGuard gil;
409409 CUmemoryPool pool;
410410 auto handle_ptr = reinterpret_cast <void *>(static_cast <uintptr_t >(fd));
@@ -448,7 +448,7 @@ void set_deallocation_stream(const DevicePtrHandle& h, StreamHandle h_stream) no
448448 get_box (h)->h_stream = std::move (h_stream);
449449}
450450
451- DevicePtrHandle deviceptr_alloc_from_pool (size_t size, MemoryPoolHandle h_pool, StreamHandle h_stream) noexcept {
451+ DevicePtrHandle deviceptr_alloc_from_pool (size_t size, MemoryPoolHandle h_pool, StreamHandle h_stream) {
452452 GILReleaseGuard gil;
453453 CUdeviceptr ptr;
454454 if (CUDA_SUCCESS != (err = p_cuMemAllocFromPoolAsync (&ptr, size, *h_pool, as_cu (h_stream)))) {
@@ -466,7 +466,7 @@ DevicePtrHandle deviceptr_alloc_from_pool(size_t size, MemoryPoolHandle h_pool,
466466 return DevicePtrHandle (box, &box->resource );
467467}
468468
469- DevicePtrHandle deviceptr_alloc_async (size_t size, StreamHandle h_stream) noexcept {
469+ DevicePtrHandle deviceptr_alloc_async (size_t size, StreamHandle h_stream) {
470470 GILReleaseGuard gil;
471471 CUdeviceptr ptr;
472472 if (CUDA_SUCCESS != (err = p_cuMemAllocAsync (&ptr, size, as_cu (h_stream)))) {
@@ -484,7 +484,7 @@ DevicePtrHandle deviceptr_alloc_async(size_t size, StreamHandle h_stream) noexce
484484 return DevicePtrHandle (box, &box->resource );
485485}
486486
487- DevicePtrHandle deviceptr_alloc (size_t size) noexcept {
487+ DevicePtrHandle deviceptr_alloc (size_t size) {
488488 GILReleaseGuard gil;
489489 CUdeviceptr ptr;
490490 if (CUDA_SUCCESS != (err = p_cuMemAlloc (&ptr, size))) {
@@ -502,7 +502,7 @@ DevicePtrHandle deviceptr_alloc(size_t size) noexcept {
502502 return DevicePtrHandle (box, &box->resource );
503503}
504504
505- DevicePtrHandle deviceptr_alloc_host (size_t size) noexcept {
505+ DevicePtrHandle deviceptr_alloc_host (size_t size) {
506506 GILReleaseGuard gil;
507507 void * ptr;
508508 if (CUDA_SUCCESS != (err = p_cuMemAllocHost (&ptr, size))) {
@@ -520,12 +520,12 @@ DevicePtrHandle deviceptr_alloc_host(size_t size) noexcept {
520520 return DevicePtrHandle (box, &box->resource );
521521}
522522
523- DevicePtrHandle deviceptr_create_ref (CUdeviceptr ptr) noexcept {
523+ DevicePtrHandle deviceptr_create_ref (CUdeviceptr ptr) {
524524 auto box = std::make_shared<DevicePtrBox>(DevicePtrBox{ptr, StreamHandle{}});
525525 return DevicePtrHandle (box, &box->resource );
526526}
527527
528- DevicePtrHandle deviceptr_create_with_owner (CUdeviceptr ptr, PyObject* owner) noexcept {
528+ DevicePtrHandle deviceptr_create_with_owner (CUdeviceptr ptr, PyObject* owner) {
529529 if (!owner) {
530530 return deviceptr_create_ref (ptr);
531531 }
@@ -607,7 +607,7 @@ struct ExportDataKeyHash {
607607static std::mutex ipc_ptr_cache_mutex;
608608static std::unordered_map<ExportDataKey, std::weak_ptr<DevicePtrBox>, ExportDataKeyHash> ipc_ptr_cache;
609609
610- DevicePtrHandle deviceptr_import_ipc (MemoryPoolHandle h_pool, const void * export_data, StreamHandle h_stream) noexcept {
610+ DevicePtrHandle deviceptr_import_ipc (MemoryPoolHandle h_pool, const void * export_data, StreamHandle h_stream) {
611611 auto data = const_cast <CUmemPoolPtrExportData*>(
612612 reinterpret_cast <const CUmemPoolPtrExportData*>(export_data));
613613
0 commit comments