diff --git a/CHANGELOG.md b/CHANGELOG.md index c780e7c57d..9b0303fc01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,10 @@ Full documentation for HIP is available at [rocm.docs.amd.com](https://rocm.docs - `hipMemcpy3DBatchAsync` Performs a batch of 3D memory copied asynchronously - `hipMemcpy3DPeer` Copies memory between devices - `hipMemcpy3DPeerAsync`Copied memory between devices asynchronously + - `hipMemsetD2D32Async` Used for setting 2D memory range with specified 32-bit values + asynchronously +* Changed HIP APIs + - `hipMemCreate` now can take hipDeviceMallocUncached as a flag to allocate uncached memory ## HIP 7.0 for ROCm 7.0 diff --git a/hipamd/src/hip_vm.cpp b/hipamd/src/hip_vm.cpp index 712ce8b2f1..28715e9b31 100644 --- a/hipamd/src/hip_vm.cpp +++ b/hipamd/src/hip_vm.cpp @@ -85,11 +85,15 @@ hipError_t hipMemCreate(hipMemGenericAllocationHandle_t* handle, size_t size, HIP_INIT_API(hipMemCreate, handle, size, prop, flags); // Currently we do not support Pinned memory - if (handle == nullptr || size == 0 || flags != 0 || prop == nullptr || + if (handle == nullptr || size == 0 || prop == nullptr || prop->type != hipMemAllocationTypePinned || prop->location.type != hipMemLocationTypeDevice) { HIP_RETURN(hipErrorInvalidValue); } + if (flags != hipDeviceMallocUncached && flags != 0) { + HIP_RETURN(hipErrorInvalidValue); + } + if (prop->location.id < 0 || prop->location.id >= g_devices.size()) { HIP_RETURN(hipErrorInvalidDevice); } @@ -112,8 +116,12 @@ hipError_t hipMemCreate(hipMemGenericAllocationHandle_t* handle, size_t size, amd::Context* amdContext = g_devices[prop->location.id]->asContext(); // When ROCCLR_MEM_PHYMEM is set, ROCr impl gets and stores unique hsa handle. Flag no-op on PAL. - void* ptr = amd::SvmBuffer::malloc(*amdContext, ROCCLR_MEM_PHYMEM, size, - dev_info.memBaseAddrAlign_, nullptr); + uint64_t ihipFlags = ROCCLR_MEM_PHYMEM; + if (flags == hipDeviceMallocUncached) { + ihipFlags |= ROCCLR_MEM_HSA_UNCACHED | CL_MEM_SVM_ATOMICS; + } + void* ptr = + amd::SvmBuffer::malloc(*amdContext, ihipFlags, size, dev_info.memBaseAddrAlign_, nullptr); // Handle out of memory cases, if (ptr == nullptr) {