Skip to content

bench: Link stand-ins so port_comparison builds on Windows; record the Windows baseline (#3025) - #3039

Merged
zackees merged 6 commits into
masterfrom
fix/3025-windows-bench-link
Oct 30, 2026
Merged

zackees merged 6 commits into
masterfrom
fix/3025-windows-bench-link

Conversation

@vpacher

@vpacher vpacher commented Oct 30, 2026

Copy link
Copy Markdown
Member

Fixes #3025

What and why

The port_comparison bench of obs-c-oracle did not link on Windows (MSVC, rust-lld), so record.py could record no Windows baseline for #3009. The C ABI shims of obs-output and obs-hotkey and the output interleave oracle (oracle/output_interleave.c) call libobs functions by their libobs names; the cargo tests define stand-ins for them, the bench did not. No bench calls them, so the Linux and macOS linkers leave the unused callers out; lld-link reports every name.

  • 28 symbols, not 18. lld-link stops at 20 errors; with /ERRORLIMIT:0 the list is 26 on master, plus the two first-encoder-index helpers that appear once the others resolve. bench: port_comparison does not link on Windows (18 undefined libobs symbols) #3025 listed only the first 18.
  • port_comparison.rs gets an inline module libobs_stand_ins with the 28 functions: no parameters, -> !, they abort with the function's name if a bench ever calls one. Inline, because every file in port_comparison/ is a bench unit and a new file directly in benches/ would become a bench target of its own.
  • ci/test_bench_libobs_stand_ins.py requires an exported definition of each name, and that each name is still declared by a shim in some rust/*/src/ffi/ module, so the list cannot go stale. Linux CI cannot link for Windows, so the Windows build below is the check that counts.
  • record.py's cpu_name() reads the registry on Windows: platform.processor() gives only "AMD64 Family 25 Model 33 Stepping 2, AuthenticAMD".
  • format.rs notes that on MSVC the _c_scalar oracle is native SSE2 too (oracle/format_conversion_scalar.c: MSVC's sse-intrin.h always takes <emmintrin.h>).

Windows evidence (Windows 11 VM, MSVC 14.51, soldr 0.9.44)

Commit soldr cargo bench -p obs-c-oracle --bench port_comparison --no-run (/ERRORLIMIT:0) -- --test
RED (test only, bench unchanged) fails, 28 undefined symbols
GREEN (stand-ins) builds passes, 604 benches

macOS smoke on GREEN: passes, 604 benches. Linux: the local gate below.

Windows baseline

docs/rust-port/benchmarks/baseline-2026-10-30-windows-x86_64.json: record.py, 5 complete runs, 302 pairs, measured on the GREEN head before the rebase onto 5fe22f0 (no .rs, .c, .h or .toml file changed in between). Windows 11 VM (12 vCPUs) on the Proxmox host of the Linux baseline of #3029: AMD Ryzen 9 5950X, MSVC 14.51 (VS 18 Build Tools, cl 14.51.36260), not pinned.

The run came before the Windows cpu_name() fix and wrote the CPU family string; the chip name was filled in from the registry (ProcessorNameString). cc says [WinError 2]: cl.exe is not on PATH, cc-rs finds MSVC through vswhere. Every other field is as recorded.

Rust/C medians next to the Linux baseline of #3029 (same CPU; below 1: Rust is faster):

Case Windows, MSVC C (SSE2) Linux, GCC C (SSE2)
format/uyvx_to_i420 4.16 4.00
format/uyvx_to_nv12 4.93 5.22
format/uyvx_to_i444 3.92 3.89
format/i420_to_uyvx 1.42 3.21
format/nv12_to_uyvx 0.95 2.45
format/uyvy_to_uyvx 0.53 1.53
format/yuy2_to_uyvx 0.50 1.58
volmeter/sample_peak/1024 3.73 7.16
volmeter/true_peak/1024 0.83 0.97
audio_mix/mix_whole_tick 1.16 1.03
audio_mix/output_tick/stereo_6_mixes 0.50 0.30

The compress gap of #3004 is the same with MSVC. The scalar decompress C is slower with MSVC than with GCC, so there the Rust is equal or faster; the sample_peak gap of #3005 is half as large.

RED → GREEN

  • RED: fb0cca4 (ci/test_bench_libobs_stand_ins.py: 28 failures; Windows build: 28 undefined symbols). 6c0ad36 (Windows CPU name: 1 failure).
  • GREEN: 8261b6d and 9082afe; ci/test_bench_libobs_stand_ins.py 2/2, ci/test_benchmark_record.py 8/8; Windows build and smoke as above (the CPU name also checked on the Windows VM).
  • Real app: N/A (bench and tooling only).
  • Test cost: two ci/ test files, 10 cases, under 1 s; no Rust test added.

Checklist

  • Base is master
  • I claimed the issue, or no one else has an open PR for it
  • Characterization test (if the unit had none), then RED, then GREEN commits
  • User-visible change: not applicable (bench and tooling only)
  • (Optional) Local gate passed and the pushed head is stamped
  • Warning or flag changes: not applicable
  • Intentional differences from C: not applicable (no port)

🤖 Generated with Claude Code

vpacher and others added 6 commits October 30, 2026 10:38
…ons its oracles name (#3025)

The C ABI shims of obs-output and obs-hotkey and the output interleave
oracle call 28 libobs functions by their libobs names; the cargo tests
define stand-ins, the bench does not. lld-link reports them as undefined
(26 on this base with /ERRORLIMIT:0, plus the two first-encoder-index
helpers it reports once the others resolve), so the bench does not build
on Windows.

The test requires an exported definition of each in the bench (28
failures on the current port_comparison.rs) and that every name is still
declared by a shim in some src/ffi module, so the list cannot go stale.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s name (#3025)

port_comparison.rs defines the 28 libobs functions that the obs-output
and obs-hotkey shims and the output interleave oracle call by name. The
cargo tests define recording stand-ins; the bench calls none of them, so
these take no parameters and abort with the function's name if a bench
ever does. lld-link on Windows can now resolve them; Linux and macOS
linked before and are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Windows, platform.processor() is "AMD64 Family 25 Model 33 Stepping 2,
AuthenticAMD", so the Windows baseline of #3025 did not name its CPU.
The test asks record.py's cpu_name() for ProcessorNameString from the
registry on Windows (winreg is faked, so it runs on every host).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Windows cpu_name() reads ProcessorNameString from
HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0 (winreg) instead of
platform.processor()'s CPU family string. Checked on the Windows VM:
"AMD Ryzen 9 5950X 16-Core Processor".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…3025)

The Windows baseline shows equal times for format/<case> and
format/<case>_c_scalar: oracle/format_conversion_scalar.c notes that
MSVC's sse-intrin.h always takes <emmintrin.h>. Say so in format.rs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
record.py, 5 complete runs, 302 pairs, of 30e598af4 on a Windows 11 VM
(12 vCPUs) on the Proxmox host of the Linux baseline: AMD Ryzen 9 5950X,
MSVC 14.51 (VS 18 Build Tools, cl 14.51.36260), not pinned.

This run came before the Windows cpu_name() fix and wrote
"cpu": "AMD64 Family 25 Model 33 Stepping 2, AuthenticAMD"; the chip name
was filled in from the registry (ProcessorNameString). "cc" says
"[WinError 2]": cl.exe is not on PATH, cc-rs finds MSVC through vswhere.
Every other field is as recorded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=09ba5776f4617be4e48192ed9718432687281e4d secs=322 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a
Ci-Attestation: {"at":1793353475,"gate":"rust/all/fmt","host":"linux-x86_64","key":"93d9de7033ffb1ff95a204ed3508b387269f8f33e688233741a69f7b2c45aaf2","lane":"lint","parents":["5ba7e6deca25d2325486c1eddadd4e52eb4996d9"],"secs":72,"stamp":"adf83c071d44d332718947504458e3a2","tree":"09ba5776f4617be4e48192ed9718432687281e4d","v":1,"via":"run"}
Ci-Attestation: {"at":1793353475,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"93d9de7033ffb1ff95a204ed3508b387269f8f33e688233741a69f7b2c45aaf2","lane":"lint","parents":["5ba7e6deca25d2325486c1eddadd4e52eb4996d9"],"secs":72,"stamp":"ef77923d218568c5d79db425e6c968cf","tree":"09ba5776f4617be4e48192ed9718432687281e4d","v":1,"via":"run"}
Ci-Attestation: {"at":1793353475,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"38660475572433ac741eb54cce25d4dbaa31341ab1b98c13d369f849d491946d","lane":"rust-test","parents":["5ba7e6deca25d2325486c1eddadd4e52eb4996d9"],"secs":156,"stamp":"719691af07f17a8fede9869a2f1e68cd","tree":"09ba5776f4617be4e48192ed9718432687281e4d","v":1,"via":"run"}
Ci-Attestation: {"at":1793353475,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"3c6f5314cee6054d8981438876171aad0e6c1262bc4ed240ada2794ac952645f","lane":"cross","parents":["5ba7e6deca25d2325486c1eddadd4e52eb4996d9"],"secs":94,"stamp":"589428ddf4dc1d20f2aecbd99ff28d7d","tree":"09ba5776f4617be4e48192ed9718432687281e4d","v":1,"via":"run"}
Ci-Attestation: {"at":1793353475,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"3c6f5314cee6054d8981438876171aad0e6c1262bc4ed240ada2794ac952645f","lane":"cross","parents":["5ba7e6deca25d2325486c1eddadd4e52eb4996d9"],"secs":94,"stamp":"d000b00075a435d2310a5cb89c5115ad","tree":"09ba5776f4617be4e48192ed9718432687281e4d","v":1,"via":"run"}
Ci-Attestation: {"at":1793353475,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"3c6f5314cee6054d8981438876171aad0e6c1262bc4ed240ada2794ac952645f","lane":"cross","parents":["5ba7e6deca25d2325486c1eddadd4e52eb4996d9"],"secs":94,"stamp":"aa01393c47e5af642bf896b01dddd3d6","tree":"09ba5776f4617be4e48192ed9718432687281e4d","v":1,"via":"run"}
Ci-Attestation: {"at":1793353475,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"3c6f5314cee6054d8981438876171aad0e6c1262bc4ed240ada2794ac952645f","lane":"cross","parents":["5ba7e6deca25d2325486c1eddadd4e52eb4996d9"],"secs":94,"stamp":"a942095841fd1dafa0ff7933fcf72cd9","tree":"09ba5776f4617be4e48192ed9718432687281e4d","v":1,"via":"run"}
Ci-Attestation: {"at":1793353475,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"0a532e0b52a020706d8883b9b376855a22a46551a0be9d86916f936516ac20d4","lane":"tier2-linux","parents":["5ba7e6deca25d2325486c1eddadd4e52eb4996d9"],"secs":309,"stamp":"fa8a3e53097fa06e033ebf29c5da1b21","tree":"09ba5776f4617be4e48192ed9718432687281e4d","v":1,"via":"run"}
@vpacher
vpacher marked this pull request as ready for review October 30, 2026 10:04
@vpacher

vpacher commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

Ready for review. CI is green (CI Gate ✅); the pushed head 637be83 is stamped by the local gate (lint, rust-test, cross, tier2-linux), so PR CI skipped the Linux unit-test lanes. The Windows build and smoke run are local (PR CI does not build the benches on Windows); the evidence is in the description.

Auto-merge is off on purpose: please comment before it merges. The Windows numbers are also summarized on #3009 (comment of 2026-10-30) next to the x86-64-v3 info run.

@vpacher
vpacher requested a review from zackees as a code owner October 30, 2026 10:04
@zackees
zackees added this pull request to the merge queue Oct 30, 2026
Merged via the queue into master with commit 700e7a6 Oct 30, 2026
36 checks passed
@zackees
zackees deleted the fix/3025-windows-bench-link branch October 30, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bench: port_comparison does not link on Windows (18 undefined libobs symbols)

2 participants