Repository navigation
feat(amd): mock HAMi vGPU resources from node annotations - #27
spencercjh wants to merge 3 commits into
Conversation
Signed-off-by: spencercjh <spencercjh@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: spencercjh The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Warning Review limit reachedNext included review available in 16 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Local K3s test: AMD vGPUTested with the released HAMi chart Setup
Documented MI300X capacity: FAILThe Mock correctly calculated and logged: However, the kubelet rejected the memory device-plugin response: The resulting Node status was therefore: {
"amd.com/gpu": "1",
"amd.com/gpucores": "100",
"amd.com/gpumem": "0"
}So the README MI300X example ( Smaller capacity and Scheduler path: PASSFor a separate control run, I changed only {
"hami.io/node-amd-register": "[{...AMD-MOCK-0...devmem:32768...}]",
"amd.com/gpu": "1",
"amd.com/gpumem": "32768",
"amd.com/gpucores": "100"
}I created this Pod: resources:
limits:
amd.com/gpu: "1"
amd.com/gpumem: "512"
amd.com/gpucores: "50"It was This confirms the annotation decoding, resource registration, Node presentation, and HAMi scheduling path work for a capacity below the gRPC message limit. The documented MI300X 196608 MiB case is still a real failure and needs a representation that does not create one mock device per MiB. I did not change product code. The test cluster was removed after collecting the result. |
Signed-off-by: spencercjh <spencercjh@gmail.com>
Signed-off-by: spencercjh <spencercjh@gmail.com>
|
Old PRs and issues are being closed because they are no longer relevant. Or it was closed because of th |
Most of this Pull Request was generated or revised with the assistance of AI tools(Raft with GPT-5.6 Sol High). I have reviewed the resulting content and take full responsibility for its accuracy, security, licensing compliance, and inclusion in this project.
Important
Mock-only limitation: this PR does not provide full-capacity MI300X mocking. A real MI300X reports about
196288 MiB; the generic mock expands that into 196288 Device Plugin API objects, so kubelet rejects the roughly 6.76 MiBListAndWatchresponse at its default 4 MiB gRPC limit. The released AMD device plugin does not use this representation: it registers ten logicalamd.com/gpusplits per physical card and carries full memory/CU values in the Node annotation. This limitation therefore applies to this mock implementation, not to the real AMD plugin or, by itself, to HAMi Scheduler.The 32 GiB example in this PR is only a transport-safe smoke test for annotation decoding, mock resource registration, and Scheduler Filter/Bind. It must not be cited as full MI300X capacity coverage.
What
hami.io/node-amd-registerJSON annotation decodingcommonWordcollisionsWhy
The previous AMD mock inferred a fixed device model and capacity from the count resource. That diverges from HAMi's current AMD scheduling contract and cannot represent the device inventory described by the Node annotation. This change makes the reducer consume the same device facts that HAMi schedules against, while explicitly retaining the generic mock transport limitation above.
AMD resource semantics
amd.com/gpu) remains an external health gate; the mock does not recreate or sum itcount: 10and advertises tenamd.com/gpusplits per physical card; examples and fixtures preserve that scheduling contractgpumemis the sum ofdevmemfor healthy annotation entries only100togpucores, because HAMi exposes AMD core requests as percentagesdevcoreremains the physical CU count used by the Scheduler to convert percentages into CUsKnown blocker: full MI300X memory in the mock
This Draft does not provide a valid full-memory MI300X mock. The released AMD device plugin reports roughly
196288 MiBfor one MI300X VF. The generic mock represents each scalar MiB as one Device Plugin API object, producing a roughly 6.76 MiBListAndWatchresponse; kubelet's default gRPC receive limit is 4 MiB, so it dropsamd.com/gpumemand the Node shows0.Shortening mock IDs can make one card fit but fails again for multiple cards; splitting
ListAndWatchis invalid because every response must be complete. Under the current scalar-resource design, preserving MiB semantics requires a matching AMDmemoryFactorin both HAMi Scheduler and this mock, or a different end-to-end representation. This PR implements neither. Until that contract exists, use the reduced 32 GiB fake inventory only for the limited smoke scope stated above.Impact
AMD mocking is enabled when all three AMD resource names are configured. An entirely empty AMD block remains disabled; partial, invalid, mixed-vendor, duplicate-resource, or conflicting configurations fail closed before replacing the global device map. Existing NVIDIA, Hygon, and Ascend behavior is unchanged.
Validation
go test ./...on Go 1.21 and the host toolchaingo test -race ./...go vet ./...golangci-lintgofmt -dgit diff --checkK3s v1.32.5 + HAMi v2.10.0 E2E confirmed both sides of the mock boundary: a nominal MI300X annotation failed at exactly
6,770,170 > 4,194,304bytes before Scheduler participation, while a separate 32 GiB control run registered all AMD resources and scheduled a Pod toRunning; its50%core request was correctly converted to152of the annotation's304physical CUs.