Repository navigation
Conversation
f4518bc to
f2a3f97
Compare
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
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.
|
|
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. |
|
Thanks for the jthread coverage, that part looks right. Full CI on f2a3f97 fails to build on Linux and Windows at the shader disk cache key check: Could you add Two small optional extras while you're there: the |
|
Windows build of
I didn't get further, so the MXCSR test itself has not run on Windows. AI-assisted |
|
@MarcZX100 I followed up on both Windows failures. With the two changes below on
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,
AI-assisted |
|
Pushed
The changes match the focused patch reported by LeandroLP23. Their independent Windows 11 26300 / Radeon 860M / WinLibs GCC 15.2.0 Release run reports Local |
|
The updated head |
jotitadev
left a comment
There was a problem hiding this comment.
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 fromStartHostThreadandStartHostJThread: also passes 5/5. - Control: with the helper setting
0x9fc0instead of0x1f80, 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
left a comment
There was a problem hiding this comment.
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_mxcsrandhost_thread_localpass 20/20 with--repeat until-fail:20. The 28 tests matchinghost_thread|pthread|mxcsrpass.- Non-GPU suite (
ctest -E "^agc|gpu|vulkan|video_out" -j7): 745/746. The new test brings the count to 746, andmainis 745/745. The one failure waspr_overlap_tools. That test only exercisestools/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_FILESpointing only atlvp_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 asmain. - Mutation: with
SetHostMxcsr()emptied,host_thread_mxcsrfails 3/3 witha host worker inherited guest MXCSR. So on Linux a plainstd::threadstarted 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,3rdpartyand the relinker) for workers that are still started directly. There is one:RefreshPoolinlibSceAgcDriver/Graphics/src/GuestBufferMemory.cpp(threads.emplace_back([this](std::stop_token token) { ... }), the mirror refresh helpers,std::vector<std::jthread>). It is created lazily byRefreshPool::Get(), so it inherits whatever MXCSR the first caller has. Its helpers onlymemcmp/memcpyblocks, 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.
|
Rebase handoff, with one test-fixture extension — rebased onto current Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, To pick it up: Head is |
|
@blawesom thanks for carrying this across the conflict. The CMake resolution is the right one: it keeps main's compiled-sources dedup and appends One thing is missing from the pushed branch: (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 @MarcZX10 the If you'd rather not force-push, merging |
7aec3f5 to
70e3144
Compare
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
Checklist