Page MenuHomePhabricator

[NFC][CostModel] Add TargetCostKind to relevant APIs

Authored by samparker on Apr 28 2020, 6:34 AM.



Make the kind of cost explicit throughout the cost model which, apart from making the cost clear, will allow the generic parts to calculate better costs. It will also allow some backends to approximate and correlate the different costs if they wish. Another benefit is that it will also help simplify the cost model around immediate and intrinsic costs, where we currently have multiple APIs.
RFC thread:

Diff Detail

Event Timeline

samparker created this revision.Apr 28 2020, 6:34 AM

Weak -0.01c
I think this might deserve an RFC on llvm-dev.

Good idea, done.

simoll added a subscriber: simoll.Apr 29 2020, 12:30 PM

Good idea, done.

(Nit) Could you link the RFC in the message?


Why not also default value CostKind here, too?

samparker marked an inline comment as done.May 1 2020, 12:06 AM

Just because I really wasn't sure what it should be.

Thanks - I meant in the commit message, so folks can readily reference it when they git log, for instance. Anyway, just a nit.


Looking at the uses of the API, it seems users pass TCK_RecipThroughput, which I think is the default for the other APIs.

samparker updated this revision to Diff 261767.May 4 2020, 2:58 AM
samparker edited the summary of this revision. (Show Details)

Added RecipThroughput as the default value to for MemoryCost.

mtrofin accepted this revision.May 4 2020, 8:15 AM


This revision is now accepted and ready to land.May 4 2020, 8:15 AM
This revision was automatically updated to reflect the committed changes.