Repository navigation
fix(agc): build the pending image snapshot and the queued index read order test with Apple's libc++ - #10676
Conversation
…order test with Apple's libc++ Co-authored-by: mugurc <mceker@gmail.com>
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed exact head e6c1d21ae8f1866a3ee4990c530c40a435b40b19 against current upstream main (dc9f1ef656367272f8485b8ed1e11378adf45a2e). The production fix replaces the unsupported std::atomic<std::shared_ptr<const Snapshot>> with the repository’s AtomicSharedPtr helper; its load/store call sites and memory orders remain unchanged, and the helper selects the same C++20 atomic specialization on standard libraries that provide it. The four pointer-to-integer casts in the test now use static_cast, which is valid for the integral conversion on Apple’s distinct uintptr_t/uint64_t typedefs. git diff --check, python3 tools/check_conventions.py --base upstream/main --head upstream/pr/10676, and git merge-tree --write-tree in both merge orders pass locally. Required hosted eligibility, intake, conventions, labels, and report checks pass; product build jobs are skipped by path policy. I could not reproduce the Apple libc++ compilation locally on this Linux host; the reported Apple M4 Pro compile and focused test results are the author’s evidence.
|
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.
|
…0859 imellag's earlier boykopovar#10676 already makes PendingList::published build with Apple's libc++, and maximilianfv's earlier boykopovar#10859 keeps sRGB storage images in their UNORM twin on every driver, which covers MoltenVK. Drop both hunks here and depend on those PRs.
|
Checked that both |
What
Two files of
libSceAgcDriverdon't compile with Apple clang and libc++ on currentmain:Graphics/src/Texture.cpp: the pending storage image list keeps its published snapshot in astd::atomic<std::shared_ptr<const Snapshot>>. Apple's libc++ has nostd::atomic<std::shared_ptr>:AtomicSharedPtrfromprx/libc/include/general/AtomicSharedPtr.hpp, the helper that the rest of the driver already uses (DeviceAccess,DispatchCache,DrawCache,GuestBufferMemory,Recorder). Where__cpp_lib_atomic_shared_ptris defined, as with libstdc++ on Linux and MinGW, the helper isstd::atomic<std::shared_ptr<T>>itself, so those builds compile the same code as before. Itsloadandstoretake the same memory orders, so the two call sites are unchanged.tests/execution/QueuedIndexReadOrder.cpp: fourreinterpret_cast<std::uint64_t>of astd::uintptr_t. On macOS these are different types (unsigned longandunsigned long long), andreinterpret_castbetween integer types is ill-formed:static_cast. This hunk is mugurc'sb84909f34efrom the macOS series, and he is co-author of the commit.Neither change is in an open PR. #7332 (closed) and mugurc's integration branch carried a different fix for the snapshot,
std::atomic_load_explicitandstd::atomic_store_expliciton a plainshared_ptr; the helper onmainmakes that unnecessary. #7201's base predates both of thesemainchanges.Tested
Apple M4 Pro, macOS 27.0.1, Apple clang, x86-64 Release (
-DCMAKE_OSX_ARCHITECTURES=x86_64, Ninja,BUILD_TESTING=ON).On
main3fcb5e4d76, with each file compiled using its own command from the build:Tests.
libSceAgcDriverdoesn't link onmainon macOS yet, because other files still fail. So I ran the tests onmain3fcb5e4d76plus the open macOS PRs (#10562, #10641, #10366, #10419, #7631, #7804, #10552, #4630, #10659, #10660, #10669, #10540) and the AGC parts of mugurc's macOS series that aren't in a PR yet. On that tree everything builds except one unrelated libkernel test, and with MoltenVK 1.4.2 from the Vulkan SDK 1.4.363.0:ctest -R '^agc_'withANYPS5_REQUIRE_VULKAN=1: 967 tests, 833 passed, 76 skipped. 58 fail with this change and with the series' version of the snapshot alike: MoltenVK feature gaps, and tests that loadlibvulkan.so.1themselves.agc_driver_queued_index_read_orderpasses.agc_recorder_*tests,agc_driver_sampled_cache_budget*,agc_driver_dcc_keys_first_write,agc_driver_store_idle_results*,agc_driver_store_over_untracked) pass.agc_driver_image_srgb_sample_copyfails with both versions: it samples 0.030769 where 0.002428 is expected.Validation layer.
maindoesn't build on macOS, so instead of amainrun I compared this change against the series' version of the snapshot. I ran those 16 tests withANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, and neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS. Both logs show the sameVUID-errors for the same tests:VkDeviceCreateInfo-pProperties-04451: the test fixtures don't enableVK_KHR_portability_subset.VkImageViewCreateInfo-imageViewFormatReinterpretation-04466and-imageViewFormatSwizzle-04465.So this change adds none.
Not built on Linux or Windows. There
AtomicSharedPtris the samestd::atomic<std::shared_ptr>, andstatic_castof astd::uintptr_ttostd::uint64_tis what the old double cast meant.check_conventions.py --base upstream/mainpasses.pr_overlap.pyreports no conflicting lines. It lists 38 pull requests that it couldn't compare onTexture.cppbecause they conflict withmain. I checked theirTexture.cpppatches, and none touches the snapshot member or its two call sites. None touches the test.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)