-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[VPlan] Remove no longer needed VP intrinsic handling in VPWidenIntrinsicRecipe::computeCost. NFCI #137573
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
[VPlan] Remove no longer needed VP intrinsic handling in VPWidenIntrinsicRecipe::computeCost. NFCI #137573
Conversation
…nsicRecipe::computeCost. NFCI Whenever calls were transformed to VP intrinsics with EVL tail folding in llvm#110412, this workaround was added in computeCost to avoid an assertion when checking ICA.getArgs(). However it turned out that the actual arguments were never used and this assertion was removed in llvm#115983 afterwards, so it's now fine to leave the arguments empty and use the type based cost instead. The type based cost and value based cost are the same for these VP intrinsics. This was tested by adding back in the transformation code in llvm#110412 and checking that no assertions were still hit.
@llvm/pr-subscribers-vectorizers @llvm/pr-subscribers-llvm-transforms Author: Luke Lau (lukel97) ChangesWhenever calls were transformed to VP intrinsics with EVL tail folding in #110412, this workaround was added in computeCost to avoid an assertion when checking ICA.getArgs(). However it turned out that the actual arguments were never used and this assertion was removed in #115983 afterwards, so it's now fine to leave the arguments empty and use the type based cost instead. The type based cost and value based cost are the same for these VP intrinsics. This was tested by adding back in the transformation code in #110412 and checking that no assertions were still hit. Full diff: https://github.com/llvm/llvm-project/pull/137573.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 75d056026025a..54990c7c806c4 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -1333,15 +1333,6 @@ InstructionCost VPWidenIntrinsicRecipe::computeCost(ElementCount VF,
for (const auto &[Idx, Op] : enumerate(operands())) {
auto *V = Op->getUnderlyingValue();
if (!V) {
- // Push all the VP Intrinsic's ops into the Argments even if is nullptr.
- // Some VP Intrinsic's cost will assert the number of parameters.
- // Mainly appears in the following two scenarios:
- // 1. EVL Op is nullptr
- // 2. The Argmunt of the VP Intrinsic is also the VP Intrinsic
- if (VPIntrinsic::isVPIntrinsic(VectorIntrinsicID)) {
- Arguments.push_back(V);
- continue;
- }
if (auto *UI = dyn_cast_or_null<CallBase>(getUnderlyingValue())) {
Arguments.push_back(UI->getArgOperand(Idx));
continue;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There is an unrelated question: is there a possibility that the operand is not of vector type?
SmallVector<Type *> ParamTys;
for (unsigned I = 0; I != getNumOperands(); ++I)
ParamTys.push_back(
toVectorTy(Ctx.Types.inferScalarType(getOperand(I)), VF));
Yes I think so. I'm not sure why this isn't an issue at the moment. But we should be checking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for removing this.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/162/builds/21259 Here is the relevant piece of the build log for the reference
|
…nsicRecipe::computeCost. NFCI (llvm#137573) Whenever calls were transformed to VP intrinsics with EVL tail folding in llvm#110412, this workaround was added in computeCost to avoid an assertion when checking ICA.getArgs(). However it turned out that the actual arguments were never used and this assertion was removed in llvm#115983 afterwards, so it's now fine to leave the arguments empty and use the type based cost instead. The type based cost and value based cost are the same for these VP intrinsics. This was tested by adding back in the transformation code in llvm#110412 and checking that no assertions were still hit.
…nsicRecipe::computeCost. NFCI (llvm#137573) Whenever calls were transformed to VP intrinsics with EVL tail folding in llvm#110412, this workaround was added in computeCost to avoid an assertion when checking ICA.getArgs(). However it turned out that the actual arguments were never used and this assertion was removed in llvm#115983 afterwards, so it's now fine to leave the arguments empty and use the type based cost instead. The type based cost and value based cost are the same for these VP intrinsics. This was tested by adding back in the transformation code in llvm#110412 and checking that no assertions were still hit.
…nsicRecipe::computeCost. NFCI (llvm#137573) Whenever calls were transformed to VP intrinsics with EVL tail folding in llvm#110412, this workaround was added in computeCost to avoid an assertion when checking ICA.getArgs(). However it turned out that the actual arguments were never used and this assertion was removed in llvm#115983 afterwards, so it's now fine to leave the arguments empty and use the type based cost instead. The type based cost and value based cost are the same for these VP intrinsics. This was tested by adding back in the transformation code in llvm#110412 and checking that no assertions were still hit.
…nsicRecipe::computeCost. NFCI (llvm#137573) Whenever calls were transformed to VP intrinsics with EVL tail folding in llvm#110412, this workaround was added in computeCost to avoid an assertion when checking ICA.getArgs(). However it turned out that the actual arguments were never used and this assertion was removed in llvm#115983 afterwards, so it's now fine to leave the arguments empty and use the type based cost instead. The type based cost and value based cost are the same for these VP intrinsics. This was tested by adding back in the transformation code in llvm#110412 and checking that no assertions were still hit.
…nsicRecipe::computeCost. NFCI (llvm#137573) Whenever calls were transformed to VP intrinsics with EVL tail folding in llvm#110412, this workaround was added in computeCost to avoid an assertion when checking ICA.getArgs(). However it turned out that the actual arguments were never used and this assertion was removed in llvm#115983 afterwards, so it's now fine to leave the arguments empty and use the type based cost instead. The type based cost and value based cost are the same for these VP intrinsics. This was tested by adding back in the transformation code in llvm#110412 and checking that no assertions were still hit.
Whenever calls were transformed to VP intrinsics with EVL tail folding in #110412, this workaround was added in computeCost to avoid an assertion when checking ICA.getArgs().
However it turned out that the actual arguments were never used and this assertion was removed in #115983 afterwards, so it's now fine to leave the arguments empty and use the type based cost instead.
The type based cost and value based cost are the same for these VP intrinsics.
This was tested by adding back in the transformation code in #110412 and checking that no assertions were still hit.