[all-commits] [llvm/llvm-project] 97bd44: [llvm-exegesis] getNonRedundantWriteProcRes - perf...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Mon Oct 24 02:46:32 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 97bd44f436ea81381d14aa108363941ecb82f544
      https://github.com/llvm/llvm-project/commit/97bd44f436ea81381d14aa108363941ecb82f544
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-10-24 (Mon, 24 Oct 2022)

  Changed paths:
    M llvm/tools/llvm-exegesis/lib/CMakeLists.txt
    M llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp

  Log Message:
  -----------
  [llvm-exegesis] getNonRedundantWriteProcRes - perform basic toplogical sorting (PR58500)

getNonRedundantWriteProcRes was assuming that tblgen topologically sorted the cpu ModelProcResources[] arrays so that resource units were declared before the resource groups that used them, but unfortunately that doesn't appear to be true - in most cases it was just getting lucky based off the alphanumeric sorting that was being performed and the choice of the resource pipe names in most scheduler models (Intel models in particular).

This patch adds an explicit sort, based off llvm-mca's initializeUsedResources, that sorts by resource mask - I'm hoping this basic sorting is enough, I don't think overlapping groups or Super resources are a problem.

I'd like to take this further in the future and start sharing more code between llvm-mca and llvm-exegesis - while triaging this bug I saw how similar both approaches are, but are just dissimilar enough that any refactor isn't going to be trivial :(

Working with @courbet on a follow up unit test

Fixes #58500
Fixes #37045

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




More information about the All-commits mailing list