Skip to content

Commit 33746d8

Browse files
authored
[SYCL][CUDA] Add concurrent memory check to mem_advice (#6567)
This PR adds a check to CUDA's mem advice to make sure the memory passed is managed memory. This change makes mem_advise line up with prefetch in terms of checking that both the device supports concurrent managed memory and that the memory passed to the function is managed. This is to prevent cuMemAdvise from failing on the SYCL mem_advise CTS tests.
1 parent ee781e4 commit 33746d8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5110,6 +5110,16 @@ pi_result cuda_piextUSMEnqueueMemAdvise(pi_queue queue, const void *ptr,
51105110
// CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS property.
51115111
}
51125112

5113+
unsigned int is_managed;
5114+
PI_CHECK_ERROR(cuPointerGetAttribute(
5115+
&is_managed, CU_POINTER_ATTRIBUTE_IS_MANAGED, (CUdeviceptr)ptr));
5116+
if (!is_managed) {
5117+
setErrorMessage(
5118+
"Memory advice ignored as memory advices only works with USM",
5119+
PI_SUCCESS);
5120+
return PI_ERROR_PLUGIN_SPECIFIC_ERROR;
5121+
}
5122+
51135123
pi_result result = PI_SUCCESS;
51145124
std::unique_ptr<_pi_event> event_ptr{nullptr};
51155125

0 commit comments

Comments
 (0)