This is an archive of the discontinued LLVM Phabricator instance.

[LV] Change interface of getReductionPatternCost to return Optional
ClosedPublic

Authored by dmgreen on Jul 16 2021, 3:43 AM.

Details

Summary

Currently the Instruction cost of getReductionPatternCost returns an Invalid cost to specify "did not find the pattern". This changes that to return an Optional with None specifying not found, allowing Invalid to mean an infinite cost as is used elsewhere.

Diff Detail

Event Timeline

dmgreen created this revision.Jul 16 2021, 3:43 AM
dmgreen requested review of this revision.Jul 16 2021, 3:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 16 2021, 3:43 AM
sdesmalen accepted this revision.Jul 19 2021, 12:29 AM

The patch looks fine to me, although this might be an incentive to add a new UnknownCost state to InstructionCost? Is this something you've considered?

This revision is now accepted and ready to land.Jul 19 2021, 12:29 AM

Thanks. I felt like this should be separate from Instruction Cost. It is whether the reduction pattern was found or not, not what the cost of the underlying instructions would be, so is a little different.

This revision was landed with ongoing or failed builds.Jul 20 2021, 8:45 AM
This revision was automatically updated to reflect the committed changes.