Skip to content

build(libSceAgcDriver): compile the tests on macOS - #15700

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
javierUDP:fix/agc-driver-tests-macos
Nov 8, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
javierUDP:fix/agc-driver-tests-macos

Conversation

@javierUDP

Copy link
Copy Markdown
Contributor

What

Four libSceAgcDriver tests guarded Linux-only code with #ifndef _WIN32, so a macOS build compiled it and failed:

  • HostImportSparseDmaBuf.cpp and execution/SparseDmaBufImport.cpp: memfd_create sealing (MFD_ALLOW_SEALING, F_ADD_SEALS, F_SEAL_SHRINK).
  • SharedWrites.cpp: RUSAGE_THREAD, and /proc/self/maps at run time.
  • GcnColorTarget.cpp: MAP_FIXED_NOREPLACE.

The two udmabuf tests already had a branch that prints "skipped, udmabuf imports are Linux only" and skips. Its condition is now !__linux__ instead of _WIN32.

SharedWrites.cpp guards with __linux__ the fault count of its benchmark (printed, never checked), the /proc/self/maps leak check, and the two blocks that write through the shared backing writer. DirectMemory.cpp registers that writer only under __linux__, so on macOS GuestArenaWriteSharedBacking returns false: the first block failed with "shared writer rejected direct backing", and the second would have passed without checking anything. #7631 brings direct memory to macOS and can widen that guard. With these guards the rest of the test runs on macOS for the first time, and passes.

GcnColorTarget.cpp takes its memory below 1 TiB from the guest arena on macOS, as it does on Windows. The arena takes the Windows protection value on every host, so the macOS branch passes ReadWriteProtection = 0x04, the name GuestHeap.cpp uses.

Windows and Linux compile the same code as before.

Tested

macOS 27.2 (Apple M5), x86-64 under Rosetta, Release, AppleClang. main does not build on macOS by itself, so this ran with #11049, #11119, #7804 and #4630 merged in: on main b8efa62, and the tests again on 5b1d381 after the rebase, where none of these files had changed. The macOS CI builds only the relinker and a few narrow targets, which is how these got in.

  • With the compile command from the build: 8, 4, 2 and 1 errors in the four files on main, none with this change.
  • agc_gcn_color_target, agc_shared_write and agc_shared_write_partial_collect pass.
  • agc_host_import_sparse and agc_driver_sparse_dma_buf_import skip with "udmabuf imports are Linux only".

Linux and Windows not built here.

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: none; no Vulkan device here, and the tests that run do not need one
  • AI-assisted: yes

Four tests guarded Linux-only code with #ifndef _WIN32, so macOS
compiled it and failed: memfd sealing in the two udmabuf import tests,
RUSAGE_THREAD and /proc/self/maps in SharedWrites, and
MAP_FIXED_NOREPLACE in GcnColorTarget.

The udmabuf tests already had a branch that skips with "udmabuf imports
are Linux only"; it now covers every host that is not Linux.

SharedWrites guards the fault count, the /proc/self/maps leak check and
the shared backing writer checks with __linux__, the condition under
which DirectMemory registers that writer. The rest of the test now runs
on macOS and passes.

GcnColorTarget takes its low memory from the guest arena on macOS, as
on Windows. The address stays below 1 TiB and the test passes.

Windows and Linux compile the same code as before.
@github-actions github-actions Bot added the agc libSceAgc* label Nov 4, 2026
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 7774321 merged onto main 5b1d381 · tested 2026-11-04 08:06 UTC · 21 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 ✅ 1,086 passed · 2 failed (0 new, 1 also fail on main, 1 unstable on main) · 4 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 1,092 of 3,883 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 (524 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 3 of the last 10 main runs
Failing on main too (1, not counted against this PR)
agc_driver_image_table
Validation IDs already present on main (13 IDs in 445 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (445 tests): agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, agc_driver_bindless_images, and 437 more
VUID-VkShaderModuleCreateInfo-pCode-08737 (8 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_float16_fma_rounding, agc_driver_float16_unused_nan_payloads, agc_driver_packed_alu, agc_driver_packed_f16_denormal_modes, agc_driver_packed_float16_native
VUID-VkShaderModuleCreateInfo-pCode-08739 (8 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_float16_fma_rounding, agc_driver_float16_unused_nan_payloads, agc_driver_packed_alu, agc_driver_packed_f16_denormal_modes, agc_driver_packed_float16_native
VUID-VkShaderModuleCreateInfo-pCode-08741 (8 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_float16_fma_rounding, agc_driver_float16_unused_nan_payloads, agc_driver_packed_alu, agc_driver_packed_f16_denormal_modes, agc_driver_packed_float16_native
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_srgb8_color_target
VUID-VkPipelineShaderStageCreateInfo-module-parameter (1 test): agc_driver_float16_unused_nan_payloads
VUID-VkPipelineShaderStageCreateInfo-pSpecializationInfo-06849 (1 test): agc_driver_float16_unused_nan_payloads
VUID-VkSamplerCreateInfo-addressModeU-01079 (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeU-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeV-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeW-parameter (1 test): agc_driver_image_gather_volume
Skipped (4)
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
Reproduce
git fetch origin 777432119b328261ae66eb8ccb19fb78c851d411 5b1d381d5ad5d9f923326b18479c3bd889cdd588
git checkout 5b1d381d5ad5d9f923326b18479c3bd889cdd588 && git merge --no-ff 777432119b328261ae66eb8ccb19fb78c851d411
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.

@github-actions

github-actions Bot commented Nov 7, 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 5021 core/libs/prx/libSceAgcDriver/tests/SharedWrites.cpp

@adriadam10 adriadam10 self-assigned this Nov 7, 2026
@adriadam10
adriadam10 merged commit 9c8c7ab into boykopovar:main Nov 8, 2026
13 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the diff: Linux and Windows compile the same code as before (only the guards change to __linux__, plus a new __APPLE__ branch in GcnColorTarget.cpp), Windows job green, NVIDIA run by @TechLevelZero green on this head; merged.

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.

3 participants