conformance: the CPU clocks and host pages have a Windows form; Windows answers no load average

The conformance command did not build for Windows: `src/clocks.rs` read the two CPU clocks with
`libc::clock_gettime` and the load average with `getloadavg`, and `src/host_pages.rs` mapped a
no-copy buffer's pages with `libc::mmap`, none of which `libc` has on Windows. So the Windows host
(a supported metal2vulkan-rt host) could not replay the suite.

On Windows the thread's and the process's CPU clocks are `GetThreadTimes` and `GetProcessTimes`
(kernel plus user, in 100 ns units), and the pages are a committed `VirtualAlloc` released with
`VirtualFree`, the forms metal2vulkan-runtime already uses. Windows keeps no load average, so
`host_load` answers `None` there, which the timing report already reads as "this host answers no
load average" and the per-call gate already judges on what the host does answer. `libc` is now a
unix-only dependency and `windows-sys` a Windows-only one, as in the runtimes.

A new unit test holds both CPU clocks to answering and moving while the thread computes, so a host
form whose call fails or reads a constant is seen. CI's Windows clippy now names the conformance
crate, so the Windows build is held from Linux.

Verified: unverified at this commit; the compile check and the Windows run follow.
This commit is contained in:
Anees Iqbal committed 2026-11-18 23:36:38 -08:00
1 parent bc6dc40a14
commit dea5618aa7
4 files changed
+193 -27

No files matched your search

+4 -4
View File
@@ -121,9 +121,9 @@ jobs:
CARGO_TARGET_DIR: target/gpucfg
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
# The published crates (and devtools, which their tests use) for Windows, checked from Linux:
# clippy links nothing, so neither target needs a Windows SDK or linker. gnullvm is the
# primary Windows target, msvc the second.
# The published crates (and devtools, which their tests use) and the conformance suite, which
# the Windows host replays, for Windows, checked from Linux: clippy links nothing, so neither
# target needs a Windows SDK or linker. gnullvm is the primary Windows target, msvc the second.
- name: Clippy for Windows (warnings denied, Linux)
if: runner.os == 'Linux'
run: |
@@ -131,7 +131,7 @@ jobs:
rustup target add x86_64-pc-windows-gnullvm x86_64-pc-windows-msvc
for target in x86_64-pc-windows-gnullvm x86_64-pc-windows-msvc; do
echo "::group::$target"
cargo clippy --target "$target" -p metal2vulkan-air -p metal2vulkan -p metal2vulkan-rt -p metal2vulkan-runtime -p metal2vulkan-devtools --all-targets --all-features -- -D warnings
cargo clippy --target "$target" -p metal2vulkan-air -p metal2vulkan -p metal2vulkan-rt -p metal2vulkan-runtime -p metal2vulkan-devtools -p metal2vulkan-conformance --all-targets --all-features -- -D warnings
echo "::endgroup::"
done