Repository navigation
test(relinker): execute the moved scalar compare - #9184
Conversation
|
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.
|
jotitadev
left a comment
There was a problem hiding this comment.
Independent run on Apple silicon under Rosetta 2, not covered in the thread yet.
Apple M2 Max, macOS 27.2 (26B5091g), Apple clang, CMake 4.4.4, Ninja, relinker-only Release build. Head cdd79f9c6 merged onto current main 0c6a5bd59 (clean). Built arm64 and x86-64 (-DCMAKE_OSX_ARCHITECTURES=x86_64 -DPython3_EXECUTABLE=/usr/bin/python3, Python 3.9.6).
- x86-64 under Rosetta:
amd64_only_converterpasses.scalarCompareExecutionruns the converted CMPSS trampoline as real code and gets the expected mask for both cases (309 vs 309 -> 0, 309 vs 310 -> 0xFFFFFFFF), with the upper three lanes of the destination preserved. - arm64: compiles (the execution is an
__x86_64__-only no-op) andamd64_only_converterpasses. - Pure test addition, so it also passes on
main; the value here is the Rosetta execution on an Apple host.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
There was a problem hiding this comment.
This is a focused test-only follow-up to the already-merged #5683 fix. The new test executes the generated trampoline for both outcomes and verifies the upper XMM lanes remain unchanged. The PR reports successful Linux, Windows, macOS native and macOS x86-64-under-Rosetta CI; the hosted Rosetta run is the key platform-specific check, and an independent M2 Max reviewer also confirmed it. I could not run Rosetta locally in this Linux environment. I manually inspected the shared-file overlap warnings: #7918 adds XSAVEOPT cases in separate test functions/registration points, and #8042 adds scanner-resynchronization cases. Neither duplicates or edits this PR's scalar-compare test. Their branches currently conflict with main, so refresh the generated overlap report after the required base update. The branch is 633 commits behind current upstream main (1 ahead); CONTRIBUTING requires keeping PR branches current. Please rebase/update, rerun the relinker checks, and regenerate the overlap report against current main. The hosted conventions, eligibility, intake, labels, Linux/Windows/macOS relinker and ASan checks all pass. The merge-tree is clean, and my local current-main convention/diff checks pass. I found no correctness problem in the test itself; I’m requesting changes for the stale base and overlap validation.
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.
|
I’ve noticed that my earlier request to hold this PR based on #5239 was unnecessary. It’s fine to keep submitting PRs; maintainers will handle them in due course. Please disregard that request. |
The stub that moves a hazard scalar compare out of line is checked through its bytes but never run, so nothing confirms that the compare still produces the mask it would inline. The x86-64 execution section now calls the stub for both outcomes of a CMPSS with an unsafe predicate and checks the destination's lanes.
cdd79f9 to
65a98e7
Compare
Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.
|
Checked the CMPSS NLT expectations (309 vs 309 -> all ones, 309 vs 310 -> 0, upper lanes untouched) on the head rebased onto |
What
--to-rosettamoves a hazard scalar compare out of line, because of the Rosetta 2 bug in #5642 where a later scalar read sees the compare mask instead of a 128-bit load that followed it. The stub is checked through its bytes, but it is never executed, so nothing confirms that the compare still produces the mask it would produce inline once it sits in a stub.The execution section now calls the stub for
cmpss $5, %xmm1, %xmm0(NLT, one of the predicates the split covers) with both outcomes, 309 against 309 and 309 against 310, and checks the destination's low lane and that the upper three lanes are untouched.Tested
Apple M5, macOS 26.4, AppleClang 21.0.0, relinker-only build of current
main.-DCMAKE_OSX_ARCHITECTURES=x86_64, executed under Rosetta: 229/229.python3 tools/check_conventions.py --base origin/mainpasses.One thing I could not establish: I wrote the #5642 repro as a small C program with inline asm and it printed the loaded value on this host, so the hazard did not show. That is not evidence the bug is gone — the shape depends on what lands in one translated block, and a hand-written repro may simply not reproduce it — so I am not drawing a conclusion from it. This test checks the stub's result, not the hazard.
No Linux or Windows host was available; the section also builds there.
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: n/a, test-only change.mdfiles or images added to the repository