fix(k8s): merge accelerator-devices over the defaults and add shared GPU entries by samhita-alla · Pull Request #8163 · flyteorg/flyte · GitHub
Skip to content

fix(k8s): merge accelerator-devices over the defaults and add shared GPU entries - #8163

Open
samhita-alla wants to merge 1 commit into
mainfrom
accelerator-devices-merge-defaults
Open

samhita-alla wants to merge 1 commit into
mainfrom
accelerator-devices-merge-defaults

Conversation

@samhita-alla

@samhita-alla samhita-alla commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Why are the changes needed?

Setting accelerator-devices in the k8s plugin config is close to unusable today. The config loader replaces the whole default map rather than merging into it, so adding one entry drops every built-in device. Viper also lowercases plain map keys, and since the lookup in GetNormalizedAcceleratorDevice upper-cases the device name, a configured key like T4 is stored as t4 and never matches.

There's also no default entry for time-sliced or MPS-shared GPUs. A cluster that runs shared GPU pools can label those nodes with a distinct accelerator value, so a task asking for "T4 shared" lands only on the shared pool and a task asking for "T4" keeps getting a whole card.

What changes were proposed in this pull request?

  • GetK8sPluginConfig now merges the configured accelerator-devices entries over the built-in defaults, with every key upper-cased so it matches the upper-cased lookup. The defaults are upper-cased once at package init. A configured entry wins over a default with the same name, and anyone who doesn't set the map gets the same defaults as before.
  • New default entries for shared GPUs, each one the plain model's label plus -shared: T4 SHARED, L4 SHARED, A10G SHARED, A10 SHARED and L40S SHARED.

Because default keys are now upper-cased too, the existing L40s entry resolves for the first time. Before this change it could never match the upper-cased lookup, so a task asking for L40s got the raw string as its node label instead of nvidia-l40s.

How was this patch tested?

New unit tests in flytek8s/utils_test.go cover a partial override keeping the defaults, lowercase configured keys resolving, the mixed-case L40s default resolving, and each shared name resolving to its shared label. TestLoadConfig now loads an accelerator-devices entry through the real viper loader and checks that the override applies and the defaults survive. That assertion fails without the fix.

go test ./flyteplugins/... passes, and golangci-lint reports no new issues on the changed packages.

Labels

  • fixed
  • added

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

🤖 Generated with Claude Code

…GPU entries

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
@samhita-alla
samhita-alla marked this pull request as ready for review October 14, 2026 05:52
EngHabu added a commit that referenced this pull request Oct 14, 2026
Signed-off-by: Haytham Abuelfutuh <haytham@afutuh.com>
cosmicbboy added a commit to flyteorg/flyte-sdk that referenced this pull request Oct 18, 2026
flyte.GPU("RTX_PRO_6000", n, partition=...) now accepts and validates
the RTX PRO 6000 Blackwell Server Edition MIG profiles: 1g.24gb, 2g.48gb
and 4g.96gb. They are exposed as RTXPro6000Parts next to the existing
A100, H100 and H200 partition types. The +gfx and +me profiles are left
out because the backend turns the partition into a node label value, and
label values cannot contain "+". The -me profiles (1g.24gb-me,
2g.48gb-me) are left out until the backend can parse them.

The GPU device type also gains shared devices: "T4 shared", "L4 shared",
"A10G shared", "A10 shared" and "L40S shared", grouped as SharedGPUType.
A "<model> shared" device requests time-sliced (or MPS) capacity, a
share of one physical GPU on a node pool that advertises the shared
accelerator for that model, so several tasks can run on the same GPU at
once. A plain "<model>" request never lands on such a pool. A shared
device takes no partition, and it works in the Resources string form too
(gpu="T4 shared:1"). The SDK sends the device name as written. The
shared names keep the space, unlike the underscore device names, because
the backend accelerator mapping uses that spelling. These devices need a
backend whose accelerator mapping includes the shared names, which comes
with flyteorg/flyte#8163 (flyteorg/flyte#8163).

Three short examples are added under examples/accelerators. Each one
only sets the GPU request, and the backend's accelerator and partition
node selectors do the rest.

- mig_slice.py runs a task on one 1g.24gb slice of an RTX PRO 6000.
- mig_mixed.py runs two 1g.24gb tasks and one 2g.48gb task, which fit on
one GPU under the MIG strategy mixed with the all-balanced layout.
- gpu_shared.py runs three tasks that share one T4 through gpu="T4
shared:1".

Test plan

- uv run pytest tests/user_api/test_resources.py
tests/internal/runtime/test_resources_serde.py (188 passed), covering
valid and invalid RTX PRO 6000 partitions, the partition_size sent to
the backend, the shared devices, and the error for a shared device with
a partition
- ruff check and ruff format --check pass on the changed files, and all
three examples import
- Ran RTX PRO 6000 MIG slices under the single and mixed strategies, and
shared T4 tasks, on a cluster with those node pools

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Niels Bantilan <niels.bantilan@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant