Skip to content

[cherrypick][LV] Vectorize Epilogues for loops with small VF but high IC #9666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

juliannagele
Copy link
Member

Cherry pick epilogue vectorization improvements from llvm#108190. Also needs llvm#113915 as a supporting change.

juliannagele and others added 3 commits November 22, 2024 11:15
…incoming values (llvm#113915)

This patch aims to strengthen collection of loop guards by processing
PHI nodes with multiple incoming values as follows: collect guards for
all incoming values/blocks and try to merge them into a single one for
the PHI node.

The goal is to determine tighter bounds on the trip counts of scalar
tail loops after vectorization, helping to avoid unnecessary transforms.
In particular we'd like to avoid vectorizing scalar tails of
hand-vectorized loops, for example in
[Transforms/PhaseOrdering/X86/pr38280.ll](https://github.com/llvm/llvm-project/blob/231e03ba7e82896847dbc27d457dbb208f04699c/llvm/test/Transforms/PhaseOrdering/X86/pr38280.ll),
discovered via llvm#108190

Compile-time impact: https://llvm-compile-time-tracker.com/compare.php?from=a55248789ed3f653740e0723d016203b9d585f26&to=500e4c46e79f60b93b11a752698c520e345948e3&stat=instructions:u

PR: llvm#113915
(cherry picked from commit 7c8e05a)
Address post-commit comments for
llvm#113915.

(cherry picked from commit feb9b37)
…8190)

- Consider MainLoopVF * IC when determining whether Epilogue
Vectorization is profitable
- Allow the same VF for the Epilogue as for the main loop
- Use an upper bound for the trip count of the Epilogue when choosing
the Epilogue VF

PR: llvm#108190
---------

Co-authored-by: Florian Hahn <[email protected]>
(cherry picked from commit a8538b9)
@juliannagele juliannagele requested a review from a team as a code owner November 22, 2024 13:07
@juliannagele
Copy link
Member Author

@swift-ci please test

1 similar comment
@juliannagele
Copy link
Member Author

@swift-ci please test

@juliannagele juliannagele merged commit f1b6330 into swiftlang:stable/20240723 Dec 2, 2024
3 checks passed
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