Madvise feature in SVM for Multi-GPU configs
v5 cover Madvise feature in SVM for Multi-GPU configs
From: Nishit Sharma <[email protected]>
This patch series adds comprehensive SVM multi-GPU IGT test coverage for madvise and prefetch functionality.
ver2:
- Test name changed in commits
- In patchwork v1 patch is missing due to last patch was not sent
ver3:
- In patch-7 tags were added and it was not sent on patchwork
ver4:
- In patch file was added which is not available in source which caused CI build failure.
ver5:
- Added subtest function wrappers
- Subtests executing for all GPUs enumerated
Nishit Sharma (8):
tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU cross-GPU memory
access test
tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU atomic operations tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU coherency test tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU performance test tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU fault handling test tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU simultaneous access
test
tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU conflicting madvise
test
tests/intel/xe_multi-gpusvm.c: Add SVM multi-GPU migration test
lib/xe/xe_ioctl.c | 39 + lib/xe/xe_ioctl.h | 5 + tests/intel/xe_multi_gpusvm.c | 1636 +++++++++++++++++++++++++++++++++ tests/intel/xe_multisvm.c | 2 + tests/meson.build | 1 + 5 files changed, 1683 insertions(+) create mode 100644 tests/intel/xe_multi_gpusvm.c
Signature · 1 line
2.48.1
PATCH v5 1/8 tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU cross-GPU memory access test
From: Nishit Sharma <[email protected]>
This test allocates a buffer in SVM, writes data to it from GPU 1, and reads/verifies the data from GPU 2. Optionally, the CPU also reads or modifies the buffer and both GPUs verify the results, ensuring correct cross-GPU and CPU memory access in a multi-GPU environment.
--- lib/xe/xe_ioctl.c | 39 +++++ lib/xe/xe_ioctl.h | 5 + tests/intel/xe_multi_gpusvm.c | 297 ++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 4 files changed, 342 insertions(+) create mode 100644 tests/intel/xe_multi_gpusvm.c
lib/xe/xe_ioctl.c +39 -0
@@ -746,3 +746,42 @@ void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t range,igt_assert_eq (__xe_vm_madvise (fd, vm, addr, range, ext, type, op_val, policy, instance),0 ); } + +#define BIND_SYNC_VAL 0x686868 +void xe_vm_bind_lr_sync (int fd,uint32_t vm,uint32_t bo,uint64_t offset, +uint64_t addr,uint64_t size,uint32_t flags) +{ +volatile uint64_t *sync_addr =malloc (sizeof (*sync_addr)); +struct drm_xe_sync sync = { + .flags =DRM_XE_SYNC_FLAG_SIGNAL , + .type =DRM_XE_SYNC_TYPE_USER_FENCE , + .addr =to_user_pointer ((uint64_t *)sync_addr), + .timeline_value =BIND_SYNC_VAL , + }; + +igt_assert (!!sync_addr); +xe_vm_bind_async_flags (fd, vm,0 , bo,0 , addr, size, &sync,1 , flags); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (fd, (uint64_t *)sync_addr,BIND_SYNC_VAL ,0 ,NSEC_PER_SEC *10 ); +/* Only free if the wait succeeds */ +free ((void *)sync_addr); +} + +void xe_vm_unbind_lr_sync (int fd,uint32_t vm,uint64_t offset, +uint64_t addr,uint64_t size) +{ +volatile uint64_t *sync_addr =malloc (sizeof (*sync_addr)); +struct drm_xe_sync sync = { + .flags =DRM_XE_SYNC_FLAG_SIGNAL , + .type =DRM_XE_SYNC_TYPE_USER_FENCE , + .addr =to_user_pointer ((uint64_t *)sync_addr), + .timeline_value =BIND_SYNC_VAL , + }; + +igt_assert (!!sync_addr); + *sync_addr =0 ; +xe_vm_unbind_async (fd, vm,0 ,0 , addr, size, &sync,1 ); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (fd, (uint64_t *)sync_addr,BIND_SYNC_VAL ,0 ,NSEC_PER_SEC *10 ); +free ((void *)sync_addr); +}
lib/xe/xe_ioctl.h +5 -0
@@ -109,4 +109,9 @@ int xe_vm_vma_attrs(int fd, struct drm_xe_vm_query_mem_range_attr *vmas_attr,struct drm_xe_mem_range_attr *xe_vm_get_mem_attr_values_in_range (int fd,uint32_t vm,uint64_t start,uint64_t range,uint32_t *num_ranges); +void xe_vm_bind_lr_sync (int fd,uint32_t vm,uint32_t bo, +uint64_t offset,uint64_t addr, +uint64_t size,uint32_t flags); +void xe_vm_unbind_lr_sync (int fd,uint32_t vm,uint64_t offset, +uint64_t addr,uint64_t size);#endif /* XE_IOCTL_H */
tests/intel/xe_multi_gpusvm.c new file +297 -0
297 lines not on this page · raw message
tests/meson.build +1 -0
@@ -313,6 +313,7 @@ intel_xe_progs = [ 'xe_mmap', 'xe_module_load', 'xe_multisvm', + 'xe_multi_gpusvm', 'xe_noexec_ping_pong', 'xe_oa', 'xe_pat',
Signature · 1 line
2.48.1
Re: [PATCH i-g-t v5 1/8] tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU cross-GPU memory access test
Hi, Nishit,
Quoted 136 lines · On Tue, 2025-11-11 at 16:34 +0000, [email protected] wrote:
From: Nishit Sharma <[email protected]>
This test allocates a buffer in SVM, writes data to it from GPU 1, and reads/verifies
the data from GPU 2. Optionally, the CPU also reads or modifies the buffer and both
GPUs verify the results, ensuring correct cross-GPU and CPU memory access in a
multi-GPU environment.Signed-off-by Nishit Sharma <[email protected]>Acked-by Thomas Hellström <[email protected]>---
lib/xe/xe_ioctl.c | 39 +++++
lib/xe/xe_ioctl.h | 5 +
tests/intel/xe_multi_gpusvm.c | 297
++++++++++++++++++++++++++++++++++
tests/meson.build | 1 +4 files changed, 342 insertions(+)create mode 100644
tests/intel/xe_multi_gpusvm.clib/xe/xe_ioctl.c +0
-0@@ -746,3 +746,42 @@ void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t range, igt_assert_eq(__xe_vm_madvise(fd, vm, addr, range, ext, type, op_val, policy,instance), 0); }
lib/xe/xe_ioctl.c +3
-0+ +#define BIND_SYNC_VAL 0x686868 +void xe_vm_bind_lr_sync(int fd, uint32_t vm, uint32_t bo, uint64_toffset,
lib/xe/xe_ioctl.c +1
-0+ uint64_t addr, uint64_t size, uint32_tflags)
lib/xe/xe_ioctl.c +11
-0+{ +volatile uint64_t *sync_addr =malloc (sizeof (*sync_addr)); +struct drm_xe_sync sync = { + .flags =DRM_XE_SYNC_FLAG_SIGNAL , + .type =DRM_XE_SYNC_TYPE_USER_FENCE , + .addr =to_user_pointer ((uint64_t *)sync_addr), + .timeline_value =BIND_SYNC_VAL , + }; + +igt_assert (!!sync_addr); + xe_vm_bind_async_flags(fd, vm, 0, bo, 0, addr, size, &sync,1, flags);
lib/xe/xe_ioctl.c +2
-0+if (*sync_addr !=BIND_SYNC_VAL ) + xe_wait_ufence(fd, (uint64_t *)sync_addr,
BIND_SYNC_VAL, 0,NSEC_PER_SEC* 10);lib/xe/xe_ioctl.c +20
-0+/* Only free if the wait succeeds */ +free ((void *)sync_addr); +} + +void xe_vm_unbind_lr_sync (int fd,uint32_t vm,uint64_t offset, + uint64_t addr, uint64_t size) +{ +volatile uint64_t *sync_addr =malloc (sizeof (*sync_addr)); +struct drm_xe_sync sync = { + .flags =DRM_XE_SYNC_FLAG_SIGNAL , + .type =DRM_XE_SYNC_TYPE_USER_FENCE , + .addr =to_user_pointer ((uint64_t *)sync_addr), + .timeline_value =BIND_SYNC_VAL , + }; + +igt_assert (!!sync_addr); + *sync_addr =0 ; +xe_vm_unbind_async (fd, vm,0 ,0 , addr, size, &sync,1 ); +if (*sync_addr !=BIND_SYNC_VAL ) + xe_wait_ufence(fd, (uint64_t *)sync_addr,
BIND_SYNC_VAL, 0,NSEC_PER_SEC* 10);lib/xe/xe_ioctl.c +2
-0+free ((void *)sync_addr); +}lib/xe/xe_ioctl.h +0
-0@@ -109,4 +109,9 @@ int xe_vm_vma_attrs(int fd, struct drm_xe_vm_query_mem_range_attr *vmas_attr,struct
drm_xe_mem_range_attr*xe_vm_get_mem_attr_values_in_range(int fd,uint32_tvm,uint64_tstart,
uint64_trange,uint32_t*num_ranges);lib/xe/xe_ioctl.h +5
-0+void xe_vm_bind_lr_sync (int fd,uint32_t vm,uint32_t bo, +uint64_t offset,uint64_t addr, +uint64_t size,uint32_t flags); +void xe_vm_unbind_lr_sync (int fd,uint32_t vm,uint64_t offset, + uint64_t addr, uint64_t size);#endif /*
XE_IOCTL_H*/tests/intel/xe_multi_gpusvm.c new file +30
-0@@ -0,0 +1,297 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2023 Intel Corporation +*/ + +#include <unistd.h> + +#include "drmtest.h" +#include "igt.h" +#include "igt_multigpu.h" + +#include "intel_blt.h" +#include "intel_mocs.h" +#include "intel_reg.h" + +#include "xe/xe_ioctl.h" +#include "xe/xe_query.h" +#include "xe/xe_util.h" + +/** +* TEST: Basic multi-gpu SVM testing +* Category: SVM +* Mega feature: Compute +* Sub-category: Compute tests +* Functionality: SVM p2p access, madvise and prefetch. +* Test category: functionality test +* +* SUBTEST: cross-gpu-mem-access +* Description: +* This test creates two malloced regions, places the destination
+ * region both remotely and locally and copies to it. Reads back to
+ * system memory and checks the result.
+ *
+ */tests/intel/xe_multi_gpusvm.c new file +1
-0+
tests/intel/xe_multi_gpusvm.c line 45
Quoted 10 lines
tests/intel/xe_multi_gpusvm.c new file +10
-0+#define MAX_XE_REGIONS 8 +#define MAX_XE_GPUS 8 +#define NUM_LOOPS 1 +#define BATCH_SIZE (_fd) ALIGN(SZ_8K, xe_get_default_alignment(_fd)) +#define BIND_SYNC_VAL 0x686868 +#define EXEC_SYNC_VAL 0x676767 +#define COPY_SIZE SZ_64M + +struct xe_svm_gpu_info { + bool supports_faults;
Indentation looks weird.
Quoted 32 lines
tests/intel/xe_multi_gpusvm.c new file +16
-0+int vram_regions[MAX_XE_REGIONS ]; +unsigned int num_regions; +unsigned int va_bits; +int fd; +}; + +typedef void (*gpu_pair_fn ) ( +struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args +); + +static void for_each_gpu_pair (int num_gpus, + struct xe_svm_gpu_info *gpus, + struct drm_xe_engine_class_instance*eci,
tests/intel/xe_multi_gpusvm.c new file +6
-0+ gpu_pair_fn fn, + void *extra_args); + +static void gpu_mem_access_wrapper(struct xe_svm_gpu_info *src, + struct xe_svm_gpu_info *dst, + struct
drm_xe_engine_class_instance*eci,tests/intel/xe_multi_gpusvm.c new file +5
-0+ void *extra_args); + +static void open_pagemaps (int fd,struct xe_svm_gpu_info *info); + +static void for_each_gpu_pair(int num_gpus, struct xe_svm_gpu_info*gpus,
tests/intel/xe_multi_gpusvm.c new file +1
-0+ struct drm_xe_engine_class_instance*eci,
tests/intel/xe_multi_gpusvm.c line 80
Quoted 7 lines
tests/intel/xe_multi_gpusvm.c new file +7
-0+ gpu_pair_fn fn, void *extra_args) +{ +for (int src =0 ; src < num_gpus; src++) { +for (int dst =0 ; dst < num_gpus; dst++) { +if (src == dst) +continue ; +fn (&gpus[src], &gpus[dst], eci, extra_args);
There may be situations where the GPU itself isn't pagefault-capable, but its memory can still be used. In that case it can be used for remote memory but not for SVM vm creation. Could we add that capability as well? It's the supports_faults field in the xe_multisvm.c demo.
Quoted 128 lines
tests/intel/xe_multi_gpusvm.c new file +19
-0+ } + } +} + +static void batch_init (int fd,uint32_t vm,uint64_t src_addr, + uint64_t dst_addr, uint64_t copy_size, + uint32_t *bo, uint64_t *addr) +{ +uint32_t width = copy_size /256 ; +uint32_t height =1 ; +uint32_t batch_bo_size =BATCH_SIZE (fd); +uint32_t batch_bo; +uint64_t batch_addr; +void *batch; +uint32_t *cmd; +uint32_t mocs_index =intel_get_uc_mocs_index (fd); +int i =0 ; + + batch_bo = xe_bo_create(fd, vm, batch_bo_size,
vram_if_possible(fd, 0), 0);tests/intel/xe_multi_gpusvm.c new file +12
-0+ batch =xe_bo_map (fd, batch_bo, batch_bo_size); + cmd = (uint32_t *) batch; + cmd[i++] =MEM_COPY_CMD | (1 <<19 ); + cmd[i++] = width -1 ; + cmd[i++] = height -1 ; + cmd[i++] = width -1 ; + cmd[i++] = width -1 ; + cmd[i++] = src_addr & ((1UL <<32 ) -1 ); + cmd[i++] = src_addr >>32 ; + cmd[i++] = dst_addr & ((1UL <<32 ) -1 ); + cmd[i++] = dst_addr >>32 ; + cmd[i++] = mocs_index << XE2_MEM_COPY_MOCS_SHIFT |
mocs_index;tests/intel/xe_multi_gpusvm.c new file +6
-0+ cmd[i++] =MI_BATCH_BUFFER_END ; + cmd[i++] =MI_BATCH_BUFFER_END ; + + batch_addr =to_user_pointer (batch); +/* Punch a gap in the SVM map where we map the batch_bo */ + xe_vm_bind_lr_sync(fd, vm, batch_bo, 0, batch_addr,
batch_bo_size, 0);tests/intel/xe_multi_gpusvm.c new file +5
-0+ *bo = batch_bo; + *addr = batch_addr; +} + +static void batch_fini(int fd, uint32_t vm, uint32_t bo, uint64_taddr)
tests/intel/xe_multi_gpusvm.c new file +18
-0+{ + /* Unmap the batch bo by re-instating the SVM binding. */ + xe_vm_bind_lr_sync(fd, vm, 0, 0, addr, BATCH_SIZE(fd), + DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR); + gem_close(fd, bo); +} + + +static void open_pagemaps (int fd,struct xe_svm_gpu_info *info) +{ +unsigned int count =0 ; +uint64_t regions =all_memory_regions (fd); +uint32_t region; + +xe_for_each_mem_region (fd, regions, region) { +if (XE_IS_VRAM_MEMORY_REGION (fd, region)) { +struct drm_xe_mem_region *mem_region = + xe_mem_region(fd, 1ull << (region -1));
tests/intel/xe_multi_gpusvm.c new file +2
-0+igt_assert (count <MAX_XE_REGIONS ); + info->vram_regions[count++] = mem_region-Quoted 1 line
instance;
tests/intel/xe_multi_gpusvm.c new file +7
-0+ } + } + + info->num_regions = count; +} + +static int get_device_info(struct xe_svm_gpu_info gpus[], int
num_gpus)tests/intel/xe_multi_gpusvm.c new file +31
-0+{ +int cnt; +int xe; +int i; + +for (i =0 , cnt =0 && i <128 ; cnt < num_gpus; i++) { + xe =__drm_open_driver_another (i,DRIVER_XE ); +if (xe <0 ) +break ; + + gpus[cnt].fd = xe; + cnt++; + } + +return cnt; +} + +static void +copy_src_dst (struct xe_svm_gpu_info *gpu0, + struct xe_svm_gpu_info *gpu1, + struct drm_xe_engine_class_instance *eci) +{ +uint32_t vm[1 ]; +uint32_t exec_queue[2 ]; +uint32_t batch_bo; +void *copy_src, *copy_dst; +uint64_t batch_addr; +struct drm_xe_sync sync = {}; +volatile uint64_t *sync_addr; + + vm[0] = xe_vm_create(gpu0->fd, DRM_XE_VM_CREATE_FLAG_LR_MODE|
DRM_XE_VM_CREATE_FLAG_FAULT_MODE, 0);tests/intel/xe_multi_gpusvm.c new file +1
-0+ exec_queue[0] = xe_exec_queue_create(gpu0->fd, vm[0], eci,0);
tests/intel/xe_multi_gpusvm.c new file +1
-0+ xe_vm_bind_lr_sync(gpu0->fd, vm[0], 0, 0, 0, 1ull << gpu0-Quoted 1 line
va_bits,DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR);tests/intel/xe_multi_gpusvm.c new file +3
-0+ +/* Allocate source and destination buffers */ + copy_src = aligned_alloc(xe_get_default_alignment(gpu0->fd),
SZ_64M);tests/intel/xe_multi_gpusvm.c new file +2
-0+igt_assert (copy_src); + copy_dst = aligned_alloc(xe_get_default_alignment(gpu1->fd),
SZ_64M);tests/intel/xe_multi_gpusvm.c new file +4
-0+igt_assert (copy_dst); + +/* +* Initialize, map and bind the batch bo. Note that Xe doesn't seem to enjoy
tests/intel/xe_multi_gpusvm.c new file +3
-0+* batch buffer memory accessed over PCIe p2p. +*/ + batch_init(gpu0->fd, vm[0], to_user_pointer(copy_src),
to_user_pointer(copy_dst),
tests/intel/xe_multi_gpusvm.c line 195
Quoted 1 line
tests/intel/xe_multi_gpusvm.c new file +1
-0+ COPY_SIZE, &batch_bo, &batch_addr);
Indentation issue?
tests/intel/xe_multi_gpusvm.c line 204
Quoted 11 lines
tests/intel/xe_multi_gpusvm.c new file +6
-0+ +/* Fill the source with a pattern, clear the destination. */ +memset (copy_src,0x67 ,COPY_SIZE ); +memset (copy_dst,0x0 ,COPY_SIZE ); + +/* Place destination in an optionally remote location to test */
tests/intel/xe_multi_gpusvm.c new file +1
-0+ xe_vm_madvise(gpu0->fd, vm[0], to_user_pointer(copy_dst),
COPY_SIZE, 0,tests/intel/xe_multi_gpusvm.c new file +2
-0+ DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC, + gpu1->fd, 0, gpu1->vram_regions[0]);
Latest KMD reports -ENOLINK if there is no fast interconnect between gpu0 and gpu1. We should detect that and perhaps use local device memory or system instead.
tests/intel/xe_multi_gpusvm.c line 216
Quoted 13 lines
tests/intel/xe_multi_gpusvm.c new file +11
-0+ + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +/* Prefetch half of destination */ + xe_vm_prefetch_async(gpu0->fd, vm[0], 0, 0,
to_user_pointer(copy_dst),tests/intel/xe_multi_gpusvm.c new file +1
-0+ COPY_SIZE / 2, &sync, 1,
Probably want to prefetch the whole region?
tests/intel/xe_multi_gpusvm.c line 217
Quoted 1 line
tests/intel/xe_multi_gpusvm.c new file +1
-0+ DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC);
We discussed before having prefetch as a separate test so that we have a test flag whether to include prefetch or not.
Thanks,
Thomas
Quoted 100 lines
tests/intel/xe_multi_gpusvm.c new file +2
-0+if (*sync_addr !=BIND_SYNC_VAL ) + xe_wait_ufence(gpu0->fd, (uint64_t *)sync_addr,
BIND_SYNC_VAL, exec_queue[0],tests/intel/xe_multi_gpusvm.c new file +12
-0+ NSEC_PER_SEC * 10); +free ((void *)sync_addr); + + sync_addr = (void *)((char *)batch_addr +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute a GPU copy. */ +xe_exec_sync (gpu0->fd, exec_queue[0 ], batch_addr, &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) + xe_wait_ufence(gpu0->fd, (uint64_t *)sync_addr,
EXEC_SYNC_VAL, exec_queue[0],tests/intel/xe_multi_gpusvm.c new file +9
-0+ NSEC_PER_SEC * 10); + +igt_assert (memcmp (copy_src, copy_dst,COPY_SIZE ) ==0 ); + +free (copy_dst); +free (copy_src); +munmap ((void *)batch_addr,BATCH_SIZE (gpu0->fd)); +batch_fini (gpu0->fd, vm[0 ], batch_bo, batch_addr); + xe_vm_unbind_lr_sync(gpu0->fd, vm[0], 0, 0, 1ull << gpu0-Quoted 1 line
va_bits);tests/intel/xe_multi_gpusvm.c new file +36
-0+xe_exec_queue_destroy (gpu0->fd, exec_queue[0 ]); +xe_vm_destroy (gpu0->fd, vm[0 ]); +} + +static void +gpu_mem_access_wrapper (struct xe_svm_gpu_info *src, + struct xe_svm_gpu_info *dst, + struct drm_xe_engine_class_instance *eci, + void *extra_args) +{ +igt_assert (src); +igt_assert (dst); + +copy_src_dst (src, dst, eci); +} + +igt_main +{ +struct xe_svm_gpu_info gpus[MAX_XE_GPUS ]; +struct xe_device *xe; +int gpu, gpu_cnt; + +struct drm_xe_engine_class_instance eci = { + .engine_class = DRM_XE_ENGINE_CLASS_COPY, + }; + + igt_fixture { + gpu_cnt =get_device_info (gpus,ARRAY_SIZE (gpus)); +igt_skip_on (gpu_cnt <2 ); + +for (gpu =0 ; gpu < gpu_cnt; ++gpu) { +igt_assert (gpu <MAX_XE_GPUS ); + +open_pagemaps (gpus[gpu].fd, &gpus[gpu]); +/* NOTE! inverted return value. */ + gpus[gpu].supports_faults =!xe_supports_faults(gpus[gpu].fd);
tests/intel/xe_multi_gpusvm.c new file +1
-0+ fprintf(stderr, "GPU %u has %u VRAMregions%s, and %s SVM VMs.\n",
tests/intel/xe_multi_gpusvm.c new file +2
-0+ gpu, gpus[gpu].num_regions, + gpus[gpu].num_regions != 1 ? "s" :"",
tests/intel/xe_multi_gpusvm.c new file +1
-0+ gpus[gpu].supports_faults ?"supports" : "doesn't support");
tests/intel/xe_multi_gpusvm.c new file +9
-0+ + xe =xe_device_get (gpus[gpu].fd); + gpus[gpu].va_bits = xe->va_bits; + } + } + +igt_describe ("gpu-gpu write-read" ); +igt_subtest ("cross-gpu-mem-access" ) + for_each_gpu_pair(gpu_cnt, gpus, &eci,
gpu_mem_access_wrapper, NULL);tests/intel/xe_multi_gpusvm.c new file +8
-0+ + igt_fixture { +int cnt; + +for (cnt =0 ; cnt < gpu_cnt; cnt++) +drm_close_driver (gpus[cnt].fd); + } +}tests/meson.build +1
-0@@ -313,6 +313,7 @@ intel_xe_progs = [ 'xe_mmap', 'xe_module_load', 'xe_multisvm', + 'xe_multi_gpusvm', 'xe_noexec_ping_pong', 'xe_oa', 'xe_pat',
Re: [PATCH i-g-t v5 1/8] tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU cross-GPU memory access test
Quoted 441 lines · Thomas Hellström
Hi, Nishit,
Quoted 143 lines · On Tue, 2025-11-11 at 16:34 +0000, [email protected] wrote:
From: Nishit Sharma <[email protected]>
This test allocates a buffer in SVM, writes data to it from GPU 1, and reads/verifies
the data from GPU 2. Optionally, the CPU also reads or modifies the buffer and both
GPUs verify the results, ensuring correct cross-GPU and CPU memory access in a
multi-GPU environment.Signed-off-by Nishit Sharma <[email protected]>Acked-by Thomas Hellström <[email protected]>---
lib/xe/xe_ioctl.c | 39 +++++
lib/xe/xe_ioctl.h | 5 +
tests/intel/xe_multi_gpusvm.c | 297
++++++++++++++++++++++++++++++++++
tests/meson.build | 1 +4 files changed, 342 insertions(+)create mode 100644
tests/intel/xe_multi_gpusvm.clib/xe/xe_ioctl.c +0
-0@@ -746,3 +746,42 @@ void xe_vm_madvise(int fd, uint32_t vm,
uint64_t
addr,uint64_trange, igt_assert_eq(__xe_vm_madvise(fd, vm, addr, range, ext, type,op_val, policy,
instance), 0); }lib/xe/xe_ioctl.c +3
-0+ +#define BIND_SYNC_VAL 0x686868 +void xe_vm_bind_lr_sync(int fd, uint32_t vm, uint32_t bo, uint64_toffset,
lib/xe/xe_ioctl.c +1
-0+ uint64_t addr, uint64_t size, uint32_tflags)
lib/xe/xe_ioctl.c +11
-0+{ +volatile uint64_t *sync_addr =malloc (sizeof (*sync_addr)); +struct drm_xe_sync sync = { + .flags =DRM_XE_SYNC_FLAG_SIGNAL , + .type =DRM_XE_SYNC_TYPE_USER_FENCE , + .addr =to_user_pointer ((uint64_t *)sync_addr), + .timeline_value =BIND_SYNC_VAL , + }; + +igt_assert (!!sync_addr); + xe_vm_bind_async_flags(fd, vm, 0, bo, 0, addr, size,&sync,
1, flags);lib/xe/xe_ioctl.c +2
-0+if (*sync_addr !=BIND_SYNC_VAL ) + xe_wait_ufence(fd, (uint64_t *)sync_addr,
BIND_SYNC_VAL, 0,NSEC_PER_SEC* 10);lib/xe/xe_ioctl.c +20
-0+/* Only free if the wait succeeds */ +free ((void *)sync_addr); +} + +void xe_vm_unbind_lr_sync (int fd,uint32_t vm,uint64_t offset, + uint64_t addr, uint64_t size) +{ +volatile uint64_t *sync_addr =malloc (sizeof (*sync_addr)); +struct drm_xe_sync sync = { + .flags =DRM_XE_SYNC_FLAG_SIGNAL , + .type =DRM_XE_SYNC_TYPE_USER_FENCE , + .addr =to_user_pointer ((uint64_t *)sync_addr), + .timeline_value =BIND_SYNC_VAL , + }; + +igt_assert (!!sync_addr); + *sync_addr =0 ; +xe_vm_unbind_async (fd, vm,0 ,0 , addr, size, &sync,1 ); +if (*sync_addr !=BIND_SYNC_VAL ) + xe_wait_ufence(fd, (uint64_t *)sync_addr,
BIND_SYNC_VAL, 0,NSEC_PER_SEC* 10);lib/xe/xe_ioctl.c +2
-0+free ((void *)sync_addr); +}lib/xe/xe_ioctl.h +0
-0@@ -109,4 +109,9 @@ int xe_vm_vma_attrs(int fd, struct drm_xe_vm_query_mem_range_attr *vmas_attr,struct
drm_xe_mem_range_attr*xe_vm_get_mem_attr_values_in_range(int fd,uint32_tvm,uint64_tstart,
uint64_trange,uint32_t*num_ranges);lib/xe/xe_ioctl.h +5
-0+void xe_vm_bind_lr_sync (int fd,uint32_t vm,uint32_t bo, +uint64_t offset,uint64_t addr, +uint64_t size,uint32_t flags); +void xe_vm_unbind_lr_sync (int fd,uint32_t vm,uint64_t offset, + uint64_t addr, uint64_t size);#endif /*
XE_IOCTL_H*/tests/intel/xe_multi_gpusvm.c new file +30
-0@@ -0,0 +1,297 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2023 Intel Corporation +*/ + +#include <unistd.h> + +#include "drmtest.h" +#include "igt.h" +#include "igt_multigpu.h" + +#include "intel_blt.h" +#include "intel_mocs.h" +#include "intel_reg.h" + +#include "xe/xe_ioctl.h" +#include "xe/xe_query.h" +#include "xe/xe_util.h" + +/** +* TEST: Basic multi-gpu SVM testing +* Category: SVM +* Mega feature: Compute +* Sub-category: Compute tests +* Functionality: SVM p2p access, madvise and prefetch. +* Test category: functionality test +* +* SUBTEST: cross-gpu-mem-access +* Description: +* This test creates two malloced regions, places the destination
+ * region both remotely and locally and copies to it. Reads back to
+ * system memory and checks the result.
+ *
+ */tests/intel/xe_multi_gpusvm.c new file +5
-0+ +#define MAX_XE_REGIONS 8 +#define MAX_XE_GPUS 8 +#define NUM_LOOPS 1 +#define BATCH_SIZE (_fd) ALIGN(SZ_8K,
xe_get_default_alignment(_fd))tests/intel/xe_multi_gpusvm.c line 45
Quoted 6 lines
tests/intel/xe_multi_gpusvm.c new file +6
-0+#define BIND_SYNC_VAL 0x686868 +#define EXEC_SYNC_VAL 0x676767 +#define COPY_SIZE SZ_64M + +struct xe_svm_gpu_info { + bool supports_faults;Indentation looks weird.
Quoted 39 lines
tests/intel/xe_multi_gpusvm.c new file +16
-0+int vram_regions[MAX_XE_REGIONS ]; +unsigned int num_regions; +unsigned int va_bits; +int fd; +}; + +typedef void (*gpu_pair_fn ) ( +struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args +); + +static void for_each_gpu_pair (int num_gpus, + struct xe_svm_gpu_info *gpus, + struct drm_xe_engine_class_instance*eci,
tests/intel/xe_multi_gpusvm.c new file +6
-0+ gpu_pair_fn fn, + void *extra_args); + +static void gpu_mem_access_wrapper(struct xe_svm_gpu_info *src, + struct xe_svm_gpu_info *dst, + struct
drm_xe_engine_class_instance*eci,tests/intel/xe_multi_gpusvm.c new file +5
-0+ void *extra_args); + +static void open_pagemaps (int fd,struct xe_svm_gpu_info *info); + +static void for_each_gpu_pair(int num_gpus, struct xe_svm_gpu_info*gpus,
tests/intel/xe_multi_gpusvm.c new file +1
-0+ struct drm_xe_engine_class_instance*eci,
tests/intel/xe_multi_gpusvm.c new file +7
-0+ gpu_pair_fn fn, void *extra_args) +{ +for (int src =0 ; src < num_gpus; src++) { +for (int dst =0 ; dst < num_gpus; dst++) { +if (src == dst) +continue ; + fn(&gpus[src], &gpus[dst], eci,Quoted 1 line
extra_args);There may be situations where the GPU itself isn't pagefault-capable, but its memory can still be used. In that case it can be used for remote memory but not for SVM vm creation. Could we add that capability
as well? It's thesupports_faultsfield in thexe_multisvm.cdemo.Quoted 133 lines
tests/intel/xe_multi_gpusvm.c new file +19
-0+ } + } +} + +static void batch_init (int fd,uint32_t vm,uint64_t src_addr, + uint64_t dst_addr, uint64_t copy_size, + uint32_t *bo, uint64_t *addr) +{ +uint32_t width = copy_size /256 ; +uint32_t height =1 ; +uint32_t batch_bo_size =BATCH_SIZE (fd); +uint32_t batch_bo; +uint64_t batch_addr; +void *batch; +uint32_t *cmd; +uint32_t mocs_index =intel_get_uc_mocs_index (fd); +int i =0 ; + + batch_bo = xe_bo_create(fd, vm, batch_bo_size,
vram_if_possible(fd, 0), 0);tests/intel/xe_multi_gpusvm.c new file +12
-0+ batch =xe_bo_map (fd, batch_bo, batch_bo_size); + cmd = (uint32_t *) batch; + cmd[i++] =MEM_COPY_CMD | (1 <<19 ); + cmd[i++] = width -1 ; + cmd[i++] = height -1 ; + cmd[i++] = width -1 ; + cmd[i++] = width -1 ; + cmd[i++] = src_addr & ((1UL <<32 ) -1 ); + cmd[i++] = src_addr >>32 ; + cmd[i++] = dst_addr & ((1UL <<32 ) -1 ); + cmd[i++] = dst_addr >>32 ; + cmd[i++] = mocs_index << XE2_MEM_COPY_MOCS_SHIFT |
mocs_index;tests/intel/xe_multi_gpusvm.c new file +6
-0+ cmd[i++] =MI_BATCH_BUFFER_END ; + cmd[i++] =MI_BATCH_BUFFER_END ; + + batch_addr =to_user_pointer (batch); +/* Punch a gap in the SVM map where we map the batch_bo */ + xe_vm_bind_lr_sync(fd, vm, batch_bo, 0, batch_addr,
batch_bo_size, 0);tests/intel/xe_multi_gpusvm.c new file +5
-0+ *bo = batch_bo; + *addr = batch_addr; +} + +static void batch_fini(int fd, uint32_t vm, uint32_t bo, uint64_taddr)
tests/intel/xe_multi_gpusvm.c new file +18
-1+{ + /* Unmap the batch bo by re-instating the SVM binding. */ + xe_vm_bind_lr_sync(fd, vm, 0, 0, addr, BATCH_SIZE(fd), + DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR); + gem_close(fd, bo); +} + + +static void open_pagemaps (int fd,struct xe_svm_gpu_info *info) +{ +unsigned int count =0 ; +uint64_t regions =all_memory_regions (fd); +uint32_t region; + +xe_for_each_mem_region (fd, regions, region) { +if (XE_IS_VRAM_MEMORY_REGION (fd, region)) { +struct drm_xe_mem_region *mem_region = + xe_mem_region(fd, 1ull << (region -1));
tests/intel/xe_multi_gpusvm.c new file +2
-0+igt_assert (count <MAX_XE_REGIONS ); + info->vram_regions[count++] = mem_region-Quoted 1 line
instance;
tests/intel/xe_multi_gpusvm.c new file +7
-0+ } + } + + info->num_regions = count; +} + +static int get_device_info(struct xe_svm_gpu_info gpus[], int
num_gpus)tests/intel/xe_multi_gpusvm.c new file +31
-0+{ +int cnt; +int xe; +int i; + +for (i =0 , cnt =0 && i <128 ; cnt < num_gpus; i++) { + xe =__drm_open_driver_another (i,DRIVER_XE ); +if (xe <0 ) +break ; + + gpus[cnt].fd = xe; + cnt++; + } + +return cnt; +} + +static void +copy_src_dst (struct xe_svm_gpu_info *gpu0, + struct xe_svm_gpu_info *gpu1, + struct drm_xe_engine_class_instance *eci) +{ +uint32_t vm[1 ]; +uint32_t exec_queue[2 ]; +uint32_t batch_bo; +void *copy_src, *copy_dst; +uint64_t batch_addr; +struct drm_xe_sync sync = {}; +volatile uint64_t *sync_addr; + + vm[0] = xe_vm_create(gpu0->fd,
DRM_XE_VM_CREATE_FLAG_LR_MODEQuoted 1 line
DRM_XE_VM_CREATE_FLAG_FAULT_MODE, 0);tests/intel/xe_multi_gpusvm.c new file +1
-0+ exec_queue[0] = xe_exec_queue_create(gpu0->fd, vm[0], eci,0);
tests/intel/xe_multi_gpusvm.c new file +1
-0+ xe_vm_bind_lr_sync(gpu0->fd, vm[0], 0, 0, 0, 1ull <<gpu0-
Quoted 1 line
va_bits,DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR);tests/intel/xe_multi_gpusvm.c new file +3
-0+ +/* Allocate source and destination buffers */ + copy_src = aligned_alloc(xe_get_default_alignment(gpu0-Quoted 1 line
fd),
SZ_64M);tests/intel/xe_multi_gpusvm.c new file +2
-0+igt_assert (copy_src); + copy_dst = aligned_alloc(xe_get_default_alignment(gpu1-Quoted 1 line
fd),
SZ_64M);tests/intel/xe_multi_gpusvm.c new file +4
-0+igt_assert (copy_dst); + +/* +* Initialize, map and bind the batch bo. Note that Xe doesn't seem to enjoy
tests/intel/xe_multi_gpusvm.c new file +3
-0+* batch buffer memory accessed over PCIe p2p. +*/ + batch_init(gpu0->fd, vm[0], to_user_pointer(copy_src),
to_user_pointer(copy_dst),tests/intel/xe_multi_gpusvm.c line 195
Quoted 1 line
tests/intel/xe_multi_gpusvm.c new file +1
-0+ COPY_SIZE, &batch_bo, &batch_addr);Indentation issue?
tests/intel/xe_multi_gpusvm.c line 204
Quoted 12 lines
tests/intel/xe_multi_gpusvm.c new file +2
-0+ +/* Fill the source with a pattern, clear the destination. */
tests/intel/xe_multi_gpusvm.c new file +4
-0+memset (copy_src,0x67 ,COPY_SIZE ); +memset (copy_dst,0x0 ,COPY_SIZE ); + +/* Place destination in an optionally remote location to test */
tests/intel/xe_multi_gpusvm.c new file +1
-0+ xe_vm_madvise(gpu0->fd, vm[0], to_user_pointer(copy_dst),
COPY_SIZE, 0,tests/intel/xe_multi_gpusvm.c new file +2
-0+ DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC, + gpu1->fd, 0, gpu1->vram_regions[0]);Latest KMD reports
-ENOLINKif there is no fast interconnect between gpu0 and gpu1. We should detect that and perhaps use local device memory or system instead.tests/intel/xe_multi_gpusvm.c line 216
Quoted 13 lines
tests/intel/xe_multi_gpusvm.c new file +11
-0+ + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +/* Prefetch half of destination */ + xe_vm_prefetch_async(gpu0->fd, vm[0], 0, 0,
to_user_pointer(copy_dst),tests/intel/xe_multi_gpusvm.c new file +1
-0+ COPY_SIZE / 2, &sync, 1,Probably want to prefetch the whole region?
tests/intel/xe_multi_gpusvm.c line 217
Quoted 1 line
tests/intel/xe_multi_gpusvm.c new file +1
-0+ DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC);We discussed before having prefetch as a separate test so that we have
a test flag whether to include prefetch or not.Thanks,
ThomasQuoted 58 lines
tests/intel/xe_multi_gpusvm.c new file +2
-0+if (*sync_addr !=BIND_SYNC_VAL ) + xe_wait_ufence(gpu0->fd, (uint64_t *)sync_addr,
BIND_SYNC_VAL, exec_queue[0],tests/intel/xe_multi_gpusvm.c new file +10
-0+ NSEC_PER_SEC * 10); +free ((void *)sync_addr); + + sync_addr = (void *)((char *)batch_addr +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute a GPU copy. */ + xe_exec_sync(gpu0->fd, exec_queue[0], batch_addr, &sync,1);
tests/intel/xe_multi_gpusvm.c new file +2
-0+if (*sync_addr !=EXEC_SYNC_VAL ) + xe_wait_ufence(gpu0->fd, (uint64_t *)sync_addr,
EXEC_SYNC_VAL, exec_queue[0],tests/intel/xe_multi_gpusvm.c new file +9
-0+ NSEC_PER_SEC * 10); + +igt_assert (memcmp (copy_src, copy_dst,COPY_SIZE ) ==0 ); + +free (copy_dst); +free (copy_src); +munmap ((void *)batch_addr,BATCH_SIZE (gpu0->fd)); +batch_fini (gpu0->fd, vm[0 ], batch_bo, batch_addr); + xe_vm_unbind_lr_sync(gpu0->fd, vm[0], 0, 0, 1ull << gpu0-Quoted 1 line
va_bits);tests/intel/xe_multi_gpusvm.c new file +31
-0+xe_exec_queue_destroy (gpu0->fd, exec_queue[0 ]); +xe_vm_destroy (gpu0->fd, vm[0 ]); +} + +static void +gpu_mem_access_wrapper (struct xe_svm_gpu_info *src, + struct xe_svm_gpu_info *dst, + struct drm_xe_engine_class_instance *eci, + void *extra_args) +{ +igt_assert (src); +igt_assert (dst); + +copy_src_dst (src, dst, eci); +} + +igt_main +{ +struct xe_svm_gpu_info gpus[MAX_XE_GPUS ]; +struct xe_device *xe; +int gpu, gpu_cnt; + +struct drm_xe_engine_class_instance eci = { + .engine_class = DRM_XE_ENGINE_CLASS_COPY, + }; + + igt_fixture { + gpu_cnt =get_device_info (gpus,ARRAY_SIZE (gpus)); +igt_skip_on (gpu_cnt <2 ); + +for (gpu =0 ; gpu < gpu_cnt; ++gpu) {
Quoted 8 lines
Quoted 8 lines
tests/intel/xe_multi_gpusvm.c new file +5
-0+igt_assert (gpu <MAX_XE_GPUS ); + +open_pagemaps (gpus[gpu].fd, &gpus[gpu]); +/* NOTE! inverted return value. */ + gpus[gpu].supports_faults =!xe_supports_faults(gpus[gpu].fd);
tests/intel/xe_multi_gpusvm.c new file +1
-0+ fprintf(stderr, "GPU %u has %u VRAMregions%s, and %s SVM VMs.\n",
Oh, and replace the fprintf's with igt_info()?
/Thomas
Re: [PATCH i-g-t v5 1/8] tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU cross-GPU memory access test
In reply to [email protected]Hi nishit.sharma,
Quoted 7 lines · On 2025-11-11 at 16:34:49 +0000, [email protected] wrote:
From: Nishit Sharma <[email protected]>
This test allocates a buffer in SVM, writes data to it from GPU 1, and reads/verifies the data from GPU 2. Optionally, the CPU also reads or modifies the buffer and both GPUs verify the results, ensuring correct cross-GPU and CPU memory access in a multi-GPU environment.
Quoted 6 lines
Signed-off-by Nishit Sharma <[email protected]>Acked-by Thomas Hellström <[email protected]>--- lib/xe/xe_ioctl.c | 39 +++++ lib/xe/xe_ioctl.h | 5 + tests/intel/xe_multi_gpusvm.c | 297 ++++++++++++++++++++++++++++++++++
Could you rename this into xe_multigpu_svm? imho 'gpusvm' looks weird.
Also why not nameing it xe_svm with multigpu tests as sub-cases?
Regards,
Kamil
Quoted 383 lines
tests/meson.build | 1 + 4 files changed, 342 insertions(+) create mode 100644 tests/intel/xe_multi_gpusvm.clib/xe/xe_ioctl.c +39
-0@@ -746,3 +746,42 @@ void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t range,igt_assert_eq (__xe_vm_madvise (fd, vm, addr, range, ext, type, op_val, policy, instance),0 ); } + +#define BIND_SYNC_VAL 0x686868 +void xe_vm_bind_lr_sync (int fd,uint32_t vm,uint32_t bo,uint64_t offset, +uint64_t addr,uint64_t size,uint32_t flags) +{ +volatile uint64_t *sync_addr =malloc (sizeof (*sync_addr)); +struct drm_xe_sync sync = { + .flags =DRM_XE_SYNC_FLAG_SIGNAL , + .type =DRM_XE_SYNC_TYPE_USER_FENCE , + .addr =to_user_pointer ((uint64_t *)sync_addr), + .timeline_value =BIND_SYNC_VAL , + }; + +igt_assert (!!sync_addr); +xe_vm_bind_async_flags (fd, vm,0 , bo,0 , addr, size, &sync,1 , flags); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (fd, (uint64_t *)sync_addr,BIND_SYNC_VAL ,0 ,NSEC_PER_SEC *10 ); +/* Only free if the wait succeeds */ +free ((void *)sync_addr); +} + +void xe_vm_unbind_lr_sync (int fd,uint32_t vm,uint64_t offset, +uint64_t addr,uint64_t size) +{ +volatile uint64_t *sync_addr =malloc (sizeof (*sync_addr)); +struct drm_xe_sync sync = { + .flags =DRM_XE_SYNC_FLAG_SIGNAL , + .type =DRM_XE_SYNC_TYPE_USER_FENCE , + .addr =to_user_pointer ((uint64_t *)sync_addr), + .timeline_value =BIND_SYNC_VAL , + }; + +igt_assert (!!sync_addr); + *sync_addr =0 ; +xe_vm_unbind_async (fd, vm,0 ,0 , addr, size, &sync,1 ); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (fd, (uint64_t *)sync_addr,BIND_SYNC_VAL ,0 ,NSEC_PER_SEC *10 ); +free ((void *)sync_addr); +}lib/xe/xe_ioctl.h +5
-0@@ -109,4 +109,9 @@ int xe_vm_vma_attrs(int fd, struct drm_xe_vm_query_mem_range_attr *vmas_attr,struct drm_xe_mem_range_attr *xe_vm_get_mem_attr_values_in_range (int fd,uint32_t vm,uint64_t start,uint64_t range,uint32_t *num_ranges); +void xe_vm_bind_lr_sync (int fd,uint32_t vm,uint32_t bo, +uint64_t offset,uint64_t addr, +uint64_t size,uint32_t flags); +void xe_vm_unbind_lr_sync (int fd,uint32_t vm,uint64_t offset, +uint64_t addr,uint64_t size);#endif /* XE_IOCTL_H */ tests/intel/xe_multi_gpusvm.c new file +297
-0@@ -0,0 +1,297 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2023 Intel Corporation +*/ + +#include <unistd.h> + +#include "drmtest.h" +#include "igt.h" +#include "igt_multigpu.h" + +#include "intel_blt.h" +#include "intel_mocs.h" +#include "intel_reg.h" + +#include "xe/xe_ioctl.h" +#include "xe/xe_query.h" +#include "xe/xe_util.h" + +/** +* TEST: Basic multi-gpu SVM testing +* Category: SVM +* Mega feature: Compute +* Sub-category: Compute tests +* Functionality: SVM p2p access, madvise and prefetch. +* Test category: functionality test +* +* SUBTEST: cross-gpu-mem-access +* Description: +* This test creates two malloced regions, places the destination +* region both remotely and locally and copies to it. Reads back to +* system memory and checks the result. +* +*/ + +#define MAX_XE_REGIONS 8 +#define MAX_XE_GPUS 8 +#define NUM_LOOPS 1 +#define BATCH_SIZE (_fd) ALIGN(SZ_8K, xe_get_default_alignment(_fd)) +#define BIND_SYNC_VAL 0x686868 +#define EXEC_SYNC_VAL 0x676767 +#define COPY_SIZE SZ_64M + +struct xe_svm_gpu_info { +bool supports_faults; +int vram_regions[MAX_XE_REGIONS ]; +unsigned int num_regions; +unsigned int va_bits; +int fd; +}; + +typedef void (*gpu_pair_fn ) ( +struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args +); + +static void for_each_gpu_pair (int num_gpus, +struct xe_svm_gpu_info *gpus, +struct drm_xe_engine_class_instance *eci, +gpu_pair_fn fn, +void *extra_args); + +static void gpu_mem_access_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args); + +static void open_pagemaps (int fd,struct xe_svm_gpu_info *info); + +static void for_each_gpu_pair (int num_gpus,struct xe_svm_gpu_info *gpus, +struct drm_xe_engine_class_instance *eci, +gpu_pair_fn fn,void *extra_args) +{ +for (int src =0 ; src < num_gpus; src++) { +for (int dst =0 ; dst < num_gpus; dst++) { +if (src == dst) +continue ; +fn (&gpus[src], &gpus[dst], eci, extra_args); + } + } +} + +static void batch_init (int fd,uint32_t vm,uint64_t src_addr, +uint64_t dst_addr,uint64_t copy_size, +uint32_t *bo,uint64_t *addr) +{ +uint32_t width = copy_size /256 ; +uint32_t height =1 ; +uint32_t batch_bo_size =BATCH_SIZE (fd); +uint32_t batch_bo; +uint64_t batch_addr; +void *batch; +uint32_t *cmd; +uint32_t mocs_index =intel_get_uc_mocs_index (fd); +int i =0 ; + + batch_bo =xe_bo_create (fd, vm, batch_bo_size,vram_if_possible (fd,0 ),0 ); + batch =xe_bo_map (fd, batch_bo, batch_bo_size); + cmd = (uint32_t *) batch; + cmd[i++] =MEM_COPY_CMD | (1 <<19 ); + cmd[i++] = width -1 ; + cmd[i++] = height -1 ; + cmd[i++] = width -1 ; + cmd[i++] = width -1 ; + cmd[i++] = src_addr & ((1UL <<32 ) -1 ); + cmd[i++] = src_addr >>32 ; + cmd[i++] = dst_addr & ((1UL <<32 ) -1 ); + cmd[i++] = dst_addr >>32 ; + cmd[i++] = mocs_index <<XE2_MEM_COPY_MOCS_SHIFT | mocs_index; + cmd[i++] =MI_BATCH_BUFFER_END ; + cmd[i++] =MI_BATCH_BUFFER_END ; + + batch_addr =to_user_pointer (batch); +/* Punch a gap in the SVM map where we map the batch_bo */ +xe_vm_bind_lr_sync (fd, vm, batch_bo,0 , batch_addr, batch_bo_size,0 ); + *bo = batch_bo; + *addr = batch_addr; +} + +static void batch_fini (int fd,uint32_t vm,uint32_t bo,uint64_t addr) +{ +/* Unmap the batch bo by re-instating the SVM binding. */ +xe_vm_bind_lr_sync (fd, vm,0 ,0 , addr,BATCH_SIZE (fd), +DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); +gem_close (fd, bo); +} + + +static void open_pagemaps (int fd,struct xe_svm_gpu_info *info) +{ +unsigned int count =0 ; +uint64_t regions =all_memory_regions (fd); +uint32_t region; + +xe_for_each_mem_region (fd, regions, region) { +if (XE_IS_VRAM_MEMORY_REGION (fd, region)) { +struct drm_xe_mem_region *mem_region = +xe_mem_region (fd,1ull << (region -1 )); +igt_assert (count <MAX_XE_REGIONS ); + info->vram_regions[count++] = mem_region->instance; + } + } + + info->num_regions = count; +} + +static int get_device_info (struct xe_svm_gpu_info gpus[],int num_gpus) +{ +int cnt; +int xe; +int i; + +for (i =0 , cnt =0 && i <128 ; cnt < num_gpus; i++) { + xe =__drm_open_driver_another (i,DRIVER_XE ); +if (xe <0 ) +break ; + + gpus[cnt].fd = xe; + cnt++; + } + +return cnt; +} + +static void +copy_src_dst (struct xe_svm_gpu_info *gpu0, +struct xe_svm_gpu_info *gpu1, +struct drm_xe_engine_class_instance *eci) +{ +uint32_t vm[1 ]; +uint32_t exec_queue[2 ]; +uint32_t batch_bo; +void *copy_src, *copy_dst; +uint64_t batch_addr; +struct drm_xe_sync sync = {}; +volatile uint64_t *sync_addr; + + vm[0 ] =xe_vm_create (gpu0->fd,DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[0 ] =xe_exec_queue_create (gpu0->fd, vm[0 ], eci,0 ); +xe_vm_bind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,0 ,1ull << gpu0->va_bits,DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + +/* Allocate source and destination buffers */ + copy_src =aligned_alloc (xe_get_default_alignment (gpu0->fd),SZ_64M ); +igt_assert (copy_src); + copy_dst =aligned_alloc (xe_get_default_alignment (gpu1->fd),SZ_64M ); +igt_assert (copy_dst); + +/* +* Initialize, map and bind the batch bo. Note that Xe doesn't seem to enjoy +* batch buffer memory accessed over PCIe p2p. +*/ +batch_init (gpu0->fd, vm[0 ],to_user_pointer (copy_src),to_user_pointer (copy_dst), +COPY_SIZE , &batch_bo, &batch_addr); + +/* Fill the source with a pattern, clear the destination. */ +memset (copy_src,0x67 ,COPY_SIZE ); +memset (copy_dst,0x0 ,COPY_SIZE ); + +/* Place destination in an optionally remote location to test */ +xe_vm_madvise (gpu0->fd, vm[0 ],to_user_pointer (copy_dst),COPY_SIZE ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu1->fd,0 , gpu1->vram_regions[0 ]); + + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +/* Prefetch half of destination */ +xe_vm_prefetch_async (gpu0->fd, vm[0 ],0 ,0 ,to_user_pointer (copy_dst), +COPY_SIZE /2 , &sync,1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,BIND_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); +free ((void *)sync_addr); + + sync_addr = (void *)((char *)batch_addr +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute a GPU copy. */ +xe_exec_sync (gpu0->fd, exec_queue[0 ], batch_addr, &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); + +igt_assert (memcmp (copy_src, copy_dst,COPY_SIZE ) ==0 ); + +free (copy_dst); +free (copy_src); +munmap ((void *)batch_addr,BATCH_SIZE (gpu0->fd)); +batch_fini (gpu0->fd, vm[0 ], batch_bo, batch_addr); +xe_vm_unbind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,1ull << gpu0->va_bits); +xe_exec_queue_destroy (gpu0->fd, exec_queue[0 ]); +xe_vm_destroy (gpu0->fd, vm[0 ]); +} + +static void +gpu_mem_access_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args) +{ +igt_assert (src); +igt_assert (dst); + +copy_src_dst (src, dst, eci); +} + +igt_main +{ +struct xe_svm_gpu_info gpus[MAX_XE_GPUS ]; +struct xe_device *xe; +int gpu, gpu_cnt; + +struct drm_xe_engine_class_instance eci = { + .engine_class =DRM_XE_ENGINE_CLASS_COPY , + }; + + igt_fixture { + gpu_cnt =get_device_info (gpus,ARRAY_SIZE (gpus)); +igt_skip_on (gpu_cnt <2 ); + +for (gpu =0 ; gpu < gpu_cnt; ++gpu) { +igt_assert (gpu <MAX_XE_GPUS ); + +open_pagemaps (gpus[gpu].fd, &gpus[gpu]); +/* NOTE! inverted return value. */ + gpus[gpu].supports_faults = !xe_supports_faults (gpus[gpu].fd); +fprintf (stderr,"GPU %u has %u VRAM regions%s, and %s SVM VMs.\n" , + gpu, gpus[gpu].num_regions, + gpus[gpu].num_regions !=1 ?"s" :"" , + gpus[gpu].supports_faults ?"supports" :"doesn't support" ); + + xe =xe_device_get (gpus[gpu].fd); + gpus[gpu].va_bits = xe->va_bits; + } + } + +igt_describe ("gpu-gpu write-read" ); +igt_subtest ("cross-gpu-mem-access" ) + for_each_gpu_pair(gpu_cnt, gpus, &eci, gpu_mem_access_wrapper, NULL); + + igt_fixture { +int cnt; + +for (cnt =0 ; cnt < gpu_cnt; cnt++) +drm_close_driver (gpus[cnt].fd); + } +}tests/meson.build +1
-0@@ -313,6 +313,7 @@ intel_xe_progs = [ 'xe_mmap', 'xe_module_load', 'xe_multisvm', + 'xe_multi_gpusvm', 'xe_noexec_ping_pong', 'xe_oa', 'xe_pat',Signature · 1 line
2.48.1
PATCH v5 2/8 tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU atomic operations
In reply to [email protected]From: Nishit Sharma <[email protected]>
This test performs atomic increment operation on a shared SVM buffer from both GPUs and the CPU in a multi-GPU environment. It uses madvise and prefetch to control buffer placement and verifies correctness and ordering of atomic updates across agents.
--- tests/intel/xe_multi_gpusvm.c | 202 +++++++++++++++++++++++++++++++++- 1 file changed, 201 insertions(+), 1 deletion(-)
tests/intel/xe_multi_gpusvm.c +201 -1
@@ -31,6 +31,11 @@* region both remotely and locally and copies to it. Reads back to * system memory and checks the result. * +* SUBTEST: atomic-inc-gpu-op +* Description: +* This test does atomic operation in multi-gpu by executing atomic +* operation on GPU1 and then atomic operation on GPU2 using same +* adress */ #define MAX_XE_REGIONS 8
@@ -40,6 +45,7 @@#define BIND_SYNC_VAL 0x686868#define EXEC_SYNC_VAL 0x676767#define COPY_SIZE SZ_64M +#define ATOMIC_OP_VAL 56struct xe_svm_gpu_info {bool supports_faults;
@@ -49,6 +55,21 @@ struct xe_svm_gpu_info {int fd; }; +struct test_exec_data { +uint32_t batch[32 ]; +uint64_t pad; +uint64_t vm_sync; +uint64_t exec_sync; +uint32_t data; +uint32_t expected_data; +uint64_t batch_addr; +}; + +struct multigpu_ops_args { +bool prefetch_req; +bool op_mod; +}; + typedef void (*gpu_pair_fn) ( struct xe_svm_gpu_info *src, struct xe_svm_gpu_info *dst,
@@ -67,7 +88,10 @@ static void gpu_mem_access_wrapper(struct xe_svm_gpu_info *src,struct drm_xe_engine_class_instance *eci, void *extra_args); -static void open_pagemaps (int fd,struct xe_svm_gpu_info *info); +static void gpu_atomic_inc_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args); static void for_each_gpu_pair(int num_gpus, struct xe_svm_gpu_info *gpus, struct drm_xe_engine_class_instance *eci,
@@ -82,6 +106,35 @@ static void for_each_gpu_pair(int num_gpus, struct xe_svm_gpu_info *gpus, } } +static void open_pagemaps (int fd,struct xe_svm_gpu_info *info); + +static void +atomic_batch_init (int fd,uint32_t vm,uint64_t src_addr, +uint32_t *bo,uint64_t *addr) +{ +uint32_t batch_bo_size =BATCH_SIZE (fd); +uint32_t batch_bo; +uint64_t batch_addr; +void *batch; +uint32_t *cmd; +int i =0 ; + + batch_bo =xe_bo_create (fd, vm, batch_bo_size,vram_if_possible (fd,0 ),0 ); + batch =xe_bo_map (fd, batch_bo, batch_bo_size); + cmd = (uint32_t *)batch; + + cmd[i++] =MI_ATOMIC |MI_ATOMIC_INC ; + cmd[i++] = src_addr; + cmd[i++] = src_addr >>32 ; + cmd[i++] =MI_BATCH_BUFFER_END ; + + batch_addr =to_user_pointer (batch); +/* Punch a gap in the SVM map where we map the batch_bo */ +xe_vm_bind_lr_sync (fd, vm, batch_bo,0 , batch_addr, batch_bo_size,0 ); + *bo = batch_bo; + *addr = batch_addr; +} +static void batch_init (int fd,uint32_t vm,uint64_t src_addr,uint64_t dst_addr,uint64_t copy_size,uint32_t *bo,uint64_t *addr)
@@ -254,6 +307,145 @@ gpu_mem_access_wrapper(struct xe_svm_gpu_info *src,copy_src_dst (src, dst, eci); } +static void +atomic_inc_op (struct xe_svm_gpu_info *gpu0, +struct xe_svm_gpu_info *gpu1, +struct drm_xe_engine_class_instance *eci, +bool prefetch_req) +{ +uint64_t addr; +uint32_t vm[2 ]; +uint32_t exec_queue[2 ]; +uint32_t batch_bo; +struct test_exec_data *data; +uint64_t batch_addr; +struct drm_xe_sync sync = {}; +volatile uint64_t *sync_addr; +volatile uint32_t *shared_val; + + vm[0 ] =xe_vm_create (gpu0->fd,DRM_XE_VM_CREATE_FLAG_LR_MODE | +DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[0 ] =xe_exec_queue_create (gpu0->fd, vm[0 ], eci,0 ); +xe_vm_bind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,0 ,1ull << gpu0->va_bits, +DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + vm[1 ] =xe_vm_create (gpu1->fd,DRM_XE_VM_CREATE_FLAG_LR_MODE | +DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[1 ] =xe_exec_queue_create (gpu1->fd, vm[1 ], eci,0 ); +xe_vm_bind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,0 ,1ull << gpu1->va_bits, +DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + data =aligned_alloc (SZ_2M ,SZ_4K ); +igt_assert (data); + data[0 ].vm_sync =0 ; + addr =to_user_pointer (data); + + shared_val = (volatile uint32_t *)addr; + *shared_val =ATOMIC_OP_VAL -1 ; + +atomic_batch_init (gpu0->fd, vm[0 ], addr, &batch_bo, &batch_addr); + +/* Place destination in an optionally remote location to test */ +xe_vm_madvise (gpu0->fd, vm[0 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu0->fd,0 , gpu0->vram_regions[0 ]); + + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +if (prefetch_req) { +xe_vm_prefetch_async (gpu0->fd, vm[0 ],0 ,0 , addr, +SZ_4K , &sync,1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,BIND_SYNC_VAL , + exec_queue[0 ],NSEC_PER_SEC *10 ); + } +free ((void *)sync_addr); + + sync_addr = (void *)((char *)batch_addr +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Executing ATOMIC_INC on GPU0. */ +xe_exec_sync (gpu0->fd, exec_queue[0 ], batch_addr, &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); + +igt_assert_eq (*shared_val,ATOMIC_OP_VAL ); + +atomic_batch_init (gpu1->fd, vm[1 ], addr, &batch_bo, &batch_addr); + +/* Place destination in an optionally remote location to test */ +xe_vm_madvise (gpu1->fd, vm[1 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu1->fd,0 , gpu1->vram_regions[0 ]); + + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +if (prefetch_req) { +xe_vm_prefetch_async (gpu1->fd, vm[1 ],0 ,0 , addr, +SZ_4K , &sync,1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr,BIND_SYNC_VAL , + exec_queue[1 ],NSEC_PER_SEC *10 ); + } +free ((void *)sync_addr); + + sync_addr = (void *)((char *)batch_addr +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute ATOMIC_INC on GPU1 */ +xe_exec_sync (gpu1->fd, exec_queue[1 ], batch_addr, &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); + +igt_assert_eq (*shared_val,ATOMIC_OP_VAL +1 ); + +munmap ((void *)batch_addr,BATCH_SIZE (gpu0->fd)); +batch_fini (gpu0->fd, vm[0 ], batch_bo, batch_addr); +batch_fini (gpu1->fd, vm[1 ], batch_bo, batch_addr); +free (data); + +xe_vm_unbind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,1ull << gpu0->va_bits); +xe_exec_queue_destroy (gpu0->fd, exec_queue[0 ]); +xe_vm_destroy (gpu0->fd, vm[0 ]); + +xe_vm_unbind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,1ull << gpu1->va_bits); +xe_exec_queue_destroy (gpu1->fd, exec_queue[1 ]); +xe_vm_destroy (gpu1->fd, vm[1 ]); +} + +static void +gpu_atomic_inc_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args) +{ +struct multigpu_ops_args *args = (struct multigpu_ops_args *)extra_args; +igt_assert (src); +igt_assert (dst); + +atomic_inc_op (src, dst, eci, args->prefetch_req); +} + igt_main {struct xe_svm_gpu_info gpus[MAX_XE_GPUS ];
@@ -288,6 +480,14 @@ igt_mainigt_subtest ("cross-gpu-mem-access" ) for_each_gpu_pair(gpu_cnt, gpus, &eci, gpu_mem_access_wrapper, NULL); + igt_subtest("atomic-inc-gpu-op") { +struct multigpu_ops_args atomic_args; + atomic_args.prefetch_req =1 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_atomic_inc_wrapper, &atomic_args); + atomic_args.prefetch_req =0 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_atomic_inc_wrapper, &atomic_args); + } + igt_fixture {int cnt;
Signature · 1 line
2.48.1
PATCH v5 3/8 tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU coherency test
In reply to [email protected]From: Nishit Sharma <[email protected]>
This test verifies memory coherency in a multi-GPU environment using SVM. GPU 1 writes to a shared buffer, GPU 2 reads and checks for correct data without explicit synchronization, and the test is repeated with CPU and both GPUs to ensure consistent memory visibility across agents.
--- tests/intel/xe_multi_gpusvm.c | 246 +++++++++++++++++++++++++++++++++- 1 file changed, 244 insertions(+), 2 deletions(-)
tests/intel/xe_multi_gpusvm.c +244 -2
@@ -34,8 +34,13 @@* SUBTEST: atomic-inc-gpu-op * Description: * This test does atomic operation in multi-gpu by executing atomic -* operation on GPU1 and then atomic operation on GPU2 using same -* adress +* operation on GPU1 and then atomic operation on GPU2 using same +* adress +* +* SUBTEST: coherency-multi-gpu +* Description: +* This test checks coherency in multi-gpu by writing from GPU0 +* reading from GPU1 and verify and repeating with CPU and both GPUs */ #define MAX_XE_REGIONS 8
@@ -93,6 +98,11 @@ static void gpu_atomic_inc_wrapper(struct xe_svm_gpu_info *src,struct drm_xe_engine_class_instance *eci, void *extra_args); +static void gpu_coherecy_test_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args); +static void for_each_gpu_pair (int num_gpus,struct xe_svm_gpu_info *gpus,struct drm_xe_engine_class_instance *eci,gpu_pair_fn fn,void *extra_args)
@@ -101,6 +111,7 @@ static void for_each_gpu_pair(int num_gpus, struct xe_svm_gpu_info *gpus,for (int dst =0 ; dst < num_gpus; dst++) {if (src == dst)continue ; +igt_info ("src :%d dst :%d\n" , src, dst);fn (&gpus[src], &gpus[dst], eci, extra_args); } }
@@ -135,6 +146,35 @@ atomic_batch_init(int fd, uint32_t vm, uint64_t src_addr, *addr = batch_addr; } +static void +store_dword_batch_init (int fd,uint32_t vm,uint64_t src_addr, +uint32_t *bo,uint64_t *addr,int value) +{ +uint32_t batch_bo_size =BATCH_SIZE (fd); +uint32_t batch_bo; +uint64_t batch_addr; +void *batch; +uint32_t *cmd; +int i =0 ; + + batch_bo =xe_bo_create (fd, vm, batch_bo_size,vram_if_possible (fd,0 ),0 ); + batch =xe_bo_map (fd, batch_bo, batch_bo_size); + cmd = (uint32_t *) batch; + + cmd[i++] =MI_STORE_DWORD_IMM_GEN4 ; + cmd[i++] = src_addr; + cmd[i++] = src_addr >>32 ; + cmd[i++] = value; + cmd[i++] =MI_BATCH_BUFFER_END ; + + batch_addr =to_user_pointer (batch); + +/* Punch a gap in the SVM map where we map the batch_bo */ +xe_vm_bind_lr_sync (fd, vm, batch_bo,0 , batch_addr, batch_bo_size,0 ); + *bo = batch_bo; + *addr = batch_addr; +} +static void batch_init (int fd,uint32_t vm,uint64_t src_addr,uint64_t dst_addr,uint64_t copy_size,uint32_t *bo,uint64_t *addr)
@@ -307,6 +347,185 @@ gpu_mem_access_wrapper(struct xe_svm_gpu_info *src,copy_src_dst (src, dst, eci); } +static void +coherency_test_multigpu (struct xe_svm_gpu_info *gpu0, +struct xe_svm_gpu_info *gpu1, +struct drm_xe_engine_class_instance *eci, +bool coh_fail_set, +bool prefetch_req) +{ +uint64_t addr; +uint32_t vm[2 ]; +uint32_t exec_queue[2 ]; +uint32_t batch_bo, batch1_bo[2 ]; +uint64_t batch_addr, batch1_addr[2 ]; +struct drm_xe_sync sync = {}; +volatile uint64_t *sync_addr; +int value =60 ; +uint64_t *data1; +void *copy_dst; + + vm[0 ] =xe_vm_create (gpu0->fd, +DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[0 ] =xe_exec_queue_create (gpu0->fd, vm[0 ], eci,0 ); +xe_vm_bind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,0 ,1ull << gpu0->va_bits, +DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + vm[1 ] =xe_vm_create (gpu1->fd, +DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[1 ] =xe_exec_queue_create (gpu1->fd, vm[1 ], eci,0 ); +xe_vm_bind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,0 ,1ull << gpu1->va_bits, +DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + data1 =aligned_alloc (SZ_2M ,SZ_4K ); +igt_assert (data1); + addr =to_user_pointer (data1); + + copy_dst =aligned_alloc (SZ_2M ,SZ_4K ); +igt_assert (copy_dst); + +store_dword_batch_init (gpu0->fd, vm[0 ], addr, &batch_bo, &batch_addr, value); + +/* Place destination in GPU0 local memory location to test */ +xe_vm_madvise (gpu0->fd, vm[0 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu0->fd,0 , gpu0->vram_regions[0 ]); + + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +/* prefetch full buffer for GPU0 */ +if (prefetch_req) { +xe_vm_prefetch_async (gpu0->fd, vm[0 ],0 ,0 , addr,SZ_4K , &sync,1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,BIND_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); + } +free ((void *)sync_addr); + + sync_addr = (void *)((char *)batch_addr +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute STORE command on GPU0 */ +xe_exec_sync (gpu0->fd, exec_queue[0 ], batch_addr, &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); + +igt_assert_eq (*(uint64_t *)addr, value); + +/* Creating batch for GPU1 using addr as Src which have value from GPU0 */ +batch_init (gpu1->fd, vm[1 ], addr,to_user_pointer (copy_dst), +SZ_4K , &batch_bo, &batch_addr); + +/* Place destination in GPU1 local memory location to test */ +xe_vm_madvise (gpu1->fd, vm[1 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu1->fd,0 , gpu1->vram_regions[0 ]); + + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +/* prefetch full buffer for GPU1 */ +if (prefetch_req) { +xe_vm_prefetch_async (gpu1->fd, vm[1 ],0 ,0 , addr, +SZ_4K , &sync,1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr,BIND_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); + } +free ((void *)sync_addr); + + sync_addr = (void *)((char *)batch_addr +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute COPY command on GPU1 */ +xe_exec_sync (gpu1->fd, exec_queue[1 ], batch_addr, &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); + +igt_assert_eq (*(uint64_t *)copy_dst, value); + +/* CPU writes 10, memset set bytes no integer hence memset fills 4 bytes with 0x0A */ +memset ((void *)(uintptr_t )addr,10 ,sizeof (int )); +igt_assert_eq (*(uint64_t *)addr,0x0A0A0A0A ); + + +if (coh_fail_set) { +igt_info ("coherency fail impl\n" ); + +/* Coherency fail scenario */ +store_dword_batch_init (gpu0->fd, vm[0 ], addr, &batch1_bo[0 ], &batch1_addr[0 ], value +10 ); +store_dword_batch_init (gpu1->fd, vm[1 ], addr, &batch1_bo[1 ], &batch1_addr[1 ], value +20 ); + + sync_addr = (void *)((char *)batch1_addr[0 ] +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute STORE command on GPU1 */ +xe_exec_sync (gpu0->fd, exec_queue[0 ], batch1_addr[0 ], &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); + + sync_addr = (void *)((char *)batch1_addr[1 ] +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute STORE command on GPU2 */ +xe_exec_sync (gpu1->fd, exec_queue[1 ], batch1_addr[1 ], &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); + +igt_assert_f (*(uint64_t *)addr == (value +10 ), +"GPU2 has overwritten value at addr\n" ); + +munmap ((void *)batch1_addr[0 ],BATCH_SIZE (gpu0->fd)); +munmap ((void *)batch1_addr[1 ],BATCH_SIZE (gpu1->fd)); + +batch_fini (gpu0->fd, vm[0 ], batch1_bo[0 ], batch1_addr[0 ]); +batch_fini (gpu1->fd, vm[1 ], batch1_bo[1 ], batch1_addr[1 ]); + } + +/* CPU writes 11, memset set bytes no integer hence memset fills 4 bytes with 0x0B */ +memset ((void *)(uintptr_t )addr,11 ,sizeof (int )); +igt_assert_eq (*(uint64_t *)addr,0x0B0B0B0B ); + +munmap ((void *)batch_addr,BATCH_SIZE (gpu0->fd)); +batch_fini (gpu0->fd, vm[0 ], batch_bo, batch_addr); +batch_fini (gpu1->fd, vm[1 ], batch_bo, batch_addr); +free (data1); +free (copy_dst); + +xe_vm_unbind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,1ull << gpu0->va_bits); +xe_exec_queue_destroy (gpu0->fd, exec_queue[0 ]); +xe_vm_destroy (gpu0->fd, vm[0 ]); + +xe_vm_unbind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,1ull << gpu1->va_bits); +xe_exec_queue_destroy (gpu1->fd, exec_queue[1 ]); +xe_vm_destroy (gpu1->fd, vm[1 ]); +} + static void atomic_inc_op(struct xe_svm_gpu_info *gpu0, struct xe_svm_gpu_info *gpu1,
@@ -446,6 +665,19 @@ gpu_atomic_inc_wrapper(struct xe_svm_gpu_info *src,atomic_inc_op (src, dst, eci, args->prefetch_req); } +static void +gpu_coherecy_test_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args) +{ +struct multigpu_ops_args *args = (struct multigpu_ops_args *)extra_args; +igt_assert (src); +igt_assert (dst); + +coherency_test_multigpu (src, dst, eci, args->op_mod, args->prefetch_req); +} + igt_main {struct xe_svm_gpu_info gpus[MAX_XE_GPUS ];
@@ -488,6 +720,16 @@ igt_mainfor_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_atomic_inc_wrapper, &atomic_args); } + igt_subtest("coherency-multi-gpu") { +struct multigpu_ops_args coh_args; + coh_args.prefetch_req =1 ; + coh_args.op_mod =0 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_coherecy_test_wrapper, &coh_args); + coh_args.prefetch_req =0 ; + coh_args.op_mod =1 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_coherecy_test_wrapper, &coh_args); + } + igt_fixture {int cnt;
Signature · 1 line
2.48.1
PATCH v5 4/8 tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU performance test
In reply to [email protected]From: Nishit Sharma <[email protected]>
This test measures latency and bandwidth for buffer access from each GPU and the CPU in a multi-GPU SVM environment. It compares performance for local versus remote access using madvise and prefetch to control buffer placement
--- tests/intel/xe_multi_gpusvm.c | 221 ++++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+)
tests/intel/xe_multi_gpusvm.c +221 -0
@@ -13,6 +13,8 @@#include "intel_mocs.h" #include "intel_reg.h" +#include "time.h" +#include "xe/xe_ioctl.h" #include "xe/xe_query.h" #include "xe/xe_util.h"
@@ -41,6 +43,11 @@* Description: * This test checks coherency in multi-gpu by writing from GPU0 * reading from GPU1 and verify and repeating with CPU and both GPUs +* +* SUBTEST: latency-multi-gpu +* Description: +* This test measures and compares latency and bandwidth for buffer access +* from CPU, local GPU, and remote GPU */ #define MAX_XE_REGIONS 8
@@ -103,6 +110,11 @@ static void gpu_coherecy_test_wrapper(struct xe_svm_gpu_info *src,struct drm_xe_engine_class_instance *eci, void *extra_args); +static void gpu_latency_test_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args); +static void for_each_gpu_pair (int num_gpus,struct xe_svm_gpu_info *gpus,struct drm_xe_engine_class_instance *eci,gpu_pair_fn fn,void *extra_args)
@@ -119,6 +131,11 @@ static void for_each_gpu_pair(int num_gpus, struct xe_svm_gpu_info *gpus,static void open_pagemaps (int fd,struct xe_svm_gpu_info *info); +static double time_diff (struct timespec *start,struct timespec *end) +{ +return (end->tv_sec - start->tv_sec) + (end->tv_nsec - start->tv_nsec) /1e9 ; +} +static void atomic_batch_init (int fd,uint32_t vm,uint64_t src_addr,uint32_t *bo,uint64_t *addr)
@@ -526,6 +543,187 @@ coherency_test_multigpu(struct xe_svm_gpu_info *gpu0,xe_vm_destroy (gpu1->fd, vm[1 ]); } +static void +latency_test_multigpu (struct xe_svm_gpu_info *gpu0, +struct xe_svm_gpu_info *gpu1, +struct drm_xe_engine_class_instance *eci, +bool remote_copy, +bool prefetch_req) +{ +uint64_t addr; +uint32_t vm[2 ]; +uint32_t exec_queue[2 ]; +uint32_t batch_bo; +uint8_t *copy_dst; +uint64_t batch_addr; +struct drm_xe_sync sync = {}; +volatile uint64_t *sync_addr; +int value =60 ; +int shared_val[4 ]; +struct test_exec_data *data; +struct timespec t_start, t_end; +double cpu_latency, gpu1_latency, gpu2_latency; +double cpu_bw, gpu1_bw, gpu2_bw; + + + vm[0 ] =xe_vm_create (gpu0->fd, +DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[0 ] =xe_exec_queue_create (gpu0->fd, vm[0 ], eci,0 ); +xe_vm_bind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,0 ,1ull << gpu0->va_bits, +DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + vm[1 ] =xe_vm_create (gpu1->fd, +DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[1 ] =xe_exec_queue_create (gpu1->fd, vm[1 ], eci,0 ); +xe_vm_bind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,0 ,1ull << gpu1->va_bits, +DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + data =aligned_alloc (SZ_2M ,SZ_4K ); +igt_assert (data); + data[0 ].vm_sync =0 ; + addr =to_user_pointer (data); + + copy_dst =aligned_alloc (SZ_2M ,SZ_4K ); +igt_assert (copy_dst); + +store_dword_batch_init (gpu0->fd, vm[0 ], addr, &batch_bo, &batch_addr, value); + +/* Measure GPU0 access latency/bandwidth */ +clock_gettime (CLOCK_MONOTONIC , &t_start); + +/* GPU0 access */ +xe_vm_madvise (gpu0->fd, vm[0 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu0->fd,0 , gpu0->vram_regions[0 ]); + + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +if (prefetch_req) { +xe_vm_prefetch_async (gpu0->fd, vm[0 ],0 ,0 , addr,SZ_4K , &sync,1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,BIND_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); + } +free ((void *)sync_addr); + +clock_gettime (CLOCK_MONOTONIC , &t_end); + gpu1_latency =time_diff (&t_start, &t_end); + gpu1_bw =COPY_SIZE / gpu1_latency / (1024 *1024 );// MB/s + + sync_addr = (void *)((char *)batch_addr +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute STORE command on GPU0 */ +xe_exec_sync (gpu0->fd, exec_queue[0 ], batch_addr, &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); + +memcpy (shared_val, (void *)addr,4 ); +igt_assert_eq (shared_val[0 ], value); + +/* CPU writes 10, memset set bytes no integer hence memset fills 4 bytes with 0x0A */ +memset ((void *)(uintptr_t )addr,10 ,sizeof (int )); +memcpy (shared_val, (void *)(uintptr_t )addr,sizeof (shared_val)); +igt_assert_eq (shared_val[0 ],0x0A0A0A0A ); + + *(uint64_t *)addr =50 ; + +if (remote_copy) { +igt_info ("creating batch for COPY_CMD on GPU1\n" ); +batch_init (gpu1->fd, vm[1 ], addr,to_user_pointer (copy_dst), +SZ_4K , &batch_bo, &batch_addr); + }else { +igt_info ("creating batch for STORE_CMD on GPU1\n" ); +store_dword_batch_init (gpu1->fd, vm[1 ], addr, &batch_bo, &batch_addr, value +10 ); + } + +/* Measure GPU1 access latency/bandwidth */ +clock_gettime (CLOCK_MONOTONIC , &t_start); + +/* GPU1 access */ +xe_vm_madvise (gpu1->fd, vm[1 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu1->fd,0 , gpu1->vram_regions[0 ]); + + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +if (prefetch_req) { +xe_vm_prefetch_async (gpu1->fd, vm[1 ],0 ,0 , addr, +SZ_4K , &sync,1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr,BIND_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); + } +free ((void *)sync_addr); + +clock_gettime (CLOCK_MONOTONIC , &t_end); + gpu2_latency =time_diff (&t_start, &t_end); + gpu2_bw =COPY_SIZE / gpu2_latency / (1024 *1024 );// MB/s + + sync_addr = (void *)((char *)batch_addr +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute COPY/STORE command on GPU1 */ +xe_exec_sync (gpu1->fd, exec_queue[1 ], batch_addr, &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); + +if (!remote_copy) +igt_assert_eq (*(uint64_t *)addr, value +10 ); +else +igt_assert_eq (*(uint64_t *)copy_dst,50 ); + +/* CPU writes 11, memset set bytes no integer hence memset fills 4 bytes with 0x0B */ +/* Measure CPU access latency/bandwidth */ +clock_gettime (CLOCK_MONOTONIC , &t_start); +memset ((void *)(uintptr_t )addr,11 ,sizeof (int )); +memcpy (shared_val, (void *)(uintptr_t )addr,sizeof (shared_val)); +clock_gettime (CLOCK_MONOTONIC , &t_end); + cpu_latency =time_diff (&t_start, &t_end); + cpu_bw =COPY_SIZE / cpu_latency / (1024 *1024 );// MB/s + +igt_assert_eq (shared_val[0 ],0x0B0B0B0B ); + +/* Print results */ +igt_info ("CPU: Latency %.6f s, Bandwidth %.2f MB/s\n" , cpu_latency, cpu_bw); +igt_info ("GPU: Latency %.6f s, Bandwidth %.2f MB/s\n" , gpu1_latency, gpu1_bw); +igt_info ("GPU: Latency %.6f s, Bandwidth %.2f MB/s\n" , gpu2_latency, gpu2_bw); + +munmap ((void *)batch_addr,BATCH_SIZE (gpu0->fd)); +batch_fini (gpu0->fd, vm[0 ], batch_bo, batch_addr); +batch_fini (gpu1->fd, vm[1 ], batch_bo, batch_addr); +free (data); +free (copy_dst); + +xe_vm_unbind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,1ull << gpu0->va_bits); +xe_exec_queue_destroy (gpu0->fd, exec_queue[0 ]); +xe_vm_destroy (gpu0->fd, vm[0 ]); + +xe_vm_unbind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,1ull << gpu1->va_bits); +xe_exec_queue_destroy (gpu1->fd, exec_queue[1 ]); +xe_vm_destroy (gpu1->fd, vm[1 ]); +} + static void atomic_inc_op(struct xe_svm_gpu_info *gpu0, struct xe_svm_gpu_info *gpu1,
@@ -678,6 +876,19 @@ gpu_coherecy_test_wrapper(struct xe_svm_gpu_info *src,coherency_test_multigpu (src, dst, eci, args->op_mod, args->prefetch_req); } +static void +gpu_latency_test_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args) +{ +struct multigpu_ops_args *args = (struct multigpu_ops_args *)extra_args; +igt_assert (src); +igt_assert (dst); + +latency_test_multigpu (src, dst, eci, args->op_mod, args->prefetch_req); +} + igt_main {struct xe_svm_gpu_info gpus[MAX_XE_GPUS ];
@@ -730,6 +941,16 @@ igt_mainfor_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_coherecy_test_wrapper, &coh_args); } + igt_subtest("latency-multi-gpu") { +struct multigpu_ops_args latency_args; + latency_args.prefetch_req =1 ; + latency_args.op_mod =1 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_latency_test_wrapper, &latency_args); + latency_args.prefetch_req =0 ; + latency_args.op_mod =0 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_latency_test_wrapper, &latency_args); + } + igt_fixture {int cnt;
Signature · 1 line
2.48.1
PATCH v5 5/8 tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU fault handling test
In reply to [email protected]From: Nishit Sharma <[email protected]>
This test intentionally triggers page faults by accessing regions without prefetch for both GPUs in a multi-GPU environment.
--- tests/intel/xe_multi_gpusvm.c | 128 +++++++++++++++++++++++++++++++++- 1 file changed, 127 insertions(+), 1 deletion(-)
tests/intel/xe_multi_gpusvm.c +127 -1
@@ -15,6 +15,7 @@#include "time.h" +#include "xe/xe_gt.h" #include "xe/xe_ioctl.h" #include "xe/xe_query.h" #include "xe/xe_util.h"
@@ -48,6 +49,11 @@* Description: * This test measures and compares latency and bandwidth for buffer access * from CPU, local GPU, and remote GPU +* +* SUBTEST: pagefault-multi-gpu +* Description: +* This test intentionally triggers page faults by accessing unmapped SVM +* regions from both GPUs */ #define MAX_XE_REGIONS 8
@@ -115,6 +121,11 @@ static void gpu_latency_test_wrapper(struct xe_svm_gpu_info *src,struct drm_xe_engine_class_instance *eci, void *extra_args); +static void gpu_fault_test_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args); +static void for_each_gpu_pair (int num_gpus,struct xe_svm_gpu_info *gpus,struct drm_xe_engine_class_instance *eci,gpu_pair_fn fn,void *extra_args)
@@ -123,7 +134,6 @@ static void for_each_gpu_pair(int num_gpus, struct xe_svm_gpu_info *gpus,for (int dst =0 ; dst < num_gpus; dst++) {if (src == dst)continue ; -igt_info ("src :%d dst :%d\n" , src, dst);fn (&gpus[src], &gpus[dst], eci, extra_args); } }
@@ -724,6 +734,101 @@ latency_test_multigpu(struct xe_svm_gpu_info *gpu0,xe_vm_destroy (gpu1->fd, vm[1 ]); } +static void +pagefault_test_multigpu (struct xe_svm_gpu_info *gpu0, +struct xe_svm_gpu_info *gpu1, +struct drm_xe_engine_class_instance *eci, +bool prefetch_req) +{ +uint64_t addr; +uint32_t vm[2 ]; +uint32_t exec_queue[2 ]; +uint32_t batch_bo; +uint64_t batch_addr; +struct drm_xe_sync sync = {}; +volatile uint64_t *sync_addr; +int value =60 , pf_count_1, pf_count_2; +void *data; +const char *pf_count_stat ="svm_pagefault_count" ; + + vm[0 ] =xe_vm_create (gpu0->fd,DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[0 ] =xe_exec_queue_create (gpu0->fd, vm[0 ], eci,0 ); +xe_vm_bind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,0 ,1ull << gpu0->va_bits,DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + vm[1 ] =xe_vm_create (gpu1->fd,DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[1 ] =xe_exec_queue_create (gpu1->fd, vm[1 ], eci,0 ); +xe_vm_bind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,0 ,1ull << gpu1->va_bits,DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + data =aligned_alloc (SZ_2M ,SZ_4K ); +igt_assert (data); + addr =to_user_pointer (data); + + pf_count_1 =xe_gt_stats_get_count (gpu0->fd, eci->gt_id, pf_count_stat); + +/* checking pagefault count on GPU */ +store_dword_batch_init (gpu0->fd, vm[0 ], addr, &batch_bo, &batch_addr, value); + +if (prefetch_req) { +xe_vm_madvise (gpu0->fd, vm[0 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu0->fd,0 , gpu0->vram_regions[0 ]); + } + + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +if (prefetch_req) { +xe_vm_prefetch_async (gpu0->fd, vm[0 ],0 ,0 , addr,SZ_4K , &sync,1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); + +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,BIND_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); + } +free ((void *)sync_addr); + + sync_addr = (void *)((char *)batch_addr +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute STORE command on GPU */ +xe_exec_sync (gpu0->fd, exec_queue[0 ], batch_addr, &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); + + pf_count_2 =xe_gt_stats_get_count (gpu0->fd, eci->gt_id, pf_count_stat); + +if (pf_count_2 != pf_count_1) { +igt_warn ("GPU pf: pf_count_2(%d) != pf_count_1(%d) prefetch_req :%d\n" , + pf_count_2, pf_count_1, prefetch_req); + } + +igt_assert_eq (*(uint64_t *)addr, value); + +/* CPU writes 11, memset set bytes no integer hence memset fills 4 bytes with 0x0B */ +memset ((void *)(uintptr_t )addr,11 ,sizeof (int )); +igt_assert_eq (*(uint64_t *)addr,0x0B0B0B0B ); + +munmap ((void *)batch_addr,BATCH_SIZE (gpu0->fd)); +batch_fini (gpu0->fd, vm[0 ], batch_bo, batch_addr); +free (data); + +xe_vm_unbind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,1ull << gpu0->va_bits); +xe_exec_queue_destroy (gpu0->fd, exec_queue[0 ]); +xe_vm_destroy (gpu0->fd, vm[0 ]); + +xe_vm_unbind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,1ull << gpu1->va_bits); +xe_exec_queue_destroy (gpu1->fd, exec_queue[1 ]); +xe_vm_destroy (gpu1->fd, vm[1 ]); +} + static void atomic_inc_op(struct xe_svm_gpu_info *gpu0, struct xe_svm_gpu_info *gpu1,
@@ -889,6 +994,19 @@ gpu_latency_test_wrapper(struct xe_svm_gpu_info *src,latency_test_multigpu (src, dst, eci, args->op_mod, args->prefetch_req); } +static void +gpu_fault_test_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args) +{ +struct multigpu_ops_args *args = (struct multigpu_ops_args *)extra_args; +igt_assert (src); +igt_assert (dst); + +pagefault_test_multigpu (src, dst, eci, args->prefetch_req); +} + igt_main {struct xe_svm_gpu_info gpus[MAX_XE_GPUS ];
@@ -951,6 +1069,14 @@ igt_mainfor_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_latency_test_wrapper, &latency_args); } + igt_subtest("pagefault-multi-gpu") { +struct multigpu_ops_args fault_args; + fault_args.prefetch_req =1 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_fault_test_wrapper, &fault_args); + fault_args.prefetch_req =0 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_fault_test_wrapper, &fault_args); + } + igt_fixture {int cnt;
Signature · 1 line
2.48.1
PATCH v5 6/8 tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU simultaneous access test
In reply to [email protected]From: Nishit Sharma <[email protected]>
This test launches compute or copy workloads on both GPUs that access the same SVM buffer, using synchronization primitives (fences/semaphores) to coordinate access. It verifies data integrity and checks for the absence of race conditions in a multi-GPU SVM environment.
--- tests/intel/xe_multi_gpusvm.c | 158 ++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+)
tests/intel/xe_multi_gpusvm.c +158 -0
@@ -54,6 +54,11 @@* Description: * This test intentionally triggers page faults by accessing unmapped SVM * regions from both GPUs +* +* SUBTEST: concurrent-access-multi-gpu +* Description: +* This tests aunches simultaneous workloads on both GPUs accessing the +* same SVM buffer synchronizes with fences, and verifies data integrity */ #define MAX_XE_REGIONS 8
@@ -126,6 +131,11 @@ static void gpu_fault_test_wrapper(struct xe_svm_gpu_info *src,struct drm_xe_engine_class_instance *eci, void *extra_args); +static void gpu_simult_test_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args); +static void for_each_gpu_pair (int num_gpus,struct xe_svm_gpu_info *gpus,struct drm_xe_engine_class_instance *eci,gpu_pair_fn fn,void *extra_args)
@@ -981,6 +991,133 @@ gpu_coherecy_test_wrapper(struct xe_svm_gpu_info *src,coherency_test_multigpu (src, dst, eci, args->op_mod, args->prefetch_req); } +static void +multigpu_access_test (struct xe_svm_gpu_info *gpu0, +struct xe_svm_gpu_info *gpu1, +struct drm_xe_engine_class_instance *eci, +bool no_prefetch) +{ +uint64_t addr; +uint32_t vm[2 ]; +uint32_t exec_queue[2 ]; +uint32_t batch_bo[2 ]; +struct test_exec_data *data; +uint64_t batch_addr[2 ]; +struct drm_xe_sync sync[2 ] = {}; +volatile uint64_t *sync_addr[2 ]; +volatile uint32_t *shared_val; + + vm[0 ] =xe_vm_create (gpu0->fd, +DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[0 ] =xe_exec_queue_create (gpu0->fd, vm[0 ], eci,0 ); +xe_vm_bind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,0 ,1ull << gpu0->va_bits, +DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + vm[1 ] =xe_vm_create (gpu1->fd, +DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[1 ] =xe_exec_queue_create (gpu1->fd, vm[1 ], eci,0 ); +xe_vm_bind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,0 ,1ull << gpu1->va_bits, +DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + data =aligned_alloc (SZ_2M ,SZ_4K ); +igt_assert (data); + data[0 ].vm_sync =0 ; + addr =to_user_pointer (data); + + shared_val = (volatile uint32_t *)addr; + *shared_val =ATOMIC_OP_VAL -1 ; + +atomic_batch_init (gpu0->fd, vm[0 ], addr, &batch_bo[0 ], &batch_addr[0 ]); + *shared_val =ATOMIC_OP_VAL -2 ; +atomic_batch_init (gpu1->fd, vm[1 ], addr, &batch_bo[1 ], &batch_addr[1 ]); + +/* Place destination in an optionally remote location to test */ +xe_vm_madvise (gpu0->fd, vm[0 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu0->fd,0 , gpu0->vram_regions[0 ]); + +xe_vm_madvise (gpu1->fd, vm[1 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu1->fd,0 , gpu1->vram_regions[0 ]); + + sync_addr[0 ] =malloc (sizeof (*sync_addr)); + sync_addr[1 ] =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr[0 ]); +igt_assert (!!sync_addr[1 ]); + + sync[0 ].flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync[0 ].type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync[0 ].addr =to_user_pointer ((uint64_t *)sync_addr[0 ]); + sync[0 ].timeline_value =BIND_SYNC_VAL ; + sync[1 ].flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync[1 ].type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync[1 ].addr =to_user_pointer ((uint64_t *)sync_addr[1 ]); + sync[1 ].timeline_value =BIND_SYNC_VAL ; + *sync_addr[0 ] =0 ; + *sync_addr[1 ] =0 ; + +if (!no_prefetch) { +xe_vm_prefetch_async (gpu0->fd, vm[0 ],0 ,0 , addr, +SZ_4K , &sync[0 ],1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); + +xe_vm_prefetch_async (gpu1->fd, vm[1 ],0 ,0 , addr, +SZ_4K , &sync[1 ],1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); + +if (*sync_addr[0 ] !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr[0 ],BIND_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); +free ((void *)sync_addr[0 ]); +if (*sync_addr[1 ] !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr[1 ],BIND_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); +free ((void *)sync_addr[1 ]); + } + +if (no_prefetch) { +free ((void *)sync_addr[0 ]); +free ((void *)sync_addr[1 ]); + } + +for (int i =0 ; i <100 ; i++) { + sync_addr[0 ] = (void *)((char *)batch_addr[0 ] +SZ_4K ); + sync[0 ].addr =to_user_pointer ((uint64_t *)sync_addr[0 ]); + sync[0 ].timeline_value =EXEC_SYNC_VAL ; + + sync_addr[1 ] = (void *)((char *)batch_addr[1 ] +SZ_4K ); + sync[1 ].addr =to_user_pointer ((uint64_t *)sync_addr[1 ]); + sync[1 ].timeline_value =EXEC_SYNC_VAL ; + *sync_addr[0 ] =0 ; + *sync_addr[1 ] =0 ; + +xe_exec_sync (gpu0->fd, exec_queue[0 ], batch_addr[0 ], &sync[0 ],1 ); +if (*sync_addr[0 ] !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr[0 ],EXEC_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); +xe_exec_sync (gpu1->fd, exec_queue[1 ], batch_addr[1 ], &sync[1 ],1 ); +if (*sync_addr[1 ] !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr[1 ],EXEC_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); + } + +igt_assert_eq (*(uint64_t *)addr,254 ); + +munmap ((void *)batch_addr[0 ],BATCH_SIZE (gpu0->fd)); +munmap ((void *)batch_addr[1 ],BATCH_SIZE (gpu0->fd)); +batch_fini (gpu0->fd, vm[0 ], batch_bo[0 ], batch_addr[0 ]); +batch_fini (gpu1->fd, vm[1 ], batch_bo[1 ], batch_addr[1 ]); +free (data); + +xe_vm_unbind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,1ull << gpu0->va_bits); +xe_exec_queue_destroy (gpu0->fd, exec_queue[0 ]); +xe_vm_destroy (gpu0->fd, vm[0 ]); + +xe_vm_unbind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,1ull << gpu1->va_bits); +xe_exec_queue_destroy (gpu1->fd, exec_queue[1 ]); +xe_vm_destroy (gpu1->fd, vm[1 ]); +} + static void gpu_latency_test_wrapper(struct xe_svm_gpu_info *src, struct xe_svm_gpu_info *dst,
@@ -1007,6 +1144,19 @@ gpu_fault_test_wrapper(struct xe_svm_gpu_info *src,pagefault_test_multigpu (src, dst, eci, args->prefetch_req); } +static void +gpu_simult_test_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args) +{ +struct multigpu_ops_args *args = (struct multigpu_ops_args *)extra_args; +igt_assert (src); +igt_assert (dst); + +multigpu_access_test (src, dst, eci, args->prefetch_req); +} + igt_main {struct xe_svm_gpu_info gpus[MAX_XE_GPUS ];
@@ -1077,6 +1227,14 @@ igt_mainfor_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_fault_test_wrapper, &fault_args); } + igt_subtest("concurrent-access-multi-gpu") { +struct multigpu_ops_args simul_args; + simul_args.prefetch_req =1 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_simult_test_wrapper, &simul_args); + simul_args.prefetch_req =0 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_simult_test_wrapper, &simul_args); + } + igt_fixture {int cnt;
Signature · 1 line
2.48.1
PATCH v5 7/8 tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU conflicting madvise test
In reply to [email protected]From: Nishit Sharma <[email protected]>
This test calls madvise operations on GPU0 with the preferred location set to GPU1 and vice versa. It reports conflicts when conflicting memory advice is given for shared SVM buffers in a multi-GPU environment.
--- tests/intel/xe_multi_gpusvm.c | 161 ++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+)
tests/intel/xe_multi_gpusvm.c +161 -0
@@ -59,6 +59,11 @@* Description: * This tests aunches simultaneous workloads on both GPUs accessing the * same SVM buffer synchronizes with fences, and verifies data integrity +* +* SUBTEST: conflicting-madvise-gpu +* Description: +* This test checks conflicting madvise by allocating shared buffer +* prefetches from both and checks for migration conflicts */ #define MAX_XE_REGIONS 8
@@ -69,6 +74,8 @@#define EXEC_SYNC_VAL 0x676767#define COPY_SIZE SZ_64M#define ATOMIC_OP_VAL 56 +#define USER_FENCE_VALUE 0xdeadbeefdeadbeefull +#define FIVE_SEC (5LL * NSEC_PER_SEC)struct xe_svm_gpu_info {bool supports_faults;
@@ -136,6 +143,11 @@ static void gpu_simult_test_wrapper(struct xe_svm_gpu_info *src,struct drm_xe_engine_class_instance *eci, void *extra_args); +static void gpu_conflict_test_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args); +static void for_each_gpu_pair (int num_gpus,struct xe_svm_gpu_info *gpus,struct drm_xe_engine_class_instance *eci,gpu_pair_fn fn,void *extra_args)
@@ -839,6 +851,134 @@ pagefault_test_multigpu(struct xe_svm_gpu_info *gpu0,xe_vm_destroy (gpu1->fd, vm[1 ]); } +#define XE_BO_FLAG_SYSTEM BIT(1) +#define XE_BO_FLAG_CPU_ADDR_MIRROR BIT(24) + +static void +conflicting_madvise (struct xe_svm_gpu_info *gpu0, +struct xe_svm_gpu_info *gpu1, +struct drm_xe_engine_class_instance *eci, +bool no_prefetch) +{ +uint64_t addr; +uint32_t vm[2 ]; +uint32_t exec_queue[2 ]; +uint32_t batch_bo[2 ]; +void *data; +uint64_t batch_addr[2 ]; +struct drm_xe_sync sync[2 ] = {}; +volatile uint64_t *sync_addr[2 ]; + + vm[0 ] =xe_vm_create (gpu0->fd, +DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[0 ] =xe_exec_queue_create (gpu0->fd, vm[0 ], eci,0 ); +xe_vm_bind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,0 ,1ull << gpu0->va_bits, +DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + vm[1 ] =xe_vm_create (gpu1->fd, +DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[1 ] =xe_exec_queue_create (gpu1->fd, vm[1 ], eci,0 ); +xe_vm_bind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,0 ,1ull << gpu1->va_bits, +DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + data =aligned_alloc (SZ_2M ,SZ_4K ); +igt_assert (data); + addr =to_user_pointer (data); + +xe_vm_madvise (gpu0->fd, vm[0 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , +DRM_XE_PREFERRED_LOC_DEFAULT_SYSTEM ,0 ,0 ); + +store_dword_batch_init (gpu0->fd, vm[0 ], addr, &batch_bo[0 ], &batch_addr[0 ],10 ); +store_dword_batch_init (gpu1->fd, vm[0 ], addr, &batch_bo[1 ], &batch_addr[1 ],20 ); + +/* Place destination in an optionally remote location to test */ +xe_vm_madvise (gpu0->fd, vm[0 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu1->fd,0 , gpu1->vram_regions[0 ]); + +xe_vm_madvise (gpu1->fd, vm[1 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu0->fd,0 , gpu0->vram_regions[0 ]); + + sync_addr[0 ] =malloc (sizeof (*sync_addr)); + sync_addr[1 ] =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr[0 ]); +igt_assert (!!sync_addr[1 ]); + + sync[0 ].flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync[0 ].type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync[0 ].addr =to_user_pointer ((uint64_t *)sync_addr[0 ]); + sync[0 ].timeline_value =BIND_SYNC_VAL ; + sync[1 ].flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync[1 ].type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync[1 ].addr =to_user_pointer ((uint64_t *)sync_addr[1 ]); + sync[1 ].timeline_value =BIND_SYNC_VAL ; + *sync_addr[0 ] =0 ; + *sync_addr[1 ] =0 ; + +if (!no_prefetch) { +xe_vm_prefetch_async (gpu0->fd, vm[0 ],0 ,0 , addr, +SZ_4K , &sync[0 ],1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); + +xe_vm_prefetch_async (gpu1->fd, vm[1 ],0 ,0 , addr, +SZ_4K , &sync[1 ],1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); + +if (*sync_addr[0 ] !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr[0 ],BIND_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); +free ((void *)sync_addr[0 ]); +if (*sync_addr[1 ] !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr[1 ],BIND_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); +free ((void *)sync_addr[1 ]); + } + +if (no_prefetch) { +free ((void *)sync_addr[0 ]); +free ((void *)sync_addr[1 ]); + } + +for (int i =0 ; i <1 ; i++) { + sync_addr[0 ] = (void *)((char *)batch_addr[0 ] +SZ_4K ); + sync[0 ].addr =to_user_pointer ((uint64_t *)sync_addr[0 ]); + sync[0 ].timeline_value =EXEC_SYNC_VAL ; + + sync_addr[1 ] = (void *)((char *)batch_addr[1 ] +SZ_4K ); + sync[1 ].addr =to_user_pointer ((uint64_t *)sync_addr[1 ]); + sync[1 ].timeline_value =EXEC_SYNC_VAL ; + *sync_addr[0 ] =0 ; + *sync_addr[1 ] =0 ; + +xe_exec_sync (gpu0->fd, exec_queue[0 ], batch_addr[0 ], &sync[0 ],1 ); +if (*sync_addr[0 ] !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr[0 ],EXEC_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); +xe_exec_sync (gpu1->fd, exec_queue[1 ], batch_addr[1 ], &sync[1 ],1 ); +if (*sync_addr[1 ] !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr[1 ],EXEC_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); + } + +igt_assert_eq (*(uint64_t *)addr,20 ); + +munmap ((void *)batch_addr[0 ],BATCH_SIZE (gpu0->fd)); +munmap ((void *)batch_addr[1 ],BATCH_SIZE (gpu0->fd)); +batch_fini (gpu0->fd, vm[0 ], batch_bo[0 ], batch_addr[0 ]); +batch_fini (gpu1->fd, vm[1 ], batch_bo[1 ], batch_addr[1 ]); +free (data); + +xe_vm_unbind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,1ull << gpu0->va_bits); +xe_exec_queue_destroy (gpu0->fd, exec_queue[0 ]); +xe_vm_destroy (gpu0->fd, vm[0 ]); + +xe_vm_unbind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,1ull << gpu1->va_bits); +xe_exec_queue_destroy (gpu1->fd, exec_queue[1 ]); +xe_vm_destroy (gpu1->fd, vm[1 ]); +} + static void atomic_inc_op(struct xe_svm_gpu_info *gpu0, struct xe_svm_gpu_info *gpu1,
@@ -1118,6 +1258,19 @@ multigpu_access_test(struct xe_svm_gpu_info *gpu0,xe_vm_destroy (gpu1->fd, vm[1 ]); } +static void +gpu_conflict_test_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args) +{ +struct multigpu_ops_args *args = (struct multigpu_ops_args *)extra_args; +igt_assert (src); +igt_assert (dst); + +conflicting_madvise (src, dst, eci, args->prefetch_req); +} + static void gpu_latency_test_wrapper(struct xe_svm_gpu_info *src, struct xe_svm_gpu_info *dst,
@@ -1209,6 +1362,14 @@ igt_mainfor_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_coherecy_test_wrapper, &coh_args); } + igt_subtest("conflicting-madvise-gpu") { +struct multigpu_ops_args conflict_args; + conflict_args.prefetch_req =1 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_conflict_test_wrapper, &conflict_args); + conflict_args.prefetch_req =0 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_conflict_test_wrapper, &conflict_args); + } + igt_subtest("latency-multi-gpu") {struct multigpu_ops_args latency_args; latency_args.prefetch_req =1 ;
Signature · 1 line
2.48.1
PATCH v5 8/8 tests/intel/xe_multi-gpusvm.c: Add SVM multi-GPU migration test
In reply to [email protected]From: Nishit Sharma <[email protected]>
This test allocates a buffer in SVM, accesses it from GPU 1, then GPU 2 and then the CPU. It verifies that the buffer migrates correctly between devices and remains accessible across all agents in a multi-GPU environment.
--- tests/intel/xe_multi_gpusvm.c | 231 ++++++++++++++++++++++++++++++++++ tests/intel/xe_multisvm.c | 2 + 2 files changed, 233 insertions(+)
tests/intel/xe_multi_gpusvm.c +231 -0
@@ -64,6 +64,11 @@* Description: * This test checks conflicting madvise by allocating shared buffer * prefetches from both and checks for migration conflicts +* +* SUBTEST: migrate-test-multi-gpu +* Description: +* This test allocates an SVM buffer, accesses it from GPU 1, GPU 2, and CPU, +* and verifies migration and accessibility between devices */ #define MAX_XE_REGIONS 8
@@ -148,6 +153,11 @@ static void gpu_conflict_test_wrapper(struct xe_svm_gpu_info *src,struct drm_xe_engine_class_instance *eci, void *extra_args); +static void gpu_migration_test_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args); +static void for_each_gpu_pair (int num_gpus,struct xe_svm_gpu_info *gpus,struct drm_xe_engine_class_instance *eci,gpu_pair_fn fn,void *extra_args)
@@ -1258,6 +1268,206 @@ multigpu_access_test(struct xe_svm_gpu_info *gpu0,xe_vm_destroy (gpu1->fd, vm[1 ]); } +static void +multigpu_migrate_test (struct xe_svm_gpu_info *gpu0, +struct xe_svm_gpu_info *gpu1, +struct drm_xe_engine_class_instance *eci, +bool prefetch_req) +{ +uint64_t addr; +uint32_t vm[2 ]; +uint32_t exec_queue[2 ]; +uint32_t batch_bo, batch1_bo[2 ]; +uint64_t batch_addr, batch1_addr[2 ]; +struct drm_xe_sync sync = {}; +volatile uint64_t *sync_addr; +int value =60 ; +uint64_t *data1; +void *copy_dst; + + vm[0 ] =xe_vm_create (gpu0->fd,DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[0 ] =xe_exec_queue_create (gpu0->fd, vm[0 ], eci,0 ); +xe_vm_bind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,0 ,1ull << gpu0->va_bits,DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + vm[1 ] =xe_vm_create (gpu1->fd,DRM_XE_VM_CREATE_FLAG_LR_MODE |DRM_XE_VM_CREATE_FLAG_FAULT_MODE ,0 ); + exec_queue[1 ] =xe_exec_queue_create (gpu1->fd, vm[1 ], eci,0 ); +xe_vm_bind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,0 ,1ull << gpu1->va_bits,DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR ); + + data1 =aligned_alloc (SZ_2M ,SZ_4K ); +igt_assert (data1); + addr =to_user_pointer (data1); + + copy_dst =aligned_alloc (SZ_2M ,SZ_4K ); +igt_assert (copy_dst); + +xe_vm_madvise (gpu0->fd, vm[0 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , +DRM_XE_PREFERRED_LOC_DEFAULT_SYSTEM ,0 ,0 ); + +store_dword_batch_init (gpu0->fd, vm[0 ], addr, &batch1_bo[0 ], &batch1_addr[0 ], value); + +/* Place destination in GPU0 local memory location to test */ +xe_vm_madvise (gpu0->fd, vm[0 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu0->fd,0 , gpu0->vram_regions[0 ]); + + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +/* prefetch full buffer for GPU0 */ +if (prefetch_req) { +xe_vm_prefetch_async (gpu0->fd, vm[0 ],0 ,0 , addr,SZ_4K , &sync,1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,BIND_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); + } +free ((void *)sync_addr); + + sync_addr = (void *)((char *)batch1_addr[0 ] +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute STORE command on GPU0 */ +xe_exec_sync (gpu0->fd, exec_queue[0 ], batch1_addr[0 ], &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu0->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[0 ], +NSEC_PER_SEC *10 ); + +igt_assert_eq (*(uint64_t *)addr, value); + +/* Creating batch for GPU1 using addr as Src which have value from GPU0 */ +store_dword_batch_init (gpu1->fd, vm[1 ], addr, &batch1_bo[1 ], &batch1_addr[1 ], value +10 ); + +/* Place destination in GPU1 local memory location to test */ +xe_vm_madvise (gpu1->fd, vm[1 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu1->fd,0 , gpu1->vram_regions[0 ]); + + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +/* prefetch full buffer for GPU1 */ +if (prefetch_req) { +xe_vm_prefetch_async (gpu1->fd, vm[1 ],0 ,0 , addr, +SZ_4K , &sync,1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr,BIND_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); + } +free ((void *)sync_addr); + + sync_addr = (void *)((char *)batch1_addr[1 ] +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute COPY command on GPU1 */ +xe_exec_sync (gpu1->fd, exec_queue[1 ], batch1_addr[1 ], &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); + +igt_assert_eq (*(uint64_t *)addr, value +10 ); + +/* CPU writes 10, memset set bytes no integer hence memset fills 4 bytes with 0x0A */ +memset ((void *)(uintptr_t )addr,10 ,sizeof (int )); +igt_assert_eq (*(uint64_t *)addr,0x0A0A0A0A ); + +/* Creating batch for GPU1 using addr as Src which have value from GPU0 */ +batch_init (gpu1->fd, vm[1 ], addr,to_user_pointer (copy_dst), +SZ_4K , &batch1_bo[1 ], &batch1_addr[1 ]); + +/* Place destination in GPU1 local memory location to test */ +xe_vm_madvise (gpu1->fd, vm[1 ], addr,SZ_4K ,0 , +DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC , + gpu1->fd,0 , gpu1->vram_regions[0 ]); + + sync_addr =malloc (sizeof (*sync_addr)); +igt_assert (!!sync_addr); + sync.flags =DRM_XE_SYNC_FLAG_SIGNAL ; + sync.type =DRM_XE_SYNC_TYPE_USER_FENCE ; + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =BIND_SYNC_VAL ; + *sync_addr =0 ; + +/* prefetch full buffer for GPU1 */ +if (prefetch_req) { +xe_vm_prefetch_async (gpu1->fd, vm[1 ],0 ,0 , addr, +SZ_4K , &sync,1 , +DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC ); +if (*sync_addr !=BIND_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr,BIND_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); + } +free ((void *)sync_addr); + + sync_addr = (void *)((char *)batch1_addr[1 ] +SZ_4K ); + sync.addr =to_user_pointer ((uint64_t *)sync_addr); + sync.timeline_value =EXEC_SYNC_VAL ; + *sync_addr =0 ; + +/* Execute COPY command on GPU1 */ +xe_exec_sync (gpu1->fd, exec_queue[1 ], batch1_addr[1 ], &sync,1 ); +if (*sync_addr !=EXEC_SYNC_VAL ) +xe_wait_ufence (gpu1->fd, (uint64_t *)sync_addr,EXEC_SYNC_VAL , exec_queue[1 ], +NSEC_PER_SEC *10 ); + +igt_assert_eq (*(uint64_t *)copy_dst,0x0A0A0A0A ); + +munmap ((void *)batch1_addr[0 ],BATCH_SIZE (gpu0->fd)); +munmap ((void *)batch1_addr[1 ],BATCH_SIZE (gpu1->fd)); +batch_fini (gpu0->fd, vm[0 ], batch1_bo[0 ], batch1_addr[0 ]); +batch_fini (gpu1->fd, vm[1 ], batch1_bo[1 ], batch1_addr[1 ]); +free (data1); +free (copy_dst); + +xe_vm_unbind_lr_sync (gpu0->fd, vm[0 ],0 ,0 ,1ull << gpu0->va_bits); +xe_exec_queue_destroy (gpu0->fd, exec_queue[0 ]); +xe_vm_destroy (gpu0->fd, vm[0 ]); + +xe_vm_unbind_lr_sync (gpu1->fd, vm[1 ],0 ,0 ,1ull << gpu1->va_bits); +xe_exec_queue_destroy (gpu1->fd, exec_queue[1 ]); +xe_vm_destroy (gpu1->fd, vm[1 ]); +} + +static void +gpu_atomic_inc (struct xe_svm_gpu_info *src_gpu, +struct xe_svm_gpu_info *dst_gpu, +struct drm_xe_engine_class_instance *eci, +bool prefetch_req) +{ +igt_assert (src_gpu); +igt_assert (dst_gpu); + +atomic_inc_op (src_gpu, dst_gpu, eci, prefetch_req); +} + +static void +gpu_coherecy_test (struct xe_svm_gpu_info *src_gpu, +struct xe_svm_gpu_info *dst_gpu, +struct drm_xe_engine_class_instance *eci, +bool coh_fail, +bool prefetch_req) +{ +igt_assert (src_gpu); +igt_assert (dst_gpu); + +coherency_test_multigpu (src_gpu, dst_gpu, eci, coh_fail, prefetch_req); +} + static void gpu_conflict_test_wrapper(struct xe_svm_gpu_info *src, struct xe_svm_gpu_info *dst,
@@ -1310,6 +1520,19 @@ gpu_simult_test_wrapper(struct xe_svm_gpu_info *src,multigpu_access_test (src, dst, eci, args->prefetch_req); } +static void +gpu_migration_test_wrapper (struct xe_svm_gpu_info *src, +struct xe_svm_gpu_info *dst, +struct drm_xe_engine_class_instance *eci, +void *extra_args) +{ +struct multigpu_ops_args *args = (struct multigpu_ops_args *)extra_args; +igt_assert (src); +igt_assert (dst); + +multigpu_migrate_test (src, dst, eci, args->prefetch_req); +} + igt_main {struct xe_svm_gpu_info gpus[MAX_XE_GPUS ];
@@ -1396,6 +1619,14 @@ igt_mainfor_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_simult_test_wrapper, &simul_args); } + igt_subtest("migrate-test-multi-gpu") { +struct multigpu_ops_args migrate_args; + migrate_args.prefetch_req =1 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_migration_test_wrapper, &migrate_args); + migrate_args.prefetch_req =0 ; +for_each_gpu_pair (gpu_cnt, gpus, &eci, gpu_migration_test_wrapper, &migrate_args); + } + igt_fixture {int cnt;
tests/intel/xe_multisvm.c +2 -0
@@ -47,6 +47,7 @@ struct xe_svm_gpu_info {int fd; }; +#if 0 static void xe_vm_bind_lr_sync (int fd,uint32_t vm,uint32_t bo,uint64_t offset,uint64_t addr,uint64_t size,uint32_t flags) {
@@ -84,6 +85,7 @@ static void xe_vm_unbind_lr_sync(int fd, uint32_t vm, uint64_t offset,xe_wait_ufence (fd, (uint64_t *)sync_addr,BIND_SYNC_VAL ,0 ,NSEC_PER_SEC *10 ); free((void *)sync_addr); } +#endif static void batch_init (int fd,uint32_t vm,uint64_t src_addr,uint64_t dst_addr,uint64_t copy_size,uint32_t *bo,uint64_t *addr)
Signature · 1 line
2.48.1
Re: [PATCH i-g-t v5 8/8] tests/intel/xe_multi-gpusvm.c: Add SVM multi-GPU migration test
Hi nishit.sharma,
Quoted 1 line · On 2025-11-11 at 16:34:56 +0000, [email protected] wrote:
From: Nishit Sharma <[email protected]>
in subject s/-/_/, s/.c:/c:/, also imho s/multi_gpusvm/multigpu_svm/ so it will be:
[PATCH i-g-t v5 8/8] tests/intel/xe_multigpu_svm: Add SVM multi-GPU migration test
Regards,
Kamil
Quoted 4 lines
This test allocates a buffer in SVM, accesses it from GPU 1, then GPU 2 and then the CPU. It verifies that the buffer migrates correctly between devices and remains accessible across all agents in a multi-GPU environment.
This should also work for only one dGPU and CPU. One more argument to place all multi-gpu subtests in one xe_svm.c? Unless cases for two or more dGPU are all that complicated?
Regards,
Kamil
Quoted 19 lines
--- tests/intel/xe_multi_gpusvm.c | 231 ++++++++++++++++++++++++++++++++++ tests/intel/xe_multisvm.c | 2 + 2 files changed, 233 insertions(+)tests/intel/xe_multi_gpusvm.c +5
-0@@ -64,6 +64,11 @@* Description: * This test checks conflicting madvise by allocating shared buffer * prefetches from both and checks for migration conflicts +* +* SUBTEST: migrate-test-multi-gpu +* Description: +* This test allocates an SVM buffer, accesses it from GPU 1, GPU 2, and CPU, +* and verifies migration and accessibility between devices */
[cut]
Patchwork
CI✗ Fi.CI.BUILD: failure for Madvise feature in SVM for Multi-GPU configs (rev4)
In reply to [email protected]== Series Details ==
== Series Details ==
Series: Madvise feature in SVM for Multi-GPU configs (rev4)
URL : https://patchwork.freedesktop.org/series/157019/
State : failure
== Summary ==
Applying: tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU cross-GPU memory access test Patch failed at 0001 tests/intel/xe_multi_gpusvm.c: Add SVM multi-GPU cross-GPU memory access test When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".