Skip to content

[Feature]: AMD GPU backend for fractiond — hard VRAM cap with the Linux dmem cgroup #173

Description

@manmohanbrahma

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):

  1. On CreateContainer, read the GPU's PCI address and the pod's share from the binder's annotations.
  2. Check that the GPU's region drm/<pci address>/vram is listed in /sys/fs/cgroup/dmem.capacity.
  3. Enable dmem in cgroup.subtree_control from the root down to the pod's parent, wherever it is not on yet. The kubelet usually has it on already.
  4. 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

Additional context

Confirmations

  • I searched open and closed issues and did not find a duplicate.
  • I agree to follow this project's Code of Conduct.

Activity

  1. manmohanbrahma commented on Nov 3, 2026

    @manmohanbrahma
    Author

    I've opened #175 with a reworked version of this proposal, aimed at a merge.

    What changed since the issue:

    • No new annotations. fractiond reads the existing gpu-memory.request / .limit / .gpus.devices contract. For AMD GPUs, gpus.devices holds the GPUs' PCI addresses.
    • Per container, through NRI. The limit and request become dmem.max and dmem.min on the container's cgroup, set with linux.resources.unified. fractiond no longer writes the host's cgroup tree, and needs no extra privileges.
    • Lab result on a Radeon PRO W7900 (kernel 7.0):
      • a container with an 11516Mi limit was stopped at 11,264 MiB;
      • its neighbour on the same GPU allocated its 20 GiB;
      • the pod cgroup stayed uncapped.

    Two questions where your direction would help:

    1. Annotation prefix on AMD nodes: keep nvidia.com/container. (configurable), or a vendor-neutral default?
    2. The KAI side: on a Run:ai cluster only KAI's binder may write 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?
  2. added
    priority/P2
    on Nov 5, 2026
  3. added theissue type on Nov 10, 2026
  4. removed
    priority/P2
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions