Skip to content

GPU sharing runtime

A self-hosted model states how it uses a GPU: a whole device, a MIG slice of one, or a time-shared device. The control plane resolves that into a GPU runtime class and admits the deployment only to a node that advertises the mode. On the node the GPU sharing runtime checks the mode again against the node's own attestation before anything is created, and after the runtime is applied the node reads the Deployment back to confirm that Kubernetes will place it with the GPU it asked for. This page covers the runtime class, the preflight, the placement the node applies, and the check that follows.

For the modes and why the set is closed, see GPU sharing.

Checked twice, applied once, verified after

flowchart TB
  subgraph CP["CONTROL PLANE"]
    direction TB
    RC[("gpu_runtime_class<br/>model.self_hosted_gpu_runtime_class.v1")]
    AD{{"Pull admission<br/>node advertises the mode?"}}
    RC --> AD
  end
  subgraph NODE["NODE"]
    direction TB
    AT[("Node attestation<br/>supported_modes")]
    PF{{"GPU sharing preflight"}}
    AP["Apply the Deployment<br/>GPU resource, selector,<br/>tolerations, runtime class"]
    RB{{"Read back and compare"}}
    AT --> PF --> AP --> RB
  end
  EV[("model.gpu_sharing_preflight_evidence.v1<br/>model.serve.self_hosted_gpu_operational_evidence.v1")]
  AD -->|"model.serve.v1"| PF
  RB --> EV

The control plane admits the assignment only to a node whose advertised modes include the requested one. The node checks again with its current attestation, because a node's configuration can change between the advertisement and the pull. The read-back then catches what neither check can see: an admission webhook or a cluster default that altered the pod's placement.

The runtime class

model.self_hosted_gpu_runtime_class.v1, carried in the self-hosted runtime contract:

Field Holds
gpu_required, gpu_count Whether the runtime needs a GPU, and how many
resource_key, resource_quantity The extended resource requested, such as nvidia.com/gpu, and its count
sharing_mode none, mig or timeslice
slice_profile The MIG profile, such as 1g.10gb; required for mig, forbidden otherwise
accelerator, accelerator_selector_key The accelerator and its node label, cloud.google.com/gke-accelerator by default
node_selector, tolerations, runtime_class_name Placement for GPU nodes

The node normalizes the class before using it:

  • A runtime with gpu_required must name a resource_key and a resource_quantity above zero.
  • mig without a slice_profile, or a slice_profile under any other mode, is refused.
  • The accelerator is written into the node selector under its selector key. An accelerator that disagrees with a value already in the selector is refused; when only the selector names one, it becomes the accelerator.
  • A runtime_class_name or tolerations on the self-hosted contract take precedence over the class's own.

A refusal fails the serve with MODEL_SERVE_SELF_HOSTED_RUNTIME_CONTRACT_INVALID. A self-hosted runtime with no GPU class runs as none, with no GPU requested.

The preflight

The preflight runs before XSRP grant admission and before any object is created. For a serve with no self-hosted runtime it reports not_required. Otherwise it compares the requested mode with the node's attestation:

supported_modes   the modes this node supports, always including none

The node builds the attestation from its configuration, which the control plane provides; a node supports none and mig unless configured otherwise. A mode the node does not support fails the serve with MODEL_SERVE_GPU_SHARING_PREFLIGHT_FAILED, naming the requested and supported modes. The preflight reports model.gpu_sharing_preflight_evidence.v1:

{
  "required": true,
  "status": "verified",
  "requested_mode": "mig",
  "supported_modes": ["mig", "none"]
}

What the node applies

The engine container requests the class's resource_key at resource_quantity, and the pod carries the merged node selector, the tolerations and the runtime class name. Under mig the resource key names the slice resource the device plugin advertises; under timeslice it names the shared device. The mode decides how many runtimes share one physical GPU, and the device plugin on your GPU nodes enforces it.

The read-back

After applying, the node reads the Deployment's pod template and compares it with the request, recording model.serve.self_hosted_gpu_operational_evidence.v1:

Compared Requested Observed
runtime_class_name From the class or the contract The pod template's runtimeClassName
node_selector The merged selector The pod template's nodeSelector
tolerations The normalized tolerations The pod template's tolerations
gpu_resource_key, gpu_resource_quantity The class's resource and count The container's requests, or its limits
accelerator The class's accelerator The selector's value under the selector key

The GPU fields are compared when the runtime requires a GPU. Any difference is listed in mismatch_fields and fails the serve with MODEL_SERVE_SELF_HOSTED_RUNTIME_GPU_OPERATIONAL_MISMATCH before the model serves. The evidence travels in the self-hosted runtime evidence, so a serving model's GPU placement is recorded as observed. See Self-hosted and proxy runtimes.

Sharing and scale to zero

A runtime that scales to zero releases its GPU, and waking it needs the GPU again. The control plane holds runs for a sleeping model until the runtime is ready, and the node applies the same class and runs the same read-back on every wake. See Dispatch guard.