app-service: honor limitedGpu as the HAMi nvidia.com/gpumem cap - #3581
Open
mvanhorn wants to merge 1 commit into
Open
app-service: honor limitedGpu as the HAMi nvidia.com/gpumem cap#3581mvanhorn wants to merge 1 commit into
mvanhorn wants to merge 1 commit into
Conversation
The app-service admission webhook derived the HAMi nvidia.com/gpumem value from requiredGpu (the scheduling floor) rather than limitedGpu (the runtime cap the app may use). A chart setting a conservative requiredGpu therefore hard-capped the container VRAM and silently ignored limitedGpu, preventing larger models from loading. Extract the derivation into a testable hamiGPUMemoryLimit helper that prefers limitedGpu when set and falls back to requiredGpu, mirroring the FitLevelLimit convention in pkg/compute/scheduler.go. Refs beclab#3213
|
@mvanhorn is attempting to deploy a commit to the Lucky's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Derive the HAMi
nvidia.com/gpumemvalue the app-service admission webhook injects from the manifest'slimitedGpu(the runtime cap the app may use) instead ofrequiredGpu(the scheduling floor), falling back torequiredGpuwhenlimitedGpuis unset. Charts that do not setlimitedGpukeep their current behavior exactly.Background
When
applications.app.bytetrade.io/gpu-injectis set, the webhook injectsnvidia.com/gpumemfor HAMi-managed workloads. The value was computed fromrequiredGpu, so a chart that sets a conservative floor such asrequiredGpu: 1Gihard-caps the container at 1 GB of VRAM and silently ignoreslimitedGpu: 24Gi; a larger model then fails to load with no clear signal.requiredGpuis meant to be the scheduling minimum andlimitedGputhe maximum the app is allowed to consume, so the runtime memory cap should come fromlimitedGpuwhen it is set. This mirrors the existingFitLevelLimitconvention inpkg/compute/scheduler.go, wheretargetGPU/levelMemoryalready preferLimitedGPUoverRequiredGPUat the limit level and the scheduler tries that level first.Changes
limitedGpu(when greater than zero) overrequiredGpufor the injectednvidia.com/gpumemcap, still injecting nothing when neither is positive.hamiGPUMemoryLimit) so it is unit-testable without a live admission request.limitedGpu > requiredGpu,limitedGpuunset (falls back torequiredGpu), both zero (returns nil), andlimitedGpu == requiredGpu.Scope is limited to
framework/app-service/pkg/apiserver/handler_webhook.goand a newhandler_webhook_test.go.Testing
gofmt,go vet,go build, andgo testall pass forpkg/apiserver.Related issues
Refs #3213
Note: issue #3213 also describes a second, separate problem (a hardcoded
release_early_check_intervalinside the proprietarylibvgpu.so). That value lives only in a compiled shared object with no source in this repository, so it is out of scope here; this PR addresses only the webhook memory-cap derivation.Note
Medium Risk
Changes admission-time GPU memory limits for HAMi workloads, which affects scheduling and runtime VRAM caps; behavior is unchanged when limitedGpu is unset.
Overview
For HAMi GPU injection, the gpu-limit admission webhook now sets
nvidia.com/gpumemfromlimitedGpuwhen it is positive, otherwiserequiredGpu, instead of always usingrequiredGpu. That aligns the runtime VRAM cap with the scheduler’sFitLevelLimitbehavior so a low scheduling floor no longer silently caps workloads that declare a higher limit.The byte-to-MiB conversion moves into
hamiGPUMemoryLimit, which returns nil when neither GPU field is positive (no gpumem patch). HAMi mode no longer skips that helper when only the limit path would apply—the outer check isIsHAMIModeonly. Table-driven tests cover limit > required, fallback, both zero, and equal values.Reviewed by Cursor Bugbot for commit 016c96f. Bugbot is set up for automated code reviews on this repo. Configure here.