diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/LookBackScan.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/LookBackScan.cpp index 3e098baae..e36b005c0 100644 --- a/core/libs/prx/libSceAgcDriver/tests/execution/LookBackScan.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/execution/LookBackScan.cpp @@ -14,159 +14,127 @@ namespace { using AgcDriver::Graphics::Require; using ShaderRecompiler::ShaderStage; -constexpr std::array ScanCode{ - 0xbfa00003u, 0x878e817eu, 0x8811ff05u, 0x00080000u, 0xbefe040eu, 0xbe900304u, 0xbe92030bu, 0xbe9303ffu, - 0x00016204u, 0x8805ff07u, 0x00040000u, 0xbe840306u, 0xbe86030cu, 0xbe8703ffu, 0x00016204u, 0xbf880003u, - 0x7e020281u, 0xe0c84000u, 0x80000100u, 0xbf8c3f70u, 0xd7600002u, 0x00010101u, 0xbefe04c1u, 0x9003860au, - 0xbf0a0380u, 0x93000a02u, 0x4a240000u, 0x7d88240cu, 0xbf840006u, 0x7e020280u, 0xbefe046au, 0xbf880002u, - 0xe0302000u, 0x80010112u, 0xbefe04c1u, 0xd76d0011u, 0x04018000u, 0xbf0a0381u, 0x7d88220cu, 0xbf840006u, - 0x7e040280u, 0xbefe046au, 0xbf880002u, 0xe0302000u, 0x80010211u, 0xbefe04c1u, 0xd76d0010u, 0x0401fe00u, - 0x00000080u, 0xbf0a0382u, 0x7d88200cu, 0xbf840006u, 0x7e060280u, 0xbefe046au, 0xbf880002u, 0xe0302000u, - 0x80010310u, 0xbefe04c1u, 0xd76d000fu, 0x0401fe00u, 0x000000c0u, 0xbf0a0383u, 0x7d881e0cu, 0xbf840006u, - 0x7e080280u, 0xbefe046au, 0xbf880002u, 0xe0302000u, 0x8001040fu, 0xbefe04c1u, 0xd76d000eu, 0x0401fe00u, - 0x00000100u, 0xbf0a0384u, 0x7d881c0cu, 0xbf840006u, 0x7e0a0280u, 0xbefe046au, 0xbf880002u, 0xe0302000u, - 0x8001050eu, 0xbefe04c1u, 0xd76d000du, 0x0401fe00u, 0x00000140u, 0xbf0a0385u, 0x7d881a0cu, 0xbf840006u, - 0x7e0c0280u, 0xbefe046au, 0xbf880002u, 0xe0302000u, 0x8001060du, 0xbefe04c1u, 0xd76d000cu, 0x0401fe00u, - 0x00000180u, 0xbf0a0386u, 0x7d88180cu, 0xbf840006u, 0x7e0e0280u, 0xbefe046au, 0xbf880002u, 0xe0302000u, - 0x8001070cu, 0xbefe04c1u, 0xd76d000bu, 0x0401fe00u, 0x000001c0u, 0xbf0a0387u, 0x7d88160cu, 0xbf840006u, - 0x7e100280u, 0xbefe046au, 0xbf880002u, 0xe0302000u, 0x8001080bu, 0xbefe04c1u, 0xbe8d0380u, 0xbe8a0380u, - 0xbf0a030du, 0xbf840020u, 0xbefc030du, 0x810d810du, 0xbf8c3f70u, 0x7e148701u, 0x7e12030au, 0xbeea287eu, - 0x02281480u, 0x4a2828fau, 0xff011114u, 0x4a2828fau, 0xff011214u, 0x4a2828fau, 0xff011414u, 0x4a2828fau, - 0xff011814u, 0xd7781013u, 0x03058314u, 0x4a2826fau, 0xaf00e414u, 0x92fea0a0u, 0xd7600000u, 0x00013f14u, - 0x4a282800u, 0xbefe046au, 0x4c121314u, 0x4a14130au, 0x4a12120au, 0xd760006au, 0x00017f0au, 0x7e028509u, - 0x810a6a0au, 0xbf82ffdeu, 0xbefe0481u, 0x7e260202u, 0xbf088002u, 0x7e14020au, 0x856a8281u, 0x7e12026au, - 0xe1402000u, 0x80040913u, 0xbf088002u, 0xbe8d0380u, 0xbefe04c1u, 0xbf840058u, 0xd76d0013u, 0x0401fe02u, - 0xffffffc0u, 0xbe8d0380u, 0x7d0626f9u, 0x06868080u, 0x7e120281u, 0x7e140280u, 0xbefe0400u, 0xbf880002u, - 0xe034e000u, 0x80040913u, 0xbefe04c1u, 0xbf8c3f70u, 0x7d041280u, 0xbf13806au, 0xbf840006u, 0xbefe0400u, - 0xbf880002u, 0xe034e000u, 0x80040913u, 0xbefe04c1u, 0xbf82fff6u, 0x7d0412f9u, 0x06868082u, 0xbf138000u, - 0xbf850016u, 0x4e2626c0u, 0xbeea287eu, 0x02121480u, 0x4a1212fau, 0xff011109u, 0x4a1212fau, 0xff011209u, - 0x4a1212fau, 0xff011409u, 0x4a1212fau, 0xff011809u, 0xd778100au, 0x03058309u, 0x4a121509u, 0xbefe046au, - 0xd7600000u, 0x00013f09u, 0xd7600001u, 0x00017f09u, 0x81140100u, 0x810d140du, 0xbf82ffd3u, 0x7e127201u, - 0x7d8a12c1u, 0x4c1212bfu, 0xbf870002u, 0x7e127200u, 0x4c12129fu, 0x7d881300u, 0x7e000509u, 0x02001480u, - 0xbeea287eu, 0xd7600014u, 0x0000010au, 0x02120080u, 0x4a1212fau, 0xff011109u, 0x4a1212fau, 0xff011209u, - 0x4a1212fau, 0xff011409u, 0x4a1212fau, 0xff011809u, 0xd7781000u, 0x03058309u, 0x4a120109u, 0xbefe0481u, - 0xd7600000u, 0x00013f09u, 0xd7600001u, 0x00017f09u, 0x81150100u, 0x816a1514u, 0x810d0d6au, 0x7e000202u, - 0x4a141af9u, 0x8686060au, 0x7e120282u, 0xe1402000u, 0x80040900u, 0xbefe04c1u, 0x7d86240cu, 0xbf090380u, - 0xbf800000u, 0x8580807eu, 0x8dea006au, 0xbefe046au, 0xbf880004u, 0xbf8c3f70u, 0x4a00020du, 0xe0702000u, - 0x80010012u, 0xbefe04c1u, 0xbf090381u, 0x7d86220cu, 0x8580807eu, 0x8dea006au, 0xbefe046au, 0xbf880004u, - 0xbf8c3f70u, 0x4a00040du, 0xe0702000u, 0x80010011u, 0xbefe04c1u, 0xbf090382u, 0x7d86200cu, 0x8580807eu, - 0x8dea006au, 0xbefe046au, 0xbf880004u, 0xbf8c3f70u, 0x4a00060du, 0xe0702000u, 0x80010010u, 0xbefe04c1u, - 0xbf090383u, 0x7d861e0cu, 0x8580807eu, 0x8dea006au, 0xbefe046au, 0xbf880004u, 0xbf8c3f70u, 0x4a00080du, - 0xe0702000u, 0x8001000fu, 0xbefe04c1u, 0xbf090384u, 0x7d861c0cu, 0x8580807eu, 0x8dea006au, 0xbefe046au, - 0xbf880004u, 0xbf8c3f70u, 0x4a000a0du, 0xe0702000u, 0x8001000eu, 0xbefe04c1u, 0xbf090385u, 0x7d861a0cu, - 0x8580807eu, 0x8dea006au, 0xbefe046au, 0xbf880004u, 0xbf8c3f70u, 0x4a000c0du, 0xe0702000u, 0x8001000du, - 0xbefe04c1u, 0xbf090386u, 0x7d86180cu, 0x8580807eu, 0x8dea006au, 0xbefe046au, 0xbf880004u, 0xbf8c3f70u, - 0x4a000e0du, 0xe0702000u, 0x8001000cu, 0xbefe04c1u, 0xbf090387u, 0x7d86160cu, 0x8580807eu, 0x8dea006au, - 0xbefe046au, 0xbf880004u, 0xbf8c3f70u, 0x4a00100du, 0xe0702000u, 0x8001000bu, 0x816ac10bu, 0xbefe04c1u, - 0xbf066a02u, 0xbf800000u, 0x85ea807eu, 0x87ea0e6au, 0xbefe046au, 0xbf880008u, 0x4a0014f9u, 0x8686060du, - 0xbe8a0381u, 0xbe8b03ffu, 0x00016204u, 0xbe891d92u, 0xe0700000u, 0x80020000u, 0xbf810000u, 0xbf9f0000u, - 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, - 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, - 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, - 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0xbf9f0000u, 0x00000000u, 0x00000000u, - 0x30306c73u, 0x0000013fu, 0x00000156u, 0x00000000u, 0x00102557u, 0x0401a600u, 0x0b100a10u, 0x40100c10u, - 0x4c104b40u, 0x4e104d10u, 0x79606f10u, 0x00107a10u, 0x00006e00u, 0x21200f64u, 0x25402410u, 0x64000010u, - 0x40241021u, 0x28600000u, 0x00102950u, 0x30c9a100u, 0x9e0800c0u, 0xa0841941u, 0x18c08418u, 0x8418c084u, - 0xc08418c0u, 0x18c08418u, 0x8418c084u, 0xe0c01040u, 0x08430820u, 0x08104108u, 0x2334108bu, 0x38838838u, - 0x88388388u, 0x83883883u, 0x80f01040u, 0x98241e05u, 0x0d8442e0u, 0xe1183e0fu, 0x17158644u, 0x46e1985eu, - 0x7e1f1d88u, 0x8a48e218u, 0x989e2725u, 0x2d8c4ae2u, 0xe318be2fu, 0x37358e4cu, 0x4ee398deu, 0xfe3f3d90u, - 0x9250e418u, 0x991e4745u, 0x4f4d92e4u, 0x6a25112eu, 0xe6ab29cau, 0xcb6b32bcu, 0x2afcbb2du, 0x31cc6c33u, - 0xf34b3cbbu, 0xdb36b5cau, 0x6716f378u, 0xddd6739cu, 0x9ede6779u, 0xf9fdf67bu, 0x83a0e067u, 0x687a1e16u, - 0x368ba2e2u, 0xe468fa3eu, 0x5e5693a4u, 0x68a6697au, 0xf7777777u, 0x5554fdddu, 0xcb000205u, 0x70817d02u, - 0x00080019u, 0x003f0146u, 0xa41002a4u, 0x3402a602u, 0xaa000a34u, 0xaa100c02u, 0x3402b002u, 0x1502b631u, - 0x400202bcu, 0x02b60101u, 0x8b2ef007u, 0xd74d0005u, 0xe0828001u, 0x00001601u, 0x00000000u, 0x00000000u, - 0x65726162u, 0x746f6f66u, 0x442e4a87u, 0x00000000u, 0x00000001u, 0x00000618u, 0x00000000u, 0x00000156u, - 0x980d163fu, 0xeddd574eu, 0x00000000u, 0x00000000u, +// A single-pass decoupled look-back over one aggregate per block (wave64, one wave per block, lane 0 +// active). The block takes its index from an atomic counter, publishes {flag 1, aggregate} with +// buffer_atomic_swap_x2 (block 0 publishes {2, aggregate}), walks back over earlier blocks with glc +// buffer_load_dwordx2, adding aggregates until it reads an inclusive prefix {2, prefix}, publishes +// {2, prefix + aggregate} and stores its exclusive prefix. A dwordx2 load that sees half of a +// swap_x2 (a new flag with an old value, or an old flag with a new value) gives a wrong prefix. +// s[0:3] counter, s[4:7] aggregates, s[8:11] {flag, value} pairs, s[12:15] prefixes. +alignas(256) constexpr std::array ScanCode{ + 0xbefe0481, // s_mov_b64 exec, 1 + 0x7e020281, // v_mov_b32 v1, 1 + 0x7e000280, // v_mov_b32 v0, 0 + 0xe0c85000, 0x80000100, // buffer_atomic_add v1, v0, s[0:3], 0 offen glc + 0xbf8c3f70, // s_waitcnt vmcnt(0) + 0x7e200501, // v_readfirstlane_b32 s16, v1 + 0x34040282, // v_lshlrev_b32 v2, 2, v1 + 0xe0301000, 0x80010302, // buffer_load_dword v3, v2, s[4:7], 0 offen + 0x34080283, // v_lshlrev_b32 v4, 3, v1 + 0xbf8c3f70, // s_waitcnt vmcnt(0) + 0xbf068010, // s_cmp_eq_u32 s16, 0 + 0x85118182, // s_cselect_b32 s17, 2, 1 + 0x7e0c0211, // v_mov_b32 v6, s17 + 0x7e0e0303, // v_mov_b32 v7, v3 + 0xe1401000, 0x80020604, // buffer_atomic_swap_x2 v[6:7], v4, s[8:11], 0 offen + 0x7e100280, // v_mov_b32 v8, 0 + 0xbf068010, // s_cmp_eq_u32 s16, 0 + 0xbf85000f, // s_cbranch_scc1 publish + 0x80928110, // s_sub_u32 s18, s16, 1 + 0x8f138312, // look: s_lshl_b32 s19, s18, 3 + 0x7e120213, // v_mov_b32 v9, s19 + 0xe0345000, 0x80020a09, // buffer_load_dwordx2 v[10:11], v9, s[8:11], 0 offen glc + 0xbf8c3f70, // s_waitcnt vmcnt(0) + 0x7e28050a, // v_readfirstlane_b32 s20, v10 + 0x7e2a050b, // v_readfirstlane_b32 s21, v11 + 0xbf068014, // s_cmp_eq_u32 s20, 0 + 0xbf85fff7, // s_cbranch_scc1 look + 0x4a101015, // v_add_nc_u32 v8, s21, v8 + 0xbf068214, // s_cmp_eq_u32 s20, 2 + 0xbf850002, // s_cbranch_scc1 publish + 0x80928112, // s_sub_u32 s18, s18, 1 + 0xbf82fff2, // s_branch look + 0x4a1a0708, // publish: v_add_nc_u32 v13, v8, v3 + 0x7e180282, // v_mov_b32 v12, 2 + 0xe1401000, 0x80020c04, // buffer_atomic_swap_x2 v[12:13], v4, s[8:11], 0 offen + 0xe0701000, 0x80030802, // buffer_store_dword v8, v2, s[12:15], 0 offen + 0xbf810000, // s_endpgm }; constexpr std::uint32_t Lanes = 64; -constexpr std::uint32_t PerBlock = 256; -constexpr std::uint32_t Blocks = 125; -constexpr std::uint32_t Elements = 31860; +constexpr std::uint32_t Blocks = 4096; alignas(256) std::array Counter{}; +alignas(256) std::array Aggregates{}; alignas(256) std::array Pairs{}; -alignas(256) std::array Data{}; -alignas(256) std::array Total{}; +alignas(256) std::array Prefixes{}; std::uint32_t Value(std::uint32_t index, std::uint32_t seed) { - return ((index * 2654435761u + seed * 40503u) >> 13u) % 3u; + return ((index * 2654435761u + seed * 40503u) >> 13u) % 1000u; +} + +std::array BufferDescriptor(const void* data, std::uint32_t bytes) { + const auto address = reinterpret_cast(data); + return {static_cast(address), static_cast((address >> 32u) & 0xffffu), bytes, 0x31016facu}; } void Run(AgcDriver::VulkanDevice& device, std::uint32_t groups) { alignas(256) static std::array code{}; code = ScanCode; - const auto address = [](const void* data) { return reinterpret_cast(data); }; - std::vector userData{ - static_cast(address(Counter.data())), static_cast((address(Counter.data()) >> 32u) & 0xffffu) | 0x00040000u, 1u, 0x00005204u, - static_cast(address(Pairs.data())), static_cast(address(Pairs.data()) >> 32u), - static_cast(address(Data.data())), static_cast(address(Data.data()) >> 32u), - static_cast(address(Total.data())), static_cast(address(Total.data()) >> 32u), - PerBlock, Blocks, Elements}; + std::vector userData; + for (const auto& descriptor : {BufferDescriptor(Counter.data(), sizeof(Counter)), BufferDescriptor(Aggregates.data(), sizeof(Aggregates)), BufferDescriptor(Pairs.data(), sizeof(Pairs)), BufferDescriptor(Prefixes.data(), sizeof(Prefixes))}) { + userData.insert(userData.end(), descriptor.begin(), descriptor.end()); + } + const auto address = reinterpret_cast(code.data()); const std::span words(code); - const std::array memory{{{address(code.data()), std::as_bytes(words)}}}; + const std::array memory{{{address, std::as_bytes(words)}}}; const ShaderRecompiler::ShaderComputeStageInfo compute{{Lanes, 1, 1}, 0, {false, false, false}, false, 1}; ShaderRecompiler::RecompileRequest request{ - {ShaderStage::Compute, address(code.data()), words, 0, {}}, + {ShaderStage::Compute, address, words, 0, {}}, {Lanes, 0, userData, compute, std::nullopt, std::nullopt, memory}, device.Target(), {0, 0, 0, 128} }; request.useCache = false; const auto result = ShaderRecompiler::Recompile(request); - device.Dispatch(result, groups, 1, 1, {}, address(code.data())); + device.Dispatch(result, groups, 1, 1, {}, address); device.WaitIdle(); } -std::uint32_t BlockSum(const std::vector& input, std::uint32_t block) { - std::uint32_t sum = 0; - for (std::uint32_t i = block * PerBlock; i < (block + 1) * PerBlock && i < Elements; ++i) sum += input[i]; - return sum; -} - +// One block against published earlier blocks: aggregates (flag 1) except block 0's inclusive prefix. void CheckLookBack(AgcDriver::VulkanDevice& device, std::uint32_t block) { const auto name = "look-back from block " + std::to_string(block); - std::vector input(Data.size(), 0u); - for (std::uint32_t i = 0; i < Elements; ++i) input[i] = Value(i, block); Pairs.fill(0u); std::uint32_t prefix = 0; + for (std::uint32_t b = 0; b < Blocks; ++b) Aggregates[b] = Value(b, block); for (std::uint32_t b = 0; b < block; ++b) { - const auto sum = BlockSum(input, b); - prefix += sum; + prefix += Aggregates[b]; Pairs[2 * b] = b == 0 ? 2u : 1u; - Pairs[2 * b + 1] = b == 0 ? prefix : sum; + Pairs[2 * b + 1] = b == 0 ? prefix : Aggregates[b]; } Counter.fill(0u); Counter[0] = block; - std::copy(input.begin(), input.end(), Data.begin()); - Total.fill(0xdeadbeefu); + Prefixes.fill(0xdeadbeefu); Run(device, 1); Require(Counter[0] == block + 1, name + ": the counter is " + std::to_string(Counter[0])); + Require(Prefixes[block] == prefix, name + ": its prefix is " + std::to_string(Prefixes[block]) + ", expected " + std::to_string(prefix)); Require(Pairs[2 * block] == 2u, name + ": its flag is " + std::to_string(Pairs[2 * block]) + ", expected 2"); - Require(Pairs[2 * block + 1] == prefix + BlockSum(input, block), name + ": it published " + std::to_string(Pairs[2 * block + 1]) + ", expected " + std::to_string(prefix + BlockSum(input, block)) + " (prefix " + std::to_string(prefix) + ")"); - std::uint32_t running = prefix; - for (std::uint32_t i = block * PerBlock; i < (block + 1) * PerBlock && i < Elements; ++i) { - Require(Data[i] == running, name + ": element " + std::to_string(i) + " is " + std::to_string(Data[i]) + ", expected " + std::to_string(running) + " (prefix " + std::to_string(prefix) + ")"); - running += input[i]; - } - if (block == Blocks - 1) Require(Total[0] == running, name + ": the total is " + std::to_string(Total[0]) + ", expected " + std::to_string(running)); + Require(Pairs[2 * block + 1] == prefix + Aggregates[block], name + ": it published " + std::to_string(Pairs[2 * block + 1]) + ", expected " + std::to_string(prefix + Aggregates[block])); } void CheckWhole(AgcDriver::VulkanDevice& device, std::uint32_t seed) { const auto name = "whole scan " + std::to_string(seed); - std::vector input(Data.size(), 0u); - for (std::uint32_t i = 0; i < Elements; ++i) input[i] = Value(i, seed); + for (std::uint32_t b = 0; b < Blocks; ++b) Aggregates[b] = Value(b, seed); Counter.fill(0u); Pairs.fill(0u); - std::copy(input.begin(), input.end(), Data.begin()); - Total.fill(0xdeadbeefu); + Prefixes.fill(0xdeadbeefu); Run(device, Blocks); std::uint32_t running = 0; - for (std::uint32_t i = 0; i < Elements; ++i) { - Require(Data[i] == running, name + ": element " + std::to_string(i) + " (block " + std::to_string(i / PerBlock) + ") is " + std::to_string(Data[i]) + ", expected " + std::to_string(running)); - running += input[i]; + for (std::uint32_t b = 0; b < Blocks; ++b) { + Require(Prefixes[b] == running, name + ": block " + std::to_string(b) + "'s prefix is " + std::to_string(Prefixes[b]) + ", expected " + std::to_string(running)); + running += Aggregates[b]; + Require(Pairs[2 * b] == 2u && Pairs[2 * b + 1] == running, name + ": block " + std::to_string(b) + " published {" + std::to_string(Pairs[2 * b]) + ", " + std::to_string(Pairs[2 * b + 1]) + "}, expected {2, " + std::to_string(running) + "}"); } - Require(Total[0] == running, name + ": the total is " + std::to_string(Total[0]) + ", expected " + std::to_string(running)); } } @@ -179,7 +147,7 @@ int main() { std::printf("skipped, subgroup size %u cannot hold a wave32\n", device->Target().subgroupSize); return VulkanTestSkipped; } - for (const std::uint32_t block : {0u, 1u, 50u, 63u, 64u, 65u, 100u, 124u}) CheckLookBack(*device, block); + for (const std::uint32_t block : {0u, 1u, 2u, 63u, 64u, 1000u, Blocks - 1}) CheckLookBack(*device, block); for (std::uint32_t seed = 0; seed < 50; ++seed) CheckWhole(*device, seed); std::puts("look-back scan tests passed"); return 0; diff --git a/docs/dev/TechnicalDebt.md b/docs/dev/TechnicalDebt.md index 57ce5607d..6dc3ce18d 100644 --- a/docs/dev/TechnicalDebt.md +++ b/docs/dev/TechnicalDebt.md @@ -227,6 +227,7 @@ Throughout the project, every function at every stage either **does exactly what - [64-bit LDS atomics](../../core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpp) (`ds_*_u64`, `ds_*_b64`, `ds_*_f64`) read and write the two dwords under a workgroup lock stored after the guest LDS, as LDS is a 32-bit array without 64-bit atomics. They are atomic with respect to each other only: 32-bit accesses to the same dwords issued concurrently are not ordered by the lock. 64-bit GDS atomics throw. `ds_min/max(_rtn)_f64` and `ds_cmpst(_rtn)_f64` follow the NaN and signed-zero rules measured for the f32 forms; the f64 forms were not measured on hardware. - [Min/max S# reduction](../../core/libs/prx/libSceAgcDriver/Graphics/src/GuestSamplerResource.cpp) (libSceAgcDriver) - `FILTER_MODE` 1 and 2 use Vulkan's min and max reduction (the same `SQ_IMG_FILTER_MODE` values RADV programs). Measured on RDNA2 (gfx1035), not on the console: only texels of non-zero weight are reduced, and the weight is taken after rounding to the 8-bit subtexel grid (a sample within 1/512 texel of a centre reduces that texel alone); a driver with other `subTexelPrecisionBits` reduces a different set there. Gathers ignore the mode. - [Min/max S#](../../core/libs/prx/libSceAgcDriver/Graphics/src/GuestSamplerResource.cpp) (libSceAgcDriver, shader recompiler) - throws with anisotropy, a linear mip filter, depth or color-texture compare, or bilinear filtering of an image the recompiler point-samples (sint, converted, depth-bits). +- [Raw `buffer_load_dwordx2`](../../core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpp) is one 64-bit access on the hardware (with or without glc), so it never sees half of a `buffer_atomic_swap_x2`. Only a glc load that is 8-byte aligned and in bounds, in a program that has the 64-bit storage view (it uses 64-bit buffer atomics), is read with one 64-bit atomic load; every other dwordx2 load is two dword loads and can tear against a concurrent 64-bit write: loads without glc, and loads in a program without 64-bit buffer atomics while another shader writes the pair with `swap_x2`. - [wcsrtombs_s](../../core/libs/prx/libc/src/Multibyte.cpp) (libc) follows the console's `libc.prx`, but a runtime-constraint violation only returns its error: the default handler there writes the message and a newline to `stderr` before returning, which is not done here. Conversion uses the C locale of `wcrtomb` (`MB_CUR_MAX` 1), so the path where a multibyte character does not fit the remaining space is not reached - [collate::_Getcat](../../core/libs/prx/libc/src/LocaleSupport.cpp) (libc) builds the facet for the C locale only and throws for any other locale name. The console's `libc.prx` stores pointers to its collation state tables at offsets 0x10 and 0x18 of the facet; ours leaves them null, as only the facet's own functions read them. `do_transform` throws for input with embedded null characters, which the console drops depending on the output buffer size, and for results of 4095 characters or more, whose string storage uses the guest's over-aligned large allocation. - [Thread exit destructors](../../core/libs/prx/libSceLibcInternal/Export.cpp) (libSceLibcInternal) run when a libkernel thread finishes; on the main or a host thread only `_sceLibcInternalThreadDtors` runs them, as `exit` does, else they are dropped