Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions projects/clr/rocclr/device/pal/palvirtual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2319,12 +2319,18 @@ void VirtualGPU::submitVirtualMap(amd::VirtualMapCommand& vcmd) {

// Create a view, since original base obj will map the whole memory and multimap cases wont work.
amd::Memory* vaddr_sub_obj = nullptr;
Pal::IGpuMemory* phymem_igpu_mem = nullptr;
size_t vaddr_offset = 0;
size_t phys_offset = 0;
Comment thread
marandje marked this conversation as resolved.
Resolved
if (phys_mem_obj != nullptr) {
constexpr bool kParent = false;
vaddr_sub_obj = phys_mem_obj->getContext().devices()[0]->CreateVirtualBuffer(
phys_mem_obj->getContext(), const_cast<void*>(vcmd.ptr()), vcmd.size(),
phys_mem_obj->getUserData().deviceId, phys_mem_obj->getUserData().locationType, kParent);

pal::Memory* phys_pal_mem = dev().getGpuMemory(phys_mem_obj);
phymem_igpu_mem = phys_pal_mem->iMem();
phys_offset = phys_pal_mem->offset();
} else {
vaddr_sub_obj = amd::MemObjMap::FindMemObj(vcmd.ptr());
}
Expand All @@ -2335,11 +2341,8 @@ void VirtualGPU::submitVirtualMap(amd::VirtualMapCommand& vcmd) {

// The imem() in the backend is shared between base and sub/view object.
pal::Memory* vaddr_pal_mem = dev().getGpuMemory(vaddr_base_obj);
Pal::IGpuMemory* phymem_igpu_mem =
(phys_mem_obj == nullptr) ? nullptr : dev().getGpuMemory(phys_mem_obj)->iMem();

Pal::VirtualMemoryRemapRange range{vaddr_pal_mem->iMem(), vaddr_offset,
phymem_igpu_mem, 0,
phymem_igpu_mem, phys_offset,
vcmd.size(), Pal::VirtualGpuMemAccessMode::NoAccess};

// Wait for previous operations before unmap
Expand All @@ -2364,7 +2367,7 @@ void VirtualGPU::submitVirtualMap(amd::VirtualMapCommand& vcmd) {
phys_mem_obj->getUserData().vaddr_mem_obj = vaddr_sub_obj;
} else {
// assert the vaddr_mem_obj is mapped and needs to be removed
amd::Memory* vaddr_sub_obj = amd::MemObjMap::FindMemObj(vcmd.ptr());
vaddr_sub_obj = amd::MemObjMap::FindMemObj(vcmd.ptr());
assert(vaddr_sub_obj != nullptr);
assert(vcmd.ptr() == vaddr_sub_obj->getSvmPtr());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@
"Unit_hipStreamCreateWithPriority_MulthreadNonblockingflag",
"SWDEV-396617 ExecMemcpyNodeSetParamsFromSymbol fails in direction",
"SWDEV-396616 hipMemMap returns invalid error",
"Unit_hipMemVmm_Basic",
"SWDEV-396615 mGPUs not considered correctly",
"Unit_hipManagedKeyword_MultiGpu",
"Disabling test tracked SWDEV-391555",
Expand Down Expand Up @@ -699,7 +698,6 @@
"====================================================",
"Unit_hipEventRecord",
"========Rock_Window_Failures_on_gfx1151===========================================",
"Unit_hipMemVmm_Uncached",
"Unit_Uuid_FntlTstsFor_SetEnv_HIP_VISIBLE_DEVICES",
"Unit_UUID_setEnv_Thread",
"Unit_hipTexRefSetArray_Positive",
Expand Down
4 changes: 2 additions & 2 deletions projects/hip-tests/catch/unit/memory/hipMemVmm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ TEST_CASE("Unit_hipMemVmm_Basic") {
HIP_CHECK(hipMemGetAllocationGranularity(&granularity, &memAllocationProp,
hipMemAllocationGranularityRecommended));

size_t size = 4 * 1024;
size_t size = granularity * 4;
void* reservedAddress{nullptr};
HIP_CHECK(hipMemAddressReserve(&reservedAddress, size, granularity, nullptr, 0));
HIP_CHECK(hipMemAddressReserve(&reservedAddress, size, 0, nullptr, 0));

hipMemGenericAllocationHandle_t gaHandle{nullptr};
HIP_CHECK(hipMemCreate(&gaHandle, size, &memAllocationProp, 0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ set(TEST_SRC
hipMemGetAllocationPropertiesFromHandle.cc
hipMemMap.cc
hipMemRelease.cc
hipMemUnmap.cc
hipMemVmm_old.cc)
hipMemUnmap.cc)

hip_add_exe_to_target(NAME VirtualMemoryManagementTest
TEST_SRC ${TEST_SRC}
Expand Down

This file was deleted.

Loading