Skip to content

Commit

Permalink
Merge pull request #1872 from npmiller/revert-access-by
Browse files Browse the repository at this point in the history
Revert use of ACCESSED_BY for managed memory
  • Loading branch information
kbenzie authored Jul 24, 2024
2 parents 3fc52b2 + a3c2a85 commit d3b42cd
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions source/adapters/cuda/usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,27 +150,15 @@ ur_result_t USMDeviceAllocImpl(void **ResultPtr, ur_context_handle_t,
return UR_RESULT_SUCCESS;
}

ur_result_t USMSharedAllocImpl(void **ResultPtr, ur_context_handle_t Context,
ur_device_handle_t CommandDevice,
ur_result_t USMSharedAllocImpl(void **ResultPtr, ur_context_handle_t,
ur_device_handle_t Device,
ur_usm_host_mem_flags_t,
ur_usm_device_mem_flags_t, size_t Size,
uint32_t Alignment) {
try {
ScopedContext Active(CommandDevice);
ScopedContext Active(Device);
UR_CHECK_ERROR(cuMemAllocManaged((CUdeviceptr *)ResultPtr, Size,
CU_MEM_ATTACH_GLOBAL));
if (getAttribute(CommandDevice,
CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS)) {
UR_CHECK_ERROR(cuMemAdvise((CUdeviceptr)*ResultPtr, Size,
CU_MEM_ADVISE_SET_ACCESSED_BY,
CommandDevice->get()));
}
for (const auto &Dev : Context->getDevices()) {
if (getAttribute(Dev, CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS)) {
UR_CHECK_ERROR(cuMemAdvise((CUdeviceptr)*ResultPtr, Size,
CU_MEM_ADVISE_SET_ACCESSED_BY, Dev->get()));
}
}
} catch (ur_result_t Err) {
return Err;
}
Expand Down

0 comments on commit d3b42cd

Please sign in to comment.