Skip to content

test(agc): map the GCN color slices below 40 bits in an ASan build - #28194

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
LeandroLP23:test/agc-gcn-slices-asan
Dec 5, 2026
Merged

oneandonlydean merged 3 commits into
boykopovar:mainfrom
LeandroLP23:test/agc-gcn-slices-asan

Conversation

@LeandroLP23

@LeandroLP23 LeandroLP23 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What

The nightly sanitizer run lists agc_driver_graphics, agc_driver_graphics_maps_fallback and agc_graphics_profile_draw as known failures. All three stop on the same check in gcnColorSliceTests(). Under ASan, GuestArena.hpp moves the guest arena to 0x100000000000, above 1 << 40. The GCN color-buffer base in 0x318 << 8 has only 40 bits, so a guest heap block cannot be encoded.

In an ASan build, the test now maps its three 64x64 slices itself with MAP_FIXED_NOREPLACE at the first free page below 1 << 40, and unmaps them afterwards. Other builds keep the guest heap block. The decode under test does not change.

With the three tests passing, .github/sanitizer-known-failures.txt is now empty. The repository test that parses the file now accepts an empty list.

Based on #17680 by @StepFPV, which its author closed. Its DepthSurfaceReuse part is already on main, and this PR carries over only the slice mapping. Refs #16813.

Tested

  • Linux, ubuntu-latest, ASan + UBSan (sanitizers.yml setup) on the fork: run 46209269345. The three tests passed: agc_driver_graphics_maps_fallback in 237.64 s, agc_driver_graphics in 280.69 s and agc_graphics_profile_draw in 297.13 s. For speed, that run built only agc_driver_graphics_tests and ran only these three tests.
  • python -m unittest tools/tests/test_sanitizer_report.py: 44 tests OK.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: n/a (test-only change; the run uses the CPU path of ubuntu-latest)
  • AI-assisted: yes (Claude Code)

Summary by CodeRabbit

  • Tests
    • Graphics tests now handle occupied address ranges when running with address sanitization enabled.
    • Sanitizer test reporting now accepts an empty set of known failures. Three outdated graphics-test failure records have been removed. These updates affect test execution and reporting; no application features have changed.

LeandroLP23 and others added 2 commits November 29, 2026 04:11
Based on boykopovar#17680 by StepFPV.

Co-Authored-By: StepFPV <StepFPV@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The three agc graphics tests pass under ASan once the GCN color slices map below 1 << 40, so the known-failures list is empty. The repository check now only requires the list to parse.

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

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Graphics test allocation and known failures

Layer / File(s) Summary
Three-slice allocation and cleanup
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
gcnColorSliceTests uses GcnSlicesBytes. ASan builds search for a mapping below the 40-bit GPU address limit and release it with munmap. Other builds use the guest heap and GuestHeapFree.
Known-failure list and test
.github/sanitizer-known-failures.txt, tools/tests/test_sanitizer_report.py
Three graphics known-failure entries were removed. The test now checks that load_known returns a dictionary without requiring it to be nonempty.

Suggested reviewers: marczx10, chitters2004, birdmarty

Change: Other

Merge Risk: Minimal · up to d5b35

This changes only test allocation under ASan builds and removes the matching known-failure entries. No production behavior changes, and the reported test runs passed. Merge risk is minimal.

Security architecture risk: Minimal · up to d5b35

The ASan graphics test now allocates its own buffer so it can exercise the existing 40-bit address decode. The PR removes three known-failure entries without changing the production decoder, guest heap, or deployment configuration.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Cppcheck (2.22.0)

Cppcheck (2.22.0) exceeded its 180-second time budget. Findings from completed work are retained; remaining checks are incomplete.

core/libs/prx/libSceAgcDriver/tests/Graphics.cpp

Cppcheck interrupted; analysis of this file is incomplete

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6ec6945b-9e30-4a35-a408-46213fb1a0d2
Commits

Reviewing files that changed from the base of the PR and between 6fc23c5 and d5b3569.

Files selected for processing: 1

  • core/libs/prx/libSceAgcDriver/tests/Graphics.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@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 — looks good

Nothing blocks this change; the review evidence supports merging.

What I ran

Reviewed head 6fc23c57ac739769aa22a500c800144af0311924 against the prepared diff. No commands or tests were run; the PR description reports sanitizer and Python test runs, but those results were not independently verified.

Results

Check Result Note
Diff and targeted code review passed Reviewed the changed logic and its parser behavior.
Tests in this review not run Author-reported results only.

Findings

Blocking

None.

Non-blocking

None.

Not verified

Read .github/sanitizer-known-failures.txt, core/libs/prx/libSceAgcDriver/tests/Graphics.cpp (including the changed function and its platform includes), and tools/tests/test_sanitizer_report.py (including the changed test). The full text of Graphics.cpp was excluded from the review folder because it was too large; only targeted ranges were read through repo_read.py. files.json was not available through the reader. I did not run the reported sanitizer tests or Python unittest command, inspect CI output, or verify behavior on other operating systems.

To get this to a good state

Nothing is required.

@github-actions github-actions Bot added agc libSceAgc* ci .github labels Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 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/tests/Graphics.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7256 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7642 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8246 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9356 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9387 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9508 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9712 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9895 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9897 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9915 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9938 .github/sanitizer-known-failures.txt
PR 10193 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 11551 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 11825 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 13928 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 13929 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 14032 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 14473 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 14944 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 15548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 15570 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 16935 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 17022 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 17056 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 17611 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 19821 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 20010 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 20153 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 22251 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 22328 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 22439 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 22697 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 23252 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 23258 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 23281 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 23811 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 24049 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 24083 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 24781 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 25489 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 26084 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 28142 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 28229 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 28250 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 28488 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 28586 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 28668 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 28808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp

@maskym

maskym commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Windows + NVIDIA result for head 6fc23c57ac, merged alone into main 63ee1c120a (the PR's Tested section names no Windows run).

Host: Windows 11 26300, Intel i7-12700K, NVIDIA GeForce RTX 2070 SUPER, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja. Build clean.

Validation-layer protocol on main and on this PR (ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation 1.4.366, VK_LOADER_DEBUG=error,warn,layer, ctest -R '^(agc|guest_video_out|video_out|pad_sdl)' --parallel 4 -V):

Tree Passed Layer inserted was not found but was requested VUID- set
main 2464/2465 2214 0 none
this PR 2465/2465 2214 0 identical

No new validation errors and no test failures on this PR's tree. agc_driver_queue_zero_quiet_interrupt failed in the main run but passed in this PR's run.

The tests this PR adds or changes (agc_address_copy_cap, agc_address_copy_cap_mirror, agc_address_copy_cap_remembered, agc_address_space_unwatched_mirror_import, agc_command_batch_fence_failure, agc_command_state, agc_compute_descriptor_layout_flags, agc_copy_input_failure_lifetime, agc_copy_input_kept_bytes, agc_depth_copy_kept_bytes, agc_descriptor_cache, agc_descriptor_pool_reset_failure, agc_driver_address_space_teardown, agc_driver_alpha_to_coverage_state, agc_driver_covered_centroid_state, agc_driver_depth_bounds_state, agc_driver_dual_source_blend_state, agc_driver_fault_only_template_records, agc_driver_fault_only_template_records_kept, agc_driver_fault_only_template_records_loop_guard, agc_driver_fault_only_template_records_loop_guard_kept, agc_driver_graphics, agc_driver_linear_volume_nonresident, agc_driver_msaa_dcc_state, agc_driver_push_constant_assembly, agc_driver_recorded_draw_retention, agc_driver_sample_location_grid_fallback, agc_driver_sample_order_planning, agc_driver_single_sample_dither_state, agc_driver_stencil_ref_export_push_budget, agc_driver_undithered_alpha_to_coverage_state, agc_driver_unobserved_provoking_vertex, agc_driver_unused_viewport_depth, agc_driver_vertex_control_state, agc_graphics_profile_draw, agc_heap_mirror_reference_size, agc_heap_mirror_run_unwatch, agc_heap_mirror_run_unwatch_no_space_cache, agc_heap_mirror_unwatch, agc_heap_mirror_unwatch_no_space_cache, agc_host_import_validity, agc_pipeline_deferred_build, agc_pipeline_deferred_build_cache_off, agc_pipeline_journal, agc_pipeline_journal_extended_paths, agc_pipeline_journal_long_paths, agc_pipeline_journal_replay_priority, agc_pipeline_journal_size_negative, agc_pipeline_journal_size_overflow, agc_pipeline_library_clear_waits_for_build, agc_pipeline_library_narrow_keys, agc_pipeline_store_fixed_bound, agc_pipeline_store_growth, agc_pipeline_store_lazy_buffer_pool, agc_pipeline_store_replay_growth, agc_pipeline_store_touch, agc_sparse_buffer_holes, agc_sparse_heap_mirror_budget, agc_sparse_heap_mirror_unwatch, agc_sparse_heap_mirror_unwatch_no_space_cache) pass in the full validation-layer run. Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine.

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The exact sanitizer-report tests passed all 44 cases on Linux. A separate ASan allocation check using the fixture's mapping loop placed the 48 KiB slice allocation at 0x60000000 and wrote to it successfully. The integrated ASan graphics fixture still needs coverage.

Can the loop distinguish occupied addresses from an unavailable mapping operation? It currently retries every error to the 40-bit ceiling. An error that will repeat for every address can turn a clear test failure into a timeout across roughly 268 million calls.

AI-assisted: yes.

… occupied address

MAP_FIXED_NOREPLACE reports an occupied range as EEXIST. Any other error
repeats at every address, so the loop retried it up to the 40-bit
ceiling, about 268 million calls, and a clear failure became a timeout.
The loop now moves on only past EEXIST and names the other case.

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

Copy link
Copy Markdown
Contributor Author

@ligmaSec good catch, fixed in d5b3569. With MAP_FIXED_NOREPLACE an occupied range fails with EEXIST; any other error repeats for every address. The loop now moves on only past EEXIST and stops at the first other error, with its own failure message. I checked the loop alone in a Linux build (GCC, gcc:latest image): with 0x60000000 occupied it maps at 0x60010000, and a mapping that fails with EINVAL stops after one call.

AI-assisted: yes (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 — looks good

The reviewed changes correctly map the ASan test slices below the 40-bit limit and allow an empty known-failures file.

What I ran

Reviewed head d5b3569f4dfea4b6549c0a7685371d45e5206310 using repo_read.py to inspect the changed code and targeted source context. No tests or builds were run; the CI results in the PR description are author-reported.

Files read: .github/sanitizer-known-failures.txt (deletion shown in the diff), core/libs/prx/libSceAgcDriver/tests/Graphics.cpp (all changed lines and the surrounding test), and tools/tests/test_sanitizer_report.py (changed line and related tests). No files were excluded by review rules.

Results

Check Result Note
Changed-line review passed All changed lines inspected
Tests and builds not run CI results are author-reported

Negative control

Not run; no test was changed to confirm it fails under a deliberately introduced defect.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

The reported sanitizer workflow and Python test run were not independently confirmed. Runtime behavior on other hosts was not tested.

To get this to a good state

No required follow-up.

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The revised loop retries only an occupied address and stops on other mapping errors. I exercised the exact loop under Linux ASan with the first hint occupied. It advanced to the next page, mapped the full 48 KiB below the 40-bit ceiling, and the test wrote through the mapping successfully. This was an isolated allocation check.

AI-assisted: yes.

@maskym

maskym commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Retested head d5b3569f4d on Windows + NVIDIA (the head moved since my earlier run), merged alone into main 87a06f59cf.

Host: Windows 11 26300, Intel i7-12700K, NVIDIA GeForce RTX 2070 SUPER, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja. Build clean.

Validation-layer protocol on main and on this PR (ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation 1.4.366, VK_LOADER_DEBUG=error,warn,layer, ctest -R '^(agc|guest_video_out|video_out|pad_sdl)' --parallel 4 -V):

Tree Passed Layer inserted was not found but was requested VUID- set
main 2514/2540 2296 0 none
this PR 2526/2540 2298 0 identical

agc_driver_resource_cache_collect_refusals_index, agc_driver_storage_cache_budget, guest_video_out_buffer_attribute_option_bounds, guest_video_out_global_alpha, video_out_flip_overlay also failed in this PR's parallel run but passes 3 of 3 rerun alone on this PR's tree, so I read it as load-dependent, not caused by this change. No new validation errors and no new failures. The failures on this PR's tree (agc_driver_pipeline_journal, agc_driver_host_allocator, guest_video_out_display_position_event, guest_video_out_high_frame_rate, guest_video_out_current_output_mode, video_out_flip_reopen, video_out_flip_present, guest_video_out_set_mode_event, guest_video_out_window_margins_bounds) also fail on main here. agc_driver_cpu_label_wake, agc_driver_draw_recipe_data, agc_driver_frame_replay_multisample_depth_faults, agc_import_settle_initial_dcc, agc_import_settle_initial_dcc_committer, agc_pipeline_journal, agc_pipeline_journal_extended_paths, agc_pipeline_journal_long_paths, agc_pipeline_store_replay_growth, guest_video_out_color_space, guest_video_out_vblank_status, guest_video_out_wqhd_detection, video_out_flip_eop, video_out_flip_lifetime, video_out_flip_ps4_initial_status, video_out_flip_resolution_override, video_out_flip_unregistered failed in the main run but passed in this PR's run.

The tests this PR adds or changes (agc_address_copy_cap, agc_address_copy_cap_mirror, agc_address_copy_cap_remembered, agc_address_space_unwatched_mirror_import, agc_command_batch_fence_failure, agc_command_state, agc_compute_descriptor_layout_flags, agc_copy_input_failure_lifetime, agc_copy_input_kept_bytes, agc_depth_copy_kept_bytes, agc_descriptor_cache, agc_descriptor_pool_reset_failure, agc_driver_address_space_teardown, agc_driver_alpha_to_coverage_state, agc_driver_covered_centroid_state, agc_driver_depth_bounds_state, agc_driver_dual_source_blend_state, agc_driver_fault_only_template_records, agc_driver_fault_only_template_records_kept, agc_driver_fault_only_template_records_loop_guard, agc_driver_fault_only_template_records_loop_guard_kept, agc_driver_graphics, agc_driver_linear_volume_nonresident, agc_driver_misaligned_shader_data_moves, agc_driver_misaligned_shader_data_moves_unrecorded, agc_driver_msaa_dcc_state, agc_driver_push_constant_assembly, agc_driver_recorded_draw_retention, agc_driver_sample_location_grid_fallback, agc_driver_sample_order_planning, agc_driver_single_sample_dither_state, agc_driver_stencil_ref_export_push_budget, agc_driver_undithered_alpha_to_coverage_state, agc_driver_unobserved_provoking_vertex, agc_driver_unused_viewport_depth, agc_driver_vertex_control_state, agc_graphics_profile_draw, agc_heap_mirror_reference_size, agc_heap_mirror_run_unwatch, agc_heap_mirror_run_unwatch_no_space_cache, agc_heap_mirror_unwatch, agc_heap_mirror_unwatch_no_space_cache, agc_host_import_validity, agc_pipeline_deferred_build, agc_pipeline_deferred_build_cache_off, agc_pipeline_journal, agc_pipeline_journal_extended_paths, agc_pipeline_journal_long_paths, agc_pipeline_journal_replay_priority, agc_pipeline_journal_size_negative, agc_pipeline_journal_size_overflow, agc_pipeline_library_clear_waits_for_build, agc_pipeline_library_narrow_keys, agc_pipeline_store_fixed_bound, agc_pipeline_store_growth, agc_pipeline_store_lazy_buffer_pool, agc_pipeline_store_replay_growth, agc_pipeline_store_touch, agc_sparse_buffer_holes, agc_sparse_heap_mirror_budget, agc_sparse_heap_mirror_unwatch, agc_sparse_heap_mirror_unwatch_no_space_cache) pass in the full validation-layer run. Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine.

@oneandonlydean
oneandonlydean merged commit 23db524 into boykopovar:main Dec 5, 2026
14 checks passed
@LeandroLP23
LeandroLP23 deleted the test/agc-gcn-slices-asan branch December 6, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* ci .github

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants