[PATCH] D132216: [CostModel][X86] RFC - Support cost kind specific look up tables

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 03:18:22 PDT 2022


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

Most of our cost model tables have been created assuming cost kind == recip-throughput. But we're starting to see passes wanting to get accurate costs for the other kinds as well. Some of these can be determined procedurally (e.g. codesize by default could just be the split count after type legalization), but others are going to need to be handled in cost tables - this is especially true for x86 which has so many ISA combinations.

I've created a 'CostKindCosts' struct which can hold cost values for the the 4 cost kinds, defaulting to -1U for unknown cost, this can be used with the existing CostTblEntryT/CostTableLookup template code. I've also added a [TargetCostKind] accessor to make it much easier to look up individual costs.

This just changes the select costs to check the effect (and also to check that the SETCC are correctly handled for default/None cost kinds) - the plan would be to slowly extend this and move the CostKindTblEntry type somewhere generic to allow other targets to use it once its matured.

I'm also going to resurrect D103695 <https://reviews.llvm.org/D103695> so that it can help with latency/codesize coverage testing.

No idea what to do about sizelatency - IIRC the definition was vague to let it be target specific - so far I've been returning the same value as latency - I'm not sure what 'weighted sum' is really supposed to mean to x86.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132216

Files:
  llvm/lib/Target/X86/X86TargetTransformInfo.cpp
  llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll
  llvm/test/Analysis/CostModel/X86/select-codesize.ll
  llvm/test/Analysis/CostModel/X86/select-latency.ll
  llvm/test/Analysis/CostModel/X86/select-sizelatency.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132216.453936.patch
Type: text/x-patch
Size: 166968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220819/a8d67842/attachment-0001.bin>


More information about the llvm-commits mailing list