Skip to content

Pr/gpu soft quota#6

Open
limes22 wants to merge 6 commits into
Project-HAMi:mainfrom
limes22:pr/gpu-soft-quota
Open

Pr/gpu soft quota#6
limes22 wants to merge 6 commits into
Project-HAMi:mainfrom
limes22:pr/gpu-soft-quota

Conversation

@limes22

@limes22 limes22 commented Jun 15, 2026

Copy link
Copy Markdown

A series of enhancements to ensure that libvgpu is actually enforced in KAI shared pods, including: existing gpu-memory support, VRAM capping via gpu-fraction, automatic per-GPU VRAM node label detection through an informer, and an env-bypass guard for NVIDIA_VISIBLE_DEVICES.

limes22 and others added 6 commits June 15, 2026 07:27
KAI binder sets the gpu-memory annotation (MiB) on shared pods but never passes
CUDA_DEVICE_MEMORY_LIMIT, which HAMi-core (libvgpu) reads to enforce the per-pod
GPU memory cap. As a result libvgpu loads via ld.so.preload but enforces nothing
(nvidia-smi shows full device memory) on KAI fractional-sharing pods.

This makes the mutating webhook translate the gpu-memory annotation into
CUDA_DEVICE_MEMORY_LIMIT=<value>m on every (init)container (skipping containers
that already set it, and handling the empty-env case), so libvgpu enforces the
requested cap. gpu-fraction carries no absolute memory value and is left untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: limes22 <limes22@users.noreply.github.com>
Builds on the gpu-memory injection: gpu-fraction pods loaded libvgpu but
received no CUDA_DEVICE_MEMORY_LIMIT, so nvidia-smi showed full device
memory. Translate gpu-fraction into an absolute cap = fraction x per-GPU
VRAM.

Per-GPU VRAM is autodetected from the nvidia.com/gpu.memory node label
(minimum across GPU nodes for heterogeneous clusters; PER_GPU_VRAM_MIB env
overrides). If undetectable, gpu-fraction caps are skipped rather than
guessed. gpu-memory handling is unchanged. Adds nodes read RBAC.

Signed-off-by: limes22 <limes22@users.noreply.github.com>
Replace the 10-minute time.Ticker poll with a client-go SharedInformer on
Nodes: recompute the gpu-fraction VRAM basis on node add/update/delete events,
reading from the informer cache (lister) instead of repeated List calls.
Blocks until cache sync at startup. Fraction-cap math and gpu-memory path
unchanged.

Signed-off-by: limes22 <limes22@users.noreply.github.com>
…AC, PER_GPU_VRAM_MIB override)

Single 'helm install' works with no manual --set or separate kubectl apply.
Chart 0.1.0 -> 0.2.0.

Signed-off-by: limes22 <limes22@users.noreply.github.com>
…nforce)

ACCEPT_NVIDIA_VISIBLE_DEVICES_ENVVAR_WHEN_UNPRIVILEGED=true (needed for KAI
fractional sharing) lets any unprivileged GPU-runtime pod grab GPUs via the
NVIDIA_VISIBLE_DEVICES env, bypassing allocation. The webhook now neutralizes
it (=void) on pods that use a GPU runtimeClass but are not authorized
(KAI share annotation, kai.scheduler/queue label, managed-by=gpu-operator, or
a trusted namespace). Mode off/audit/enforce, default audit (log-only) so a
wrong allowlist can't break system pods before it's observed.

Signed-off-by: limes22 <limes22@users.noreply.github.com>
Revert deployment-specific defaults (personal Docker Hub image, GPU-node
nodeSelector, appVersion) back to upstream values. The new feature options
(perGpuVramMiB, nvidiaVisibleDevicesGuard, nodes-autodetect RBAC) remain with
neutral defaults so the chart stays generic.

Signed-off-by: limes22 <limes22@users.noreply.github.com>
@hami-robot hami-robot Bot requested a review from archlitchi June 15, 2026 07:31
@hami-robot

hami-robot Bot commented Jun 15, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: limes22
Once this PR has been reviewed and has the lgtm label, please assign archlitchi for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hami-robot hami-robot Bot added the size/XL label Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant