Files
reims-vgpu/Cargo.toml
T
Anees Iqbal 92a8a11651 ⚡ The shipping staticlib is built at opt-level 3 with fat LTO, because the profile nobody had looked at since the first commit was costing 3.3% of every draw
Component: workspace release profile, which is what `hw/display/meson.build`
builds the reims-vgpu staticlib under (`cargo build --release`) and therefore
what every boot of both device shims runs.

`[profile.release] opt-level = 2` has been there unchanged and unexplained since
`a61a5e12`, with cargo's defaults for the rest — `lto = false` and
`codegen-units = 16`. Nothing had measured it. The device's own largest costs are
host CPU inside this staticlib, so the codegen settings are a product decision
rather than a developer convenience, and the profile now says so in a comment.

`panic` deliberately stays `unwind`. Every `reims_vgpu_qemu_*` entry point wraps
its body in `catch_unwind` (`device/mod.rs:807`) because a Rust panic unwinding
into QEMU's C frames is undefined behavior; `panic = "abort"` would convert every
caught panic into a dead VM. That was checked before the profile was touched, not
assumed.

Measured: six driven macos-13 boots on the x86/PCI/Vulkan pathway, Apple Maps
panned from the host over QMP, three per arm, alternating A/B/A/B/A/B against two
pinned QEMU binaries so host drift lands on both arms. Host quiesced; nothing else
running. Per-draw columns are medians over busy windows only (>= 20 draws), since
a `--testing` boot's idle tail has windows of two draws whose per-draw numbers are
noise.

Arms did not overlap on three columns — every optimized boot came in below every
baseline boot:

  draw_us/draw   375.7 -> 363.3   -3.3%   (371.5..380.0 vs 351.8..364.3)
  prep_us/chain    0.57 ->  0.39  -30.8%  (0.55..0.61   vs 0.39..0.41)
  sampled_us/chain 14.5 ->  12.9  -11.1%  (13.4..15.2   vs 12.8..12.9)

Not verified, and stated as such:

- **Frame rate did not move.** `present_hz` is 9.20 median on both arms. This
  workload leaves the drain worker at 4% duty, so per-draw CPU is not what caps
  it — the render writeback is, and that is a separate change. Do not read this
  commit as a frame-rate win; it is a per-draw CPU win on a device that currently
  has CPU headroom, and it will matter on a rail or workload that does not.
- `total_draws` and `total_presents` came out 5.4% and 1.7% *lower* on the
  optimized arm. Those are guest-driven counts, so this is drag-round variance
  rather than a device regression, but three boots an arm cannot separate the two
  and no claim is made either way.
- Only the x86/Vulkan pathway was booted. The Metal arm compiles under the
  cross-target clippy run below but nothing on this host can run it.
- The other five columns (`binds_us`, `pipeline_us`, `engine_us`, `store_us`,
  `assemble_us`) all overlap between arms and are not claimed.

Cost: the crate's release build goes from ~7.6 s to ~100 s, entirely from
`lto = "fat"` and `codegen-units = 1`. Tests and clippy are unaffected (dev
profile). Worth naming because it is paid on every boot cycle.

Tests: `cargo test -p reims-vgpu --no-default-features --features
backend-vulkan,host-window -- --test-threads=1` green (1794 lib + 82 across the
integration suites). Clippy clean with `-D warnings` on all three arms — the
`backend-metal` `--target aarch64-apple-darwin` arm, the host Vulkan arm, and the
`--target x86_64-unknown-linux-gnu` Vulkan arm.
2026-08-11 01:11:12 +03:00

30 lines
1.1 KiB
TOML

# Cargo workspace for the project's host-side product crate.
#
# Product path: crates/reims-vgpu (protocol + C ABI + Metal|Vulkan backend).
# UEFI option ROM: crates/reims-vgpu-efi (own Cargo workspace — x86_64-unknown-uefi;
# not a member here so host builds never pull the no_std PE graph).
[workspace]
resolver = "2"
members = [
"crates/reims-vgpu",
"crates/reims-vgpu-paging",
"crates/reims-vgpu-wire",
]
exclude = [
"crates/reims-vgpu-efi",
]
# The shipping artifact is this workspace's staticlib linked into QEMU, and the
# device's own largest cost is host CPU in that staticlib — `chain_phase` divides
# the whole per-draw chain and its columns are Rust work, not GPU work. So these
# are the settings the product runs under, not a developer convenience.
#
# `panic` stays at the default `unwind` and must not become `abort`: every
# `reims_vgpu_qemu_*` entry point wraps its body in `catch_unwind`
# (`device::mod`), because a Rust panic unwinding into QEMU's C frames is
# undefined behavior. Aborting would turn every caught panic into a dead VM.
[profile.release]
opt-level = 3
lto = "fat"
codegen-units = 1