A report could not say which builds it came from: reims-ctl's version was
the package's, and the library named its commit only where `cargo xtask
dist` set RVG_BUILD_COMMIT, so a QEMU or reims-ctl from another build than
the install's went unseen.
Each is now stamped at build time by a build script of its own, with no
new dependency: `git rev-parse HEAD`, `-dirty` where a tracked file of the
tree differs from it (Cargo.lock aside, which a build rewrites), and
`unknown` outside a checkout, never failing the build. The library's is
reims-vgpu-c's, handed to the Vulkan crate at the C API's first call, so
every build of it carries it, not only dist's; xtask's RVG_BUILD_COMMIT and
the recorder's own read of it go.
`reims-ctl --version` shows its stamp. The ask for the counts writes the
library's build line, `reims-vgpu: build <commit> on metal2vulkan <pin>`,
and system.txt's head names reims-ctl's stamp, the running library's as
the QEMU log names it, the install record's commit and the metal2vulkan
commit, with one plain line where the commits differ. Display only.
A user's install of the development channel on Windows stopped in cargo
xtask dist: Git for Windows' installer sets core.autocrlf=true, the clone
held CRLF .metal sources, and reims-vgpu-vulkan's build script found the
committed metallibs built from other bytes. 5fdd3c05f's .gitattributes
(* text=auto eol=lf) keeps LF in every checkout, but nothing checked that
the attribute holds for the files read byte for byte.
xtask's new test asks git check-attr for text and eol of a .metal source,
the C header and a guest Info.plist, and wants auto and lf for each. With
the attribute line taken out it fails: eol is unspecified.
cargo xtask dist builds reims-vgpu-compile with reims-vgpu-c selected beside
its package, so the crates the two share resolve with the library's features
and build once, and installs it in the tree's bin on Linux, macOS and Windows.
The library starts the helper from beside the host's executable, so make qemu
copies it into build/qemu and install-ctl.sh into each QEMU install, with the
CLANG64 DLLs it loads on Windows. A QEMU without it refuses the pipelines past
rt's stage bound as before; --skip-qemu warns about such a kept install.
RtPlatform, over metal2vulkan-rt, has been the library's platform since the
`rt` feature went on by default; VulkanPlatform, over metal2vulkan-runtime,
built only without it. This deletes VulkanPlatform, every module only it
used, the metal2vulkan-runtime dependency, and the `rt` feature with its cfg
arms in reims-vgpu-vulkan, reims-vgpu and reims-vgpu-c. Every handle was
already made on RtPlatform, so neither the guest nor the host sees a change;
the C header, QEMU, the guest's sets, the ROM and reims-ctl are untouched.
The tests of the deleted code go with it. The on_vulkan tests that held the
old platform now hold rt. The 15 that rt fails are ignored, each with the gap
rt names: texture buffers, a texture over a buffer or an IOSurface plane, a
rasterization rate map, visibility result modes, a kernel's stage input,
tessellation, a buffer of 0 bytes, a texture at the guest's resource ID, and
the guest's class, which rt is not told.
.config/nextest.toml drops the overrides of the deleted tests, and
lane-gate.sh reads the pin from metal2vulkan-rt's line.
0ba60a07dc linked Homebrew's Vulkan loader and KosmicKrisp in
<target>/debug/lib, ../lib from <target>/debug/deps. Under the pinned
nightly's build-dir layout no deps directory is made: each test binary is
<target>/.../build/<crate>/<hash>/out/<bin>, whose ../lib is
build/<crate>/<hash>/lib, so the links served no test (batch 329's Mac leg,
m3-max-58423, had no deps directory at all).
The check now asks nextest where the binaries are: cargo nextest list with
the run's own arguments, which builds them, lists each binary's path
(binary-path, --list-type binaries-only, JSON), and the loader and
KosmicKrisp are linked in ../lib from each binary's directory before the
run. That holds under either layout. A file Homebrew lacks is named and
not linked, as before. A list that fails, or that names no binary, fails
the check.
tools.rs's reader of cargo metadata's target_directory becomes json_strings,
every string value of a key, which reads nextest's list too. The test that
pinned the Makefile lines goes: the check no longer runs make for this. The
new tests read a list and lay out the directories of both layouts.
On a Mac the rt platform loads the Vulkan loader and Mesa's KosmicKrisp only
from beside the process's executable or from ../lib (rt_driver.rs). nextest
runs the test binaries from <target>/debug/deps, where nothing links them, so
on a Mac every test that opens a device found none. The merge harness links
them itself for its own test runs; cargo xtask check did not.
The check now runs the Makefile's vulkan-links before nextest, with BUILD set
to <target>/debug, so the links land in <target>/debug/lib: the loader to
Homebrew's vulkan-loader and KosmicKrisp to Homebrew's mesa, through each
formula's opt directory, as for a QEMU in build/qemu. A file Homebrew lacks
is named and not linked, as there. A test pins the Makefile lines the path
depends on.
The owner's word (Telegram 1924, relayed by metal2vulkan): the hosts are
Linux, Windows and macOS, and on macOS the library runs on Vulkan, not Metal.
README and the crates' and docs' notes said VMs run on Linux and that the Mac
build was for development and tests. They now say x86-64 guests run on Linux
and Windows hosts and arm64 guests on Apple silicon Macs, and that the Vulkan
platform runs natively on Linux and Windows and over MoltenVK on macOS.
rust-toolchain.toml names Windows' target as shipping too, and a reims-ctl
test's note says the test, not the installer, is Linux-only. AGENTS.md waits
for the owner's own word.
Cargo.lock is committed without metal2vulkan's git source lines, and every
build writes them back, so by the time cargo xtask dist ran its check every
tree that had built read as dirty. The lock's other changes follow Cargo.toml,
which the check still reads.
metal2vulkan's stream table reads which recorder made a recording off its
files. The stats file now starts with recorder_commit, the commit the library
was built from, and a recorder_fix line for each change to what a stream holds
since format version 2, in landing order (recorder::FIXES, which each such
change extends in its own commit). cargo xtask dist stamps the commit for its
Cargo steps in RVG_BUILD_COMMIT (git rev-parse HEAD, -dirty where a tracked
file differs); other builds write unknown. Cargo and kache key the Vulkan
crate on the variable, so a dist at another commit compiles it again. The
stream itself and the device's behaviour are unchanged.
The module doc of xtask/src/dist/order.rs linked [`cmd_link_order`], a function
built only on Linux. cargo doc on a Mac (the merge's rustdoc, -D warnings)
found no such item and failed (m3-max-38085). It is named in code font now.
On the desktop, the device's lanes walk WindowServer's command buffers at
about 120 us per render encoder on a Zen 4 host, and the walk is bound by
instruction fetch: the code it runs is spread over far more 4 KiB pages
than the L2 iTLB holds. Placing that code in the order lld's call-graph
clustering gives it, from a profile of the desktop, makes the walk faster.
Linux's dist now reads crates/reims-vgpu-c/link-order.txt, the library's
functions one a line as GNU nm -C prints them without crate
disambiguators, and in the objcopy call that localizes the archive's object
renames each listed function's section to .text.sorted.NNNNNN in the
list's order. GNU ld's default script sorts those by name ahead of the
rest of .text, so make qemu and install-ctl.sh's QEMU get the order with
the compiler's default linker; a linker that does not sort them keeps the
order it had. dist prints how many of the list's functions it placed: a
function no longer in the archive is skipped, so a stale list loses speed
and never fails the build. The list survives a metal2vulkan pin move,
whose crates change only their disambiguators.
cargo xtask link-order BINARY CALL_GRAPH (Linux) writes the list from a
QEMU lld linked with --call-graph-ordering-file, after this tree's dist;
docs/development.md, "The link order", says how to refresh it. With no
list the archive is as before.
aux.rs (ad3b37b8e) kept every Windows checkout of development out from
25ff40427 on, through every check, as none checks the tree out on Windows.
`cargo xtask paths`, now the first step of `cargo xtask check`, reads every
path `git ls-files` lists, reims-ctl's and reims-restore's workspaces among
them, and fails on what git for Windows refuses or Windows' file systems
merge: a device name Windows keeps (CON, PRN, AUX, NUL, COM1 to COM9, LPT1
to LPT9, CONIN$, CONOUT$) with or without an extension, a character Windows
refuses (<>:"|?*, a backslash, a control character), a name ending in a dot
or a space, and two paths or directories that differ only by case. Its tests
hold bad names of each kind, aux.rs among them, and names that only start
like a device's.
docs/lessons.md records the trap, and the one beside it: reims-ctl's new
dependency, built for Windows only on Windows.
cargo xtask check's Windows clippy left the video crate's own tests and
examples out, since its fuzzers' CPU-time clock was clock_gettime's alone. They
build for Windows now, so the exclusion goes, and the check type-checks every
workspace target for x86_64-pc-windows-gnullvm.
Every library crate builds for x86_64-pc-windows-gnullvm since 11-15, but
nothing in the check saw Windows, so the next Unix-only call in shared code
would break the Windows build unnoticed. The check now runs clippy for that
target on the Mac and on Linux, as the Mac already does for Linux: SDL left
unbuilt, nothing linked. The video crate's own tests and examples stay out,
since their CPU-time clock (codec/fuzz_support.rs) is clock_gettime's; its
library is still checked as reims-vgpu's dependency.
rust-toolchain.toml lists the target, so rustup installs it on every host,
and a test keeps the check's cross targets in that list.
`cargo xtask dist` refused on Windows. Run in MSYS2's CLANG64 environment, it
now builds reims-vgpu-c for x86_64-pc-windows-gnullvm, the MinGW target whose
archive QEMU's Windows build links, and writes the tree as on Linux: the
archive, lib/libreims_vgpu.dll, the header, and reims-vgpu.pc, whose
Libs.private is rustc's native-static-libs note for the target.
The archive bundles SDL3, whose 3203 SDL_* globals a host's own SDL (QEMU's
-display sdl, SDL 2) would bind to. Linux links the objects into one and makes
every global but the C API's local; COFF has no such link: lld makes no
relocatable object, and GNU ld -r resolves the objects' COMDAT sections into
static symbols in section 0 that lld refuses ("GCC_except_table36 should not
refer to special section 0"), after writing a plain COFF object of 156110
sections that no tool read until given --oformat pe-bigobj-x86-64. So the
objects stay as built, and llvm-objcopy --redefine-syms gives every global they
define but the rvg_* functions the suffix .rvg, with its __imp_ name, in every
object: no C name of a host's is one of them, and each reference in the archive
binds where it did. rustc's 1832 raw-dylib import members stay as built. dist
fails where the objects keep another global.
The DLL is linked from the archive with a module-definition file that exports
the rvg_* functions alone, and not --whole-archive, which would define each
crate's import descriptor of a DLL again. No import library is installed, so
-lreims_vgpu and meson's static lookup take the archive. What Linux and Windows
share (rustc's note, nm's listing, the C API's names and the globals check)
moves from linux.rs to dist/archive.rs.
xtask did not build for Windows: dist picked an OS module only on Linux
and macOS, and replace_if_changed and its tests set and read Unix modes.
cargo xtask is how a Windows host will run the checks, so it builds there
now:
- dist/windows.rs makes no tree. Its dist refuses, building and writing
nothing, until a dist tree is laid out for Windows (the static archive's
symbol localization there is still open).
- replace_if_changed sets the mode on Unix only, since Windows keeps no mode
bits. The tests' mode reads and the symlink case run on Unix only.
- The helpers that only the Unix dists call expect dead_code on Windows, so
the expectation fails once a Windows dist uses them.
Linux and macOS run the same code as before.
cargo xtask dist wrote every file of its tree on each run, the archive and
the header included, so every make qemu recompiled reims-graphics-pci.c and
relinked the 358 MB qemu-system-x86_64 even when nothing had changed.
Every file dist writes now goes through one helper, replace_if_changed: a
file that already holds the bytes keeps its mtime and gets only its mode;
one that changed is removed and written anew, as install did. For the bytes
to come out the same, the archive is packed in the target dir's
dist-localized with zero dates (ar's D on Linux, libtool -D on macOS) and
installed from there, and on macOS the dylib is renamed and signed on a copy
there before it is installed.
The Vulkan crate is the library's only platform since the Metal platform
went, and every crate that links core links the Vulkan crate too, so core
needs no crate of its own. Its files move unchanged under
reims_vgpu_vulkan::core (crate::core in the Vulkan crate), the module the
video crate's layout already uses; its #[macro_export] macros stay at the
crate's root, so reims_vgpu_core::metal_check! is reims_vgpu_vulkan's now.
core's lint set is the module's inner attributes, as it was the crate's.
Nothing the guest or the host observes changes, and reims_vgpu.h is the
same. Core's log lines name reims_vgpu_vulkan::core:: as their target in
place of reims_vgpu_core::, so reims-ctl's example filter says so.
The testkit feature is the Vulkan crate's, reims-vgpu-vulkan/testkit, and
the crate's integration tests turn it on through a dev-dependency on the
crate itself, as core's dependents turned core's on. core's tests keep
their paths below core:: in the Vulkan crate's unit tests, and cargo xtask
check's x86_64-apple-darwin leg runs those alone: -p reims-vgpu-vulkan
--lib -E 'test(/^core::/)'. The tests that run themselves again in a child
name themselves below core:: too (a child given a name that matches no
test runs nothing and passes), and the memory map's tests take the lines
of the targets below reims_vgpu_vulkan::core::memory.
The macOS test that declares _exit now declares it safe, as the testkit
does: rustc's clashing_extern_declarations compares the declarations
within one crate.
dist_writes_the_tree_and_renames_the_dylib expected target/dist, but the dist
tree's default has been target/dist-vulkan (DEFAULT_OUT) since the Metal
platform's deletion, so the test failed on every Mac. It now expects
DEFAULT_OUT, the constant the code uses.
The crate that holds the reims-graphics device's wire and transport now
carries the library's prefix, as reims-vgpu-video does: its directory is
crates/reims-vgpu-graphics, its package reims-vgpu-graphics, and its Rust
path and log target reims_vgpu_graphics. The guest's, the option ROM's and
Ambrosia's Makefiles include the wire header from the new directory, and the
prebuilt records name it there.
Nothing changes for the guest or the host. The device keeps its name
(reims-graphics, QEMU's reims-graphics-pci, PCI 1234:5247), and the wire
header keeps its file name and RGFX_ symbols. The C API header is unchanged,
and the prebuilt kexts and option ROM are byte-identical; only the records'
paths and source hashes move. A log filter names the crate's lines by its
new target (REIMS_VGPU_LOG=info,reims_vgpu_graphics=trace), a diagnostic.
The owner's order: the library runs on the Vulkan platform alone. On Linux
it already did; on a Mac it now builds over MoltenVK, for development and
tests, and ships nowhere. crates/reims-vgpu-metal goes whole, with its
workspace entry and every use:
- reims-vgpu: platform/metal.rs, graphics::metal (the macOS sink),
display_cost.rs and cfg(vulkan_platform) go; DefaultPlatform is
VulkanPlatform everywhere, and the Vulkan crate and the runtime are plain
dependencies. `vulkan` stays as an empty feature for the builds that name
it.
- reims-vgpu-window: the AppKit side's message layer, clock and threads
are the Vulkan crate's (reims_vgpu_vulkan::os::msg, OsClock, OsThreads).
- reims-vgpu-vulkan: the macOS OS layer moves in from the Metal crate, cut
to what is used (msg.rs, clock, threads, Mach VM, IOSurface,
autorelease); shaders.metal moves here, without the XR10 paging kernels
nothing calls since the paravirt protocol went. shaders.metallib and
no_draw.metallib are compiled again on the M3 Max with metallibs.toml.
- reims-vgpu-c: Plat is VulkanPlatform; `vulkan` stays as an empty feature.
The C API's header does not change.
- xtask dist builds the Vulkan platform on every OS into dist-vulkan, and
refuses `--platform metal`; check tests one feature set everywhere. The
Makefile's RUST_DIST follows.
The tests whose oracle was the Metal platform keep its answers: each Metal
leg was run on the M3 Max (macOS 27.0.1) before the crate went, and its
answers are the test's fixed expected values, in text files beside each
test (metal_answers/, large ones as a digest or in an xz companion), read
by core's testkit::metal_answers. They are Metal's, never to be rewritten
from this library's own output. Tests that only measured the Metal platform,
or duplicated a literal-checked Vulkan test, go.
apple-gfx-pci loaded ReimsVgpu.rom, its UEFI driver, as its default romfile;
with apple-gfx gone the driver, its sources and its build go, and cargo xtask
dist installs no ROM and names none in reims-vgpu.pc (QEMU stops reading its
optionrom variable). The firmware builds only the reims-graphics device's ROM,
which reims-ctl carries: OptionRom.S keeps the layout ReimsGraphicsRom.S
includes, with no apple-gfx-pci identity to fall back on.
The prebuilt ROM's bytes are unchanged (sha256 749434f8, rebuilt on the Mac):
only its record moves, for the Makefile and the two assembler files it names.
QEMU keeps only reims-graphics-pci.c's calls once apple-gfx goes: the ten
rvg_graphics_device_* functions, rvg_status_message, the window's and the
cursor's types and the memory map the device's config names. Everything of
Apple's paravirt device goes from the header: the device, its displays and
frames, the IOSurface, video and scaler devices, trace ranges, the log hook,
the dirty source, suspend and resume, and their status codes, pins and the
xtask smoke that drove them.
The C API is no longer additive-only: the status codes are renumbered to the
five the graphics calls return, rvg_status_message keeping a message for each,
and the struct versions the paravirt hosts needed go, so a struct_size below
the library's is refused. The window config keeps its mode, the one field the
graphics device reads; the cursor and memory-map types move beside the
graphics device. rvg_graphics_device_mmio_write goes too, QEMU calling only
the taking write, which now carries the plain write's contract.
`make -C guest prebuilt-check` hashes guest/prebuilt and the sources it was
built from against guest/prebuilt/sources.toml, on any host, and fails
where the set reims-ctl embeds went stale. It runs beside the ROM's check,
since the library's checks would not reach a change to the wire header the
set is built against.
QEMU's reims-graphics-pci has no default option ROM, and reims-ctl is to
name one for every x86-64 VM on reims-vgpu's own device, on hosts that
build no firmware. firmware/prebuilt/ReimsGraphics.rom is the ROM `make -C
firmware prebuilt` builds on a Mac (Apple clang 21.0.0, Homebrew lld 23.1.4;
the bytes are the compiler's), and ReimsGraphics.toml records its sha256
and that of every file it was built from, the wire header among them.
`make -C firmware prebuilt-check` (firmware/prebuilt.sh --check) hashes the
ROM and those files against the record on any host, with no compiler, and
`cargo xtask check` runs it: the wire header is the library's, whose checks
would otherwise never see the ROM go stale.
rustdoc, on macOS and the Linux target, in public and private docs,
found 55 broken intra-doc links beside those of the commit before, and 8
redundant explicit ones. Each now names the item it means: a link to a
test-only helper, or to an item rustdoc cannot see from the doc or that
only another OS has, becomes the plain name; one to an item out of the
doc's scope takes its path; an ambiguous name takes its kind (a module,
or a function by its parentheses); and links to items gone name what the
code does now (the vaapi backend's frames are copied through read_back
and FrameReadBack::copy_to; the graphics decoder lets a message go at
end_message; the gate's waits and lane moves are their _offering forms,
the plain ones being the tests'). The links the ycbcr module made to an
'answer' that never resolved are dropped.
cargo xtask dist builds SDL again with the flags that give its classes the
library's names and keep its globals uncommon (-fno-common), for macOS 11.0.
Where the build runs through kache (dev-env.sh), kache serves a build
script's run from its store by the inputs Cargo reruns it for, and SDL's
script declares none of those flags, so a run of a build with no flags, from
any target directory on the host, was served in its place. A dev dist then
failed its archive check: SDL's _b_inModeTransition and _mach_base_info were
common symbols, left global, and its objects were built for the SDK's macOS
(measured on the M3 Max, after a dev test build had built SDL there).
dist's build now turns kache's build-script cache off with an [env] entry,
KACHE_BUILD_SCRIPT_CACHE=0, which the rustc wrapper and the scripts see, so
its build scripts run as without kache, and a run with the library's flags
is not served to another build either.
The guest's kext and option ROM are built in parallel and need the device's
wire format before the host side exists: its registers, the region's layout,
the rings' header and the control commands and events of the design's stage
2 wire protocol. They live in a new crate, reims-graphics, which will hold the
device's host side too, and cbindgen writes them into
include/reims_graphics_wire.h, which cargo xtask header --check keeps equal
to its output, as it does reims_vgpu.h.
Two fixes to the design's tables: a control ring's byte ring is 32 KiB, the
largest power of two after its 256-byte header in its 64 KiB (64 KiB less the
header is no power of two), and a pad's header is its type and size alone,
since the bytes left before a ring's end may be 8. A u64 that would follow a
u32 at an offset not a multiple of 8 has a reserved u32 before it, so C and
Rust lay the records out alike.
The owner asked for Rust's incremental cache and kache 2.0.0's. dev-env.sh
no longer sets CARGO_INCREMENTAL=0 or KACHE_ADAPTIVE_INCREMENTAL=0, and unsets
both where a shell kept them, and `cargo xtask check` runs its cargo steps in
the environment it starts in, so a check run again after a fix rebuilds what
the fix changed. Each host's kache configuration turns on adaptive and seeded
incremental state: kache compiles a unit being edited incrementally, and a
new worktree's first incremental compile of it imports a compatible one's
state (rustc 1.98 or later). docs/development.md says how, and that kache 2
compiles through its daemon, which builds now start.
Each worktree's check compiled everything again with full debuginfo and
incremental caches no rebuild used. The dev profile keeps line tables for
the workspace and none for its dependencies, the check builds without
incremental caches, and builds go through kache where it is installed, so
a worktree's first build reuses what another tree built, build scripts
included. Tests read the tree's paths at run time, so a build is the same
in every tree.
scripts/new-worktree.sh makes a worktree from clones of the main checkout's
suite files, and AGENTS.md says a profiling run removes its traces.
Source: 53a4a8edd b568f382e 0c7a0eabc 72c24f74b 10051ba78 8f415697a 73d557f71
bde4220b6 46c7c6b23
On x86-64 Linux and arm64 macOS the C API's crate makes jemalloc the global
allocator, so every Rust allocation in the library, metal2vulkan's runtime's
among them, goes through it. FIFO 1's commands allocate memory that the
runtime's threads free, and glibc refills its arena for each such block on
the allocating thread: on ms01's Iris Xe a Finder drag ran at 36 frames/s
under glibc and 42 with jemalloc preloaded into QEMU.
jemalloc's symbols stay prefixed, so QEMU's C code, the drivers and Apple's
frameworks keep the system's malloc. On macOS jemalloc is built with no
malloc zone (the workspace's cargo config), as its zone would otherwise
register ahead of the system's in every host that links the archive whole.
No block crosses between the two allocators: the suspend bytes the host is
handed go back through rvg_bytes_free, and the blocks the Metal platform
gives NSData and dispatch_data to free are malloc's own. Nothing the guest
or the host observes changes.
A Mac's `cargo xtask check` type-checks Linux with no Linux C toolchain, so
it points jemalloc's build script at an empty archive for that target, as it
leaves SDL unbuilt there: nothing links.
This repository now holds libreims_vgpu, a Rust library that is the host
side of the paravirtualized GPU macOS guests drive, in place of Apple's
ParavirtualizedGraphics.framework: the library and its C API
(reims_vgpu.h), the PCI device's option ROM, QEMU's apple-gfx on that API
(vendor/qemu), the behaviour-lock suite that drives the C API as QEMU
does, and reims-ctl, the VM manager users run. README.md says what it is
and how it is laid out, and AGENTS.md how to change it.
Every file of the earlier tree is replaced. vendor/qemu moves to the
steelbrain/reims-vgpu branch of the same public repository.