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
- Variables
- func Decode(r io.Reader, out any) error
- func EncodeArgv(modelPath string, options map[string]any, negatable []string) ([]string, error)
- func ParseSize(s string) (int64, error)
- type Argv
- type Canary
- type Graphs
- type Hardware
- type HardwareTable
- type Hooks
- type Launch
- type Loader
- type Mixed
- type Model
- type Parallel
- type Profile
- type Range
- type Resources
- type RestorePolicy
- type Warmup
- type WarmupCase
Constants ¶
const ( Schema = "warmctl.profile/v1" DefaultsSchema = "warmctl.profile-defaults/v1" )
Schema identifies a profile file; DefaultsSchema the defaults file.
const HardwareSchema = "warmctl.hardware/v1"
HardwareSchema identifies hardware/hardware.yaml.
Variables ¶
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 EncodeArgv ¶
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.
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"`
// Vendor is "amd" for an AMD Instinct row, which names its model in
// ProductName (as warmctl reads it from the KFD topology) instead of
// NvidiaSMIName; empty for NVIDIA's rows.
Vendor string `yaml:"vendor,omitempty" json:"vendor,omitempty"`
ProductName string `yaml:"product_name,omitempty" json:"product_name,omitempty"`
}
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 a product name: nvidia-smi's, or an AMD GPU's.
func (HardwareTable) VendorOf ¶
func (t HardwareTable) VendorOf(p Profile) string
VendorOf is the GPU vendor a profile is written for: "amd" when every hardware row it lists is an AMD one, else "" (NVIDIA).
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 (Launch) StockArgs ¶
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
// Vendor is the GPU vendor of the host the profile runs on. "amd" lays
// profiles/_defaults-rocm.yaml over the defaults; empty (NVIDIA) reads
// _defaults.yaml alone, as always.
Vendor string
}
Loader finds profiles in the embedded assets and in extra directories.
func (Loader) DefaultsFor ¶
DefaultsFor are the defaults p is resolved over when inspected (warmctl profile show, argv, check): the ROCm layer for a profile of AMD rows. A bake takes the vendor from its host instead.
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.
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.
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.
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 ¶
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 ¶
Environment flattens the merged env map.
func (Profile) IPCMode ¶
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 ¶
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.
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 ¶
UnmarshalYAML accepts either an integer or a from/to/step mapping.
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.