Repository navigation
Description
Component
fractiond
Problem or use case
KAI can place fractional GPU pods on AMD GPUs with the changes discussed in kai-scheduler/KAI-Scheduler#2556. On NVIDIA, fractiond makes the memory share binding: it injects NVIDIA_GPU_MEMORY_LIMIT, and the driver enforces it. AMD has no driver-side memory limit, so an AMD fraction can only be capped inside the framework, e.g. with PyTorch's per_process_memory_fraction. That cap is soft. In our lab, a pod that lifted it took 23 GiB of a 22.5 GiB share while it shared the GPU with a 20 GiB neighbour.
Proposed solution
Add an AMD backend to fractiond, chosen with --gpu-vendor=amd (env GPU_VENDOR; the default stays nvidia). It uses the Linux dmem cgroup controller (Linux 6.14+, amdgpu):
- On
CreateContainer, read the GPU's PCI address and the pod's share from the binder's annotations. - Check that the GPU's region
drm/<pci address>/vramis listed in/sys/fs/cgroup/dmem.capacity. - Enable
dmemincgroup.subtree_controlfrom the root down to the pod's parent, wherever it is not on yet. The kubelet usually has it on already. - Write
dmem.max = drm/<pci address>/vram <share × VRAM>on the pod cgroup.
Once a pod passes its share, hipMalloc (and HSA) allocations fail with an out-of-memory error. Other pods on the same GPU are not affected.
If the cap cannot be set, the container is refused, unless --fail-open is set, as on NVIDIA. Retroactive enforcement stays NVIDIA-only.
We have a working implementation: https://github.com/openinferencefabric/gpu-fractioning/tree/main/fractioning-manager/fractiond/internal/amd. It is a fork of this repository: about 190 lines of Go, plus unit tests on fake cgroup and sysfs trees. The README explains how each NVIDIA piece maps to AMD: docs/amd/README.md.
Lab result, 2026-11-03: Radeon PRO W7900 (48 GB), kernel 7.0, KAI places the pods, with test/amd/quick-dmem-cap.sh:
| Pod (share) | Cap set by fractiond | Allocated |
|---|---|---|
| 0.25 pod, plugin off | none | 30,720 MiB of 30 GiB asked |
| 0.25 pod, plugin on | 11,516 MiB | 11,264 MiB, then out of memory |
| 0.5 neighbour on the same GPU | 23,032 MiB | 20,480 MiB of 20 GiB asked |
Alternatives considered
- Framework caps (PyTorch
per_process_memory_fraction, vLLM--gpu-memory-utilization): soft, and a workload can lift them. - GPU partitions (Instinct compute and memory partitions): only on Instinct GPUs, at a fixed granularity. Workstation and consumer GPUs have none.
HSA_CU_MASK: limits compute units, not memory, and only the process can set it on itself.
Compatibility and operational impact
- No change for NVIDIA; the AMD path runs only with
--gpu-vendor=amd. - Needs cgroup v2 and Linux 6.14+ with
amdgpu. On older kernels the region is missing fromdmem.capacity, and the container is refused unless--fail-openis set. hipMemGetInfostill reports the whole GPU inside the cap ([Feature]: hipMemGetInfo and the HSA memory pool size ignore the cgroup dmem.max VRAM limit ROCm/rocm-systems#14860), so frameworks should keep their own fraction setting to size their pools.- The annotation names (
oif.ai/amd-gpu,oif.ai/amd-gpu-fraction) follow our KAI binder patch. They would become whatever names KAI chooses in feat: GPU fractions on AMD GPU nodes (amd.com/gpu) KAI-Scheduler#2556. - AMD has no MPS equivalent, so
mpsdand SM sharing are not ported.metricsdcould read memory per pod fromdmem.current. ROCm has no per-process compute time yet ([Feature]: Per-process compute busy time for KFD queues (per-container GPU utilization) ROCm/rocm-systems#14861).
Additional context
- Design questions for the AMD fraction path in KAI: feat: GPU fractions on AMD GPU nodes (amd.com/gpu) KAI-Scheduler#2556.
- We would like to contribute this as a pull request with signed-off commits once the approach and the annotation names are agreed.
Confirmations
- I searched open and closed issues and did not find a duplicate.
- I agree to follow this project's Code of Conduct.
Activity
manmohanbrahma commentedon Nov 3, 2026
I've opened #175 with a reworked version of this proposal, aimed at a merge.
What changed since the issue:
gpu-memory.request/.limit/.gpus.devicescontract. For AMD GPUs,gpus.devicesholds the GPUs' PCI addresses.dmem.maxanddmem.minon the container's cgroup, set withlinux.resources.unified. fractiond no longer writes the host's cgroup tree, and needs no extra privileges.Two questions where your direction would help:
nvidia.com/container.(configurable), or a vendor-neutral default?gpus.devices. For AMD fractions, KAI would write PCI addresses there (feat: GPU fractions on AMD GPU nodes (amd.com/gpu) KAI-Scheduler#2556). Would you like that proposed as a KAI PR next?