tools: correlate ExecuteIndirect census with CPU A/B phases #3500

Merged
leonida/mandy
MoonEyes merged 1 commit from kaoru-maki/mandy:codex/execute-indirect-ab-report into main 2026-12-04 23:00:13 +00:00

Pull request successfully merged and closed

Contributor

Claimed in the coordination issue as: TOOLS-INDIRECT-CENSUS-CPU-AB

What and why

Add a standard-library analyzer for a capture directory or ZIP containing frames.txt and the runtime log. It uses the existing ExecuteIndirect census and CPU phase records. Census #3481 · CPU phases #3486 · Output fix #3488

  • Match a census record to a 300-Present block with consecutive host frame numbers and one unambiguous Present marker in each timestamp bracket. A bounded join requires two consecutive verified census boundaries.
  • Compare CPU phases with a consistent switch configuration, consecutive phase boundaries, and a matching host Present count after warm-up. Omit the delta for a missing or incomplete partner. Apply the capture's measurement window if one is present.
  • Write the same JSON for a capture directory and ZIP. Keep diagnostic errors and partial coverage visible. The report reconstructs phase windows from host Present brackets and wall-clock log timestamps. GPU pass duration requires GPU timestamps.
python -I scripts/indirect_census.py capture.zip --output indirect-census.json

Example with generated inputs

I combined the ExecuteIndirect census with archived Present boundaries and CPU A/B phases in an offline validator. The generated census input produced two verified 300-Present blocks and one bounded join. The first block contains 299 measured intervals between Presents. A missing Present, missing census boundary, stale tally, or inconsistent subtotal leaves the affected block without a join. The report rejects a diagnostic row with an unplaceable timestamp because it can change which boundaries are complete.

Generated CPU input Complete pairs What the validator reports
Both phases complete 1 Phase 2 to phase 3, with 450 and 520 measured host intervals. The constructed effect is −1 ms for list calls and −10 ms for frame-time P99.
Partner absent 0 MissingPartner with the delta omitted
Partner's CPU record truncated 0 IncompletePartner with the delta omitted
Measurement window clips a required phase 0 ClippedByMeasurementWindow

The first Windows validation passed 22 analyzer tests and the seven upstream ab_cpu.py tests passed. The offline checks add validation against host Present timestamps and measurement-window boundaries. Measuring GPU clamp-pass cost would require GPU timestamps. Census #3481 · CPU phases #3486 · Output fix #3488

Tested

The published diff passed all 27 synthetic analyzer tests and the clean-room scan on Windows. The source diff checksum matches the published commit. On macOS with Python 3.12, all 27 analyzer tests, seven existing CPU A/B tests, three line-ending checks, and the repository clean-room scan also passed. All inputs were generated.

The added review regressions reject impossible phase summaries, keep the missing-boundary count unknown for a trimmed trace, and handle unreadable compressed archives without overwriting the existing report or exposing absolute paths. The corresponding cases failed before the fixes.

The original Windows validation passed 22 analyzer tests, seven CPU A/B tests, 40 gate tests, 59 documentation tests, and three line-ending tests. The shared path test for NTFS case sensitivity also failed on that environment's unmodified main. The analyzer's own output-alias regression passed.

Reports are intended for local correlation. The public examples above use generated times, labels, and counters.

GPUs tested: n/a (offline Python analysis).

AI-assisted: OpenAI Codex (GPT-6). Independent read-only review by GPT-6.2 Sol.

Checklist

  • Based on current main.
  • One topic.
  • Generated inputs and clean-room check.
Claimed in the coordination issue as: [TOOLS-INDIRECT-CENSUS-CPU-AB](https://git.leonida.now/leonida/mandy/issues/3312#issuecomment-26535) ### What and why Add a standard-library analyzer for a capture directory or ZIP containing `frames.txt` and the runtime log. It uses the existing ExecuteIndirect census and CPU phase records. [Census #3481](https://git.leonida.now/leonida/mandy/pulls/3481) · [CPU phases #3486](https://git.leonida.now/leonida/mandy/pulls/3486) · [Output fix #3488](https://git.leonida.now/leonida/mandy/pulls/3488) - Match a census record to a 300-Present block with consecutive host frame numbers and one unambiguous Present marker in each timestamp bracket. A bounded join requires two consecutive verified census boundaries. - Compare CPU phases with a consistent switch configuration, consecutive phase boundaries, and a matching host Present count after warm-up. Omit the delta for a missing or incomplete partner. Apply the capture's measurement window if one is present. - Write the same JSON for a capture directory and ZIP. Keep diagnostic errors and partial coverage visible. The report reconstructs phase windows from host Present brackets and wall-clock log timestamps. GPU pass duration requires GPU timestamps. ```powershell python -I scripts/indirect_census.py capture.zip --output indirect-census.json ``` ### Example with generated inputs I combined the `ExecuteIndirect` census with archived Present boundaries and CPU A/B phases in an offline validator. The generated census input produced two verified 300-Present blocks and one bounded join. The first block contains 299 measured intervals between Presents. A missing Present, missing census boundary, stale tally, or inconsistent subtotal leaves the affected block without a join. The report rejects a diagnostic row with an unplaceable timestamp because it can change which boundaries are complete. | Generated CPU input | Complete pairs | What the validator reports | |---|---:|---| | Both phases complete | 1 | Phase 2 to phase 3, with 450 and 520 measured host intervals. The constructed effect is −1 ms for list calls and −10 ms for frame-time P99. | | Partner absent | 0 | `MissingPartner` with the delta omitted | | Partner's CPU record truncated | 0 | `IncompletePartner` with the delta omitted | | Measurement window clips a required phase | 0 | `ClippedByMeasurementWindow` | The first Windows validation passed 22 analyzer tests and the seven upstream `ab_cpu.py` tests passed. The offline checks add validation against host Present timestamps and measurement-window boundaries. Measuring GPU clamp-pass cost would require GPU timestamps. [Census #3481](https://git.leonida.now/leonida/mandy/pulls/3481) · [CPU phases #3486](https://git.leonida.now/leonida/mandy/pulls/3486) · [Output fix #3488](https://git.leonida.now/leonida/mandy/pulls/3488) ### Tested The published diff passed all 27 synthetic analyzer tests and the clean-room scan on Windows. The source diff checksum matches the published commit. On macOS with Python 3.12, all 27 analyzer tests, seven existing CPU A/B tests, three line-ending checks, and the repository clean-room scan also passed. All inputs were generated. The added review regressions reject impossible phase summaries, keep the missing-boundary count unknown for a trimmed trace, and handle unreadable compressed archives without overwriting the existing report or exposing absolute paths. The corresponding cases failed before the fixes. The original Windows validation passed 22 analyzer tests, seven CPU A/B tests, 40 gate tests, 59 documentation tests, and three line-ending tests. The shared path test for NTFS case sensitivity also failed on that environment's unmodified main. The analyzer's own output-alias regression passed. Reports are intended for local correlation. The public examples above use generated times, labels, and counters. GPUs tested: n/a (offline Python analysis). AI-assisted: OpenAI Codex (GPT-6). Independent read-only review by GPT-6.2 Sol. ### Checklist - [x] Based on current main. - [x] One topic. - [x] Generated inputs and clean-room check.
First-time contributor

Independent local verification of this change (I changed no code).

  • Head 9fe33d81, merge base 0036195a. The new tests are absent on the base: git grep -F test_confirms_two_blocks_and_one_bounded_join 0036195a -- tests/test_indirect_census.py -> exit 1 (same for the other new cases).
  • On the PR head: python -I -m unittest discover -s tests -p test_indirect_census.py -> Ran 27 tests, OK (3.8 s). Synthetic census traces only; no game log and no device involved.
  • git diff --check 0036195a 9fe33d81 -> clean. python -I scripts/check_no_game_data.py scripts/indirect_census.py tests/test_indirect_census.py docs/measuring_fps.md -> clean.

GPUs tested: none (pure Python trace parsing on synthetic inputs). Driver: n/a. No game data, assets or extracted shaders were used or attached.

AI-assisted: yes, Hy4 flash (verification only). No approval implied; this is a local test report.

Independent local verification of this change (I changed no code). - Head `9fe33d81`, merge base `0036195a`. The new tests are absent on the base: `git grep -F test_confirms_two_blocks_and_one_bounded_join 0036195a -- tests/test_indirect_census.py` -> exit 1 (same for the other new cases). - On the PR head: `python -I -m unittest discover -s tests -p test_indirect_census.py` -> Ran 27 tests, OK (3.8 s). Synthetic census traces only; no game log and no device involved. - `git diff --check 0036195a 9fe33d81` -> clean. `python -I scripts/check_no_game_data.py scripts/indirect_census.py tests/test_indirect_census.py docs/measuring_fps.md` -> clean. GPUs tested: none (pure Python trace parsing on synthetic inputs). Driver: n/a. No game data, assets or extracted shaders were used or attached. AI-assisted: yes, Hy4 flash (verification only). No approval implied; this is a local test report.
Member

Merged by Moon's agent on Moon's written authorization (two maintainers). Checked before merging: head merged with main and python -m pytest tests/test_indirect_census.py (27 passed) on Windows 11, scripts/check_no_game_data.py clean on the changed files, and an ACCEPT from a separate reviewer agent that did not write the code. No GPU or game run needed: offline tool only.

Merged by Moon's agent on Moon's written authorization (two maintainers). Checked before merging: head merged with main and `python -m pytest tests/test_indirect_census.py` (27 passed) on Windows 11, `scripts/check_no_game_data.py` clean on the changed files, and an ACCEPT from a separate reviewer agent that did not write the code. No GPU or game run needed: offline tool only.
Sign in to join this conversation.
No description provided.