Skip to content

test(agc): retain Windows stderr for loader diagnostics - #10322

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-prepared-shader-stderr-handles
Oct 26, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-prepared-shader-stderr-handles

Conversation

@Ondra97

@Ondra97 Ondra97 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What

On Windows, the prepared-shader tests temporarily replace CRT stderr with _dup2. This closes the underlying handle while Vulkan loader diagnostics can still retain it. With VK_LOADER_DEBUG=error,warn,layer, deferred-ABI tests failed during teardown; GDB stopped at STATUS_INVALID_HANDLE in the loader's WriteFile.

Give the Windows process standard-error slot an independent handle before loading Vulkan. It stays valid for process lifetime while the existing CRT capture continues to collect the test's asserted diagnostics. No assertions or loader diagnostics are disabled.

Tested

Windows 11 Pro build 26300, WinLibs GCC 15.2.0, Release, RTX 4070 Ti SUPER, NVIDIA 617.42.

  • Before: agc_driver_prepared_shaders_abi_deferred_undecodable_state repeatedly failed with loader diagnostics enabled; _abi_deferred_stages also failed in the initial run. GDB identified the invalid native handle in WriteFile during Vulkan teardown.
  • After: all 21 existing agc_driver_prepared_shaders* CTests pass, zero skips, with Vulkan required, the shader cache disabled, the same loader diagnostics and Khronos validation. Logs confirm actual instance/device validation layer insertion; zero VUIDs. Captured deferral-message assertions still pass.
  • The selected tests and full Windows Release integration build pass. This validation used the local PRAGMATA bring-up build on main 4be3da2c with the independent buffer-owner fix from fix(agc): keep buffer owners when a staged address space dissolves #10304 and perf(agc): defer pipeline artifacts with first-use preparation #6743. PreparedShaders.cpp and ShaderRegistry.cpp are unchanged between that main and this branch's parent b066e5cb.
  • Conventions and whitespace pass. The five shared-file PRs the overlap tool could not compare were checked manually; none implements this handle lifetime change.

This is a test-harness fix; no game-performance claim.
Independent validation of the published commit: Published head cc4c48c0989a3b10fd34a52bfe177861546a4fc7: full Windows Release build and all 21 existing prepared-shader CTests and patched-library validation pass on a clean tracked tree without overlays (22/22, zero skips). Vulkan is required, shader caches are disabled, and loader logs confirm actual Khronos instance/device validation layers; no VUIDs. Hardware and toolchain are the Windows/NVIDIA configuration listed above. This independently validates the published commit in addition to the earlier integration runs. The complete CTest suite was not run.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • 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
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER, NVIDIA 617.42, Windows 11 Pro build 26300
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5115 core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 7642 core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 9508 core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 10193 core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp

@github-actions github-actions Bot added the agc libSceAgc* label Oct 23, 2026
@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase onto current main as required by CONTRIBUTING.md. This branch is based on b066e5c, 7,515 commits behind current main, and PreparedShaders.cpp has changed on main since then. The published-head Windows test run is useful, but it does not cover the current integration. After rebasing, please rerun the prepared-shader test set with loader diagnostics enabled and Vulkan required; the hosted Windows product job is skipped for this path.

@ycbuzi

ycbuzi commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

A Windows check of this head with loader diagnostics on, main against main + cc4c48c098: Windows 11 Home 10.0.26200, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, GeForce RTX 4070 SUPER (NVIDIA 616.92) and Radeon iGPU (1002:164e, AMD 32.0.21030.2001). The set is the 22 tests matching ^agc_driver_prepared_shaders. Each log's Selected GPU line names the device, with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1.

run main main + this PR
VK_LOADER_DEBUG=error,warn,layer, no layer (main b27cc8416f), 3 runs per GPU 22 of 22 every run 22 of 22 every run
plus VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (SDK 1.4.363.0, main 4e43321bd6), 2 runs per GPU 22 of 22, 0 VUID- 22 of 22, 0 VUID-
  • Loader diagnostics were really on: each run's log has 5,800 to 6,700 [Vulkan Loader] lines.
  • The layer really loaded: those runs ran from a non-elevated process, since the loader ignores VK_LAYER_PATH when elevated. The loader logs Insert instance layer and Inserted device layer for VK_LAYER_KHRONOS_validation from the SDK's Bin, and a best-practices control run wrote 28 lines to the layer's log file.
  • So the teardown failure you saw on main (_abi_deferred_undecodable_state, STATUS_INVALID_HANDLE in the loader's WriteFile) doesn't reproduce on this machine, with either GPU. That fits a closed handle whose value may or may not have been reused by the time the loader writes. This run shows the change keeps all 22 passing, with diagnostics and validation on, on NVIDIA and AMD. It doesn't show the failure going away.

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit 6ea31b4 into boykopovar:main Oct 26, 2026
15 checks passed
@Ondra97
Ondra97 deleted the codex/fix-prepared-shader-stderr-handles branch October 27, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants