diff --git a/projects/clr/hipamd/src/hip_memory.cpp b/projects/clr/hipamd/src/hip_memory.cpp index dddd54e448..bd553f4678 100644 --- a/projects/clr/hipamd/src/hip_memory.cpp +++ b/projects/clr/hipamd/src/hip_memory.cpp @@ -732,7 +732,7 @@ hipError_t hipExtMallocWithFlags(void** ptr, size_t sizeBytes, unsigned int flag } else if (flags == hipDeviceMallocFinegrained) { ihipFlags = CL_MEM_SVM_ATOMICS; } else if (flags == hipDeviceMallocUncached) { - ihipFlags = CL_MEM_SVM_ATOMICS | ROCCLR_MEM_HSA_UNCACHED; + ihipFlags = ROCCLR_MEM_HSA_UNCACHED; } else if (flags == hipDeviceMallocContiguous) { ihipFlags = ROCCLR_MEM_HSA_CONTIGUOUS | ROCCLR_MEM_HSA_UNCACHED; } else if (flags == hipMallocSignalMemory) { diff --git a/projects/clr/rocclr/device/device.hpp b/projects/clr/rocclr/device/device.hpp index 254ef55e69..6310094ab4 100644 --- a/projects/clr/rocclr/device/device.hpp +++ b/projects/clr/rocclr/device/device.hpp @@ -1814,7 +1814,8 @@ class Device : public RuntimeObject { uint32_t pseudo_fine_grain_ : 1; //!< True if pseudo fine grain memory is required uint32_t contiguous_ : 1; //!< True if contiguous memory allocation is required uint32_t executable_ : 1; //!< True if executable memory is required - uint32_t reserved_ : 28; //!< Reserved for future use + uint32_t uncached_ : 1; //!< True if uncached memory is required + uint32_t reserved_ : 27; //!< Reserved for future use }; uint32_t data_; } AllocationFlags; diff --git a/projects/clr/rocclr/device/rocm/rocdevice.cpp b/projects/clr/rocclr/device/rocm/rocdevice.cpp index f38afa17d4..5718a7d6d6 100644 --- a/projects/clr/rocclr/device/rocm/rocdevice.cpp +++ b/projects/clr/rocclr/device/rocm/rocdevice.cpp @@ -2176,6 +2176,9 @@ void* Device::deviceLocalAlloc(size_t size, const AllocationFlags& flags) const if (flags.executable_) { hsa_mem_flags |= HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG; } + if (flags.uncached_ && isa().versionMajor() == 12) { + hsa_mem_flags |= HSA_AMD_MEMORY_POOL_UNCACHED_FLAG; + } void* ptr = nullptr; hsa_status_t stat = Hsa::memory_pool_allocate(pool, size, hsa_mem_flags, &ptr); diff --git a/projects/clr/rocclr/device/rocm/rocmemory.cpp b/projects/clr/rocclr/device/rocm/rocmemory.cpp index 4cfaabfa8c..6ce4f820d6 100644 --- a/projects/clr/rocclr/device/rocm/rocmemory.cpp +++ b/projects/clr/rocclr/device/rocm/rocmemory.cpp @@ -852,6 +852,7 @@ bool Buffer::create(bool alloc_local) { flags.atomics_ = (memFlags & CL_MEM_SVM_ATOMICS) != 0; flags.pseudo_fine_grain_ = (memFlags & ROCCLR_MEM_HSA_UNCACHED) != 0; flags.contiguous_ = (memFlags & ROCCLR_MEM_HSA_CONTIGUOUS) != 0; + flags.uncached_ = (memFlags & ROCCLR_MEM_HSA_UNCACHED) != 0; deviceMemory_ = dev().deviceLocalAlloc(size(), flags); } owner()->setSvmPtr(deviceMemory_);