Report per-GPU memory at container instance registration#5061
Open
harishxr wants to merge 1 commit into
Open
Conversation
harishxr
marked this pull request as ready for review
July 24, 2026 05:45
harishxr
force-pushed
the
mps-ec2-rci-memory
branch
from
July 24, 2026 16:55
c6c8dc3 to
5fb5ba5
Compare
harishxr
enabled auto-merge (rebase)
July 24, 2026 17:19
ecs-init discovers per-GPU usable memory via NVML and the agent reports it in the PlatformDevice.gpuInfo field so the control plane can place GPU instances by available memory.
harishxr
force-pushed
the
mps-ec2-rci-memory
branch
from
July 24, 2026 17:23
5fb5ba5 to
cb88dff
Compare
amogh09
approved these changes
Jul 24, 2026
| Type: types.PlatformDeviceTypeGpu, | ||
| }) | ||
| } | ||
| if memMiB, ok := n.GPUMemoryMiB[gpuID]; ok { |
Contributor
There was a problem hiding this comment.
What is the case when memory could be missing?
Contributor
Author
There was a problem hiding this comment.
Potential cases:
- NVML does not return a response due to some reason when we query for memory, memory will be missing in such a case.
- Agent version is newer than init version, ecs-init will not be able to write the gpuMemory to the gpu info file where agent reads from. In that case, memory will be empty as well.
Comment on lines
+250
to
+251
| seelog.Errorf("Failed to get UUID for device at index %d during memory detection: %v", i, nvml.ErrorString(ret)) | ||
| continue |
Contributor
There was a problem hiding this comment.
We should think about how we can better surface such errors to customers. Silently registering less capacity is not ideal.
Contributor
There was a problem hiding this comment.
Can this mismatch be caught in DescribeContainerInstances response vs EC2 DescribeInstances or something like that?
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
ecs-init discovers per-GPU usable memory (NVML v2 Total - Reserved) during Setup and persists it as a UUID->MiB map in the GPU info file. The agent loads the map and populates PlatformDevice.GpuInfo.MemoryInMiB when building
the RegisterContainerInstance payload, so the control plane can size GPUs for MPS memory-based placement.
Implementation details
Backward compatible and additive: the field is omitempty on both sides, so older agents/hosts that do not report it send nothing, and the control plane treats it as optional.
Testing
nvidia-gpu-info.jsonGPUMemoryMiB = 22563, matching nvidia-smi (23034 total - 471 reserved).New tests cover the changes: yes
Description for the changelog
Enhancement - Report per-GPU memory at container instance registration for GPU sharing
Additional Information
Does this PR include breaking model changes? If so, Have you added transformation functions? No
Does this PR include the addition of new environment variables in the README? No
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.