|
| 1 | +--- |
| 2 | +title: GPU Sharing Isolation Level |
| 3 | +authors: |
| 4 | + - "@zqzten" |
| 5 | +reviewers: |
| 6 | + - "@ZiMengSheng" |
| 7 | + - "@hormes" |
| 8 | +creation-date: 2025-05-23 |
| 9 | +last-updated: 2025-05-23 |
| 10 | +--- |
| 11 | + |
| 12 | +# GPU Sharing Isolation Level |
| 13 | + |
| 14 | +## Table of Contents |
| 15 | + |
| 16 | +<!-- TOC --> |
| 17 | +* [GPU Sharing Isolation Level](#gpu-sharing-isolation-level) |
| 18 | + * [Table of Contents](#table-of-contents) |
| 19 | + * [Summary](#summary) |
| 20 | + * [Motivation](#motivation) |
| 21 | + * [Goals](#goals) |
| 22 | + * [Non-Goals](#non-goals) |
| 23 | + * [Proposal](#proposal) |
| 24 | + * [User Story](#user-story) |
| 25 | + * [API](#api) |
| 26 | + * [Workflow](#workflow) |
| 27 | + * [Feature Gate](#feature-gate) |
| 28 | +<!-- TOC --> |
| 29 | + |
| 30 | +## Summary |
| 31 | + |
| 32 | +Introduce a mechanism to differentiate a GPU share Pod's GPU resource isolation level. This takes effect on both scheduling and device allocating. |
| 33 | + |
| 34 | +## Motivation |
| 35 | + |
| 36 | +It's common that user want to use different GPU isolation levels for different GPU sharing workloads in one cluster. Currently, there're two common levels: |
| 37 | + |
| 38 | +- Isolated: Pod can only use (or see) the GPU resource it requested. e.g. The GPU has 16Gi memory and the Pod request 8Gi, it can only use up to 8Gi. |
| 39 | +- Shared: Pod can use (or see) the GPU resource up to the full card which assigned to it. e.g. The GPU has 16Gi memory and the Pod request 8Gi, it can use up to 16Gi. |
| 40 | + |
| 41 | +The Isolated is somewhat like K8s Guaranteed and the Shared is like Burstable. |
| 42 | + |
| 43 | +### Goals |
| 44 | + |
| 45 | +- Introduce a mechanism to differentiate a GPU share Pod's GPU resource isolation level. |
| 46 | + |
| 47 | +### Non-Goals |
| 48 | + |
| 49 | +- Introduce new GPU isolation providers. |
| 50 | + |
| 51 | +## Proposal |
| 52 | + |
| 53 | +### User Story |
| 54 | + |
| 55 | +User has two different kind of GPU sharing workloads in one K8s cluster. The first ones' GPU usage is predictable and user wants to ensure their stability, the second ones' GPU usage is burstable and user wants to maximize their GPU utilization. |
| 56 | + |
| 57 | +For the first ones, user labels the pods to set their GPU isolation level to **Isolated**, so that they would get guaranteed GPU share resources, different pods sharing the same GPU card would not disturb each other. Thus, the stability of the workload is ensured. |
| 58 | + |
| 59 | +For the second ones, user labels the pods to set their GPU isolation level to **Shared**, so that they would get burstable GPU share resources, every pod sharing the same GPU card can take use of the full card. Thus, the GPU utilization is maximized. A typical use case is running two pods with different models on the same GPU card, a model router would route requests to one of the model, so that there would be only one active inferencing process running on the GPU at the same time. By sharing the same GPU card, both of the pods could utilize the computing power of full card. |
| 60 | + |
| 61 | +### API |
| 62 | + |
| 63 | +- Introduce a new Pod label `koordinator.sh/gpu-share-isolation-level` whose value is one of `Isolated` and `Shared`. In the future, we might introduce more isolation levels such as `CoreIsolated` and `MemoryIsolated` for more use cases. |
| 64 | +- The existing Pod label `koordinator.sh/gpu-isolation-provider` should be set if `koordinator.sh/gpu-share-isolation-level` is set to `Isolated`. |
| 65 | +- For convenience and compatibility, if user does not set the isolation level label, it would be defaulted to `Isolated` if the isolation provider label is set, otherwise to `Shared`. But note if the isolation provider supports multiple isolation levels, user must set the isolation level label himself. |
| 66 | + |
| 67 | +### Workflow |
| 68 | + |
| 69 | +On k8s side, user creates GPU share Pod with/without the isolation level label. |
| 70 | + |
| 71 | +On koord-manager side, the Pod mutating webhook defaults the isolation level label if not set by user, and the Pod validating webhook validates if the isolation provider supports the isolation level. |
| 72 | + |
| 73 | +On koord-scheduler side, the device share scheduler makes sure that only Pods with the same isolation level would be allocated on the same GPU card. |
| 74 | + |
| 75 | +On koordlet side, the GPU hook enables GPU isolation provider only if the isolation level of the Pod is set to `Isolated`. |
| 76 | + |
| 77 | +### Feature Gate |
| 78 | + |
| 79 | +Since this feature may introduce additional complexity to user and system (especially scheduler), and may not be needed in some scenarios (e.g. only one isolation level in one cluster), a feature gate named `GPUIsolationLevel` would be introduced to completely enable/disable this feature. |
0 commit comments