reprend #2031: runtime: harden submit_phases period parsing and skip Scope overhead when disabled #2738
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2738
Loading…
Reference in a new issue
No description provided.
Delete branch "carry/pr-2031"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Carries #2031 by @IlyassRS3, because it conflicts with
mainafter #2566 and the reminder to mergemain(https://github.com/ProjectLeonida/mandy/pull/2031#issuecomment-7232642471) got no answer within the delay of the carry rule. If the author comes back, this carry is dropped.Item:
RT-SUBMIT-PHASES-PERIOD-PARSE-AND-ZERO-OVERHEAD-SCOPE-CARRY(claimed in https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7280119323; original itemRT-SUBMIT-PHASES-PERIOD-PARSE-AND-ZERO-OVERHEAD-SCOPE).What this branch is
ed34b996c, unchanged (no rebase, author commits kept).main(from the carry preparation of 29/11) that resolves the conflict, then a merge of currentmainf9f3ec4c6(no new conflict). Both merge commits carryCo-authored-bythe author.What conflicted and how it was resolved
runtime/src/submit_phases.h:main'sScope(nested phases, active phase) kept. The PR's skip now applies only when nobody reads the times:timing_wanted()is period 0 andLEONIDA_DEV_OVERLAYnot 1, becausemain's dev overlay reads these totals and the active phase.Design choice for a human: the PR's zero-overhead skip is narrowed to keep
main's dev overlay working; whether that is the wanted trade-off is not decided here.Tests
mainf9f3ec4c6merged), Windows 11, Python 3.12, no GPU used: C++ only: left to this PR's CI (no local C++ build in this run).ctest502 tests,submit_phasesanddev_overlaypass; red: the test does not compile onmain(kDefaultPeriodSeconds,kNsPerSecond,kMaxPeriodSecondsabsent).python -I scripts/check_no_game_data.pyon every file this PR changes: clean.ctest, the full translator suite).Depends on: none.
Needs a careful human read of the resolution and an independent verifier before merge (red/green on another machine).
AI-assisted (Claude Code, oreofr-agent).
🤖 Generated with Claude Code
Regression in the carry: frame and floor reports lose phase timings. The
timing_wanted()gate considers the phase line and dev overlay. The frame and floor reports also read the phase counters and have a separate interval,LEONIDA_SUBMIT_FRAME_SECONDS, which defaults to 10 seconds.MEASURED on
b2914269merged withmain20fe0c75(tree197476d4). The tested header and stock tests are byte-identical in the clean merge ontof44904d2. I ran the same synthetic probe under native Linux Clang 23.1.5 with ASan/UBSan and under Wine 11.22 with a Win64 clang-cl build. It opens aSubmissionwith nested texture and replay scopes and advances the report deadline in the fixture to exercise the production emitters.With
LEONIDA_SUBMIT_PHASES_SECONDS=0and the overlay unset, I tried both an unset frame interval (10 s) andLEONIDA_SUBMIT_FRAME_SECONDS=1. On both platforms and settings, main reported nonzero texture/replay times and a nonzero submission floor. The PR still emitted both reports and counted 2 submissions and 2 floor samples, with zero phase and floor times.A local control that added
|| frame_period_ns() > 0totiming_wanted()restored those times. In both the PR and control, scopes stayed untimed with all three consumers off, and timed with only the overlay or only the phase line enabled. The unmodifiedsubmit_phasesanddev_overlaytests passed under Wine. A second agent checked the raw logs. CPU-only synthetic test, AI-assisted.Independent Windows check of
b29142696on currentmainb17b22d33(no conflict, treeea277f812). Native Windows 11, MSVC 19.50 x64, built alone as its CMake target builds it (/Isrc), under AddressSanitizer with the debug CRT and checked iterators (/W4 /permissive- /utf-8 /Od /MDd /fsanitize=address).test/submit_phases_test.cpp:submit_phases_test: OK (0 failures), no ASan report.parse_period_nsand thek*PeriodSecondsconstants this PR adds tosubmit_phases.h, so it doesn't build againstmain.getenvinsubmit_phases.h, whichmainhas too (two of them there as well).I didn't read the conflict resolution line by line.
GPUs tested: n/a (CPU unit test). AI-assisted: yes.
Independent check on Windows (not the author), at
b29142696.runtimeand builtsubmit_phases_test(MSVC 14.52.37025, Windows SDK 10.0.26100).submit_phases_test: OK (0 failures)— exit 0.Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711.
Based on
f9f3ec4c6; a rebase on currentmainbefore merge would keep history linear.AI-assisted: yes (opencode).
c13dc82a5fixes the regression @merzleckeier found:timing_wanted()now also counts the frame and floor lines (frame_period_ns() > 0,LEONIDA_SUBMIT_FRAME_SECONDS, 10 s by default) as a consumer of the phase times, which is the control from the report above.test_timing_wanted_for_frame_linesinruntime/test/submit_phases_test.cpp:main()setsLEONIDA_SUBMIT_PHASES_SECONDS=0, unsetsLEONIDA_SUBMIT_FRAME_SECONDSandLEONIDA_DEV_OVERLAYbefore anything reads them (timing_wanted()decides once per process), then checks thattiming_wanted()is true and that aScopeis active.-std=c++20 -Wall -Wextra -fsanitize=address,undefined: red (this PR's header before the fix + the new test):submit_phases_test: FAILED (2 failures), the two new checks; green:submit_phases_test: OK (0 failures), no sanitizer report, no warning.timing_wanted()andScope::activeper process: all three consumers off (PHASES=0,FRAME=0, no overlay) → 0/0, so the zero-overhead scope this PR is for still holds; frame line only (default orFRAME=1) → 1/1; phase line only → 1/1; overlay only → 1/1._putenv_sunder_WIN32). Same owner as the carry: needs someone else's check.AI-assisted: Claude Code
Verified by MoonEyes (another owner than OreoFR) on head
c13dc82a5merged withmainbe7690805: Windows 11, MSVC 2022 x64, RelWithDebInfo,ctest -R ^submit_phases$: 1/1 passed, with the new case for the frame lines that merzleckeier reported. Red on the old header ofmainis not possible here (the test uses names this pull request adds); the author measured red and green for that case on Mac. CPU unit test, no run of the title.AI-assisted (Claude Code).
The
windowsjob of run 46451903600 was cancelled by its 50-minute limit, not by a failure: the build took about 48 minutes (cold cache), ctest started at 16:25:58 and was at test 209 of 547 when time ran out. This PR's own test had already run there:29/547 Test #29: submit_phases ... Passed.c08ececafmerges currentmainto run the CI again (no change to the PR's files;submit_phases_testOK on macOS under ASan/UBSan after the merge).AI-assisted: Claude Code
The new
windowsfailure (run 46462604990, 1 minute) is the CI's cache, not this PR:sccache: error: Server startup failed: cache storage failed to read ... ServerBusy: Egress is over the account limitwhile compilingvulkan_aftermath.cppandcrt_timed_wait.cpp. It needs a rerun once the cache quota is back.AI-assisted: Claude Code
Verified again by MoonEyes (another owner than OreoFR) on head
e957e20d6merged withmain1d4949d58: Windows 11, MSVC 2022 x64, RelWithDebInfo,ctest -R ^submit_phases$: 1/1 passed. Same note as before on red. CPU unit test, no run of the title.AI-assisted (Claude Code).
Merging. Head
e957e20d6merges cleanly withmaincee1cb1d3and does not force a rebase of #2566. Verified on this head on Windows 11 by another owner; merzleckeier's regression fixed. Merged by MoonEyes.AI-assisted (Claude Code).