TargetPfmCounters.td 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //===- TargetPfmCounters.td - Target Pfm Counters -*- tablegen ----------*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file defines the target-independent interfaces for performance counters.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. // Definition of a hardware counters from libpfm identifiers.
  13. class PfmCounter<string counter> {
  14. // The name of the counter that measures events.
  15. // The name can be "some_counter + some_other_counter", in which case the
  16. // measured value is the sum of events on these counters.
  17. string Counter = counter;
  18. }
  19. // Issue counters can be tied to a ProcResource
  20. class PfmIssueCounter<string resource_name, string counter>
  21. : PfmCounter<counter> {
  22. // The name of the ProcResource on which uops are issued. This is used by
  23. // llvm-exegesis to compare measurements with values in the SchedModels.
  24. // If the CPU has a sched model, this should correspond to the name of a
  25. // ProcResource.
  26. string ResourceName = resource_name;
  27. }
  28. def NoPfmCounter : PfmCounter <""> {}
  29. // Set of PfmCounters for measuring sched model characteristics.
  30. class ProcPfmCounters {
  31. // Processors can define how to measure cycles by defining a CycleCounter.
  32. PfmCounter CycleCounter = NoPfmCounter;
  33. // Processors can define how to measure uops by defining a UopsCounter.
  34. PfmCounter UopsCounter = NoPfmCounter;
  35. // Processors can define how to measure issued uops by defining IssueCounters.
  36. list<PfmIssueCounter> IssueCounters = [];
  37. }
  38. // A binding of a set of counters to a CPU.
  39. class PfmCountersBinding<string cpu_name, ProcPfmCounters counters> {
  40. string CpuName = cpu_name;
  41. ProcPfmCounters Counters = counters;
  42. }
  43. // Declares the default binding for unbound CPUs for the target.
  44. class PfmCountersDefaultBinding<ProcPfmCounters counters>
  45. : PfmCountersBinding<"", counters> {}