[PATCH] D132288: [TTI] Improve description of TargetCostKind enums to aid targets in choosing cost values

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 20 04:11:12 PDT 2022


RKSimon created this revision.
RKSimon added reviewers: samparker, dmgreen, reames, craig.topper, spatel, hfinkel, andreadb.
Herald added subscribers: StephenFan, pengfei.
Herald added a project: All.
RKSimon requested review of this revision.
Herald added a project: LLVM.

I'm not sure how much to add to the description as we've tried to allow targets to interpret the TargetCostKind enums in their own way. But we need to make it clear that certain cost kinds need to match threshold numbers used by various passes (and vice-versa when passes are determining a cost-benefit threshold).

I'm not keen on the "The weighted sum of size and latency" description, but its very difficult to come up with anything else that's suitably generic (e.g. X86 will probably use uop counts here to easily work with LoopMicroOpBufferSize thresholds, even though high latency fdiv/fsqrt instructions still often have low uop counts).

This is likely to become a bikeshed discussion, but we need some clarity here :-)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132288

Files:
  llvm/include/llvm/Analysis/TargetTransformInfo.h


Index: llvm/include/llvm/Analysis/TargetTransformInfo.h
===================================================================
--- llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -212,6 +212,8 @@
   ///
   /// There are several different cost models that can be customized by the
   /// target. The normalization of each cost model may be target specific.
+  /// e.g. TCK_SizeAndLatency should be comparable to target thresholds such as
+  /// those derived from MCSchedModel::LoopMicroOpBufferSize etc.
   enum TargetCostKind {
     TCK_RecipThroughput, ///< Reciprocal throughput.
     TCK_Latency,         ///< The latency of instruction.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132288.454196.patch
Type: text/x-patch
Size: 696 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220820/4d785831/attachment.bin>


More information about the llvm-commits mailing list