tests: cover FrozenComputeRequests eviction, capacity bounds, and concurrency #3744

Manually merged
github merged 3 commits from github-bot/gh-3742 into main 2026-12-01 17:11:25 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-12-01 13:53 UTC · original
Ammmae0x:tests/frozen-compute-requests → main · +1056 −0 · 5 files · 3 commits · merged 2026-12-01 17:07 UTC

Refs #1149

Portable C++17 unit, boundary, concurrency, and mutation tests for src/frozen_compute_requests.h (x2w::FrozenComputeRequests), with zero edits to existing files (5 new files only).

  • tests/frozen_compute_requests_check.cpp: 20 cases pinning enabled() budgets, the exact byte budget (a request charging exactly max_bytes fits, one byte over is refused without evicting), FIFO entry eviction and single/multi-entry byte eviction, duplicate-key early return before eviction (under entry and byte pressure) versus re-insert after take(), caller-mutation isolation and stats() accounting (hits, misses, evicted, bytes, entries), take() restoring byte headroom, wave32 detection from state block A byte 18 (set, clear, bit variants, short blocks), and multi-threaded contention (distinct keys, same-key puts, same-key takes). Charges are measured via stats().bytes, never assumed, so the exact-fit cases hold on any standard library.
  • tests/cmake/frozen_compute_requests.cmake: per-case tests plus frozen_compute_requests_all and 6 WILL_FAIL TRUE controls against real copied headers (enabled-bytes, byte-guard, duplicate, evicted-counter, wave32-assign, take-bytes).
  • tests/frozen_compute_requests_meta_check.py: contract audit plus native g++ run (all cases together and singly, 1:1 real mutated header copies, zero model-only mutants).
  • tests/checks/python-linux/frozen_compute_requests.txt and docs/experiments/frozen-compute-requests.md.

Linux checks (this host, g++ 13): meta check PASS: frozen compute requests: 20 cases, 6/6 mutations killed (g++); form/docs/bidi pass (208 files/802 links, 2826 files); parallel runner 90/90; scratch CMake + CTest 27/27; git diff --check clean. One flag is downgraded, and only that one: the unmodified src/shader_compute_request.cpp triggers -Wmissing-field-initializers on g++ 13, so the native compile adds -Wno-error=missing-field-initializers. No mingw on this host, so no Windows compile check; WIN-VERIFY run is the arbiter.

AI-assisted.

Windows Verification (d91bbf8b)

  • git merge-tree --write-tree upstream/main HEAD -> 17345441 (exit 0), git diff --check clean
  • Python checks: py_compile, form_coverage_check.py, docs_links_check.py (209 files, 806 links), bidi_controls_check.py (2829 files) passed
  • Commands:
cmake --build --preset dev --target frozen_compute_requests_check frozen_compute_requests_enabled_bytes_mut frozen_compute_requests_byte_guard_mut frozen_compute_requests_duplicate_mut frozen_compute_requests_evicted_counter_mut frozen_compute_requests_wave32_assign_mut frozen_compute_requests_take_bytes_mut
ctest --preset dev --no-tests=error -R "^frozen_compute_requests" --output-on-failure
cmake --build --preset release --target frozen_compute_requests_check frozen_compute_requests_enabled_bytes_mut frozen_compute_requests_byte_guard_mut frozen_compute_requests_duplicate_mut frozen_compute_requests_evicted_counter_mut frozen_compute_requests_wave32_assign_mut frozen_compute_requests_take_bytes_mut
ctest --preset release --no-tests=error -R "^frozen_compute_requests" --output-on-failure
  • Results: dev 27/27 passed (1.07s); release 27/27 passed (0.90s); frozen_compute_requests_check: PASS: frozen_compute_requests: 20/20 cases passed. AI-assisted.
**@⁠Ammmae0x** on GitHub · 2026-12-01 13:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3742) `Ammmae0x:tests/frozen-compute-requests` → `main` · +1056 −0 · 5 files · 3 commits · merged 2026-12-01 17:07 UTC Refs #1149 Portable C++17 unit, boundary, concurrency, and mutation tests for `src/frozen_compute_requests.h` (`x2w::FrozenComputeRequests`), with zero edits to existing files (5 new files only). - `tests/frozen_compute_requests_check.cpp`: 20 cases pinning `enabled()` budgets, the exact byte budget (a request charging exactly `max_bytes` fits, one byte over is refused without evicting), FIFO entry eviction and single/multi-entry byte eviction, duplicate-key early return before eviction (under entry and byte pressure) versus re-insert after `take()`, caller-mutation isolation and `stats()` accounting (hits, misses, evicted, bytes, entries), `take()` restoring byte headroom, `wave32` detection from state block A byte 18 (set, clear, bit variants, short blocks), and multi-threaded contention (distinct keys, same-key puts, same-key takes). Charges are measured via `stats().bytes`, never assumed, so the exact-fit cases hold on any standard library. - `tests/cmake/frozen_compute_requests.cmake`: per-case tests plus `frozen_compute_requests_all` and 6 `WILL_FAIL TRUE` controls against real copied headers (enabled-bytes, byte-guard, duplicate, evicted-counter, wave32-assign, take-bytes). - `tests/frozen_compute_requests_meta_check.py`: contract audit plus native g++ run (all cases together and singly, 1:1 real mutated header copies, zero model-only mutants). - `tests/checks/python-linux/frozen_compute_requests.txt` and `docs/experiments/frozen-compute-requests.md`. Linux checks (this host, g++ 13): meta check `PASS: frozen compute requests: 20 cases, 6/6 mutations killed (g++)`; form/docs/bidi pass (208 files/802 links, 2826 files); parallel runner 90/90; scratch CMake + CTest 27/27; `git diff --check` clean. One flag is downgraded, and only that one: the unmodified `src/shader_compute_request.cpp` triggers `-Wmissing-field-initializers` on g++ 13, so the native compile adds `-Wno-error=missing-field-initializers`. No mingw on this host, so no Windows compile check; WIN-VERIFY run is the arbiter. AI-assisted. <!-- WIN-VERIFY: passed | sha=d91bbf8ba144a6d6f9ccb5acb4de4cb5925cc574 | targets=frozen_compute_requests_check frozen_compute_requests_enabled_bytes_mut frozen_compute_requests_byte_guard_mut frozen_compute_requests_duplicate_mut frozen_compute_requests_evicted_counter_mut frozen_compute_requests_wave32_assign_mut frozen_compute_requests_take_bytes_mut | ctest=^frozen_compute_requests | release=true --> ### Windows Verification (`d91bbf8b`) - `git merge-tree --write-tree upstream/main HEAD` -> `17345441` (exit 0), `git diff --check` clean - Python checks: `py_compile`, `form_coverage_check.py`, `docs_links_check.py` (209 files, 806 links), `bidi_controls_check.py` (2829 files) passed - Commands: ```text cmake --build --preset dev --target frozen_compute_requests_check frozen_compute_requests_enabled_bytes_mut frozen_compute_requests_byte_guard_mut frozen_compute_requests_duplicate_mut frozen_compute_requests_evicted_counter_mut frozen_compute_requests_wave32_assign_mut frozen_compute_requests_take_bytes_mut ctest --preset dev --no-tests=error -R "^frozen_compute_requests" --output-on-failure cmake --build --preset release --target frozen_compute_requests_check frozen_compute_requests_enabled_bytes_mut frozen_compute_requests_byte_guard_mut frozen_compute_requests_duplicate_mut frozen_compute_requests_evicted_counter_mut frozen_compute_requests_wave32_assign_mut frozen_compute_requests_take_bytes_mut ctest --preset release --no-tests=error -R "^frozen_compute_requests" --output-on-failure ``` - Results: `dev` 27/27 passed (1.07s); `release` 27/27 passed (0.90s); `frozen_compute_requests_check`: `PASS: frozen_compute_requests: 20/20 cases passed`. AI-assisted.
Refs #1149

Portable C++17 unit, boundary, concurrency, and mutation tests for
src/frozen_compute_requests.h with zero edits to existing files:
20 cases pinning enabled() budgets, the exact byte budget (fit at
max_bytes, refusal at max_bytes + 1 without evicting), FIFO entry
and single/multi-entry byte eviction, duplicate-key early return
versus re-insert after take(), caller-mutation isolation and
stats() accounting, take() restoring byte headroom, wave32
detection from state block A byte 18 (set, clear, bit variants,
short blocks), and multi-threaded contention, plus 6 WILL_FAIL
TRUE mutation controls.

Linux: meta check PASS (20 cases, 6/6 mutations killed, g++);
form/docs/bidi pass (208 files/802 links, 2826 files); parallel
runner 90/90; scratch CMake + CTest 27/27; git diff --check
clean. Windows verification pending.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 13:54:56 +00:00
The lambdas in case_concurrency_distinct() use per_thread without
capturing it. GCC accepts the implicit use of the block-scope
constexpr, but MSVC C++17 rejects it with error C3493. Making
threads and per_thread static constexpr gives them static storage
duration, so no capture is needed. No other lambda in the check
uses an uncaptured local. Refs #1149.
Author
Owner

@⁠Leyukaka on GitHub · 2026-12-01 14:20 UTC · original · reviewed

Please derive the byte_eviction_multi budget from reachable fixture charges. with_charged assumes increasing the code length can produce every integer charge. MSVC rounds char string capacities using a mask of 15. The six copied strings in this fixture then charge 202 bytes for the base request and can only produce charges congruent to 10 modulo 16. The target of 404 is unreachable, so this test throws before it checks eviction.

One option is to measure a larger fixture, set the budget to its measured charge, and require that two small entries fit before inserting it. That still checks that insertion evicts both entries and leaves the expected byte count.

**@⁠Leyukaka** on GitHub · 2026-12-01 14:20 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3742#pullrequestreview-6133142072) · **reviewed** Please derive the byte_eviction_multi budget from reachable fixture charges. with_charged assumes increasing the code length can produce every integer charge. MSVC rounds char string capacities using a mask of 15. The six copied strings in this fixture then charge 202 bytes for the base request and can only produce charges congruent to 10 modulo 16. The target of 404 is unreachable, so this test throws before it checks eviction. One option is to measure a larger fixture, set the budget to its measured charge, and require that two small entries fit before inserting it. That still checks that insertion evicts both entries and leaves the expected byte count.
MSVC STL grows std::string capacity in 16-byte quanta, so
with_charged(2 * charge) could never hit its exact target and
byte_eviction_multi threw on Windows. Measure a large request
whose charge exceeds twice the small charge instead, budget the
pool at large_charge + small, and evict keys 1 and 2 for key 99,
keeping 3 and 99. Remove the now-unused with_charged() helper
and its meta-check needle and doc mentions.
github manually merged commit f59508a568 into main 2026-12-01 17:11:25 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.