Repository navigation
Conversation
9386d7a to
7bac921
Compare
|
Please keep the native 16-byte output contract and establish this profile's MXCSR at entry: exceptions masked, nearest-even rounding, DAZ and FTZ off (control bits matching |
7bac921 to
74c2023
Compare
|
Updated and rebased onto
|
74c2023 to
ff84027
Compare
MarlomMedeiros
left a comment
There was a problem hiding this comment.
Independent run on AMD Ryzen 7 5800X3D, Windows 11 build 26300.10075, MSVC 14.52.37025, SDK 10.0.26100.0, on ff84027:
ctest --preset dev --no-tests=error -R '^cpu_aot_sse_float_arith$' -V
# 504 baseline 128-bit SSE packed single-precision arithmetic cases matched native and translated DLLs — Passed
Second AMD datapoint (author used a 7600): both confirm the destination-NaN-wins selection, which also matches the architected rule in SDM Vol.1 Table 4-7 for non-MIN/MAX SSE arithmetic, so the pinned a | quiet order is the right model, and if silicon ever deviated the differential would fail loudly as designed.
Semantic review of sse_arith_f32: every branch checks out. x != x correctly isolates NaN inputs before the generated-NaN override, a|quiet/b|quiet quiet sNaNs preserving sign+payload, subps does not negate a source NaN, and 0xffc00000 is exactly the SP QNaN indefinite hardware produces for masked invalid ops. Denormals run on host SSE under the same forced MXCSR as native, DAZ/FTZ off. The VEX/EVEX/memory rejection paths behave as the test asserts (distinct iced mnemonics fall to the generic reject; addps xmm,[mem] raises the expected diagnostic). divps_self_op being absent looks deliberate (x/x is uninformative) but is worth noting below.
Three findings, none blocking:
-
The lifted-side
_mm_setcsris unverifiable by this test.tools/ffx_version_query.pyemits_mm_setcsr(...)at function entry, butcheck()sets the same MXCSR on the thread before every round vialifted.set_mxcsr, so deleting the emitted line would still pass the whole suite. If "establishing the profile's MXCSR at entry" is a claimed guarantee, consider a case that pre-sets a non-profile MXCSR (e.g. FTZ on) immediately before a lifted call and reads it back after, which would exercise the emitted line directly. -
_mm_setcsrmutates the caller thread's FP environment permanently (clears DAZ/FTZ, forces round-nearest, preserves sticky bits) with no restore. Native leaves it alone. For this fixture that's masked by the test's own set/restore, butlower()is also used bygenerate()for real images, so a lifted function containing these ops silently reprograms host FP state for the remainder of its run. Probably intended (the guest profile is the contract) but worth an explicit sentence in the docs. -
Coverage asymmetries:
divps_self_opis missing (the one self-op that exercises 0/0 and inf/inf invalid paths), every export writesxmm0sowide1/wide2destination paths are emitted but never executed, and only 16 output bytes are observable, so upper-wideNcorruption would be invisible. Alsox != xdepends on/fp:precise(fine under the presets today, would break under/fp:fast).
Integration note: the base (2f1f832) predates sse2_shift_pack_ops, fma_packed, and avx2_perm_ops in the same has_wide chain, plus new lowering arms and the CMakeLists.txt/experiments.md anchors this PR touches, so a rebase will conflict in all three files; resolutions look mechanical. It also lands adjacent to #602's sse34_fp_ops in the same regions, so whichever merges second will need the same trivial union.
AI-assisted: yes. All reported checks ran locally on the hardware listed.
ff84027 to
a0b3769
Compare
|
Thanks @MarlomMedeiros for the detailed independent review, hardware verification, and helpful findings! I have addressed all the feedback and rebased the branch onto current
|
a0b3769 to
c3e7568
Compare
|
Closing this PR as the lowering for ADDPS, SUBPS, MULPS, and DIVPS (along with the broader packed float instruction set) has been addressed and merged in #725. Thank you @R0Y00 and @MarlomMedeiros for the detailed reviews, guidance, and hardware verification! |
Change
This change lowers the baseline 128-bit legacy SSE packed single-precision floating-point arithmetic instructions (
addps,subps,mulps,divps) intools/ffx_version_query.py. It maps each operation across all four 32-bit float lanes while preserving the upper 128 bits of the destination YMM register.This advances x64 Zen 2 instruction-form coverage by adding 4 previously uncovered forms to the
SSEgroup indocs/coverage/dashboard.svg.Verification
Tested on Windows 11 x64 with an AMD Ryzen 7 7800X3D (Zen 4) CPU and MSVC 19.44 / CMake 3.31 at commit
9386d7a.Result: Succeeded without diagnostics.
Result:
Result: All passed (
Checked 10 Markdown files and 119 links. Self-test passed.).Evidence and follow-up
tests/cpu/sse_float_arith.asmis a new source-built synthetic MASM fixture submitted under the MIT License. It defines 7 exports exercising:addps,subps,mulps,divpsaddps xmm0, xmm0(doubling),subps xmm0, xmm0(zeroing idiom), andmulps xmm0, xmm0(squaring)The test vectors evaluate 5 input sets including positive/negative normals, signed zeros (
+0.0/-0.0), extreme magnitudes, and infinities (inf/-inf).Negative control:
check_rejections()asserts that EVEX encodings (vaddps,vsubps,vmulps,vdivps) and legacy XMM memory forms without an alignment contract are explicitly rejected withValueError.Reproduction notes and build commands are documented in
docs/experiments.md. Follow-up PRs can lower the remaining SSE packed single-precision forms: bitwise logic (andps,andnps,orps,xorps) and comparisons/approximations (minps,maxps,sqrtps,rsqrtps,rcpps).This change was AI-assisted.
Checklist