The floor
What the kernel compute device asks of a program that
has no GPU userspace under it.
Unit 1 holds two file descriptors: every ioctl goes to
/dev/kfd, and the render node only gives the fd for ACQUIRE_VM and the
host views of buffers.
The "floor" is the lowest level interface for accessing compute.
On this machine, it is the kernel character device /dev/kfd.
A userspace runtime sits above /dev/kfd, hiding it.
redbluegreen starts below that runtime in order to
optimize model training for the constraints of this box.
This unit does four things in order:
- It reads gpu_id
from the sysfs topology. It skips each node with gpu_id 0.
- It opens both device nodes.
- It calls GET_VERSION.
- It calls ACQUIRE_VM with the render fd and the gpu_id.
The compute device takes every ioctl and serves the
doorbells and event page.
The render node gives the fd ACQUIRE_VM needs and carries the host
view of each buffer.
RUNTIME_ENABLE is called once per process,
before any queue. The kernel comment says that MES uses this call to clear a stale process
context.
Even though redbluegreen is trying to minimize
dependencies, it cannot avoid three:
- The driver header defines every struct.
- An assembler builds gfx1151 machine code.
- libc supplies ioctl and
mmap.
Sources
docs/floor.md
docs/queue.md
kfd_ioctl.h, the driver uapi header
libhsakmt, the vendor thunk source