test(libc): run cpu_topology on Windows #9584
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9584"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T03:15:58Z.
What
cpu_topologywas registered only on Linux (libc/CMakeLists.txt:912).CpuTopology::GetandPinalso have Windows paths, which no test ran:GetProcessAffinityMask,LayoutFromClassesoverGetLogicalProcessorInformationExefficiency classes, andSetThreadAffinityMask.How:
libc/CMakeLists.txt: the guard becomesLinux OR WIN32. macOS stays excluded becauseGet/Pinhave no macOS path. The libc link,configure_windows_unwindand thePATHprepend apply on WIN32 only, so the Linux build is unchanged.CpuTopology.cpp: the sysfsMaskFromCpuListchecks move under#ifdef __linux__, since that function is Linux-only. On Windows the pinned mask is read back withSetThreadAffinityMask, which returns the mask it replaces. Pinning by thread handle is also checked, because the WindowsPinhonours handles. The Linux checks are unchanged.Tested
ctest -R ^cpu_topology$passes.GetProcessAffinityMaskinGet()disabled, the test fails with "process affinity read". Restored, it passes.tools/check_conventions.pypasses.Overlap (
tools/pr_overlap.py --branchplusgit merge-tree):tests/process/CpuTopology.cpp.git merge-treefollows the rename and reports no conflict there, and the libc CMakeLists conflict-hunk count against #6044 is unchanged (17).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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T03:45:23Z.
Review: CHANGES_REQUESTED
The Windows assertions exercise process-mask filtering, current-thread pinning and the thread-handle path; the implementation changes shown in the PR leave the Linux assertions under their original platform guard. The latest conventions check passes, superseding the earlier template-check failure. Hosted relinker, register-context and write-watch checks pass; product build jobs are skipped. The Windows test result is author-reported; I did not run it locally.
The unresolved manual overlap with #6044 is specifically the moved
CpuTopology.cpp, not just the shared CMake insertion. #6044 renames the Linux test tocore/libs/tests/process/CpuTopology.cppwithout changing its contents; this PR adds the Windows branch to the original path. Please coordinate with #6044's author so the Windows additions follow the file to its renamed path if #6044 lands first, and record the agreed order/dependency if one must land first. The PR's statement that merge-tree followed the rename should be reconciled with the overlap bot's explicit inability to compare the test path.Please also update the test path/registration if the reorganization lands first; keeping the new Windows-only coverage on the unregistered old filename would drop it from CI.
Imported from boykopovar/AnyPS5. Originally posted by fogydes on 2026-10-22T08:13:10Z.
The Conventions check fails on the head of this PR (job 119621777041:
Fill in the pull request template: section 'What' is missing or empty, and the same forTestedandChecklist).Everything else in the matrix is green (relinker on all three OSes, relinker-asan, register-context, write-watch), and
python3 tools/check_conventions.py --base origin/mainprints the same three template findings locally. Filling in every line of.github/pull_request_template.md(What, Tested, Depends on, Unblocks, GPUs tested, AI-assisted, and tick the boxes) is all that appears to block CI.Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T09:20:37Z.
@fogydes thanks. That was the first head; the template was filled in and the Conventions job on the current head passes. For #6044 I've proposed the order on that PR (the Windows additions follow
CpuTopology.cpptotests/process/if #6044 lands first) and am waiting for its author.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T10:22:24Z.
Review: CHANGES_REQUESTED
The test changes keep Linux behavior under the Linux guards and add Windows checks for process affinity, class layout, current-thread pinning and handle-based pinning. I also compiled the exact
core/libs/tests/CpuTopology.cppwith GCC 12.2 (-std=c++20 -Wall -Wextra -Werror) and ran it standalone on Linux; it passed. This checks the shared/Linux path, not the new Windows-only assertions. The Windows 11 run and negative control in the PR description remain author-reported. One repository gate remains: 1. #6044 coordination: thank you for proposing on #6044 that the Windows cases followCpuTopology.cpptotests/process/if its rename lands first. I do not see an agreement from that PR's author yet. Please wait for agreement and record the agreed merge order in the checklist (Depends onif this PR must wait), then carry the Windows cases and registration to the renamed path as needed. The overlap workflow cannot compare the shared files while #6044 conflicts withmain. This head is 107 commits behind currentupstream/main; please update it after the #6044 order is settled and rerun the checks. Checks on exact head46c665015223ad582a26e90768b2c0f9dfd7b0e0: -git diff --check upstream/main...HEAD: passed. -python tools/check_conventions.py --base upstream/main --head HEAD: passed. - Standalone Linux test-source compile/run: passed (GCC 12.2; this does not test the Windows branch). - Hosted eligibility, conventions, labels, report, relinker matrix, ASan, register-context and write-watch checks pass; Linux/Windows product jobs are skipped. I am requesting changes for unresolved overlap agreement and base freshness only, not a queue-based intake hold or a defect in the added test logic. It is fine to keep submitting PRs; maintainers will handle them in due course.I’ve noticed that holding this PR because of #5239 isn’t necessary. It’s fine for PRs to keep coming in; they’ll be handled in due course. Please disregard my earlier request to hold or defer it.
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-22T13:17:36Z.
Independent Windows run, as data only. Machine: Windows 11 Enterprise 10.0.22621, AMD Ryzen 9 5950X (16 cores, 32 logical processors), WinLibs GCC 15.2.0 UCRT r7, Release. Head
46c6650152was merged with #9583 ontomain8b3a6ba88d.cpu_topologypasses in 10 of 10 runs. (guest_fopen_errorsfrom #9583 is a separate issue, reported there.)AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-25T04:16:18Z.
Review: APPROVED
Reviewed
46c665015223ad582a26e90768b2c0f9dfd7b0e0against6ef5a1c4c92272598b18adeb9b5414112f8d15ed. No actionable findings in this focused review.Source review: Inspected the complete registration/test change and CpuTopology's header-only implementation. Linux list parsing stays Linux-only. Windows checks compare SetThreadAffinityMask's previous-mask return value after Pin, reject masks outside the process and verify handle-based pinning. The CMake branch adds the Windows runtime/unwind setup and PATH consistently with neighboring native tests.
Validation: Windows / MinGW GCC 15.2: built the exact head CpuTopology.cpp against its pinned headers and ran it successfully (exit 0). Its runtime changes are confined to that test child. Baseline Windows compilation fails at the former unconditional Linux affinity APIs, demonstrating the portability change. Conventions, whitespace and script registration passed. Current hosted relinker/ASan and metadata checks succeeded; product Windows/Linux jobs were skipped.
Scope: Actual header-only CPU topology test on this Windows host; the full libc-linked CMake target and Linux runtime were not rebuilt/run locally. No game or GPU test.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T07:08:40Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the Windows test setup and affinity assertions are consistent with the implementation inspected.
What I ran
Reviewed head
bdcb263095b74c4403680707ebe0a3245a89a426. Readreview/description.md,review/commits.md,review/manifest.json,review/diff.patch, and both changed files in full, plus the relevantCpuTopology.hppimplementation. The repository reader was used for targeted reads. No build or test commands were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The author reports Windows 11, WinLibs GCC 15.2.0 CTest and convention checks passed, including a negative control; these were not independently run. No programmatic checks were run during this review.
review/files.jsonwas not provided as a review document; the file listing confirms both manifest-listed changed files were included and read.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T11:53:46Z.
Review: COMMENTED
The exact
CpuTopologyfixture passed on Linux. I also compiled its Windows code path with MinGW and ran it under Wine, where the affinity and handle checks passed. The Windows check used a standalone executable, with the CMake linkage and native Windows left to CI.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.