[LLVMdev] CostModel analysis -- what is its actual purpose?

Hal Finkel hfinkel at anl.gov
Sun Feb 1 08:27:05 PST 2015


----- Original Message -----
> From: "Chandler Carruth" <chandlerc at gmail.com>
> To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>, "Nadav Rotem" <nrotem at apple.com>, "Arnold Schwaighofer"
> <aschwaighofer at apple.com>, "Hal Finkel" <hfinkel at anl.gov>
> Sent: Sunday, February 1, 2015 3:24:17 AM
> Subject: CostModel analysis -- what is its actual purpose?
> 
> 
> Greetings,
> 
> 
> So the CostModel 'analysis' today isn't actually an analysis at all.
> It is one of the only analyses which doesn't even have an interface
> available outside of the .cpp file, so it is literally impossible to
> use it today.
> 
> 
> The only use is to form tests of TargetTransformInfo, but if that's
> really the only intent, then I have two somewhat large questions:
> 
> 
> 1) Why isn't this just the implementation of the print method for
> TTI? Should I make it into that?

Is there some way to force an analysis to run and print itself via the new PM infrastructure such that we don't need 'printing passes' for testing?

> 
> 
> 2) Why is there so much logic in it? This doesn't really seem like
> it's *just* testing TTI, it almost seems its duplicating some logic
> in the vectorizers to ensure that logic behaves correctly.... But if
> so, that logic should really be de-duplicated into an actual
> analysis with an API that is used by the vectorizers...

The current difference is that the CostModel analysis always gets the cost of the current instruction. The vectorizers deal with scalar instructions, and wants the scalar cost, but also the cost of potentially-created corresponding vector instructions. While there is obvious overlap for the current instruction case, for costing potentially-created instructions, I'm not sure the logic would be universal.

 -Hal

> 
> 
> Anyways, I'm asking because I've ported TTI to the new pass manager,
> but it the testing is quite weak. I can port CostModel as well, but
> I don't really know what the right port is given that it is an
> analysis which can only be used to print things.
> 
> 
> -Chandler

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-dev mailing list