[all-commits] [llvm/llvm-project] e6c516: [SandboxIR] Fix notifyEraseInstr to skip scheduled...
Anshil Gandhi via All-commits
all-commits at lists.llvm.org
Wed Jul 29 22:50:37 PDT 2026
Branch: refs/heads/users/gandhi56/sandbox-vectorizer/topdown-vec
Home: https://github.com/llvm/llvm-project
Commit: e6c5169218507c5cea31a1cdc54711a99af47350
https://github.com/llvm/llvm-project/commit/e6c5169218507c5cea31a1cdc54711a99af47350
Author: Anshil Gandhi <gandhi21299 at gmail.com>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M llvm/lib/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.cpp
M llvm/unittests/Transforms/Vectorize/SandboxVectorizer/DependencyGraphTest.cpp
Log Message:
-----------
[SandboxIR] Fix notifyEraseInstr to skip scheduled neighbors
Guard both loops with !PredN->scheduled() / !SuccN->scheduled() so
scheduled neighbors are left untouched, and add a unit test that erases
a node with one scheduled and one unscheduled predecessor to cover the
fix.
Commit: 345444aa20dbe1a582b0a737ab04b9187d400246
https://github.com/llvm/llvm-project/commit/345444aa20dbe1a582b0a737ab04b9187d400246
Author: Anshil Gandhi <gandhi21299 at gmail.com>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h
M llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/VecUtils.h
M llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
M llvm/lib/Transforms/Vectorize/SandboxVectorizer/VecUtils.cpp
M llvm/test/Transforms/SandboxVectorizer/external_uses.ll
M llvm/test/Transforms/SandboxVectorizer/pack.ll
A llvm/test/Transforms/SandboxVectorizer/topdown_vec.ll
M llvm/unittests/Transforms/Vectorize/SandboxVectorizer/VecUtilsTest.cpp
Log Message:
-----------
[SBVec] Add top-down vectorization to the unified Sandbox Vectorizer
Extend the Sandbox Vectorizer's `bottom-up-vec` pass so a single
implementation can vectorize in either direction, and add the top-down
strategy that walks def-use chains forward from a seed.
Direction selection
--------------------
The pass direction is chosen from the Region's auxiliary pass argument:
"bottom-up" (or empty, the default) and "top-down" map onto a
SchedDirection, and any other value is rejected with a fatal usage error.
The vectorizer always runs in the same direction as the scheduler.
Top-down traversal
------------------
Bottom-up starts from a seed slice (e.g. stores to consecutive addresses)
and recurses into operands. Top-down instead starts from a seed of
consecutive loads and recurses into *users*:
- vectorizeRec() registers the current bundle's vector (pre-order) before
recursing, so instructions are marked vectorized as soon as they are
claimed. This prevents sibling user bundles from claiming the same
instruction and guarantees termination.
- VecUtils::getNextUserBundles() drives the walk. For each user of lane 0
it tries to assemble a matching user for every remaining lane, requiring
the same opcode, type, parent block, and operand-usage indices, and
claiming each instruction at most once. Only complete bundles (one user
per lane) are returned.
- A non-Widen legality result stops the walk down that path: the bundle is
left scalar and no action is recorded. DiamondReuse results cannot occur
top-down because already-vectorized users are skipped, so a bundle never
contains an instruction already in InstrMaps.
Operand and external-use handling
---------------------------------
Because a user bundle is emitted after its operand bundle, emitVectors()
looks up each operand's vector in InstrMaps and creates a pack when the
operand was not vectorized. emitUnpacksForExternalUses() now redirects
only the genuinely external (non-vectorized) uses via replaceUsesWithIf(),
instead of a blanket replaceAllUsesWith() that would corrupt the operands
of user bundles not yet emitted. Scheduling is currently skipped for the
top-down direction (TODO).
Refactoring
-----------
Unify the two strategies to avoid code duplication: introduce a shared
BundleTy alias, move user-bundle collection into VecUtils (with unit
tests), and thread the direction through legality checks and vector
emission.
Co-authored-by: Cursor <cursoragent at cursor.com>
Commit: ce54474efae1476b43478da359493cdf5fd4f4d8
https://github.com/llvm/llvm-project/commit/ce54474efae1476b43478da359493cdf5fd4f4d8
Author: Anshil Gandhi <Anshil.Gandhi at amd.com>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h
M llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
Log Message:
-----------
[SBVec] Refactor BottomUpVec pass for clarity and maintainability
- Corrected comments to clarify the direction of def-use and use-def chains.
- Changed the initialization of the SchedDirection variable to improve clarity.
- Updated documentation in vectorizeRec() to better describe the purpose of UserBndl.
- Removed outdated TODO comment regarding top-down vectorization scheduling.
Commit: c02362f0ebf14c6c38a2a6b7a797138c97df843e
https://github.com/llvm/llvm-project/commit/c02362f0ebf14c6c38a2a6b7a797138c97df843e
Author: Anshil Gandhi <Anshil.Gandhi at amd.com>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M llvm/lib/Transforms/Vectorize/SandboxVectorizer/VecUtils.cpp
M llvm/test/Transforms/SandboxVectorizer/topdown_vec.ll
Log Message:
-----------
[SBVec] Track claimed users across bundles
Commit: 5b9e622ff8ba356330d80cfce77ecb42d54030f4
https://github.com/llvm/llvm-project/commit/5b9e622ff8ba356330d80cfce77ecb42d54030f4
Author: Anshil Gandhi <Anshil.Gandhi at amd.com>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
M llvm/test/Transforms/SandboxVectorizer/topdown_vec.ll
Log Message:
-----------
3 element tests
- nits
Commit: 30f0db66f1985a6e5679d12fa331beb4f2b2ee7e
https://github.com/llvm/llvm-project/commit/30f0db66f1985a6e5679d12fa331beb4f2b2ee7e
Author: Anshil Gandhi <Anshil.Gandhi at amd.com>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M llvm/test/Transforms/SandboxVectorizer/topdown_vec.ll
Log Message:
-----------
Add 3-way test to check for consecutive matching
Commit: 39aca64e8e6ad5675605489b0717d69baa8eac4d
https://github.com/llvm/llvm-project/commit/39aca64e8e6ad5675605489b0717d69baa8eac4d
Author: Anshil Gandhi <Anshil.Gandhi at amd.com>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/VecUtils.h
M llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
M llvm/lib/Transforms/Vectorize/SandboxVectorizer/VecUtils.cpp
M llvm/test/Transforms/SandboxVectorizer/topdown_vec.ll
Log Message:
-----------
Pass Claimed by ref to getNextUserBundles
A user should not be claimed by multiple successful
bundles. Added a test for this.
Commit: 1b7b2e7f4a91cfce1b7d248129f1d402e5cc1cd5
https://github.com/llvm/llvm-project/commit/1b7b2e7f4a91cfce1b7d248129f1d402e5cc1cd5
Author: Anshil Gandhi <gandhi21299 at gmail.com>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M llvm/test/Transforms/SandboxVectorizer/topdown_vec.ll
Log Message:
-----------
Remove stores
Commit: d5047dfb85b427fc050be9bba6ef0ad6a44e2ba5
https://github.com/llvm/llvm-project/commit/d5047dfb85b427fc050be9bba6ef0ad6a44e2ba5
Author: Anshil Gandhi <gandhi21299 at gmail.com>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/VecUtils.h
M llvm/lib/Transforms/Vectorize/SandboxVectorizer/VecUtils.cpp
M llvm/test/Transforms/SandboxVectorizer/topdown_vec.ll
M llvm/unittests/Transforms/Vectorize/SandboxVectorizer/VecUtilsTest.cpp
Log Message:
-----------
Refactor getNextUserBundles
Commit: 96b251430bb8a78647714a60fcb2586c5d353259
https://github.com/llvm/llvm-project/commit/96b251430bb8a78647714a60fcb2586c5d353259
Author: Anshil Gandhi <gandhi21299 at gmail.com>
Date: 2026-07-30 (Thu, 30 Jul 2026)
Changed paths:
M llvm/lib/Transforms/Vectorize/SandboxVectorizer/VecUtils.cpp
Log Message:
-----------
Add a cl::opt to limit the number of users visited
Commit: 7862d524a4712ec3f80391004c4d77a8d0b74a71
https://github.com/llvm/llvm-project/commit/7862d524a4712ec3f80391004c4d77a8d0b74a71
Author: Anshil Gandhi <gandhi21299 at gmail.com>
Date: 2026-07-30 (Thu, 30 Jul 2026)
Changed paths:
M llvm/lib/Transforms/Vectorize/SandboxVectorizer/VecUtils.cpp
M llvm/unittests/Transforms/Vectorize/SandboxVectorizer/VecUtilsTest.cpp
Log Message:
-----------
Refactor VecUtilsTest for readability
Compare: https://github.com/llvm/llvm-project/compare/351d2fd4e858...7862d524a471
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list