profile

package
v2.0.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 15 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 profile loads model profiles and the hardware table from YAML and turns a profile into the effective vLLM launch: argv, environment, graph capture sizes, warmup grid, canary policy and resources.

Nothing here knows a model or a GPU by name. A profile is data; the code only merges it over profiles/_defaults.yaml, validates the few layouts a snapshot cannot restore, and encodes options into vLLM flags.

Index

Constants

View Source
const (
	Schema         = "warmctl.profile/v1"
	DefaultsSchema = "warmctl.profile-defaults/v1"
)

Schema identifies a profile file; DefaultsSchema the defaults file.

View Source
const HardwareSchema = "warmctl.hardware/v1"

HardwareSchema identifies hardware/hardware.yaml.

Variables

View Source
var Lifecycle = []string{
	"--enable-sleep-mode",
	"--enable-nccl-comm-suspend",
	"--worker-extension-cls=warmctl_vllm.worker.Extension",
}

Lifecycle flags are what warmctl adds to a serving launch; a stock vLLM baseline runs the same launch without them.

Functions

func Decode

func Decode(r io.Reader, out any) error

Decode reads one strict YAML document.

func EncodeArgv

func EncodeArgv(modelPath string, options map[string]any, negatable []string) ([]string, error)

EncodeArgv turns options into `vllm serve <model> --flag ...`, keys sorted. The YAML type of a value picks the encoding: bool is a switch (`--x`, or `--no-x` when false and negatable), ints and floats take a separate value, strings use `--x=v`, lists repeat values after the flag, maps become canonical JSON.

func ParseSize

func ParseSize(s string) (int64, error)

ParseSize reads "1TiB", "64GiB", "512MiB", "16KiB", "1024" (bytes) and the decimal forms "1TB", "64GB". Case-insensitive, spaces allowed.

Types

type Argv

type Argv struct {
	// Negatable flags take `--no-<flag>` when false; every other false
	// boolean is simply omitted.
	Negatable []string `yaml:"negatable,omitempty" json:"negatable,omitempty"`
}

Argv holds encoder settings that are data, not code.

type Canary

type Canary struct {
	Mode         string  `yaml:"mode,omitempty" json:"mode,omitempty"`
	Tolerance    float64 `yaml:"tolerance,omitempty" json:"tolerance,omitempty"`
	PrefixTokens int     `yaml:"prefix_tokens,omitempty" json:"prefix_tokens,omitempty"`
}

Canary is the restore correctness policy: bitwise, tolerance or warn.

type Graphs

type Graphs struct {
	Mode             string `yaml:"mode,omitempty" json:"mode,omitempty"`
	DecodeBatches    []int  `yaml:"decode_batches,omitempty" json:"decode_batches,omitempty"`
	ExtraSizes       []int  `yaml:"extra_capture_sizes,omitempty" json:"extra_capture_sizes,omitempty"`
	FuseAllReduceRMS *bool  `yaml:"fuse_allreduce_rms,omitempty" json:"fuse_allreduce_rms,omitempty"`
	CompileMode      *int   `yaml:"compile_mode,omitempty" json:"compile_mode,omitempty"`
}

Graphs describes CUDA graph capture when vllm.compilation-config is not written out explicitly. Capture sizes are batch x (1+k) tokens, k being the speculative token count declared in vllm.speculative-config.

type Hardware

type Hardware struct {
	ID               string `yaml:"id" json:"id"`
	NvidiaSMIName    string `yaml:"nvidia_smi_name" json:"nvidia_smi_name"`
	MemoryMiB        int64  `yaml:"memory_mib" json:"memory_mib"`
	Arch             string `yaml:"arch" json:"arch"`
	NVLink           bool   `yaml:"nvlink" json:"nvlink"`
	TopologyClass    string `yaml:"topology_class" json:"topology_class"`
	DeviceConfigName string `yaml:"device_config_name" json:"device_config_name"`
	DriverMin        string `yaml:"driver_min" json:"driver_min"`
}

Hardware is one qualified GPU model. Code branches only on these fields, never on a product name.

type HardwareTable

type HardwareTable struct {
	Schema string     `yaml:"schema" json:"schema"`
	Rows   []Hardware `yaml:"rows" json:"rows"`
}

HardwareTable is hardware/hardware.yaml.

func (HardwareTable) ByID

func (t HardwareTable) ByID(id string) (Hardware, bool)

ByID finds a row.

func (HardwareTable) ByName

func (t HardwareTable) ByName(name string) (Hardware, bool)

ByName finds the row for an nvidia-smi product name.

type Hooks

type Hooks struct {
	HostTables      string   `yaml:"host_tables,omitempty" json:"host_tables,omitempty"`
	MoETunedConfigs string   `yaml:"moe_tuned_configs,omitempty" json:"moe_tuned_configs,omitempty"`
	Plugins         []string `yaml:"plugins,omitempty" json:"plugins,omitempty"`
}

Hooks are the optional adapter behaviours a profile turns on.

type Launch

type Launch struct {
	Profile      Profile           `json:"profile"`
	Options      map[string]any    `json:"options"`
	Argv         []string          `json:"argv"`
	Env          map[string]string `json:"env"`
	CaptureSizes []int             `json:"capture_sizes"`
	Mode         string            `json:"cudagraph_mode"`
	Speculative  int               `json:"speculative_tokens"`
	Memory       int64             `json:"memory_bytes"`
	SHM          int64             `json:"shm_bytes"`
}

Launch is the effective engine launch of a profile on its defaults.

func Resolve

func Resolve(defaults, p Profile) (Launch, error)

Resolve merges p over defaults and encodes the launch.

func (Launch) StockArgs

func (l Launch) StockArgs() []string

StockArgs are the argv flags without `vllm serve <model>` and without the lifecycle flags: what a stock vLLM A/B baseline runs.

func (Launch) WarmupCases

func (l Launch) WarmupCases() []WarmupCase

WarmupCases expands the profile's warmup generator. Without a warmup section it is prompts of 32, 128 and 512 tokens at every decode batch, which replays every full decode graph. With piecewise graphs one lone prompt is added for each capture size no case's prefill step lands on.

type Loader

type Loader struct {
	Assets fs.FS
	Dirs   []string
}

Loader finds profiles in the embedded assets and in extra directories.

func (Loader) Defaults

func (l Loader) Defaults() (Profile, error)

Defaults reads profiles/_defaults.yaml from the assets.

func (Loader) Hardware

func (l Loader) Hardware() (HardwareTable, error)

Hardware reads the embedded table plus a hardware.yaml in each profile directory, whose rows extend it.

func (Loader) IDs

func (l Loader) IDs() ([]string, error)

IDs lists the embedded profiles.

func (Loader) Load

func (l Loader) Load(ref string) (Profile, error)

Load resolves ref: a path to a YAML file, or a profile id looked up in Dirs and then in the embedded profiles directory.

type Mixed

type Mixed struct {
	PromptTokens []int `yaml:"prompt_tokens" json:"prompt_tokens"`
	Batches      []int `yaml:"batches" json:"batches"`
}

Mixed is a prompt-length by batch-size block of warmup requests.

type Model

type Model struct {
	ID            string   `yaml:"id" json:"id"`
	Revision      string   `yaml:"revision" json:"revision"`
	ContainerPath string   `yaml:"container_path,omitempty" json:"container_path,omitempty"`
	ServedNames   []string `yaml:"served_names,omitempty" json:"served_names,omitempty"`
}

Model is the checkpoint a profile serves.

func (Model) MountPath

func (m Model) MountPath() string

MountPath is where the model directory is mounted inside the container.

type Parallel

type Parallel struct {
	TP int  `yaml:"tp" json:"tp"`
	DP int  `yaml:"dp,omitempty" json:"dp,omitempty"`
	EP bool `yaml:"ep,omitempty" json:"ep,omitempty"`
}

Parallel is the engine layout. EP shards experts whole across ranks.

func (Parallel) Ranks

func (p Parallel) Ranks() int

Ranks is the number of GPU workers: TP x DP.

type Profile

type Profile struct {
	Schema    string             `yaml:"schema" json:"schema"`
	ID        string             `yaml:"id,omitempty" json:"id"`
	Image     string             `yaml:"image,omitempty" json:"image"`
	Model     Model              `yaml:"model,omitempty" json:"model"`
	Parallel  Parallel           `yaml:"parallel,omitempty" json:"parallel"`
	Hardware  []string           `yaml:"hardware,omitempty" json:"hardware"`
	VLLM      map[string]any     `yaml:"vllm,omitempty" json:"vllm"`
	Env       map[string]*string `yaml:"env,omitempty" json:"env"`
	Graphs    Graphs             `yaml:"graphs,omitempty" json:"graphs"`
	Warmup    Warmup             `yaml:"warmup,omitempty" json:"warmup"`
	Canary    Canary             `yaml:"canary,omitempty" json:"canary"`
	Resources Resources          `yaml:"resources,omitempty" json:"resources"`
	Hooks     Hooks              `yaml:"hooks,omitempty" json:"hooks"`
	// IPC is how cross-process CUDA memory is checkpointed: native,
	// interpose or auto (docs/interpose.md).
	IPC     string        `yaml:"ipc,omitempty" json:"ipc"`
	Restore RestorePolicy `yaml:"restore,omitempty" json:"restore"`
	Argv    Argv          `yaml:"argv,omitempty" json:"argv"`
}

Profile is one YAML profile, or the defaults file.

func Merge

func Merge(defaults, p Profile) Profile

Merge lays p over the defaults: scalars win when set, vllm and env merge one level deep where a null value removes the default, lists replace.

func (Profile) Environment

func (p Profile) Environment() map[string]string

Environment flattens the merged env map.

func (Profile) IPCMode

func (p Profile) IPCMode() string

IPCMode resolves the profile's ipc before the engine starts: auto stays auto (the donor checks the GPUs) unless the engine has one GPU process, which shares no memory and runs native.

func (*Profile) Set

func (p *Profile) Set(expr string) error

Set applies one command-line override, "vllm.<flag>=<yaml value>", "env.<NAME>=<value>" or "ipc=<mode>"; the value null removes the key, as in YAML.

func (Profile) Supports

func (p Profile) Supports(row Hardware) bool

Supports reports whether a profile lists the hardware row.

func (Profile) Validate

func (p Profile) Validate() error

Validate refuses what a snapshot cannot capture or restore. Everything else is the user's choice; a bad vLLM flag fails at engine start.

type Range

type Range struct {
	From, To, Step int
}

Range is an inclusive token range with a step, usable where a plain integer is: `{from: 64, to: 2560, step: 64}` or `16384`.

func (*Range) UnmarshalYAML

func (r *Range) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML accepts either an integer or a from/to/step mapping.

func (Range) Values

func (r Range) Values() []int

Values expands the range.

type Resources

type Resources struct {
	Memory string `yaml:"memory,omitempty" json:"memory,omitempty"`
	PIDs   int    `yaml:"pids,omitempty" json:"pids,omitempty"`
	SHM    string `yaml:"shm,omitempty" json:"shm,omitempty"`
	CPUs   int    `yaml:"cpus,omitempty" json:"cpus,omitempty"`
}

Resources are the container limits.

type RestorePolicy

type RestorePolicy struct {
	Warmup      string `yaml:"warmup,omitempty" json:"warmup,omitempty"`
	CUDARestore string `yaml:"cuda_restore,omitempty" json:"cuda_restore,omitempty"`
}

RestorePolicy is what a restore does after the engine is awake.

type Warmup

type Warmup struct {
	PrefillCaptureSizes bool    `yaml:"prefill_capture_sizes,omitempty" json:"prefill_capture_sizes,omitempty"`
	PrefillTokens       []Range `yaml:"prefill_tokens,omitempty" json:"prefill_tokens,omitempty"`
	DecodePromptTokens  int     `yaml:"decode_prompt_tokens,omitempty" json:"decode_prompt_tokens,omitempty"`
	Mixed               []Mixed `yaml:"mixed,omitempty" json:"mixed,omitempty"`
	GeneratedTokens     int     `yaml:"generated_tokens,omitempty" json:"generated_tokens,omitempty"`
}

Warmup is the generator of the bake warmup grid. An empty section means prompts of 32/128/512 tokens at every decode batch.

type WarmupCase

type WarmupCase struct {
	PromptTokens    int `json:"prompt_tokens"`
	Batch           int `json:"batch"`
	GeneratedTokens int `json:"generated_tokens"`
}

WarmupCase is one bake warmup request shape: a batch of identical prompts of PromptTokens, decoding GeneratedTokens, with the prefix cache reset first so the prefill really runs.

Jump to

Keyboard shortcuts

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