Skip to content

[LV]: Add costs to VPInstruction #125008

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions llvm/lib/Transforms/Vectorize/VPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,9 @@ class VPInstruction : public VPRecipeWithIRFlags,
InstructionCost computeCost(ElementCount VF,
VPCostContext &Ctx) const override {
// TODO: Compute accurate cost after retiring the legacy cost model.
// Use legacy cost model for now.
if (auto *I = dyn_cast_or_null<Instruction>(getUnderlyingValue()))
Copy link
Contributor

@david-arm david-arm Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @hassnaaHamdi, I think you should be able to do this without falling back on the legacy cost model. I also plan to put a patch up fairly soon that starts filling this function in properly because it's needed for the early exit work. What instructions were you hitting when getting into this instruction?

Copy link
Member Author

@hassnaaHamdi hassnaaHamdi Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original instruction was 'or disjoint' and it got replaced by the VPlanTransforms to 'Add' instruction wrapped in VPInstruction.

return Ctx.getLegacyCost(I, VF);
return 0;
}

Expand Down