Skip to content

fix(tests): fix two flaky AGC tests and guest_sce_net without IPv - #2214

Closed
zmeizy wants to merge 8 commits into
boykopovar:mainfrom
zmeizy:main
Closed

zmeizy wants to merge 8 commits into
boykopovar:mainfrom
zmeizy:main

Conversation

@zmeizy

@zmeizy zmeizy commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What

Fixes two flaky tests and one test that cannot pass on a host without IPv6.

  1. agc_driver_flip flake (driver fix). When a queue worker failed, Driver::run called ReportFailure(error) before Fail on the flips of the submission it was executing. ReportFailure wakes the idle waiters, so a thread returning from AgcDriverWaitIdle could see such a flip neither completed nor failed (failed flip was completed successfully). The executing submission's flips are now failed first, as ReportFailure already does for the pending submissions it drops. The only IFlipRequest::Fail outside the tests (VideoOut's) takes only its own mutex and does not call into the driver, so this cannot deadlock.
  2. agc_driver_shader_clock flake (test fix). llvmpipe builds the shader clock's high dword with a left shift (LLVMBuildShl(result, 32) then truncation in emit_clock, Mesa src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c), so it is always 0 and s_memtime/s_memrealtime wrap every 2^32 ns (~4.3 s). On llvmpipe the test now compares the two reads modulo 2^32; other devices keep the 64-bit check. Recorded in TechnicalDebt.
  3. guest_sce_net without IPv6 (test fix). On a host with no IPv6, socket(AF_INET6) fails and the test aborted before its TCP, UDP, epoll, sendmsg/recvmsg, resolver and NetCtl checks. It now skips only the IPv6 socket checks, runs the rest, and exits 77 (SKIP_RETURN_CODE 77), so ctest reports it as skipped. Hosts with IPv6 run every check.

Tested

Ubuntu 24.04, GCC 13.3, lavapipe (Mesa 25.2.8, LLVM 20), 4 cores, ctest --parallel 4 --timeout 120 as in CI.

  • agc_driver_flip, four copies at once: 2 of 240 runs failed before, 0 of 480 after. With the old order plus a 50 ms delay, 5 of 5 runs fail.
  • agc_driver_shader_clock: a probe dispatching just before a 2^32 ns boundary made 24 lanes read a wrapped clock; the old check rejected all 24, the new one none.
  • guest_sce_net on a container without IPv6: before, it aborted; after, every other check passes and ctest reports it as skipped. The IPv6 path could not be run there.
  • Full suite on main d70b8998 with all three changes: 513 tests, 0 failures; check_test_registration.py and check_conventions.py pass.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR (three related test-reliability fixes; can be split on request)
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt (n/a)
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source (n/a)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

claude and others added 8 commits October 9, 2026 10:30
When a queue worker failed, it published the failure and woke the idle
waiters before failing the flips of the submission it was executing.
A thread returning from AgcDriverWaitIdle with that failure could still
see one of those flips neither completed nor failed, which made
agc_driver_flip fail with "failed flip was completed successfully" in
2 of 240 runs under four-way parallel load on lavapipe.

Fail the executing submission's flips first, as ReportFailure already
does for the pending submissions it drops before it notifies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha6Tsy62AFUyp9a5Mf7vjA
llvmpipe builds the high dword of the shader clock with a left shift by
32 (emit_clock in Mesa's lp_bld_nir_soa.c), so it is always 0 and
s_memtime and s_memrealtime wrap every 2^32 ns. A pass of
agc_driver_shader_clock whose two reads straddle a wrap failed with
"memtime: lane N went back from 4294921902 to 3823"; dispatching right
before the boundary fails every lane of that pass.

On llvmpipe compare the low dwords modulo 2^32, which stays correct if
Mesa fixes the shift. Other devices keep the 64-bit comparison.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha6Tsy62AFUyp9a5Mf7vjA
On a host without IPv6, socket(AF_INET6) fails with EAFNOSUPPORT, so
guest_sce_net aborted at its first IPv6 socket and never ran the TCP,
UDP, epoll, sendmsg/recvmsg, resolver and NetCtl checks after it.

When sceNetSocket reports guest EAFNOSUPPORT (47) for the IPv6 socket,
skip those socket checks, run the rest of the test, and exit with 77,
which ctest reports as skipped. Hosts with IPv6 run every check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha6Tsy62AFUyp9a5Mf7vjA
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha6Tsy62AFUyp9a5Mf7vjA
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha6Tsy62AFUyp9a5Mf7vjA
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha6Tsy62AFUyp9a5Mf7vjA
The technical debt entry still said the generated executable always opens
a console. Since 908befe --windows-gui selects the GUI subsystem; what
remains is that a GUI executable has no console, so the unhandled
exception message and the Windows crash report, both written to stderr,
are lost unless stderr is redirected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha6Tsy62AFUyp9a5Mf7vjA
docs(dev): describe the console window with --windows-gui available
@rmz-24

rmz-24 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Windows run: Windows 11 Pro 25H2 (10.0.26200.9457), RTX 5060 Ti (NVIDIA 617.42), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON, full build plus libs. bd2e6ad cherry-picked onto current main d70b899 (applies cleanly).

  • agc_driver_shader_clock and guest_sce_net pass (this host has IPv6).
  • Full ctest: 510/510.

AI-assisted: yes

@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

The current upstream Conventions run fails because the “One topic per PR” checklist item is unchecked. CONTRIBUTING requires one topic per branch, and this diff currently combines three independent changes: queue flip failure ordering, shader-clock wrap handling, and skipping IPv6 socket checks. Please split these into separate PRs (or otherwise bring the scope into line with the contribution rule) and rerun Conventions; I have not approved this PR.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#2045 docs/dev/TechnicalDebt.md L301-302
#2046 docs/dev/TechnicalDebt.md L301-302
#2162 docs/dev/TechnicalDebt.md L301-302

@zmeizy

zmeizy commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Closing since it got split into 3 PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants