[llvm-branch-commits] [llvm] [VPlan] Initial modeling of runtime VF * UF as VPValue. (PR #74761)

2023-12-07 Thread via llvm-branch-commits


@@ -2624,6 +2644,9 @@ class VPlan {
   /// The vector trip count.
   VPValue () { return VectorTripCount; }
 
+  /// Returns runtime VF * UF for the vector loop region.

ayalz wrote:

```suggestion
  /// Returns the VF * UF of the vector loop region.
```

https://github.com/llvm/llvm-project/pull/74761
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [VPlan] Initial modeling of runtime VF * UF as VPValue. (PR #74761)

2023-12-07 Thread via llvm-branch-commits

https://github.com/ayalz approved this pull request.

LGTM, couple of minor nits.

https://github.com/llvm/llvm-project/pull/74761
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [VPlan] Initial modeling of runtime VF * UF as VPValue. (PR #74761)

2023-12-07 Thread via llvm-branch-commits


@@ -1168,13 +1166,26 @@ class VPInstruction : public VPRecipeWithIRFlags, 
public VPValue {
   return false;
 case VPInstruction::ActiveLaneMask:
 case VPInstruction::CalculateTripCountMinusVF:
-case VPInstruction::CanonicalIVIncrement:
 case VPInstruction::CanonicalIVIncrementForPart:
 case VPInstruction::BranchOnCount:
   return true;
 };
 llvm_unreachable("switch should return");
   }
+

ayalz wrote:

/// Returns true if the recipe only uses the first part of operand \p Op.

https://github.com/llvm/llvm-project/pull/74761
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [VPlan] Initial modeling of runtime VF * UF as VPValue. (PR #74761)

2023-12-07 Thread via llvm-branch-commits

https://github.com/ayalz edited https://github.com/llvm/llvm-project/pull/74761
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [VPlan] Initial modeling of runtime VF * UF as VPValue. (PR #74761)

2023-12-07 Thread via llvm-branch-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff f7aef976460187cf1c851e359f3fe46ab0ba6527 
9421037da2ec22ec345216e5b8f3c3108926adbe -- 
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp 
llvm/lib/Transforms/Vectorize/VPlan.cpp llvm/lib/Transforms/Vectorize/VPlan.h 
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp 
llvm/lib/Transforms/Vectorize/VPlanValue.h
``





View the diff from clang-format here.


``diff
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp 
b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index c06698765c..32e86d811a 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -8620,9 +8620,9 @@ static void addCanonicalIVRecipes(VPlan , Type 
*IdxTy, bool HasNUW,
 
   // Add a CanonicalIVIncrement{NUW} VPInstruction to increment the scalar
   // IV by VF * UF.
-  auto *CanonicalIVIncrement = new VPInstruction(
-  Instruction::Add, {CanonicalIVPHI, ()},
-  {HasNUW, false}, DL, "index.next");
+  auto *CanonicalIVIncrement =
+  new VPInstruction(Instruction::Add, {CanonicalIVPHI, ()},
+{HasNUW, false}, DL, "index.next");
   CanonicalIVPHI->addOperand(CanonicalIVIncrement);
 
   VPBasicBlock *EB = TopRegion->getExitingBasicBlock();

``




https://github.com/llvm/llvm-project/pull/74761
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [VPlan] Initial modeling of runtime VF * UF as VPValue. (PR #74761)

2023-12-07 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-risc-v

Author: Florian Hahn (fhahn)


Changes

This patch starts initial modeling of runtime VF * UF in VPlan.
Initially, introduce a dedicated RuntimeVFxUF VPValue, which is then
populated during VPlan::prepareToExecute. Initially, the runtime
VF * UF applies only to the main vector loop region. Once we extend the
scope of VPlan in the future, we may want to associate different VFxUFs
with different vector loop regions (e.g. the epilogue vector loop)

This allows explicitly parameterizing recipes that rely on the runtime
VF * UF, like the canonical induction increment. At the moment, this
mainly helps to avoid generating some duplicated calls to vscale with
scalable vectors. It should also allow using EVL as induction increments
explicitly in D99750. Referring to VF * UF is also needed in other
places that we plan to migrate to VPlan, like the minimum trip count
check during skeleton creation.

The first version creates the value for VF * UF directly in
prepareToExecute to limit the scope of the patch. A follow-on patch will
model VF * UF computation explicitly in VPlan using recipes.

Moved from Phabricator (https://reviews.llvm.org/D157322)


---

Patch is 308.19 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/74761.diff


53 Files Affected:

- (modified) llvm/lib/Transforms/Vectorize/LoopVectorize.cpp (+3-3) 
- (modified) llvm/lib/Transforms/Vectorize/VPlan.cpp (+21-1) 
- (modified) llvm/lib/Transforms/Vectorize/VPlan.h (+30-4) 
- (modified) llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp (+8-23) 
- (modified) llvm/lib/Transforms/Vectorize/VPlanValue.h (+6) 
- (modified) llvm/test/Transforms/LoopVectorize/AArch64/masked-call.ll (+11-11) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/outer_loop_prefer_scalable.ll (+2-2) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/scalable-avoid-scalarization.ll 
(+2-2) 
- (modified) llvm/test/Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll 
(+16-16) 
- (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-cond-inv-loads.ll 
(+4-4) 
- (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-gather-scatter.ll 
(+6-6) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/sve-inductions-unusual-types.ll 
(+4-6) 
- (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-inductions.ll 
(+2-2) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/sve-interleaved-accesses.ll (+26-26) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/sve-interleaved-masked-accesses.ll 
(+12-12) 
- (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-inv-store.ll (+2-2) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-forced.ll (+4-3) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-optsize.ll (+1-1) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-overflow-checks.ll 
(+3-3) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-reductions.ll 
(+12-12) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-unroll.ll (+4-4) 
- (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding.ll 
(+20-20) 
- (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-vfabi.ll (+2-2) 
- (modified) llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-gep.ll (+2-1) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/synthesize-mask-for-call.ll (+12-6) 
- (modified) llvm/test/Transforms/LoopVectorize/AArch64/tail-folding-styles.ll 
(+10-10) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/uniform-args-call-variants.ll (+4-4) 
- (modified) 
llvm/test/Transforms/LoopVectorize/AArch64/widen-call-with-intrinsic-or-libfunc.ll
 (+5-2) 
- (modified) llvm/test/Transforms/LoopVectorize/RISCV/defaults.ll (+2-2) 
- (modified) llvm/test/Transforms/LoopVectorize/RISCV/divrem.ll (+12-12) 
- (modified) llvm/test/Transforms/LoopVectorize/RISCV/interleaved-accesses.ll 
(+4-4) 
- (modified) llvm/test/Transforms/LoopVectorize/RISCV/mask-index-type.ll (+2-2) 
- (modified) llvm/test/Transforms/LoopVectorize/RISCV/masked_gather_scatter.ll 
(+4-4) 
- (modified) llvm/test/Transforms/LoopVectorize/RISCV/riscv-vector-reverse.ll 
(+8-6) 
- (modified) llvm/test/Transforms/LoopVectorize/RISCV/scalable-basics.ll 
(+20-20) 
- (modified) llvm/test/Transforms/LoopVectorize/RISCV/scalable-tailfold.ll 
(+10-10) 
- (modified) llvm/test/Transforms/LoopVectorize/RISCV/select-cmp-reduction.ll 
(+6-6) 
- (modified) llvm/test/Transforms/LoopVectorize/RISCV/strided-accesses.ll 
(+6-6) 
- (modified) llvm/test/Transforms/LoopVectorize/RISCV/uniform-load-store.ll 
(+20-20) 
- (modified) 
llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains-vplan.ll 
(+4-2) 
- (modified) 
llvm/test/Transforms/LoopVectorize/first-order-recurrence-sink-replicate-region.ll
 (+12-6) 
- (modified) llvm/test/Transforms/LoopVectorize/icmp-uniforms.ll (+2-1) 
- (modified) 

[llvm-branch-commits] [llvm] [VPlan] Initial modeling of runtime VF * UF as VPValue. (PR #74761)

2023-12-07 Thread Florian Hahn via llvm-branch-commits

https://github.com/fhahn created https://github.com/llvm/llvm-project/pull/74761

This patch starts initial modeling of runtime VF * UF in VPlan.
Initially, introduce a dedicated RuntimeVFxUF VPValue, which is then
populated during VPlan::prepareToExecute. Initially, the runtime
VF * UF applies only to the main vector loop region. Once we extend the
scope of VPlan in the future, we may want to associate different VFxUFs
with different vector loop regions (e.g. the epilogue vector loop)

This allows explicitly parameterizing recipes that rely on the runtime
VF * UF, like the canonical induction increment. At the moment, this
mainly helps to avoid generating some duplicated calls to vscale with
scalable vectors. It should also allow using EVL as induction increments
explicitly in D99750. Referring to VF * UF is also needed in other
places that we plan to migrate to VPlan, like the minimum trip count
check during skeleton creation.

The first version creates the value for VF * UF directly in
prepareToExecute to limit the scope of the patch. A follow-on patch will
model VF * UF computation explicitly in VPlan using recipes.

Moved from Phabricator (https://reviews.llvm.org/D157322)



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits