diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp index ba4700340d..7a1b80c775 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp @@ -241,6 +241,12 @@ KfdDriver::AllocateMemory(const core::MemoryRegion &mem_region, ? 1 : kmt_alloc_flags.ui32.Uncached); + if (kmt_alloc_flags.ui32.Uncached) { + /* Uncached overwrites CoarseGrain and ExtendedCoherent */ + kmt_alloc_flags.ui32.CoarseGrain = 0; + kmt_alloc_flags.ui32.ExtendedCoherent = 0; + } + kmt_alloc_flags.ui32.ExecuteBlit = !!(alloc_flags & core::MemoryRegion::AllocateExecutableBlitKernelObject); diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp index e3d2349e7f..47e3a2e3bb 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp @@ -881,6 +881,9 @@ hsa_status_t hsa_amd_memory_pool_allocate(hsa_amd_memory_pool_t memory_pool, siz if (flags & HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG) alloc_flag |= core::MemoryRegion::AllocateExecutable; + if (flags & HSA_AMD_MEMORY_POOL_UNCACHED_FLAG) + alloc_flag |= core::MemoryRegion::AllocateUncached; + #ifdef SANITIZER_AMDGPU if (mem_region->owner()->device_type() == core::Agent::kAmdGpuDevice) alloc_flag |= core::MemoryRegion::AllocateAsan; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h b/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h index ed44a44781..1c590946b3 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h @@ -1579,7 +1579,10 @@ typedef enum hsa_amd_memory_pool_flag_s { * Allocates executable memory */ HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG = (1 << 2), - + /** + * Allocates uncached memory + */ + HSA_AMD_MEMORY_POOL_UNCACHED_FLAG = (1 << 3), } hsa_amd_memory_pool_flag_t; /**