fix(runtime): isolate host worker MXCSR #7622

Merged
MarcZX10 merged 11 commits from upstream-pr/7622 into main 2026-11-12 19:28:57 +00:00
MarcZX10 commented 2026-10-18 17:41:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T17:41:21Z.


What

Starts AnyPS5-owned native workers with host MXCSR 0x1f80 before their tasks. Linux threads created from guest execution contexts can otherwise inherit guest MXCSR 0x9fc0 and its FTZ/DAZ settings. The change covers current-main std::thread and std::jthread workers across runtime, AGC, VideoOut, shader cache, AvPlayer and libkernel code, the shader-registration pthread trampoline, and both Windows crash-diagnostic thread entrypoints. The focused helpers preserve the caller's MXCSR. Guest pthread execution remains governed by its separate guest-entry logic in #7565; this follows up on the host-worker question in #7594.

Tested

  • Linux x86_64: compiled and ran host_thread_mxcsr_tests. It verifies std::thread and std::jthread workers each start at 0x1f80 while the caller remains at 0x9fc0.
  • python3 tools/check_conventions.py --base upstream/main passed.
  • git diff --check passed.
  • Full project CMake configuration could not complete because this checkout lacks the SDL2 source submodule and XRandR development support. No full runtime build or native Windows test was run.
  • The overlap scan identified same-file worker-launch edits in #5431, #6946, #6947 and #7121, plus other open PRs whose conflicting branches could not be compared against main. These address different behavior; the overlapping launches were manually inspected, and a rebase may be needed if they merge first. No PR duplicates the MXCSR initialization behavior.

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 (https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4911309958 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T17:41:21Z. --- ### What Starts AnyPS5-owned native workers with host MXCSR 0x1f80 before their tasks. Linux threads created from guest execution contexts can otherwise inherit guest MXCSR 0x9fc0 and its FTZ/DAZ settings. The change covers current-main std::thread and std::jthread workers across runtime, AGC, VideoOut, shader cache, AvPlayer and libkernel code, the shader-registration pthread trampoline, and both Windows crash-diagnostic thread entrypoints. The focused helpers preserve the caller's MXCSR. Guest pthread execution remains governed by its separate guest-entry logic in #7565; this follows up on the host-worker question in #7594. ### Tested - Linux x86_64: compiled and ran host_thread_mxcsr_tests. It verifies std::thread and std::jthread workers each start at 0x1f80 while the caller remains at 0x9fc0. - python3 tools/check_conventions.py --base upstream/main passed. - git diff --check passed. - Full project CMake configuration could not complete because this checkout lacks the SDL2 source submodule and XRandR development support. No full runtime build or native Windows test was run. - The overlap scan identified same-file worker-launch edits in #5431, #6946, #6947 and #7121, plus other open PRs whose conflicting branches could not be compared against main. These address different behavior; the overlapping launches were manually inspected, and a rebase may be needed if they merge first. No PR duplicates the MXCSR initialization behavior. ### Checklist - [x] Based on current main; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt (https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation .md files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-18 18:00:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T18:00:31Z.


Latest hosted run: conventions, eligibility, report, Linux/macOS Debug+Release register-context, Linux/macOS/Windows relinker, relinker ASAN, and both macOS write-watch jobs pass. The workflow skipped the full Linux and Windows app suites, so those results are not covered by this run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6253244840 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6253244840). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T18:00:31Z. --- Latest hosted run: conventions, eligibility, report, Linux/macOS Debug+Release register-context, Linux/macOS/Windows relinker, relinker ASAN, and both macOS write-watch jobs pass. The workflow skipped the full Linux and Windows app suites, so those results are not covered by this run.
oneandonlydean commented 2026-10-18 18:23:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T18:23:14Z.


Thanks for the jthread coverage, that part looks right. Full CI on f2a3f97021 fails to build on Linux and Windows at the shader disk cache key check:

core/shader/recompiler/ShaderDiskCache.cpp includes core/libs/prx/libc/include/HostThread.hpp, which the shader disk cache key does not hash: add it to shaderCacheKeySources in core/shader/recompiler/ShaderCacheVersion.cmake

Could you add HostThread.hpp to shaderCacheKeySources (ShaderCacheVersion.cmake)?

Two small optional extras while you're there: the RefreshPool mirror-refresh helpers (GuestBufferMemory.cpp) still start without the reset (no float math, so not required), and a debt line noting that threads started by third-party code while on a guest thread (SDL audio, driver-internal threads) still inherit guest MXCSR on Linux would make the boundary explicit.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6253481780 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6253481780). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-18T18:23:14Z. --- Thanks for the jthread coverage, that part looks right. Full CI on f2a3f97021 fails to build on Linux and Windows at the shader disk cache key check: ``` core/shader/recompiler/ShaderDiskCache.cpp includes core/libs/prx/libc/include/HostThread.hpp, which the shader disk cache key does not hash: add it to shaderCacheKeySources in core/shader/recompiler/ShaderCacheVersion.cmake ``` Could you add `HostThread.hpp` to `shaderCacheKeySources` (ShaderCacheVersion.cmake)? Two small optional extras while you're there: the `RefreshPool` mirror-refresh helpers (GuestBufferMemory.cpp) still start without the reset (no float math, so not required), and a debt line noting that threads started by third-party code while on a guest thread (SDL audio, driver-internal threads) still inherit guest MXCSR on Linux would make the boundary explicit.
LeandroLP23 commented 2026-10-18 18:28:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T18:28:36Z.


Windows build of f2a3f9702 on main c3591adf9 (clean merge), WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. It fails in two places:

  1. The shader cache key check stops the build:

    Shader disk cache key check failed:
      core/shader/recompiler/ShaderDiskCache.cpp includes core/libs/prx/libc/include/HostThread.hpp, which the shader disk cache key does not hash: add it to shaderCacheKeySources in core/shader/recompiler/CMakeLists.txt
    

    This check runs on every host, so it probably fails on Linux as well once the project is configured.

  2. host_thread_mxcsr_tests does not link with MinGW:

    HostThreadMxcsr.cpp.obj:HostThreadMxcsr.cpp:(.data+0x0): undefined reference to `__gxx_personality_v0'
    

    The other executables in that block link a target that brings the runtime in. host_thread_local_tests links host_thread_local_test_library, and windows_backtrace_report_tests links libc. The new one links nothing.

I didn't get further, so the MXCSR test itself has not run on Windows.

AI-assisted

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6253535695 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6253535695). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-18T18:28:36Z. --- Windows build of `f2a3f9702` on `main` `c3591adf9` (clean merge), WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`. It fails in two places: 1. The shader cache key check stops the build: ``` Shader disk cache key check failed: core/shader/recompiler/ShaderDiskCache.cpp includes core/libs/prx/libc/include/HostThread.hpp, which the shader disk cache key does not hash: add it to shaderCacheKeySources in core/shader/recompiler/CMakeLists.txt ``` This check runs on every host, so it probably fails on Linux as well once the project is configured. 2. `host_thread_mxcsr_tests` does not link with MinGW: ``` HostThreadMxcsr.cpp.obj:HostThreadMxcsr.cpp:(.data+0x0): undefined reference to `__gxx_personality_v0' ``` The other executables in that block link a target that brings the runtime in. `host_thread_local_tests` links `host_thread_local_test_library`, and `windows_backtrace_report_tests` links `libc`. The new one links nothing. I didn't get further, so the MXCSR test itself has not run on Windows. AI-assisted
LeandroLP23 commented 2026-10-18 18:34:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T18:34:26Z.


@MarcZX100 I followed up on both Windows failures. With the two changes below on f2a3f9702 (merged onto main c3591adf9, together with #7629, #7630 and #7627), the full build succeeds and the new test passes.

  • Cache key check: HostThread.hpp added to shaderCacheKeySources, next to HostThreadLocal.hpp.
  • Link: this toolchain uses DWARF exceptions (ANYPS5_MINGW_DWARF_EXCEPTIONS). __gxx_personality_v0 then comes from AnyPS5's libc (exception/Personality.cpp), not from MinGW's libstdc++. A manual g++ link of the two objects with the default -lstdc++ fails the same way. So the test links libc, as windows_backtrace_report_tests does, and on Windows gets the PATH to it like the other libc tests.
diff --git a/core/libs/CMakeLists.txt b/core/libs/CMakeLists.txt
index 1fe93b670..8e6a0576d 100644
--- a/core/libs/CMakeLists.txt
+++ b/core/libs/CMakeLists.txt
@@ -469,7 +469,11 @@ if(BUILD_TESTING)
     set_tests_properties(host_thread_local PROPERTIES TIMEOUT 15)
     add_test_executable(host_thread_mxcsr_tests tests/HostThreadMxcsr.cpp)
     target_include_directories(host_thread_mxcsr_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+    target_link_libraries(host_thread_mxcsr_tests PRIVATE libc)
     add_test(NAME host_thread_mxcsr COMMAND host_thread_mxcsr_tests)
+    if(WIN32)
+        set_tests_properties(host_thread_mxcsr PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
+    endif()
     if(MINGW)
         add_test(NAME prx_thread_local_destructors COMMAND ${CMAKE_COMMAND} -DNM=${CMAKE_NM} -DOBJDUMP=${CMAKE_OBJDUMP}
             -DMODULES=$<TARGET_FILE_DIR:libc> -P ${CMAKE_CURRENT_SOURCE_DIR}/tests/ThreadLocalDestructors.cmake)
diff --git a/core/shader/recompiler/CMakeLists.txt b/core/shader/recompiler/CMakeLists.txt
index e4bcac3e9..7aed6fe08 100644
--- a/core/shader/recompiler/CMakeLists.txt
+++ b/core/shader/recompiler/CMakeLists.txt
@@ -178,7 +178,7 @@ function(add_shader_recompiler target runtimeTarget)
             "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/*.cmake"
             "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/CMakeLists.txt"
     )
-    set(shaderCacheKeySources "${PROJECT_SOURCE_DIR}/core/libs/prx/libc/include/HostThreadLocal.hpp")
+    set(shaderCacheKeySources "${PROJECT_SOURCE_DIR}/core/libs/prx/libc/include/HostThread.hpp" "${PROJECT_SOURCE_DIR}/core/libs/prx/libc/include/HostThreadLocal.hpp")
     foreach(source IN LISTS shaderCacheKeySources)
         if(NOT EXISTS "${source}")
             message(FATAL_ERROR "Shader disk cache key source does not exist: ${source}")

Results, Radeon 860M, Windows 11 26300, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON:

  • host_thread_mxcsr and host_thread_local pass, 3 runs of 3.
  • Every agc_* test on that build: 719 of 722 pass. The 3 failures don't come from this PR: agc_driver_depth_bounds_state is #7627's missing Windows PATH, and agc_driver_quad_pixel_mask and agc_driver_layered_volume_vertex_no_gpl fail the same way on main here.

AI-assisted

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6253594777 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6253594777). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-18T18:34:26Z. --- @MarcZX100 I followed up on both Windows failures. With the two changes below on `f2a3f9702` (merged onto `main` `c3591adf9`, together with #7629, #7630 and #7627), the full build succeeds and the new test passes. - **Cache key check:** `HostThread.hpp` added to `shaderCacheKeySources`, next to `HostThreadLocal.hpp`. - **Link:** this toolchain uses DWARF exceptions (`ANYPS5_MINGW_DWARF_EXCEPTIONS`). `__gxx_personality_v0` then comes from AnyPS5's `libc` (`exception/Personality.cpp`), not from MinGW's `libstdc++`. A manual `g++` link of the two objects with the default `-lstdc++` fails the same way. So the test links `libc`, as `windows_backtrace_report_tests` does, and on Windows gets the `PATH` to it like the other `libc` tests. ```diff diff --git a/core/libs/CMakeLists.txt b/core/libs/CMakeLists.txt index 1fe93b670..8e6a0576d 100644 --- a/core/libs/CMakeLists.txt +++ b/core/libs/CMakeLists.txt @@ -469,7 +469,11 @@ if(BUILD_TESTING) set_tests_properties(host_thread_local PROPERTIES TIMEOUT 15) add_test_executable(host_thread_mxcsr_tests tests/HostThreadMxcsr.cpp) target_include_directories(host_thread_mxcsr_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + target_link_libraries(host_thread_mxcsr_tests PRIVATE libc) add_test(NAME host_thread_mxcsr COMMAND host_thread_mxcsr_tests) + if(WIN32) + set_tests_properties(host_thread_mxcsr PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>") + endif() if(MINGW) add_test(NAME prx_thread_local_destructors COMMAND ${CMAKE_COMMAND} -DNM=${CMAKE_NM} -DOBJDUMP=${CMAKE_OBJDUMP} -DMODULES=$<TARGET_FILE_DIR:libc> -P ${CMAKE_CURRENT_SOURCE_DIR}/tests/ThreadLocalDestructors.cmake) diff --git a/core/shader/recompiler/CMakeLists.txt b/core/shader/recompiler/CMakeLists.txt index e4bcac3e9..7aed6fe08 100644 --- a/core/shader/recompiler/CMakeLists.txt +++ b/core/shader/recompiler/CMakeLists.txt @@ -178,7 +178,7 @@ function(add_shader_recompiler target runtimeTarget) "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/*.cmake" "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/CMakeLists.txt" ) - set(shaderCacheKeySources "${PROJECT_SOURCE_DIR}/core/libs/prx/libc/include/HostThreadLocal.hpp") + set(shaderCacheKeySources "${PROJECT_SOURCE_DIR}/core/libs/prx/libc/include/HostThread.hpp" "${PROJECT_SOURCE_DIR}/core/libs/prx/libc/include/HostThreadLocal.hpp") foreach(source IN LISTS shaderCacheKeySources) if(NOT EXISTS "${source}") message(FATAL_ERROR "Shader disk cache key source does not exist: ${source}") ``` Results, Radeon 860M, Windows 11 26300, WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`: - `host_thread_mxcsr` and `host_thread_local` pass, 3 runs of 3. - Every `agc_*` test on that build: 719 of 722 pass. The 3 failures don't come from this PR: `agc_driver_depth_bounds_state` is #7627's missing Windows `PATH`, and `agc_driver_quad_pixel_mask` and `agc_driver_layered_volume_vertex_no_gpl` fail the same way on `main` here. AI-assisted
MarcZX10 commented 2026-10-18 18:43:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T18:43:49Z.


Pushed 7aec3f58f to address the two reported build failures:

  • Add HostThread.hpp to the shader disk cache key inputs.
  • Link host_thread_mxcsr_tests with libc and prepend its directory to PATH on Windows.

The changes match the focused patch reported by LeandroLP23. Their independent Windows 11 26300 / Radeon 860M / WinLibs GCC 15.2.0 Release run reports host_thread_mxcsr and host_thread_local passing 3/3 each, and the full build succeeding. That run was on an equivalent merged tree before this commit; it has not yet run against this exact head.

Local git diff --check passes. The local conventions checker reports seven pre-existing baseline findings (one silent stub and six old revert subjects); no finding points to these two CMake edits. This host's full build remains blocked by the unrelated GCC dependent-template error in SrtDescriptorEvaluation.cpp. The prior PR CI had full Linux and Windows jobs skipped, so those are not presented as validation of this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6253691049 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6253691049). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T18:43:49Z. --- Pushed `7aec3f58f` to address the two reported build failures: - Add `HostThread.hpp` to the shader disk cache key inputs. - Link `host_thread_mxcsr_tests` with `libc` and prepend its directory to `PATH` on Windows. The changes match the focused patch reported by LeandroLP23. Their independent Windows 11 26300 / Radeon 860M / WinLibs GCC 15.2.0 Release run reports `host_thread_mxcsr` and `host_thread_local` passing 3/3 each, and the full build succeeding. That run was on an equivalent merged tree before this commit; it has not yet run against this exact head. Local `git diff --check` passes. The local conventions checker reports seven pre-existing baseline findings (one silent stub and six old revert subjects); no finding points to these two CMake edits. This host's full build remains blocked by the unrelated GCC dependent-template error in `SrtDescriptorEvaluation.cpp`. The prior PR CI had full Linux and Windows jobs skipped, so those are not presented as validation of this head.
MarcZX10 commented 2026-10-18 18:54:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T18:54:50Z.


The updated head 7aec3f58f now has green conventions, eligibility, report, register-context (Ubuntu Debug/Release and macOS Intel Debug/Release), relinker (Linux, Windows, macOS arm64/x86_64, ASan), and write-watch (macOS arm64/Intel) checks. Full Linux/Windows builds were skipped by path policy. The independent Radeon 860M run remains evidence from an equivalent merged tree before this exact head, as described above.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6253802986 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6253802986). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T18:54:50Z. --- The updated head `7aec3f58f` now has green conventions, eligibility, report, register-context (Ubuntu Debug/Release and macOS Intel Debug/Release), relinker (Linux, Windows, macOS arm64/x86_64, ASan), and write-watch (macOS arm64/Intel) checks. Full Linux/Windows builds were skipped by path policy. The independent Radeon 860M run remains evidence from an equivalent merged tree before this exact head, as described above.
jotitadev commented 2026-10-19 00:37:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T00:37:16Z.

Review: COMMENTED


Checked the new test on macOS (x86-64 under Rosetta 2), head 7aec3f58f. Apple M2 Max, macOS 27.2, Apple clang 21. The full x86-64 tree from this head configures on macOS but libc does not compile there (CLOCK_REALTIME_COARSE, st_mtim in General.cpp; #7332 covers that), so I built core/libs/tests/HostThreadMxcsr.cpp with the PR's HostThread.hpp on its own (clang++ -arch x86_64 -std=c++20 -O2). The arm64 build does not include core/libs.

On macOS the test does not catch a missing reset:

  • As in the PR: passes 5/5.
  • With both SetHostMxcsr() calls removed from StartHostThread and StartHostJThread: also passes 5/5.
  • Control: with the helper setting 0x9fc0 instead of 0x1f80, it throws as expected, so the check itself works.

Under Rosetta 2 a new thread starts with the default MXCSR and does not inherit the creator's FTZ/DAZ. A plain probe shows the same for std::thread and pthread_create: the caller is at 0x9fc0, the new thread reads 0x1f80 (3/3). I have no Intel Mac to check native x86-64.

So the inheritance this PR fixes does not happen here. On macOS the reset changes nothing for new threads, and host_thread_mxcsr only works as a regression test on Linux. It may be worth saying that in Tested, or showing it failing on Linux without the reset.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5565867194 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#pullrequestreview-5565867194). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-19T00:37:16Z. **Review:** COMMENTED --- Checked the new test on macOS (x86-64 under Rosetta 2), head `7aec3f58f`. Apple M2 Max, macOS 27.2, Apple clang 21. The full x86-64 tree from this head configures on macOS but `libc` does not compile there (`CLOCK_REALTIME_COARSE`, `st_mtim` in `General.cpp`; #7332 covers that), so I built `core/libs/tests/HostThreadMxcsr.cpp` with the PR's `HostThread.hpp` on its own (`clang++ -arch x86_64 -std=c++20 -O2`). The arm64 build does not include `core/libs`. On macOS the test does not catch a missing reset: - As in the PR: passes 5/5. - With both `SetHostMxcsr()` calls removed from `StartHostThread` and `StartHostJThread`: also passes 5/5. - Control: with the helper setting `0x9fc0` instead of `0x1f80`, it throws as expected, so the check itself works. Under Rosetta 2 a new thread starts with the default MXCSR and does not inherit the creator's FTZ/DAZ. A plain probe shows the same for `std::thread` and `pthread_create`: the caller is at `0x9fc0`, the new thread reads `0x1f80` (3/3). I have no Intel Mac to check native x86-64. So the inheritance this PR fixes does not happen here. On macOS the reset changes nothing for new threads, and `host_thread_mxcsr` only works as a regression test on Linux. It may be worth saying that in Tested, or showing it failing on Linux without the reset. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
jotitadev commented 2026-10-19 00:52:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T00:52:30Z.

Review: COMMENTED


Linux follow-up to my macOS note above: a full Linux build and suite run of 7aec3f58f, plus the mutation I suggested there. The hosted run skipped the Linux app suite, and the Linux runs so far covered only the focused test. On Linux the test does catch a missing reset.

Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release, BUILD_TESTING=ON, full build.
Head 7aec3f58f merged onto main a373e85e5 (clean merge). Same commands on plain main for the baseline.

  • Builds, including the shader cache key check that failed on f2a3f9702.
  • host_thread_mxcsr and host_thread_local pass 20/20 with --repeat until-fail:20. The 28 tests matching host_thread|pthread|mxcsr pass.
  • Non-GPU suite (ctest -E "^agc|gpu|vulkan|video_out" -j7): 745/746. The new test brings the count to 746, and main is 745/745. The one failure was pr_overlap_tools. That test only exercises tools/pr_overlap.py, which this PR doesn't touch. It passed 3/3 on its own in the same merged tree, so I read it as a flake under -j7.
  • AGC suite on lavapipe (Mesa 26.0.3, VK_DRIVER_FILES pointing only at lvp_icd.json; ctest -R "^agc" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64" -j4): 732/732 with 50 skipped, the same as main.
  • Mutation: with SetHostMxcsr() emptied, host_thread_mxcsr fails 3/3 with a host worker inherited guest MXCSR. So on Linux a plain std::thread started from a thread at 0x9fc0 really starts at 0x9fc0, unlike under Rosetta 2, and the test catches it.
  • Coverage check: in the merged tree, I grepped core (without tests, 3rdparty and the relinker) for workers that are still started directly. There is one: RefreshPool in libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp (threads.emplace_back([this](std::stop_token token) { ... }), the mirror refresh helpers, std::vector<std::jthread>). It is created lazily by RefreshPool::Get(), so it inherits whatever MXCSR the first caller has. Its helpers only memcmp/memcpy blocks, so FTZ/DAZ has no effect on them today. It is the only launch I found outside the helpers, in case you want the coverage to be complete.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5565924864 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#pullrequestreview-5565924864). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-19T00:52:30Z. **Review:** COMMENTED --- Linux follow-up to my macOS note above: a full Linux build and suite run of `7aec3f58f`, plus the mutation I suggested there. The hosted run skipped the Linux app suite, and the Linux runs so far covered only the focused test. On Linux the test does catch a missing reset. Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release, `BUILD_TESTING=ON`, full build. Head `7aec3f58f` merged onto `main` `a373e85e5` (clean merge). Same commands on plain `main` for the baseline. - Builds, including the shader cache key check that failed on `f2a3f9702`. - `host_thread_mxcsr` and `host_thread_local` pass 20/20 with `--repeat until-fail:20`. The 28 tests matching `host_thread|pthread|mxcsr` pass. - Non-GPU suite (`ctest -E "^agc|gpu|vulkan|video_out" -j7`): 745/746. The new test brings the count to 746, and `main` is 745/745. The one failure was `pr_overlap_tools`. That test only exercises `tools/pr_overlap.py`, which this PR doesn't touch. It passed 3/3 on its own in the same merged tree, so I read it as a flake under `-j7`. - AGC suite on lavapipe (Mesa 26.0.3, `VK_DRIVER_FILES` pointing only at `lvp_icd.json`; `ctest -R "^agc" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64" -j4`): 732/732 with 50 skipped, the same as `main`. - Mutation: with `SetHostMxcsr()` emptied, `host_thread_mxcsr` fails 3/3 with `a host worker inherited guest MXCSR`. So on Linux a plain `std::thread` started from a thread at 0x9fc0 really starts at 0x9fc0, unlike under Rosetta 2, and the test catches it. - Coverage check: in the merged tree, I grepped `core` (without tests, `3rdparty` and the relinker) for workers that are still started directly. There is one: `RefreshPool` in `libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` (`threads.emplace_back([this](std::stop_token token) { ... })`, the mirror refresh helpers, `std::vector<std::jthread>`). It is created lazily by `RefreshPool::Get()`, so it inherits whatever MXCSR the first caller has. Its helpers only `memcmp`/`memcpy` blocks, so FTZ/DAZ has no effect on them today. It is the only launch I found outside the helpers, in case you want the coverage to be complete. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
blawesom commented 2026-10-19 07:24:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T07:24:45Z.


Rebase handoff, with one test-fixture extension — rebased onto current main (all three commits, authorship unchanged). The conflict in the recompiler CMakeLists kept main's dedup machinery plus your HostThread.hpp key source — and the shader_cache_runtime_sources test fixture needed the matching HostThread.hpp stub added (it only created HostThreadLocal.hpp, so the new key source made its configure step fail). Both included.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds; conventions pass; the shader-cache runtime-sources test passes; full suite green apart from the four known main regressions (agc_driver_tessellation — Mesa #5444; agc_driver_bda_device — #7584; agc_driver_image_table_vouched_lookups — #7766; agc_driver_guest_memory_lifetime — #7784, which I bisected today to 16473dbbe in the #6499 family), none from this PR.

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/7622
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 398b2576c.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6261962619 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6261962619). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-19T07:24:45Z. --- **Rebase handoff, with one test-fixture extension** — rebased onto current `main` (all three commits, authorship unchanged). The conflict in the recompiler CMakeLists kept `main`'s dedup machinery plus your `HostThread.hpp` key source — and the `shader_cache_runtime_sources` test fixture needed the matching `HostThread.hpp` stub added (it only created `HostThreadLocal.hpp`, so the new key source made its configure step fail). Both included. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): builds; conventions pass; the shader-cache runtime-sources test passes; **full suite green apart from the four known `main` regressions** (`agc_driver_tessellation` — Mesa #5444; `agc_driver_bda_device` — #7584; `agc_driver_image_table_vouched_lookups` — #7766; `agc_driver_guest_memory_lifetime` — #7784, which I bisected today to `16473dbbe` in the #6499 family), none from this PR. **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/7622 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `398b2576c`.
oneandonlydean commented 2026-10-19 07:47:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-19T07:47:58Z.


@blawesom thanks for carrying this across the conflict. The CMake resolution is the right one: it keeps main's compiled-sources dedup and appends HostThread.hpp to shaderCacheKeySources, which ShaderCacheVersion.cmake still requires because ShaderDiskCache.cpp includes it. The first two commits come through unchanged.

One thing is missing from the pushed branch: rebase/7622 at 398b2576c doesn't contain the shader_cache_runtime_sources fixture stub. The last commit only touches the two CMakeLists files, and tools/tests/test_shader_cache_runtime_sources.py still only writes HostThreadLocal.hpp. On 398b2576c that test fails at the fixture configure ("Shader disk cache key source does not exist", 11 failures). With this line added after the HostThreadLocal.hpp write, it passes:

        (header.parent / 'HostThread.hpp').write_text('struct FixtureThread {};\n', encoding='utf-8')

My guess is that it's still uncommitted on your side. Could you push it to rebase/7622?

@MarcZX10 the --ff-only pickup won't work because this is a real rebase: 398b2576c doesn't contain your current head 7aec3f58f. Once the stub is on blawesom's branch, adopting it would be:

git fetch https://github.com/blawesom/AnyPS5 rebase/7622
git checkout codex/host-worker-mxcsr
git reset --hard FETCH_HEAD
git push --force-with-lease

If you'd rather not force-push, merging main into your branch works too: it's the same single conflict in core/shader/recompiler/CMakeLists.txt, resolved the same way, plus the fixture line above. Either way, we'll run full CI on the new head before it goes on.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6262327190 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6262327190). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-19T07:47:58Z. --- @blawesom thanks for carrying this across the conflict. The CMake resolution is the right one: it keeps main's compiled-sources dedup and appends `HostThread.hpp` to `shaderCacheKeySources`, which `ShaderCacheVersion.cmake` still requires because `ShaderDiskCache.cpp` includes it. The first two commits come through unchanged. One thing is missing from the pushed branch: `rebase/7622` at `398b2576c` doesn't contain the `shader_cache_runtime_sources` fixture stub. The last commit only touches the two CMakeLists files, and `tools/tests/test_shader_cache_runtime_sources.py` still only writes `HostThreadLocal.hpp`. On `398b2576c` that test fails at the fixture configure ("Shader disk cache key source does not exist", 11 failures). With this line added after the `HostThreadLocal.hpp` write, it passes: ```python (header.parent / 'HostThread.hpp').write_text('struct FixtureThread {};\n', encoding='utf-8') ``` My guess is that it's still uncommitted on your side. Could you push it to `rebase/7622`? @MarcZX10 the `--ff-only` pickup won't work because this is a real rebase: `398b2576c` doesn't contain your current head `7aec3f58f`. Once the stub is on blawesom's branch, adopting it would be: ``` git fetch https://github.com/blawesom/AnyPS5 rebase/7622 git checkout codex/host-worker-mxcsr git reset --hard FETCH_HEAD git push --force-with-lease ``` If you'd rather not force-push, merging `main` into your branch works too: it's the same single conflict in `core/shader/recompiler/CMakeLists.txt`, resolved the same way, plus the fixture line above. Either way, we'll run full CI on the new head before it goes on.
MarcZX10 commented 2026-10-19 16:00:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T16:00:02Z.


Thanks for catching this fixture omission. I verified the current PR head 597498066e15a50d38a94f827e61eb8c15cc1834 includes the HostThread.hpp fixture stub (FixtureHostThread) in tools/tests/test_shader_cache_runtime_sources.py. The current-head workflow checks are all successful, including the relinker matrix; Linux/Windows full Build jobs are skipped by the workflow. The fixture fix is present in the latest commit.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6271490659 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6271490659). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-19T16:00:02Z. --- Thanks for catching this fixture omission. I verified the current PR head `597498066e15a50d38a94f827e61eb8c15cc1834` includes the `HostThread.hpp` fixture stub (`FixtureHostThread`) in `tools/tests/test_shader_cache_runtime_sources.py`. The current-head workflow checks are all successful, including the relinker matrix; Linux/Windows full Build jobs are skipped by the workflow. The fixture fix is present in the latest commit.
MarcZX10 commented 2026-10-20 10:07:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T10:07:15Z.


Thanks for spotting the remaining direct std::jthread launch in RefreshPool. I now start those mirror-refresh helpers with Libc::StartHostJThread, preserving the stop-token callback and CPU pinning while setting the host MXCSR first. The workers currently only compare/copy bytes, but this makes the worker initialization invariant complete.\n\nI also merged current main, retaining its screenshot-aware frame-dump behavior while keeping Libc::StartHostThread. Validation on the updated tree: GuestBufferMemory.cpp and VulkanDevice.cpp compile with the existing GCC 12 Release flags; HostThreadMxcsr was freshly compiled and passed; conventions and git diff --check pass. Full platform CI is running for the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6288506066 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6288506066). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T10:07:15Z. --- Thanks for spotting the remaining direct `std::jthread` launch in `RefreshPool`. I now start those mirror-refresh helpers with `Libc::StartHostJThread`, preserving the stop-token callback and CPU pinning while setting the host MXCSR first. The workers currently only compare/copy bytes, but this makes the worker initialization invariant complete.\n\nI also merged current `main`, retaining its screenshot-aware frame-dump behavior while keeping `Libc::StartHostThread`. Validation on the updated tree: `GuestBufferMemory.cpp` and `VulkanDevice.cpp` compile with the existing GCC 12 Release flags; `HostThreadMxcsr` was freshly compiled and passed; conventions and `git diff --check` pass. Full platform CI is running for the updated head.
screamm commented 2026-10-20 14:05:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-20T14:05:00Z.


Windows check of 50c1efcf5, stacked with #7594 (9ebc10733) on main 1d4164552 (clean merge; also merges cleanly onto d50ec76da).

Windows 11 Pro 26220, NVIDIA GeForce RTX 4070 (driver 596.21), Ryzen 7 5700X, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON. Built the named test targets, relinker and libs (not the full all target). The libc link of host_thread_mxcsr_tests and the shader-cache key check both pass now.

Tests

  • host_thread_mxcsr, host_thread_local, guest_pthread_start and guest_pthread_frame_chain: 3/3 each.
  • shader_cache_runtime_sources, run directly: Ran 9 tests in 211.373s OK. Through ctest it hits its 180 s limit on my loaded host, and under load the fixture's 15 s cmake configure also times out.

Negative control: the test does not detect the regression on Windows. I made SetHostMxcsr() a no-op in the tree, so the helpers behave like a plain std::thread, and rebuilt host_thread_mxcsr_tests: it still passes 3/3. A small probe shows why. With the caller at 0x9fc0, a new std::thread and a new CreateThread thread both start at 0x1f80, because Windows does not inherit MXCSR into new threads. So on Windows this PR changes no worker's MXCSR, and the test only guards Linux. That fits the PR description, but a reviewer reading the Windows CI result should know the test passes there either way.

In running titles, I read CONTEXT.MxCsr from every thread at 15 s and 40 s. With both PRs, the only FTZ/DAZ thread in Showcase (PPSA99005, 1 of 53) and Ping Pong (PPSA28319, 1 of 107) is the guest main thread (0x9fe1). Every host worker reads 0x1f80 plus sticky flags, the same as on main. Four titles ran 60 s each, main vs PR: no new stop line, and no FAIL:, FATAL: or what(). RetroArch PPSA99169 ran 6 interleaved runs per side; details are in my #7594 comment.

Two host workers are still unwrapped. They landed on main after this PR was written: PerformanceTrace.hpp:347 (worker = std::thread([this] { run(); });) and libSceVideoOut/src/Telemetry.cpp:92 (thread = std::jthread(...)). Both are diagnostic-only and matter only on Linux, but they are the same pattern.

check_conventions.py --base origin/main passes and git diff --check is clean.

Not checked: Linux (where the change has an effect), macOS, the full test suite and GPU tests.

Written with Claude Code assistance (validation by a subagent, reviewed in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6292737836 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6292737836). Originally posted by [screamm](https://github.com/screamm) on 2026-10-20T14:05:00Z. --- Windows check of `50c1efcf5`, stacked with #7594 (`9ebc10733`) on `main` `1d4164552` (clean merge; also merges cleanly onto `d50ec76da`). Windows 11 Pro 26220, NVIDIA GeForce RTX 4070 (driver 596.21), Ryzen 7 5700X, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`. Built the named test targets, `relinker` and `libs` (not the full `all` target). The `libc` link of `host_thread_mxcsr_tests` and the shader-cache key check both pass now. **Tests** - `host_thread_mxcsr`, `host_thread_local`, `guest_pthread_start` and `guest_pthread_frame_chain`: 3/3 each. - `shader_cache_runtime_sources`, run directly: `Ran 9 tests in 211.373s OK`. Through ctest it hits its 180 s limit on my loaded host, and under load the fixture's 15 s `cmake` configure also times out. **Negative control: the test does not detect the regression on Windows.** I made `SetHostMxcsr()` a no-op in the tree, so the helpers behave like a plain `std::thread`, and rebuilt `host_thread_mxcsr_tests`: it still passes 3/3. A small probe shows why. With the caller at `0x9fc0`, a new `std::thread` and a new `CreateThread` thread both start at `0x1f80`, because Windows does not inherit MXCSR into new threads. So on Windows this PR changes no worker's MXCSR, and the test only guards Linux. That fits the PR description, but a reviewer reading the Windows CI result should know the test passes there either way. **In running titles**, I read `CONTEXT.MxCsr` from every thread at 15 s and 40 s. With both PRs, the only FTZ/DAZ thread in Showcase (PPSA99005, 1 of 53) and Ping Pong (PPSA28319, 1 of 107) is the guest main thread (`0x9fe1`). Every host worker reads `0x1f80` plus sticky flags, the same as on `main`. Four titles ran 60 s each, main vs PR: no new stop line, and no `FAIL:`, `FATAL:` or `what()`. RetroArch PPSA99169 ran 6 interleaved runs per side; details are in my #7594 comment. **Two host workers are still unwrapped.** They landed on `main` after this PR was written: `PerformanceTrace.hpp:347` (`worker = std::thread([this] { run(); });`) and `libSceVideoOut/src/Telemetry.cpp:92` (`thread = std::jthread(...)`). Both are diagnostic-only and matter only on Linux, but they are the same pattern. `check_conventions.py --base origin/main` passes and `git diff --check` is clean. Not checked: Linux (where the change has an effect), macOS, the full test suite and GPU tests. Written with Claude Code assistance (validation by a subagent, reviewed in this session).
DavidAmsellem commented 2026-10-20 16:59:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-20T16:59:17Z.


First AMD-on-Linux (RADV) run of this PR. Head 50c1efcf5 merged onto main 6bef96df7 (clean merge), built in full and compared with the same main, on the same machine.

AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.

Full suite (ANYPS5_REQUIRE_VULKAN=1 ctest -j8) at 1736a3788: 1713/1714 with this PR, against 1712/1713 on main. The one failure is the same on both, so this PR adds none: agc_driver_guest_memory_lifetime (#7784).

Comparing the JUnit output with main: the PR's new entry, host_thread_mxcsr, runs and passes. No other entry is added, and none is skipped or removed. I also ran host_thread_mxcsr on its own with the Khronos validation layer: it passes and reports no VUID.

GPUs tested: n/a (runtime change; suite run on the machine above)

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6296423428 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6296423428). Originally posted by [DavidAmsellem](https://github.com/DavidAmsellem) on 2026-10-20T16:59:17Z. --- First AMD-on-Linux (RADV) run of this PR. Head `50c1efcf5` merged onto `main` `6bef96df7` (clean merge), built in full and compared with the same `main`, on the same machine. AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release. Full suite (`ANYPS5_REQUIRE_VULKAN=1 ctest -j8`) at `1736a3788`: **1713/1714 with this PR**, against 1712/1713 on `main`. The one failure is the same on both, so this PR adds none: `agc_driver_guest_memory_lifetime` (#7784). Comparing the JUnit output with `main`: the PR's new entry, `host_thread_mxcsr`, runs and passes. No other entry is added, and none is skipped or removed. I also ran `host_thread_mxcsr` on its own with the Khronos validation layer: it passes and reports no VUID. GPUs tested: n/a (runtime change; suite run on the machine above) AI-assisted: yes
MarcZX10 commented 2026-10-20 21:48:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T21:48:06Z.


Thanks for the full RADV suite comparison. The PR adds the host_thread_mxcsr entry and passes it with no validation-layer VUID; the one full-suite failure is also present on main, so your run shows no additional failure from this change on that setup.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6302361268 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6302361268). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T21:48:06Z. --- Thanks for the full RADV suite comparison. The PR adds the `host_thread_mxcsr` entry and passes it with no validation-layer VUID; the one full-suite failure is also present on main, so your run shows no additional failure from this change on that setup.
oneandonlydean commented 2026-10-21 08:59:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T08:59:01Z.


@MarcZX10 thanks, StartHostThread / StartHostJThread cover the driver workers we were worried about, and HostThreadMxcsr pins the reset. We're testing this together with #7565, #7594 and #7532 on one tree. Four host threads on that tree still start with a plain std::thread / std::jthread, so on Linux they inherit the creator's MXCSR:

  • core/libs/prx/libc/src/Process.cpp (the exit drain thread)
  • core/libs/prx/libSceVideoOut/src/Telemetry.cpp (the writer jthread)
  • core/libs/prx/libSceAgcDriver/Execution/include/PerformanceTrace.hpp (TraceBenchWriter)
  • core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp (the GPU progress watcher)

None of them does much floating-point work, but switching them to the wrappers would make "every host worker starts at 0x1f80" true without exceptions. Could you include them here?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6312113713 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#issuecomment-6312113713). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T08:59:01Z. --- @MarcZX10 thanks, `StartHostThread` / `StartHostJThread` cover the driver workers we were worried about, and `HostThreadMxcsr` pins the reset. We're testing this together with #7565, #7594 and #7532 on one tree. Four host threads on that tree still start with a plain `std::thread` / `std::jthread`, so on Linux they inherit the creator's MXCSR: - `core/libs/prx/libc/src/Process.cpp` (the exit drain thread) - `core/libs/prx/libSceVideoOut/src/Telemetry.cpp` (the writer `jthread`) - `core/libs/prx/libSceAgcDriver/Execution/include/PerformanceTrace.hpp` (`TraceBenchWriter`) - `core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp` (the GPU progress watcher) None of them does much floating-point work, but switching them to the wrappers would make "every host worker starts at 0x1f80" true without exceptions. Could you include them here?
MarcZX10 commented 2026-11-02 04:57:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:57:01Z.

Review: COMMENTED


Replies checked — two re-added lines confirmed, library-portability fails on wasm64

The head re-adds two lines that main removed from FrameDumpWriter::Enqueue, and the hosted library-portability job fails to compile HostThread.hpp under the wasm64 build.

What I ran

  • Live head b2a3a59a2370b899b3fda719d211bfba6723ef64 (OPEN, unchanged from batch).
  • gh api comments and reviews on #7622, newer than 2026-10-30T01:32:26Z, excluding MarcZX10 and bots.
  • gh pr view 7622 --json statusCheckRollup; gh api repos/boykopovar/AnyPS5/actions/jobs/124716526222/logs (saved and grepped).
  • git show b2a3a59a:core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp and .../libc/include/HostThread.hpp; the same file on upstream/main.
  • git merge-tree --write-tree upstream/main b2a3a59a (exit 0).
  • Nothing built or run.

Results

Check Result Note
Live head matches batch OPEN
merge-tree vs upstream/main exit 0 820 behind, 5 ahead
library-portability (hosted) FAILURE wasm64 build, first error at HostThread.hpp:15
Hosted windows, relinker, relinker-asan, conventions, register-context SUCCESS linux SKIPPED
NVIDIA run 2026-11-01 05:42 UTC (third-party) passed 0 new failures

Findings

  • @oneandonlydean (2026-11-01 09:47 UTC): the two lines require(pixels.size() <= maxBytes - queuedBytes, ...) and if (!frameDumpOutput.Enabled_nid_no_patch()) return; are present after the wait at VulkanDevice.cpp L263-L264. Main has neither there. Confirmed. With L264 in place, a screenshot is dropped when frame-dump output is off, because L259 exempts screenshots and L264 does not. Answer needed: remove both lines, so the hunk only changes std::thread to Libc::StartHostThread.
  • Hosted library-portability: the job fails compiling FileEvent.cpp, which includes HostThread.hpp, with use of undeclared identifier '_mm_setcsr' at L15 (SetHostMxcsr, L14-L16). The wasm64 target has no SSE intrinsics. Answer needed: guard SetHostMxcsr for x86 only, or make the header x86-only.
  • The NVIDIA run is third-party and was not re-run here.

Sources

Not verified

  • The reviewer's screenshot behaviour (not run).
  • Whether the wasm64 build is fixed by either option above (not built).
  • The NVIDIA run details.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5732246887 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7622#pullrequestreview-5732246887). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T04:57:01Z. **Review:** COMMENTED --- # Replies checked — two re-added lines confirmed, library-portability fails on wasm64 The head re-adds two lines that main removed from `FrameDumpWriter::Enqueue`, and the hosted library-portability job fails to compile `HostThread.hpp` under the wasm64 build. ## What I ran - Live head `b2a3a59a2370b899b3fda719d211bfba6723ef64` (OPEN, unchanged from batch). - `gh api` comments and reviews on #7622, newer than 2026-10-30T01:32:26Z, excluding MarcZX10 and bots. - `gh pr view 7622 --json statusCheckRollup`; `gh api repos/boykopovar/AnyPS5/actions/jobs/124716526222/logs` (saved and grepped). - `git show b2a3a59a:core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` and `.../libc/include/HostThread.hpp`; the same file on upstream/main. - `git merge-tree --write-tree upstream/main b2a3a59a` (exit 0). - Nothing built or run. ## Results | Check | Result | Note | |---|---|---| | Live head | matches batch | OPEN | | `merge-tree` vs upstream/main | exit 0 | 820 behind, 5 ahead | | `library-portability` (hosted) | FAILURE | wasm64 build, first error at `HostThread.hpp:15` | | Hosted windows, relinker, relinker-asan, conventions, register-context | SUCCESS | `linux` SKIPPED | | NVIDIA run 2026-11-01 05:42 UTC (third-party) | passed | 0 new failures | ## Findings - @oneandonlydean (2026-11-01 09:47 UTC): the two lines `require(pixels.size() <= maxBytes - queuedBytes, ...)` and `if (!frameDumpOutput.Enabled_nid_no_patch()) return;` are present after the wait at `VulkanDevice.cpp` L263-L264. Main has neither there. Confirmed. With L264 in place, a screenshot is dropped when frame-dump output is off, because L259 exempts screenshots and L264 does not. Answer needed: remove both lines, so the hunk only changes `std::thread` to `Libc::StartHostThread`. - Hosted `library-portability`: the job fails compiling `FileEvent.cpp`, which includes `HostThread.hpp`, with `use of undeclared identifier '_mm_setcsr'` at L15 (`SetHostMxcsr`, L14-L16). The wasm64 target has no SSE intrinsics. Answer needed: guard `SetHostMxcsr` for x86 only, or make the header x86-only. - The NVIDIA run is third-party and was not re-run here. ## Sources - https://github.com/boykopovar/AnyPS5/blob/b2a3a59a2370b899b3fda719d211bfba6723ef64/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp#L259-L264 - https://github.com/boykopovar/AnyPS5/blob/b2a3a59a2370b899b3fda719d211bfba6723ef64/core/libs/prx/libc/include/HostThread.hpp#L14-L16 ## Not verified - The reviewer's screenshot behaviour (not run). - Whether the wasm64 build is fixed by either option above (not built). - The NVIDIA run details.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!7622
No description provided.