[PATCH i-g-t v1 0/2] tests/amdgpu: add SVM (shared virtual memory) test suite

Junhua Shen <[email protected]>
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
This series adds IGT coverage for the amdgpu SVM (shared virtual memory)
uAPI, which exposes HMM-based unified virtual memory to user space
through the amdgpu render node CS path (DRM_IOCTL_AMDGPU_GEM_SVM).
Until now, SVM has only been testable via the KFD/ROCm stack; this
brings equivalent coverage to the DRM render-node interface.

The work is split into two patches so the reusable pieces land
independently of the test:

  1. lib/amdgpu: a small helper library (lib/amdgpu/amd_svm.{c,h})
     wrapping the SVM register/prefetch ioctls and the compute/SDMA
     submission needed to touch SVM ranges, plus the amdgpu_drm.h uAPI
     sync and meson wiring.

  2. tests/amdgpu: the amd_svm test itself, with subtests covering
     system- and VRAM-backed allocation, prefetch, CPU<->GPU migration
     and access-in-place, range split/merge, partial unmap, eviction of
     system ranges, and VRAM overcommit. Most subtests are adapted from
     the KFD SVM test suite (KFDSVMRangeTest) and ported to the amdgpu
     render-node CS path.

Testing:
  Run on a VEGA20 (GFX9) dGPU against an amdgpu kernel with the SVM
  uAPI applied, with XNACK enabled. The suite passes except for two
  expected cases:
    - set-get-attributes: fails due to a known kernel-side stale 
      attribute reporting issue (kept to track the fix).
    - read-only-range: skipped, as the kernel write-fault path is not
      yet safe to exercise.

Dependency:
  This series depends on the amdgpu SVM kernel support: the new uAPI
  (DRM_IOCTL_AMDGPU_GEM_SVM) together with its amdgpu driver
  implementation built on the DRM GPUSVM framework.

  Its userspace entry point is provided by libdrm (amdgpu_svm_*
  wrappers in libdrm_amdgpu); the amd_svm helper library in patch 1
  builds on top of that, and its bundled amdgpu_drm.h mirrors the
  kernel uAPI.

  Kernel series (uAPI + amdgpu DRM SVM implementation):
    https://lore.kernel.org/all/[email protected]/
  libdrm support (userspace DRM_IOCTL_AMDGPU_GEM_SVM wrappers):
    https://gitlab.freedesktop.org/mesa/libdrm/-/merge_requests/485

Junhua Shen (2):
  lib/amdgpu: add SVM helper library and uAPI
  tests/amdgpu: add SVM test suite

 include/drm-uapi/amdgpu_drm.h |  106 ++
 lib/amdgpu/amd_svm.c          |  215 ++++
 lib/amdgpu/amd_svm.h          |   42 +
 lib/meson.build               |    1 +
 tests/amdgpu/amd_svm.c        | 2184 +++++++++++++++++++++++++++++++++
 tests/amdgpu/meson.build      |    1 +
 6 files changed, 2549 insertions(+)
 create mode 100644 lib/amdgpu/amd_svm.c
 create mode 100644 lib/amdgpu/amd_svm.h
 create mode 100644 tests/amdgpu/amd_svm.c


base-commit: 0385a3845f2b29c202df21ebe7928462c98536f5
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.