Skip to content

GPU sharing

A model runtime either has a GPU to itself or shares one, and how it shares is a declared mode rather than an inferred arrangement. The control plane resolves the mode into a runtime class contract the node applies.

Three modes

Mode Means
none The runtime does not share a GPU
mig Hardware partitioning into isolated instances
timeslice The GPU is time-shared between runtimes

The three are ordered, and the order is meaningful: none isolates most and shares least, timeslice shares most and isolates least. A deployment picks a point on that line explicitly.

MIG slices are named by profile

A MIG mode names the slice profile it wants, in the form the hardware uses:

<instances>g.<memory>gb

The form is validated rather than passed through, so a profile the hardware cannot provide is refused at resolution rather than at scheduling.

The accelerator is selected, not assumed

A GPU runtime declares which accelerator it needs, as a validated token, and the resolved contract carries the node selector that places it:

cloud.google.com/gke-accelerator

Naming the selector in the contract keeps placement a control-plane decision rather than a node-side match. The node applies what it was given.

The three modes

flowchart LR
  subgraph NONE["none"]
    direction TB
    G1[("GPU")]
    R1["Runtime A"]
    R1 --- G1
  end
  subgraph MIG["mig"]
    direction TB
    subgraph G2["GPU, partitioned"]
      direction LR
      S1[("slice 1")]
      S2[("slice 2")]
    end
    R2["Runtime A"]
    R3["Runtime B"]
    R2 --- S1
    R3 --- S2
  end
  subgraph TS["timeslice"]
    direction TB
    G3[("GPU, whole")]
    R4["Runtime A"]
    R5["Runtime B"]
    R4 -.- G3
    R5 -.- G3
  end

Read left to right, isolation falls and sharing rises. Under mig each runtime owns a hardware slice; under timeslice the runtimes take turns on the whole device, shown by the dashed edges.

Self-hosted runtimes get a runtime class contract

The declared mode is resolved into a runtime class contract, and the node applies that contract to the serve runtime.

The contract is what connects a declared mode to what Kubernetes actually enforces. A self-hosted GPU runtime supports the same three modes, so the vocabulary does not change between managed and self-hosted serving.

Why the mode is closed

Three modes can be reasoned about in policy: a governance rule can require isolation for a class of workload by requiring none, or permit sharing by allowing the others. An open-ended sharing configuration could not be governed that way.

It also makes capacity answerable. A node reporting its accelerators and the modes in use describes its remaining capacity in the same terms the control plane schedules in.

Sharing and scale to zero

A shared GPU is released when a runtime scales to zero, and reacquired when it wakes. The wake path therefore depends on the accelerator being available again, which is one of the conditions a held run is waiting on. See Dispatch guard.