Skip to content

fix: clear GCC warnings in the AGC driver and two tests - #7555

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
milescoviello:fix/gcc-warnings-libs
Nov 2, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
milescoviello:fix/gcc-warnings-libs

Conversation

@milescoviello

@milescoviello milescoviello commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What

A clean Release build (CMAKE_BUILD_TYPE=Release, BUILD_TESTING=ON) with GCC warns in these five places in core/. Each is fixed without changing behaviour:

  • libSceAgcDriver/Execution/src/SubmissionCapture.cpp (QueueType): "queue 0x%x is neither the graphics queue nor a compute queue" needs up to 67 bytes, and it was formatted into 64. So for a queue number above 0xfffff, the end of the exception message was cut off. The buffer is now 96 bytes.
  • libSceAgcDriver/tests/ConstantPhi.cpp: the result of a [[nodiscard]] IrBuilder::Emit was ignored. It is now static_cast<void>, as the other tests do.
  • tests/GuestMemoryModule.cpp: guestMemoryModuleData was both initialized and declared extern ("initialized and declared 'extern'"). The definition is now inside an extern "C" { } block, which gives the same C linkage and external symbol.
  • libSceAgcDriver/Execution/src/Driver/Packets/CommandValidation.cpp (second commit): "unsupported PM4 packet type: header 0x%08x at DWORD %zu of %zu" needs up to 101 bytes for the largest %zu values and had 96 (-Wformat-truncation). The buffer is 128 bytes.
  • libSceAgcDriver/Graphics/src/State.cpp (second commit): the stencil operation message needs up to 119 bytes for a 10-digit %u and had 112 (-Wformat-truncation). The operation is at most 15, so the text always fit; 128 bytes only silences the warning. fix(agc): replace with a stencil operation value the pixel shader exports #6762, which changed that buffer, has merged.

Not in this PR any more: this PR also fixed chdir's deprecated std::filesystem::u8path in libc and the null %s argument in sceKernelOpen's log. Both functions now copy the guest path first (2c5fcf6, "safely copy guest path arguments"), so main no longer warns there, and the rebase dropped those hunks.

Also not in this PR:

Tested

  • Rebased onto main 316615d042 (head 9db070f8de, two commits). SubmissionCapture.cpp conflicted with fix(agc): accept compute queue 0x58 on SubmitAcb #10307's queue range change: the merge keeps main's DriverDetail::SubmissionQueueEnd bound and this PR's 96-byte buffer. Ubuntu 26.04.1, GCC 15.2, Release. The rebased first commit (9aaf5ee0bf) recompiled its three files without their warnings; that build's log still showed the two the second commit fixes and DepthSurface.cpp:1305, which is fix(agc): pass the tile mode of a mismatched depth plane copy as an int #7504's. At this head, the two files the second commit changes recompile without a warning. agc_driver_graphics, agc_constant_phi, guest_memory and agc_driver_pm4 pass 3 of 3. Windows 11 VM (GT 1030, WinLibs GCC 15.2.0, Release): the base 316615d042 and this head both build, and the four tests pass 3 of 3 on each; the rebased first commit alone (9aaf5ee0bf) passes its three 3 of 3 too.

Earlier:

  • Rebased onto main 6f58a04 (head 7e7b5ca3a7, one commit), on Ubuntu 26.04.1, GCC 15.2, Release. I touched the three files and built their targets on main and on this head. On main, all three warnings appear:

    • SubmissionCapture.cpp:179 -Wformat-truncation
    • ConstantPhi.cpp:177 ignored [[nodiscard]]
    • GuestMemoryModule.cpp:1 "initialized and declared 'extern'"

    On this head none appear. agc_driver_graphics, agc_constant_phi and guest_memory pass.

  • Windows 11 VM (GT 1030, 582.78, WinLibs GCC 15.2.0): both the merge base acbfd7c7fe and this head build. The same three tests pass 3 of 3 on each.

  • Windows: @brummilab confirmed the ConstantPhi.cpp:177 -Wunused-result warning this fixes, with WinLibs GCC 15.2.0 r7 on main 2fade7e.

Earlier, on the five-file head 2368d21ba0, Ubuntu 24.04 (Linux 6.8), GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02:

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, driver 595.99.02, Ubuntu 24.04 (Linux 6.8); RTX 4070 Ti, driver 615.71.09, Ubuntu 26.04.1 (rebased head)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

@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.

Reviewed the five warning fixes against their call sites and existing UTF-8 path construction. The null-path log now avoids passing a null pointer to %s; the larger queue message buffer accommodates the full formatted diagnostic; and the ignored nodiscard result and C-linkage definition changes are appropriate. The focused hosted checks and cross-platform relinker/context jobs pass. I did not rerun the full build locally.

@adriadam10 adriadam10 self-assigned this Oct 19, 2026
adriadam10 added a commit to mazen320/AnyPS5 that referenced this pull request Oct 24, 2026
@brummilab

Copy link
Copy Markdown

Confirming the ConstantPhi.cpp:177 -Wunused-result warning this fixes on Windows too: WinLibs GCC 15.2.0 r7, main 2fade7ef4.

AI-assisted: yes

@milescoviello

Copy link
Copy Markdown
Contributor Author

@brummilab thank you for checking it on Windows. It's in the Tested section now.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 25, 2026
@milescoviello milescoviello changed the title fix: clear GCC warnings in libc, libkernel, the AGC driver and two tests fix: clear GCC warnings in the AGC driver and two tests Oct 25, 2026
@milescoviello

Copy link
Copy Markdown
Contributor Author

Rebased onto main 6f58a04. The new head is 7e7b5ca3a7, still one commit. 2c5fcf6 ("safely copy guest path arguments") rewrote chdir and sceKernelOpen to copy the guest path first, which also removed this PR's libc and libkernel warnings, so those two hunks are gone and the title now names what is left: the AGC driver's message buffer and the two tests.

With GCC 15.2 on Ubuntu 26.04.1, main still warns in all three (SubmissionCapture.cpp:179 -Wformat-truncation, ConstantPhi.cpp:177 ignored [[nodiscard]], GuestMemoryModule.cpp:1 "initialized and declared 'extern'"), and this head doesn't. agc_driver_graphics, agc_constant_phi and guest_memory pass.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 25, 2026
adriadam10 added a commit to mazen320/AnyPS5 that referenced this pull request Oct 28, 2026
A Release build with GCC warned in these three places:

- SubmissionCapture's unknown-queue message needs up to 67 bytes and
  was formatted into 64, so queue numbers above 0xfffff lost its end.
  The buffer is 96 bytes.
- ConstantPhi.cpp ignored IrBuilder::Emit's nodiscard result.
- GuestMemoryModule.cpp both initialized and declared guestMemoryModuleData
  extern. The definition is now inside an extern "C" block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 28, 2026
GCC 15.2 now warns (-Wformat-truncation) at two error messages that
landed after the first commit: the unsupported PM4 packet message needs
up to 101 bytes and had 96, and the stencil operation message needs up
to 119 and had 112. Both buffers are 128 bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milescoviello

Copy link
Copy Markdown
Contributor Author

@MarcZX10 this changed since your approval, so a re-check is needed.

  • Rebase: onto main 316615d042. SubmissionCapture.cpp conflicted with fix(agc): accept compute queue 0x58 on SubmitAcb #10307's queue range change, and the merge keeps main's DriverDetail::SubmissionQueueEnd bound with this PR's 96-byte buffer. Adrià's 4a7c749047 had left that buffer width to this PR.
  • Second commit (9db070f8de): two more one-line buffer sizes, for -Wformat-truncation warnings GCC 15.2 now gives at messages that landed later. CommandValidation.cpp's unsupported PM4 packet message goes from 96 to 128 bytes; it needs up to 101. State.cpp's stencil operation message goes from 112 to 128; that one always fit, since the operation is at most 15, so the change only silences the warning.
  • Tests: agc_driver_graphics, agc_constant_phi, guest_memory and agc_driver_pm4 pass 3 of 3 on Linux, and on the Windows VM at both the base and this head. The description is updated.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 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 1395 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6977 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 9020 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 9335 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 9432 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 9489 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 10249 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp

@TechLevelZero

TechLevelZero commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 9db070f merged onto main 9f748f4 · tested 2026-10-30 21:45 UTC · 20 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,309 passed · 2 failed (0 new, 2 also fail on main) · 41 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,352 of 3,021 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (866 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_bda_device 61.8 s, ⚠️ agc_driver_graphics_maps_fallback 30.9 s, ⚠️ agc_driver_graphics 30.2 s
Failing on main too (2, not counted against this PR)
guest_mmap_executable
guest_socket_options_multicast
Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)
agc_driver_job_manager_compute_capacity: Failed in the parallel run; also passed only on retry in 134 other runs in the last 7 days
Validation IDs already present on main (4 IDs in 385 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (385 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_array_layer_target_cpu, agc_driver_bda_span_reads_draw_pipeline, agc_driver_bitfield_mask, agc_driver_buffer_atomic_csub, and 377 more
VUID-vkCmdCopyImage-srcImage-01548 (13 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 5 more
VUID-vkCmdCopyImage-srcImage-01551 (13 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 5 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
Skipped (41)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fresh: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_labels: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is eithe
Reproduce
git fetch origin 9db070f8dec6970a99e0bd79face952b5bf41cdd 9f748f4d8e36ce3714f3b95f3386316e110a9b22
git checkout 9f748f4d8e36ce3714f3b95f3386316e110a9b22 && git merge --no-ff 9db070f8dec6970a99e0bd79face952b5bf41cdd
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@oneandonlydean oneandonlydean self-assigned this Nov 2, 2026
@oneandonlydean
oneandonlydean merged commit 059ba93 into boykopovar:main Nov 2, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants