[PATCH] D122126: [LoopVectorize] Don't interleave when the number of runtime checks exceeds the threshold
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 31 04:25:51 PDT 2022
dmgreen accepted this revision.
dmgreen added a comment.
This revision is now accepted and ready to land.
> 1. `Requirements` can not be accessed in `selectInterleaveCount`, so additional parameters need to be added to selectInterleaveCount. Do you think it is necessary?<br>
Yeah - it might need to pass Requirements.getNumRuntimePointerChecks() through to selectInterleaveCount. I think it's OK as you have it right now, but Florian (or anyone else) can complain if they disagree.
> 2. I'm not sure if I need to keep `SelectedVF.Width.getKnownMinValue() > 1`, but if it is not necessary, we could remove it in a separate patch.
I was just hoping that if it got to that block then it would prevent the interleaving. It looks like it doesn't work like that though.
LGTM. Perhaps wait a day or two in case anyone else has comments.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7673-7674
// Check if it is profitable to vectorize with runtime checks.
- unsigned NumRuntimePointerChecks = Requirements.getNumRuntimePointerChecks();
- if (SelectedVF.Width.getKnownMinValue() > 1 && NumRuntimePointerChecks) {
- bool PragmaThresholdReached =
- NumRuntimePointerChecks > PragmaVectorizeMemoryCheckThreshold;
- bool ThresholdReached =
- NumRuntimePointerChecks > VectorizerParams::RuntimeMemoryCheckThreshold;
- if ((ThresholdReached && !Hints.allowReordering()) ||
- PragmaThresholdReached) {
+ if (SelectedVF.Width.getKnownMinValue() > 1) {
+ if (hasTooManyRuntimeChecks()) {
ORE->emit([&]() {
----------------
Maybe just use a single if now: `if (SelectedVF.Width.getKnownMinValue() > 1 && hasTooManyRuntimeChecks()) {`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122126/new/
https://reviews.llvm.org/D122126
More information about the llvm-commits
mailing list