cpu: lower AVX broadcast, permute, shuffle, blend, dot, round, and vzeroall instructions #390
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!390
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/390/head"
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?
@Vonsek on GitHub · 2026-11-22 00:07 UTC · original
Vonsek:ag/cpu-lower-avx-shuffle-blend→main· +706 −4 · 7 files · 4 commits · merged 2026-11-23 17:27 UTCChange
vzeroallinstructions intools/ffx_version_query.py:vbroadcastss,vbroadcastsd,vbroadcastf128,vextractf128,vinsertf128,vperm2f128vpermilps,vpermilpd,vshufps,vshufpd,vunpcklps,vunpckhps,vunpcklpd,vunpckhpd,vmovddup,vmovsldup,vmovshdupvblendps,vblendpd,vblendvps,vblendvpd,vdpps,vdppd,vroundps,vroundpd,vzeroallEncodingKind.VEX(rejecting EVEX and MXCSR rounding mode imm8 & 4 != 0) and zero upper YMM bytes for 128-bit XMM destinations.OSXSAVE) and 28 (AVX) plus XCR0 XMM/YMM state before invoking the native fixture (exiting 77 withSKIP_RETURN_CODE 77on hosts without AVX).tests/cpu/avx_shuffle_blend.{asm,def,py}, CMake targetcpu_avx_shuffle_blend_lifted, CTestcpu_aot_avx_shuffle_blend, coverage mapping intools/form_coverage.py, and documentation indocs/experiments.md.Verification
cmake --build --preset dev --target cpu_avx_shuffle_blend_lifted:ValueError: unsupported query operation at 0x1000: vbroadcastss ymm0,dword ptr [rcx]cmake --build --preset dev --target cpu_avx_shuffle_blend_liftedsucceeded with 0 warningsctest --preset dev --no-tests=error -R "^(cpu_aot_avx_shuffle_blend|cpu_aot_bmi1)$" -V: 2/2 passed (26 AVX broadcast/permute/shuffle/blend/dot/round/zeroall cases matched native and translated DLLs+ MXCSR-modevroundpsrejection control).\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py:form coverage checks passedEvidence and follow-up
AVX-grouped mnemonics indocs/coverage/x64_zen2.tsvusing source-built fixtures, gated by a runtime CPUID/XCR0 check.@chatgpt-codex-connector[bot] on GitHub · 2026-11-22 00:11 UTC · original · edited 2026-11-22 00:20 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
a0881a1ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-22 00:20 UTC · original
For cancellation-sensitive inputs, this sequential accumulation produces different results from the instruction. With the fixture's existing
0xd5immediate, source lanes[1e20f, 0, -1e20f, 3]dotted with[1, 1, 1, 1]produce0natively but3in the emitted code, reproduced with a source-built AVX probe under default MXCSR. VDPPS reduces the masked products as(p0 + p1) + (p2 + p3), with intermediate rounding, rather than accumulating left to right. Emit that reduction tree and add a cancellation-sensitive differential case.Useful? React with 👍 / 👎.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-22 00:20 UTC · original
For
vmovddup xmm0, qword ptr [rcx], the architectural memory operand is only eight bytes, butnbytesis 16 because it describes the destination width. This initializer consequently reads eight bytes beyond the operand. When the source occupies the last eight readable bytes before a protected page, the native instruction succeeds while the emitted code faults in an unoptimized build; this was reproduced with a guarded-page probe. Derive the read size from the memory operand or special-case the 128-bit VMOVDDUP form instead of using the output width.Useful? React with 👍 / 👎.
@ -0,0 +251,4 @@vzeroall_lift_entry PROC FRAME.endprologvmovups ymm0, ymmword ptr [rcx]vzeroall@chatgpt-codex-connector[bot] on GitHub · 2026-11-22 00:20 UTC · original
On the x64 Windows target,
vzeroallclears the low 128 bits of XMM6–XMM15, which are callee-saved, but this export returns without restoring them. The native fixture is called directly through ctypes incheck(), so any live caller state in those registers is lost even when the output comparison passes. A source-built register probe confirms that an XMM6 sentinel returns as zero. Save and restore the nonvolatile XMM halves, or invoke this fixture through an ABI-preserving native wrapper.AGENTS.md reference: AGENTS.md:L37-L38
Useful? React with 👍 / 👎.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-22 00:20 UTC · original
When a source lane contains a signaling NaN and invalid exceptions are masked, VROUNDPS/VROUNDPD return a quiet NaN rather than preserving the signaling representation. This early return leaves the input bits unchanged: with the fixture's
vroundpsimmediate8, a source-built probe produced native bits0x7fc00001versus lowered bits0x7f800001for input0x7f800001. Handle signaling NaNs explicitly so the helper quiets them while preserving the appropriate payload.Useful? React with 👍 / 👎.
@legacy-code-archaeologist on GitHub · 2026-11-22 19:26 UTC · original
Verified
afc5773on an Intel Core i7-6820HQ (Skylake), Windows 11 26100.9168, MSVC/ML64 19.52.37029,devpreset.ctest --preset dev --no-tests=error -R "^cpu_" -j 4passes 81 of 81 on this branch's base.Two notes:
tests/cpu/avx_shuffle_blend.pyexercisesvdpps_op/vdppd_oponly with finite inputs; there are no NaN or infinity lanes. In #602 a DPPS case with several NaN products failed on this Intel host because the reference model encodes one vendor's NaN choice, and the translation runs the host's own dot-product instruction. The same case does not arise here yet, but a multi-NaN dot product would need the same vendor-tolerant check.mainatff7f68a(git merge-tree).AI-assisted (Claude Code).
@R0Y00 on GitHub · 2026-11-23 16:59 UTC · original
Updated the branch to
adb3101and preserved the existing XMM shuffle paths and #404 packed integer regression. The new YMM paths now run through the correct width dispatch. The XMM memory VMOVDDUP reads only the decoded eight bytes, verified at a no-access page boundary. VDPPS uses the host lane operation and passes the cancellation case that distinguishes a left-to-right sum. The multiple-NaN check accepts a NaN in selected lanes and still compares the other lanes bit for bit. The original AVX fixture and the existing SSE3/4, AVX packed FP and AVX integer shift/pack checks passed 4/4 in both Debug and Release. Fresh CI will run on the updated head.@R0Y00 on GitHub · 2026-11-23 17:08 UTC · original
d9320baadds a Win64-native wrapper that saves and restores XMM6–XMM15 around the raw VZEROALL fixture. A separate native call now checks that an XMM6 sentinel survives. It also adds exact signaling-NaN readbacks for VROUNDPS and VROUNDPD with the invalid exception masked. This verifies the packed round intrinsics, in addition to the eight-byte VMOVDDUP guard-page and VDPPS cancellation checks from the earlier update. All four focused tests passed in Debug and Release.@chatgpt-codex-connector[bot] on GitHub · 2026-11-22 00:20 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
a0881a1512ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".