[llvm] 7338f97 - [TTI] Improve description of TargetCostKind enums to aid targets in choosing cost values

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 2 03:09:19 PDT 2022


Author: Simon Pilgrim
Date: 2022-09-02T11:09:06+01:00
New Revision: 7338f9709bba25d23960dfea475efa2e49608c1c

URL: https://github.com/llvm/llvm-project/commit/7338f9709bba25d23960dfea475efa2e49608c1c
DIFF: https://github.com/llvm/llvm-project/commit/7338f9709bba25d23960dfea475efa2e49608c1c.diff

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

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 use uop counts here to easily work with LoopMicroOpBufferSize thresholds, even though high latency fdiv/fsqrt instructions still often have low uop counts).

Differential Revision: https://reviews.llvm.org/D132288

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index 6c6d0d7dcea6e..918433111b320 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -212,6 +212,8 @@ class TargetTransformInfo {
   ///
   /// There are several 
diff erent 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.


        


More information about the llvm-commits mailing list