Files
OBLITERATUS/docs/gpu-qualification.md
T
Joseph MaglyandClaude Opus 5.5 260674a9fa fix(gpu): canonicalize GPU UUIDs in the module-placement qualification driver
torch reports device UUIDs without the "GPU-" prefix that nvidia-smi,
CUDA_VISIBLE_DEVICES and schedulers use. The driver (#356) compared raw
strings, so on real NVIDIA hardware:

- model workers were masked with the bare UUID, which CUDA does not
  accept ("No CUDA GPUs are available");
- select_uuids rejected nvidia-smi-form --uuids;
- visible_device_records could not join the nvidia-smi inventory, leaving
  pci_bus_id, physical_ordinal and topology empty.

Add normalize_uuid (bare or GPU- prefixed, case-insensitive, to
GPU-<lowercase>; MIG identifiers left distinct) and use it at discovery,
selection, inventory join, worker UUID checks and evidence validation.
Found on an A100 run of module-placement-gpu at 7fee696.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:20:10 -04:00

11 KiB

Ordinary module-placement qualification

scripts/gpu_qualification.py runs the ordinary, non-TP pipeline on complete decoder modules. Every requested GPU must hold real resident parameters. A device-map entry, offload execution hook, empty module, or additional visible GPU does not satisfy this check. Missing devices and failed prerequisites fail the attempt. This driver currently accepts native dense Llama, Qwen2 and GPT-2 local checkpoints; it generates a deterministic tiny Llama fixture by default.

The sequence is load, stock loss/generation, activation collection, direction extraction, edit, verification, native checkpoint save, edit-worker exit, then fresh-process checkpoint reload and logit/greedy-generation comparison. It uses the real AbliterationPipeline phase methods. A separate reference worker runs the same lifecycle with CPU or one-device placement when feasible. Reference activations, direction projectors, and stock/edited outputs are compared with tolerances fixed before any worker starts. Greedy tokens require exact equality. Every decoder block is explicitly selected for editing so tiny-model layer heuristics cannot turn the edit stage into a no-op; this policy is recorded.

Run on allocated hardware with an installed CUDA runtime:

python scripts/gpu_qualification.py --output evidence/one --devices 1
python scripts/gpu_qualification.py --output evidence/pair --devices 2
python scripts/gpu_qualification.py --output evidence/three --devices 3
python scripts/gpu_qualification.py --output evidence/four-disk --devices 4 --offload disk

Each output directory must be new. Consecutive complete decoder blocks are forced across every requested GPU, plus a block on CPU/disk when requested. Explicit maps use --device-map map.json; all weights must be covered, decoder blocks must remain whole, and every requested GPU must have nonzero ownership. The embedding and head receive explicit placements in generated maps. Tied parameters share one placement device and are counted once in weight budgets; explicit maps must also keep them together.

Select UUIDs with --uuids GPU-... GPU-.... A disposable discovery worker resolves the current visible CUDA ordinals before masking model workers by UUID. Both bare and GPU- UUID forms are accepted case-insensitively and canonicalized to GPU-<lowercase uuid>. Selections must be distinct and within that visible allocation; an existing scheduler mask is never expanded. Evidence records the original visible ordinal, selected worker ordinal, physical inventory ordinal, UUID, PCI bus ID, compute capability, driver, topology paths and CUDA peer-access results. Each model worker checks its actual UUID order again. No lease broker is required; existing optional lifecycle grant checks still apply.

nvidia-smi topo -m distinguishes observed NV# links from PIX, PXB, PHB, NODE and SYS PCIe paths. Unavailable diagnostics are retained as errors with unknown topology; they never imply NVLink. --require-link nvlink or --require-link pcie rejects an allocation without the requested detected paths. The mapping is printed before model loading and retained in the bundle.

For an offline rehearsal on a CPU machine:

python scripts/gpu_qualification.py --output evidence/cpu --mode rehearsal --devices 3 --offload cpu
python scripts/gpu_qualification.py --output evidence/disk --mode rehearsal --devices 4 --offload disk

Rehearsal hides CUDA, builds the tiny fixture, plans complete placement on meta tensors for the synthetic GPU count, and executes the complete CPU/offload lifecycle and independent reload. CPU offload uses real Accelerate meta-backed parameters; disk offload forces a decoder block onto disk. These results carry the cpu_meta_rehearsal claim and no GPU occupancy claim.

For a staged representative checkpoint, supply --model /path/to/checkpoint and --workload workload.json. Nothing is downloaded and remote code is disabled. The resolved checkpoint and output paths must be separate: neither directory may contain the other. Invalid paths are rejected before creating the run directory or launching workers. The workload object contains at least two strings in each of harmful_prompts, harmless_prompts, and comparison_prompts. Optional quality_thresholds accepts the pipeline's max_perplexity_increase, min_coherence_retention, and max_degenerate_fraction. The generated random fixture uses permissive, recorded quality thresholds to test infrastructure; representative models retain ordinary pipeline thresholds unless the operator explicitly supplies others.

Qualification requires finite baseline and post-edit perplexity/coherence metrics, finite loss on every reference text, completed capability checks, and evaluation of every selected refusal prompt. Skipped or partial diagnostics fail qualification. Quality thresholds remain operator-controlled.

Control dtype, sequence workload and comparison with --dtype, --generation-tokens (default 4), --seed, --atol and --rtol. The driver fixes activation/reference-loss sequences at 32 tokens and direction count at one. Activation collection uses one prompt per batch in every worker, preserving unpadded absolute positions regardless of available accelerator memory. Generation is capped consistently for all workers. Comparison probes explicitly use one greedy sequence with a dynamic KV cache and no auxiliary outputs, regardless of checkpoint generation defaults. Default FP32 tolerances are atol=1e-6, rtol=1e-5; the explicit FP16/BF16 starting envelope is 0.05/0.05. A failure never changes those tolerances. Passing this small workload does not establish a larger sequence/batch or model-quality envelope.

--reference auto runs a CPU reference only when metadata weight bytes fit both --reference-max-bytes (default 1 GiB) and one sixth of current host headroom. Evidence records the selection and reason. Force a reference with --reference cpu or --reference cuda:0, or explicitly omit it with --reference none. Reload parity remains mandatory in every run.

Placement budgets release unused CUDA cache before measuring each GPU's current free bytes and available host/cgroup headroom. Before weight loading, preparation freezes a capacity plan with whole-block placement and device/host/disk peaks for every phase, including LM-head projection and bounded export. Workers recheck the frozen peaks against current availability. The optional --gpu-memory-utilization total-memory ceiling also counts existing reservations; fresh free memory remains an independent bound. --device-ceilings limits.json supplies per-device byte ceilings, also available through OBLITERATUS_DEVICE_MEMORY_CEILINGS. CUDA ceilings include the process's existing allocator reservations; CPU ceilings bound additional host demand. CUDA ceiling ordinals refer to the worker's visible order after UUID selection. Explicit maps are checked against the same fresh placement budgets before load. CPU/disk offload places the head on the selected backing tier as well as complete decoder blocks. This reduces GPU edit peaks while increasing host workspace and retained backing overlays. The plan and actual export eligibility are retained in evidence. Optional pristine snapshots are explicitly disabled with an immutable source/reload reason; lifecycle verification still requires the independent reload.

Use --plan-only (alias --dry-run) with --plan-config, per-GPU --plan-free-memory, --plan-host-memory and --plan-disk-memory to print and retain a capacity estimate before downloading weights or discovering hardware. The default planning artifact is a sibling <output>.capacity-plan.json, leaving the run directory available for a later qualification attempt. Planning refusals exit unsuccessfully after writing their budget table and reasons.

The driver defaults to --admission-mode strict, enforcing known phase estimates and rejecting unknown sizes. --admission-mode fail-closed also rejects every uncalibrated allocation, including estimates that fit. CPU/offload phases currently contain estimates and may therefore be rejected under that policy. Resolve such a rejection explicitly; it is a failed admission, never a passing calibration. --admission-mode default retains the ordinary warning policy. Every choice is recorded. See phase admission.

Native bounded export eligibility is required by default. The explicit --allow-unbounded-export option admits the ordinary fallback and records that choice. Per-worker --timeout limits kill and reap the worker process group; interrupt/termination also cleans up the active worker. Each attempt owns its new directory, leaving the source and prior attempts intact. Conditional and rehearsal test timeouts terminate the supervisor and wait for worker cleanup before returning. Source hashes are checked again before success. A killed supervisor or exhausted filesystem can prevent final evidence publication; absence of a passed bundle is non-evidence.

Evidence is a content-addressed, exclusively created, mode-0444 JSON envelope:

{"schema_version": 1, "sha256": "<canonical payload digest>", "payload": {"status": "passed"}}

The complete payload contains run/configuration/code/lock/checkpoint/package identities, commands, image/environment identity (--environment-id), diagnostics, actual placement, reference errors, phase metrics, worker PIDs/exit status, and SHA-256 inventories of observations, checkpoint files and logs. validate_evidence requires every lifecycle phase, separate worker PIDs, reload parity and every requested device's resident ownership and GPU peaks before accepting success. Failure bundles retain partial reports and an error. The digest provides integrity checking; retain the envelope in immutable external storage for stronger archival guarantees. Set --environment-id to the reviewed image digest for rental evidence.

GPU allocation/reservation peaks use CUDA allocator high-water marks with phase boundary synchronization. Host RSS, physical GPU usage and run-directory disk bytes are sampled every 50 ms plus phase boundaries, and are labelled sampled peaks; sub-sample transients may be missed. Minimum sampled filesystem free space is also retained. Sampling errors prevent passed evidence. These observations measure the selected workload; they cannot reserve memory against unrelated jobs.

The manual conditional gate module-placement-gpu runs tests/conditional/test_gpu_qualification.py. Set OBLITERATUS_GPU_QUALIFICATION_DEVICES=1, 2, or 3/4 for the required lane, and optionally OBLITERATUS_GPU_QUALIFICATION_OFFLOAD=cpu|disk, OBLITERATUS_GPU_QUALIFICATION_UUIDS (comma separated), OBLITERATUS_GPU_QUALIFICATION_LINK=nvlink|pcie, OBLITERATUS_GPU_QUALIFICATION_ADMISSION, and OBLITERATUS_GPU_QUALIFICATION_OUTPUT (a new directory). The lane exercises both untied and tied embeddings; the tied run appends -tied to the output directory. The gate rejects skips and empty test results. Default CPU CI selects the planning/schema/admission tests and offline rehearsals; hardware evidence requires an explicit conditional run.