manifest

package
v2.0.0-beta.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package manifest defines manifest.json, the one description of a snapshot. A restore reads everything it needs from it and never derives a launch from code: the effective profile, the argv and environment the donor ran, the hardware it ran on, the processes that own CUDA state, the files of the snapshot and, per rank, how the weights pool was exported.

Index

Constants

View Source
const (
	Schema     = "warmctl.snapshot/v2"
	SchemaROCm = "warmctl.snapshot/v2-rocm"
)

Schema identifies manifest.json. A snapshot of AMD GPUs carries SchemaROCm instead: releases before AMD support refuse to read it, so that one of them, choosing among a repository's snapshots, skips the AMD ones rather than picks one it cannot restore.

View Source
const (
	VendorNVIDIA = "nvidia"
	VendorAMD    = "amd"
)

GPU vendors, as Hardware.Vendor names them.

View Source
const (
	BackendCRIU  = "criu"
	BackendDMTCP = "dmtcp"
)

Snapshot backends, as Process.Backend names them.

View Source
const (
	RoleCRIU      = "criu"
	RoleRuntimeFS = "runtimefs"
	RoleFSMeta    = "runtimefs-meta"
	RoleRemaps    = "remaps"
	RoleJITCache  = "jitcache"
	RoleWeights   = "weights"
	RoleHostTable = "host-table"
	RoleAdapter   = "adapter"
	RoleIPC       = "ipc"
	RoleDriver    = "driver"
)

File roles.

View Source
const EncodingZframes = "zstd-frames-32m"

EncodingZframes stores a file as independent zstd frames of zframes.Size bytes of it each.

View Source
const GPUStateKFDReplay = "libkfdreplay"

GPUStateKFDReplay is Process.GPUState of an AMD snapshot.

Variables

This section is empty.

Functions

func DriverBranch

func DriverBranch(v string) string

DriverBranch is the branch of an NVIDIA driver version: 580 of 580.173.02.

func IsDigest

func IsDigest(s string) bool

IsDigest reports a lowercase hex SHA-256.

Types

type Allocation

type Allocation struct {
	Index  int    `json:"index"`
	Ptr    string `json:"ptr"`
	Bytes  int64  `json:"bytes"`
	Tag    string `json:"tag"`
	Part   int    `json:"part"`
	Offset int64  `json:"offset"`
	// Sum is the allocation's fingerprint read from donor device memory:
	// sum, sum of squares and position-weighted sum of its bytes.
	Sum [3]int64 `json:"sum"`
}

Allocation is one entry of the sleep-mode allocator's weights pool: the virtual address it must come back at, its size and where its bytes sit in the rank's part stream.

type Canary

type Canary struct {
	PromptTokens int     `json:"prompt_tokens"`
	MaxTokens    int     `json:"max_tokens"`
	Miss         Row     `json:"miss"`
	Hit          Row     `json:"hit"`
	MissCached   int     `json:"miss_cached_tokens"`
	HitCached    int     `json:"hit_cached_tokens"`
	MissSeconds  float64 `json:"miss_seconds"`
	HitSeconds   float64 `json:"hit_seconds"`
}

Canary is a miss and a hit of the same token-ID prompt: the donor's baseline, and what a restored engine must reproduce.

type File

type File struct {
	Path   string `json:"path"`
	Size   int64  `json:"size"`
	SHA256 string `json:"sha256"`
	Role   string `json:"role"`
	Root   string `json:"root,omitempty"`
	// Encoding is how the snapshot directory stores the file: "" as it is,
	// or EncodingZframes, zstd frames (internal/zframes) whose end offsets
	// are Frames, their bytes in Split planes (2 for 16-bit weights). Size
	// and SHA256 are always the file's own.
	Encoding string  `json:"encoding,omitempty"`
	Frames   []int64 `json:"frames,omitempty"`
	Split    int     `json:"split,omitempty"`
}

File is one member of the snapshot directory, relative to it.

func (File) Stored

func (f File) Stored() int64

Stored is how many bytes the snapshot directory holds of f.

type Fingerprint

type Fingerprint struct {
	Sum         [3]int64 `json:"sum"`
	Allocations int      `json:"allocations"`
	Bytes       int64    `json:"bytes"`
}

Fingerprint totals a rank's allocation fingerprints, for the record.

type GPU

type GPU struct {
	Rank      int    `json:"rank"`
	Index     int    `json:"index"`
	UUID      string `json:"uuid"`
	PCIBusID  string `json:"pci_bus_id"`
	Name      string `json:"name"`
	MemoryMiB int64  `json:"memory_mib"`
	// Device is the node the donor's processes opened, /dev/nvidiaN (on AMD
	// the render node, /dev/dri/renderDN); a receiver's GPU of the same rank
	// may have another number.
	Device string `json:"device,omitempty"`
	// An AMD GPU's ISA (gfx950), the kernel's gpu_id for it and its
	// firmware (MEC and SDMA versions), which a restore must match.
	Arch     string `json:"arch,omitempty"`
	KFDGPUID uint64 `json:"kfd_gpu_id,omitempty"`
	Firmware string `json:"firmware,omitempty"`
}

GPU is one device of the donor, in rank order.

type Hardware

type Hardware struct {
	Row            profile.Hardware `json:"row"`
	GPUs           []GPU            `json:"gpus"`
	Topology       string           `json:"topology"`
	TopologySHA256 string           `json:"topology_sha256"`
	Driver         string           `json:"driver"`
	Kernel         string           `json:"kernel"`
	CPUFlags       []string         `json:"cpu_flags"`
	VLLM           string           `json:"vllm"`
	CRIU           string           `json:"criu"`
	CUDACheckpoint string           `json:"cuda_checkpoint"`
	// DriverPortable: built with the driver's version check off, so the
	// snapshot restores under any release of the same driver branch.
	// DriverFiles are the host driver libraries the dump maps, kept under
	// driver/ and mounted back at these paths under another release.
	DriverPortable bool     `json:"driver_portable,omitempty"`
	DriverFiles    []string `json:"driver_files,omitempty"`
	// Vendor is VendorAMD for a snapshot of AMD GPUs; empty is NVIDIA, as
	// every snapshot before AMD support. GPUCheckpoint names what moved an
	// AMD process's GPU state ("libkfdreplay 0.1.1"), as CUDACheckpoint
	// does for NVIDIA; ROCm is the GPU runtime the engine ran.
	Vendor        string `json:"vendor,omitempty"`
	GPUCheckpoint string `json:"gpu_checkpoint,omitempty"`
	ROCm          *ROCm  `json:"rocm,omitempty"`
}

Hardware is what a restore host has to match.

func (Hardware) VendorName

func (h Hardware) VendorName() string

VendorName is the vendor of the snapshot's GPUs; snapshots older than the field are NVIDIA's.

type HostTable

type HostTable struct {
	Name  string `json:"name"`
	Bytes int64  `json:"bytes"`
	Parts []Part `json:"parts"`
}

HostTable is a pinned host table released before the dump.

type Launch

type Launch struct {
	Image string `json:"image"`
	// Model is the served name requests use.
	Model string `json:"model"`
	// ModelDir is the donor host's model directory.
	ModelDir     string            `json:"model_dir"`
	ModelSHA256  string            `json:"model_sha256"`
	Argv         []string          `json:"argv"`
	Env          map[string]string `json:"env"`
	CaptureSizes []int             `json:"capture_sizes"`
	Ranks        int               `json:"ranks"`
	// ReloadWaits says the engine's adapter waits for a weights part whose
	// file is not there yet, so up wakes it while the snapshot still arrives.
	ReloadWaits bool `json:"reload_waits,omitempty"`
}

Launch is the engine launch exactly as the donor ran it.

type Manifest

type Manifest struct {
	Schema    string          `json:"schema"`
	ID        string          `json:"id"`
	CreatedAt time.Time       `json:"created_at"`
	Tool      string          `json:"warmctl"`
	Profile   profile.Profile `json:"profile"`
	Launch    Launch          `json:"launch"`
	Hardware  Hardware        `json:"hardware"`
	Process   Process         `json:"process"`
	Files     []File          `json:"files"`
	Weights   Weights         `json:"weights"`
	Canary    *Canary         `json:"canary,omitempty"`
}

Manifest is manifest.json.

func Read

func Read(name string) (Manifest, error)

Read loads and validates manifest.json.

func (Manifest) Bytes

func (m Manifest) Bytes() int64

Bytes is the size of every listed file.

func (Manifest) Encoded

func (m Manifest) Encoded() bool

Encoded says whether any file is stored encoded: such a snapshot restores from a decoded local copy (restore.Stage).

func (Manifest) File

func (m Manifest) File(name string) (File, bool)

File finds a listed file.

func (Manifest) FirstLane

func (m Manifest) FirstLane() []File

FirstLane are the files a restore needs before the weights: everything but the exported parts.

func (Manifest) LaunchLane

func (m Manifest) LaunchLane() []File

LaunchLane are the files a restore reads before its receiver starts: the adapter and the cuInterpose build it mounts, the donor's driver libraries.

func (Manifest) StoredBytes

func (m Manifest) StoredBytes() int64

StoredBytes is how many bytes the snapshot directory holds.

func (Manifest) Validate

func (m Manifest) Validate() error

Validate checks what a restore depends on.

func (Manifest) WeightBytes

func (m Manifest) WeightBytes() int64

WeightBytes is the size of the exported pools.

func (Manifest) WeightLane

func (m Manifest) WeightLane() []File

WeightLane are the exported parts and host tables, in rank order.

func (Manifest) Write

func (m Manifest) Write(name string) error

Write stores the manifest atomically.

type MappedFile

type MappedFile struct {
	Path    string `json:"path"`
	Size    int64  `json:"size"`
	MtimeNS int64  `json:"mtime_ns"`
	SHA256  string `json:"sha256,omitempty"`
	Version string `json:"version,omitempty"`
}

MappedFile is a file a restore needs at the same path with the same size and modification time (DMTCP maps unmodified file areas from the file).

type Owner

type Owner struct {
	PID        int    `json:"pid"`
	StartTicks uint64 `json:"start_ticks"`
	Rank       int    `json:"rank"`
	Role       string `json:"role"`
}

Owner is a process of the dumped tree that holds CUDA state. Rank is -1 for the engine core and the API server.

type Part

type Part struct {
	Index  int    `json:"index"`
	Path   string `json:"path"`
	Size   int64  `json:"size"`
	SHA256 string `json:"sha256"`
}

Part is one exported file. The parts of a rank, concatenated in order, are its pool stream: every allocation's bytes in address order.

type Process

type Process struct {
	// Backend dumped the tree: criu (empty in older snapshots) or dmtcp, whose
	// PIDs here are DMTCP's virtual ones.
	Backend             string   `json:"backend,omitempty"`
	RootPID             int      `json:"root_pid"`
	MaxID               int      `json:"max_id"`
	PIDFloor            int      `json:"pid_floor"`
	NeedsModel          bool     `json:"needs_model"`
	Owners              []Owner  `json:"cuda_owners"`
	VisibleUUIDs        []string `json:"visible_uuids"`
	CollectivesDetached bool     `json:"collectives_detached"`
	NCCLMode            string   `json:"nccl_mode"`
	EngineURL           string   `json:"engine_url"`
	// IPC is "interpose" when the engine ran under cuInterpose: the restore
	// mounts the snapshot's ipc/ where the donor had the build and runs the
	// coordinator after the CUDA restore.
	IPC string `json:"ipc,omitempty"`
	// IPCProcesses are the processes the coordinator prepared and restores.
	IPCProcesses []int `json:"ipc_processes,omitempty"`
	// IPCBuild is where a DMTCP engine mapped the cuInterpose build from:
	// nothing mounts the snapshot's copy for it, so the restoring pod must
	// have the same build there.
	IPCBuild string `json:"ipc_build,omitempty"`
	// On AMD: GPUState is what moved the GPU state (GPUStateKFDReplay), in
	// the engine's processes themselves; GPULib the library they mapped,
	// which a restart maps again from the same file; GPUOwners the
	// processes that held the GPU; GPUMaxWptr the most packets any GPU
	// queue had taken, which the restore replays to bring the queue back.
	GPUState   string      `json:"gpu_state,omitempty"`
	GPULib     *MappedFile `json:"gpu_lib,omitempty"`
	GPUOwners  []Owner     `json:"gpu_owners,omitempty"`
	GPUMaxWptr uint64      `json:"gpu_max_wptr,omitempty"`
	// Mapped are files outside the snapshot that DMTCP reopens from the receiver
	// filesystem, including model shards and external volume files.
	Mapped []MappedFile `json:"mapped,omitempty"`
}

Process describes the dumped process tree.

func (Process) BackendName

func (p Process) BackendName() string

BackendName is the backend that dumped the tree; snapshots older than the field are CRIU's.

type ROCm

type ROCm struct {
	// HIP is torch.version.hip; Runtime the ROCm userspace's version (the
	// TheRock wheels' or /opt/rocm's).
	HIP     string `json:"hip,omitempty"`
	Runtime string `json:"runtime,omitempty"`
}

ROCm is the AMD GPU runtime the donor's engine ran, as its workers reported it.

type Rank

type Rank struct {
	Rank        int          `json:"rank"`
	Allocations []Allocation `json:"allocations"`
	Parts       []Part       `json:"parts"`
	Fingerprint Fingerprint  `json:"fingerprint"`
	HostTables  []HostTable  `json:"host_tables,omitempty"`
}

Rank is one worker's export.

type Row

type Row struct {
	Tokens   []int     `json:"tokens"`
	Logprobs []float64 `json:"logprobs"`
}

Row is one generated sequence: token IDs and their logprobs.

type Weights

type Weights struct {
	PartBytes int64  `json:"part_bytes"`
	Ranks     []Rank `json:"ranks"`
}

Weights is the whole export.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL