Skip to content

Feat/devectorize - #1010

Merged
mahaloz merged 3 commits into
Noelo-Lab:mainfrom
ReversingWithMe:feat/devectorize
Oct 12, 2026
Merged

mahaloz merged 3 commits into
Noelo-Lab:mainfrom
ReversingWithMe:feat/devectorize

Conversation

@ReversingWithMe

Copy link
Copy Markdown
Contributor

Add O3/de-vectorization experimental SSA analysis.

Reduce synthetic wide SSA slices to direct lane expressions with the
default-on wideslice option. Add devectorize to recover a single scalar
sum loop when its equivalence to the vector reduction is established.
devectorize defaults off in the catalog and is enabled by the aggressive
preset.

Include self-contained x86-64 regressions, matcher unit tests, option
catalog entries, and phase documentation.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
mahaloz and others added 2 commits October 12, 2026 01:50
… global store

devectorize re-rolled a reduction even when a block it drops or reruns
wrote global storage: the early return after the fold, the remainder loop
and the scalar exit could each store to a global, and a loop-carried value
the remainder loop counted from the handoff index escaped through such a
store. Every block the match inspects now refuses an op whose output is
persistent storage. The guard bound no longer takes a signed compare
against a negative constant as a lower bound (nor overflows on the maximum
constant), and a lane must lie inside the bytes of the load it is sliced
from.

RuleWideSlice set its rewritten opcodes with a flagless TypeOp, so the
PIECE/COPY/bitwise ops it made lacked the unary/binary/commutative flags
later passes read; it now takes the canonical TypeOp. On libzstd this
drops the functions wideslice changes from 21 to the 7 where it removes
wide temporaries.

New stage test kuna-devectorize-effects.xml (two hand-written sums whose
exits disagree on a store to 0x3000) fails on the previous head.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011d7uHgQPRpFwdybmGwWHtw
@mahaloz
mahaloz merged commit 93c1339 into Noelo-Lab:main Oct 12, 2026
@mahaloz

mahaloz commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

[AUTOMATED] Merged with one review fix-up on top (99f7916):

  • devectorize now declines a reduction when any block it rewrites (the vector arm, the remainder loop, the else block or either exit) writes global storage. Hand-written sums whose two exits stored different values to a global decompiled to code that always ran the scalar loop and lost the store; tests/stages/kuna-devectorize-effects.xml pins this.
  • The guard-bound check is sign-aware and overflow-checked, and the lane matcher no longer credits a lane with bytes past its slice.
  • wideslice builds its new ops with the canonical TypeOp flags.

Recompiled output from 26 reductions under 9 clang/gcc configurations matches the binaries on random inputs, and both options are within speed noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants