Non-CUDA equivalent of allocating pinned memory and returning pointer to it. On XPU, uses pin_memory=True (SYCL USM host allocation) for fast DMA transfers. On other non-CUDA platforms, pinning is not supported.
(size: int, device_id: int = 0)
| 418 | |
| 419 | |
| 420 | def alloc_pinned_ptr(size: int, device_id: int = 0) -> int: |
| 421 | """Non-CUDA equivalent of allocating pinned memory and returning pointer |
| 422 | to it. On XPU, uses pin_memory=True (SYCL USM host allocation) for |
| 423 | fast DMA transfers. On other non-CUDA platforms, pinning is not supported.""" |
| 424 | |
| 425 | view, aligned_ptr = _alloc_page_aligned_pinned_view(size) |
| 426 | _tensor_registry[aligned_ptr] = view |
| 427 | return aligned_ptr |
| 428 | |
| 429 | |
| 430 | def free_pinned_ptr(ptr: int) -> None: |
no test coverage detected