diff --git a/projects/clr/hipamd/src/hip_vm.cpp b/projects/clr/hipamd/src/hip_vm.cpp index 69f96d4488..85a4c9beee 100644 --- a/projects/clr/hipamd/src/hip_vm.cpp +++ b/projects/clr/hipamd/src/hip_vm.cpp @@ -388,10 +388,6 @@ hipError_t hipMemSetAccess(void* ptr, size_t size, const hipMemAccessDesc* desc, if (accessLocationType != hipMemLocationTypeDevice && accessLocationType != hipMemLocationTypeHost) { HIP_RETURN(hipErrorInvalidValue); } - if (accessLocationType == hipMemLocationTypeHost && - memLocationType != hipMemLocationTypeHost) { - HIP_RETURN(hipErrorInvalidValue) - } if (desc[desc_idx].location.id >= g_devices.size()) { HIP_RETURN(hipErrorInvalidValue) diff --git a/projects/hip-tests/catch/unit/virtualMemoryManagement/hipMemSetGetAccess.cc b/projects/hip-tests/catch/unit/virtualMemoryManagement/hipMemSetGetAccess.cc index 36ea1f1a4f..e9bf960a3d 100644 --- a/projects/hip-tests/catch/unit/virtualMemoryManagement/hipMemSetGetAccess.cc +++ b/projects/hip-tests/catch/unit/virtualMemoryManagement/hipMemSetGetAccess.cc @@ -1489,18 +1489,23 @@ TEST_CASE("Unit_hipMemSetAccessHost_devicealloc") { HIP_CHECK(hipMemMap(addr, mapSize, 0 /*offset*/, handle, 0 /*flags*/)); - // Grant HOST access. + // Grant HOST access. hipMemAccessDesc accHost{}; accHost.flags = hipMemAccessFlagsProtReadWrite; accHost.location.type = hipMemLocationTypeHost; accHost.location.id = 0; - HIP_CHECK_ERROR(hipMemSetAccess(addr, mapSize, &accHost, 1), hipErrorInvalidValue); +#if HT_AMD + // SWDEV-563752: we need to allow setAccess to the host even if location is set to + // hipMemLocationTypeDevice in hipMemCreate + HIP_CHECK(hipMemSetAccess(addr, mapSize, &accHost, 1)); +#else + HIP_CHECK_ERROR(hipMemSetAccess(addr, mapSize, &accHost, 1), hipErrorNotSupported); +#endif HIP_CHECK(hipMemUnmap(addr, mapSize)); HIP_CHECK(hipMemAddressFree(addr, mapSize)); HIP_CHECK(hipMemRelease(handle)); } - /** * End doxygen group VirtualMemoryManagementTest. * @}