diff --git a/projects/clr/rocclr/device/rocm/rocdevice.cpp b/projects/clr/rocclr/device/rocm/rocdevice.cpp index 2c5d041de9..21375aa875 100644 --- a/projects/clr/rocclr/device/rocm/rocdevice.cpp +++ b/projects/clr/rocclr/device/rocm/rocdevice.cpp @@ -199,6 +199,7 @@ Device::Device(hsa_agent_t bkendDevice) system_kernarg_segment_.handle = 0; gpuvm_segment_.handle = 0; gpu_fine_grained_segment_.handle = 0; + gpu_ext_fine_grained_segment_.handle = 0; prefetch_signal_.handle = 0; isXgmi_ = false; cache_state_ = Device::CacheState::kCacheStateInvalid; @@ -2360,8 +2361,11 @@ void Device::deviceVmemRelease(uint64_t mem_handle) const { void* Device::deviceLocalAlloc(size_t size, bool atomics, bool pseudo_fine_grain, bool contiguous) const { - const hsa_amd_memory_pool_t& pool = (pseudo_fine_grain) ? gpu_ext_fine_grained_segment_ - : (atomics) ? gpu_fine_grained_segment_ : gpuvm_segment_; + + const hsa_amd_memory_pool_t& pool = (pseudo_fine_grain && gpu_ext_fine_grained_segment_.handle) + ? gpu_ext_fine_grained_segment_ + : (atomics && gpu_fine_grained_segment_.handle) + ? gpu_fine_grained_segment_ : gpuvm_segment_; if (pool.handle == 0 || gpuvm_segment_max_alloc_ == 0) { DevLogPrintfError("Invalid argument, pool_handle: 0x%x , max_alloc: %u \n",