Skip to content

moss-infer-vulkan: the engine's request checks, --help/--version, --vram-budget - #10

Merged
xycld merged 2 commits into
mainfrom
fix/vulkan-cli
Nov 4, 2026
Merged

xycld merged 2 commits into
mainfrom
fix/vulkan-cli

Conversation

@xycld

@xycld xycld commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Brings moss-infer-vulkan's command line in line with moss-infer generate. The gaps were found by the review of moss-infer-hip, which mirrors this program.

  • Help and version. --help prints the usage to stdout and exits 0 (it went to stderr with exit 2). --version is new.
  • The engine's request checks. pipeline::validate()'s bounds and messages:
    • a whitespace-only prompt is refused ("Enter a prompt.");
    • at most 4.2 megapixels and 4096 pixels on a side (4096x4096 was accepted);
    • at most 10000 steps (the limit was 1000);
    • the engine's seed, cfg, shift and max-seq messages;
    • --device below -1 is refused.
  • PNG metadata.
    • The bundle is named by util::path_key(model).filename(), as the engine names it. Before, a trailing slash gave an empty name and --model . gave ".".
    • noise_layout: official is recorded.
  • --vram-budget GiB, with vram_option_bytes' bounds. It caps the device memory of the VAE and the DiT: their weights, the DiT's activations and the decode. The DiT's blocks past the budget stream from host memory.
    • A budget that cannot hold the decode, or the DiT with every block streamed (Dit::minimum_weight_bytes(): the global tensors, the text refiner and the two block slots), is refused before the text encoder runs.

RTX 4090 Laptop GPU:

  • 512x512, 20 steps with --vram-budget 4: 10 of 42 blocks resident, and the latents and PNG bytes are identical to the run without a budget.
  • 0.5 GiB and 1.3 GiB at 512x512, and 2 GiB at 1024x1024: refused before any work.
  • 3 GiB at 1024x1024: runs with 3 blocks resident.
  • Every argument check gives the engine's message, with exit status 2.

xycld added 2 commits November 4, 2026 01:52
…ram-budget

Found by the moss-infer-hip review, which mirrors this program:
- --help prints the usage to stdout and exits 0; --version prints the version.
- pipeline::validate()'s bounds and messages: a whitespace-only prompt, at most 4.2 megapixels and 4096 pixels on a
  side, at most 10000 steps (was 1000), the seed, cfg, shift and max-seq messages; --device below -1 is refused.
- The PNG metadata names the bundle by util::path_key(model).filename(), as the engine does (a trailing slash or
  "--model ." gave an empty name or "."), and records noise_layout official.
- --vram-budget GiB, with vram_option_bytes' bounds: caps the device memory of the VAE and the DiT (weights, the
  DiT's activations, the decode); the DiT's blocks past it stream. A budget that cannot hold the decode or the
  activations is refused before the text encoder runs.

RTX 4090 Laptop, 512x512 20 steps: --vram-budget 4 keeps 10 of 42 blocks resident and gives the same latents and PNG
bytes as no budget; 0.5 GiB is refused before any work; 2 GiB at 1024x1024 streams every block and completes.
…block streamed

Review of the previous commit: the early refusal counted the DiT's activations only, so a budget just above them passed,
then the DiT's global tensors, text refiner and two block slots (about 1 GiB) went past it. Dit::minimum_weight_bytes()
gives that footprint from the shape lists the constructor checks (now shared); the refusal before the text encoder and
a second one before the DiT loads (should the encoder's lengths differ from the token counts) both include it, instead
of falling back to every block streamed past the budget.

RTX 4090 Laptop: 1.3 GiB at 512x512 and 2 GiB at 1024x1024 (both ran before, over the budget) are refused before the
text encoder; 3 GiB at 1024x1024 runs with 3 blocks resident; 4 GiB at 512x512 gives the same latents as no budget.
@xycld
xycld merged commit ded9426 into main Nov 4, 2026
8 checks passed
@xycld xycld mentioned this pull request Nov 4, 2026
@xycld
xycld deleted the fix/vulkan-cli branch November 8, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant