diff --git a/fabtests/common/hmem.c b/fabtests/common/hmem.c index 9342b0d5530..e80e6c67b18 100644 --- a/fabtests/common/hmem.c +++ b/fabtests/common/hmem.c @@ -88,9 +88,9 @@ static struct ft_hmem_ops hmem_ops[] = { .init = ft_ze_init, .cleanup = ft_ze_cleanup, .alloc = ft_ze_alloc, - .alloc_host = ft_default_alloc_host, + .alloc_host = ft_ze_alloc_host, .free = ft_ze_free, - .free_host = ft_default_free_host, + .free_host = ft_ze_free, .mem_set = ft_ze_memset, .copy_to_hmem = ft_ze_copy, .copy_from_hmem = ft_ze_copy, diff --git a/fabtests/common/hmem_ze.c b/fabtests/common/hmem_ze.c index 97408eca8c8..6aed1bf1050 100644 --- a/fabtests/common/hmem_ze.c +++ b/fabtests/common/hmem_ze.c @@ -74,6 +74,12 @@ static const ze_device_mem_alloc_desc_t device_desc = { .ordinal = 0, }; +static const ze_host_mem_alloc_desc_t host_desc = { + .stype = ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC, + .pNext = NULL, + .flags = 0, +}; + static void *libze_handle; struct libze_ops libze_ops; int init_libze_ops(void) @@ -360,6 +366,12 @@ int ft_ze_alloc(uint64_t device, void **buf, size_t size) -FI_EINVAL : 0; } +int ft_ze_alloc_host(void **buffer, size_t size) +{ + return (*libze_ops.zeMemAllocHost)(context, &host_desc, size, 16, + buffer) ? -FI_EINVAL : FI_SUCCESS; +} + int ft_ze_free(void *buf) { if (!buf) @@ -439,6 +451,11 @@ int ft_ze_alloc(uint64_t device, void **buf, size_t size) return -FI_ENOSYS; } +int ft_ze_alloc_host(void **buffer, size_t size) +{ + return -FI_ENOSYS; +} + int ft_ze_free(void *buf) { return -FI_ENOSYS; diff --git a/fabtests/include/hmem.h b/fabtests/include/hmem.h index 0cb7f81d14b..3723e991f90 100644 --- a/fabtests/include/hmem.h +++ b/fabtests/include/hmem.h @@ -127,6 +127,7 @@ int init_libze_ops(void); int ft_ze_init(void); int ft_ze_cleanup(void); int ft_ze_alloc(uint64_t device, void **buf, size_t size); +int ft_ze_alloc_host(void **buf, size_t size); int ft_ze_free(void *buf); int ft_ze_memset(uint64_t device, void *buf, int value, size_t size); int ft_ze_copy(uint64_t device, void *dst, const void *src, size_t size);