[llvm-dev] Cost Model returning only cost of 1 or 0 never higer
M W via llvm-dev
llvm-dev at lists.llvm.org
Wed Nov 21 05:08:44 PST 2018
For a project I need to know the rudimentary cost of an instruction and for
that I want to use the CostModel class as defined in the CostModel.cpp file.
The idea is to get the cost of an instruction to calculate the Worst Case
Execution Time (WCET) by traversing instructions one by one from an IR
file. It does not have to be precise. However, as it turns out it is always
returning 1 when choosing the RecipeThroughput option.
When I analyze the IR file with the -cost-model pass I am getting sometimes
2 for operands like fadd and fmul. (opt -analyze -targetlibinfo -cost-model
inputFile.ll).
I have implemented the CostModel class separatly into my project. Basicly,
I created a header for the CostModel class and gave it a different name
like so:
https://github.com/MWestenberg/EnergyAnalysis/blob/master/EnergyAnalysis/src/EnergyAnalysis/WCETCostModelAnalysis.h
I was hoping the cost-model analysis would simply run the CostModel class
like I implemented it myself. Is this maybe not the case? How is it
possible that I am only getting a value of 1 or 0 whilst the cost-model
pass is showing different values?
I have also tried another method TargetTransformInfo but this also just
returns 1 or 0 for each instruction.
Any help or information regarding the CostModel analysis pass would be
appreciated. Currently I am stuck on this and cannot proceed without
finding the cause.
Many thanks!
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181121/32e88507/attachment-0001.html>
More information about the llvm-dev
mailing list