@@ -158,10 +158,10 @@ static void store_last_native_error(int32_t native_error) {
158158struct ctl ze_memory_ctl_root ;
159159static UTIL_ONCE_FLAG ctl_initialized = UTIL_ONCE_FLAG_INIT ;
160160
161- static ze_relaxed_allocation_limits_exp_desc_t relaxed_device_allocation_desc =
162- { .stype = ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC ,
163- .pNext = NULL ,
164- .flags = ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE };
161+ static ze_relaxed_allocation_limits_exp_desc_t relaxed_allocation_desc = {
162+ .stype = ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC ,
163+ .pNext = NULL ,
164+ .flags = ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE };
165165
166166static ze_external_memory_export_desc_t memory_export_desc = {
167167 .stype = ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_DESC ,
@@ -691,6 +691,13 @@ static umf_result_t ze_memory_provider_alloc_helper(void *provider, size_t size,
691691 .stype = ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC ,
692692 .pNext = NULL ,
693693 .flags = 0 };
694+ void * lastNext = & host_desc .pNext ;
695+
696+ // add relaxed allocation desc to the pNext chain
697+ ze_relaxed_allocation_limits_exp_desc_t relaxed_allocation_desc_copy =
698+ relaxed_allocation_desc ;
699+ * (void * * )lastNext = & relaxed_allocation_desc_copy ;
700+
694701 ze_result = g_ze_ops .zeMemAllocHost (ze_provider -> context , & host_desc ,
695702 size , alignment , resultPtr );
696703 break ;
@@ -703,13 +710,12 @@ static umf_result_t ze_memory_provider_alloc_helper(void *provider, size_t size,
703710 .ordinal = ze_provider -> device_ordinal };
704711 void * lastNext = & dev_desc .pNext ;
705712
706- ze_relaxed_allocation_limits_exp_desc_t
707- relaxed_device_allocation_desc_copy =
708- relaxed_device_allocation_desc ;
713+ ze_relaxed_allocation_limits_exp_desc_t relaxed_allocation_desc_copy =
714+ relaxed_allocation_desc ;
709715 if (use_relaxed_allocation (ze_provider , size )) {
710716 // add relaxed allocation desc to the pNext chain
711- * (void * * )lastNext = & relaxed_device_allocation_desc_copy ;
712- lastNext = & relaxed_device_allocation_desc_copy .pNext ;
717+ * (void * * )lastNext = & relaxed_allocation_desc_copy ;
718+ lastNext = & relaxed_allocation_desc_copy .pNext ;
713719 }
714720
715721 // check if the allocation should use import / export mechanism
@@ -734,7 +740,7 @@ static umf_result_t ze_memory_provider_alloc_helper(void *provider, size_t size,
734740 ze_device_mem_alloc_desc_t dev_desc = {
735741 .stype = ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC ,
736742 .pNext = use_relaxed_allocation (ze_provider , size )
737- ? & relaxed_device_allocation_desc
743+ ? & relaxed_allocation_desc
738744 : NULL ,
739745 .flags = 0 ,
740746 .ordinal = ze_provider -> device_ordinal };
0 commit comments