[KongchangAI]
Productstageload guard

stageload

A small library for loading models stage by stage. It includes a built-in watchdog that monitors macOS swap space and free memory and, before a budget is exceeded, sends signals to a process group to terminate the task.

Timeline (last 90 days)

Oct 13

When using stageload's release(module) to move parameters and buffers to the meta device and running Qwen-Image-2.1 in a stage-by-stage 'load at start, release at end' manner (the 16.3 GB text encoder and the 13.3 GB transformer loaded only one at a time), the peak on the same Mac dropped to 19.0 GB, and swap did not grow in either run.

Unverified50%
Oct 12

The stageload supervisor does not require root privileges and only terminates the command and its process group.

Unverified50%
Oct 12

The stageload supervisor uses exit code 3 to indicate that the supervisor terminated the command, and 4 to indicate that no startup space was found.

Unverified50%
Oct 12

The stageload run command can place jobs into a queue on the same machine, scheduling fairly by lane and owner.

Unverified50%
Oct 12

The stageload guard command can wait until kern.memorystatus_level is at least a specified percentage before launching the command, and terminates the command when swap space growth exceeds the budget or free memory falls below the threshold twice in a row

Unverified50%
Oct 12

The stageload supervisor and meter read macOS counters (libproc, sysctl), so they can only run on a Mac.

Unverified50%
Oct 12

The supervisor first sends SIGTERM to the command's entire process group, then sends SIGKILL five seconds later; sending to the process group rather than a single PID avoids orphan processes.

Unverified50%
Oct 12

Each stageload run writes a memory trace for the command and all its child processes, and records one line in ~/.stageload/history.jsonl.

Unverified50%

All Facts (8)

Unverified

The stageload guard command can wait until kern.memorystatus_level is at least a specified percentage before launching the command, and terminates the command when swap space growth exceeds the budget or free memory falls below the threshold twice in a row

50%
Unverified

The stageload supervisor does not require root privileges and only terminates the command and its process group.

50%
Unverified

The stageload supervisor uses exit code 3 to indicate that the supervisor terminated the command, and 4 to indicate that no startup space was found.

50%
Unverified

The stageload run command can place jobs into a queue on the same machine, scheduling fairly by lane and owner.

50%
Unverified

Each stageload run writes a memory trace for the command and all its child processes, and records one line in ~/.stageload/history.jsonl.

50%
Unverified

The stageload supervisor and meter read macOS counters (libproc, sysctl), so they can only run on a Mac.

50%
Unverified

The supervisor first sends SIGTERM to the command's entire process group, then sends SIGKILL five seconds later; sending to the process group rather than a single PID avoids orphan processes.

50%
Unverified

When using stageload's release(module) to move parameters and buffers to the meta device and running Qwen-Image-2.1 in a stage-by-stage 'load at start, release at end' manner (the 16.3 GB text encoder and the 13.3 GB transformer loaded only one at a time), the peak on the same Mac dropped to 19.0 GB, and swap did not grow in either run.

50%

Source Articles