Page MenuHomePhabricator

[NFC][CostModel] Add TargetCostKind to relevant APIs
ClosedPublic

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

Details

Summary

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: http://lists.llvm.org/pipermail/llvm-dev/2020-April/141263.html

Diff Detail

Event Timeline

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

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

Good idea, done.

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

Good idea, done.

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

llvm/include/llvm/Analysis/TargetTransformInfo.h
933

Why not also default value CostKind here, too?

samparker marked an inline comment as done.Fri, May 1, 12:06 AM
llvm/include/llvm/Analysis/TargetTransformInfo.h
933

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.

llvm/include/llvm/Analysis/TargetTransformInfo.h
933

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.Mon, May 4, 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.Mon, May 4, 8:15 AM

lgtm

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