[PATCH] D43079: [TTI CostModel] change default cost of FP ops to 1 (PR36280)

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 13:38:00 PST 2018


hfinkel added inline comments.


================
Comment at: include/llvm/CodeGen/BasicTTIImpl.h:494
+    // assumption when they can provide more accurate information.
+    unsigned OpCost = 1;
 
----------------
spatel wrote:
> hfinkel wrote:
> > spatel wrote:
> > > ABataev wrote:
> > > > Maybe it is better to add a virtual method that will return the default cost of the integer and floating point operations for the target? The default implementation should keep 1 and 2, but for X86 it should return 1 in both cases.
> > > I don't know of any target where anything but '1' is the right default answer, so I'd rather not perpetuate this. I think it's better to correct the problems revealed by this change.
> > I agree, but recall that these are measuring reciprocal throughputs, and it's not unreasonable to assume that floating-point ops will have lower throughputs than integer operations in some general sense. Nevertheless, '2' seems somewhat arbitrary in this regard.
> Ah, the code comment isn't accurate then. And since we're using integers, this is really a relative reciprocal throughput (can't go under 1) rather than an actual cycle-based value?
Not sure what you mean by "cycle based." All cost model results are relative, but this cost model used by the vectorizer is supposed to return (relative) reciprocal throughputs. We now have a separate cost model for latency (and a separate "user cost" model, which essentially models micro-op count).


https://reviews.llvm.org/D43079





More information about the llvm-commits mailing list