Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/llvm/Target/TargetPfmCounters.td is written in an unsupported language. File is not indexed.

0001 //===- TargetPfmCounters.td - Target Pfm Counters -*- tablegen ----------*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file defines the target-independent interfaces for performance counters.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 // Definition of a hardware counters from libpfm identifiers.
0014 class PfmCounter<string counter> {
0015   // The name of the counter that measures events.
0016   // The name can be "some_counter + some_other_counter", in which case the
0017   // measured value is the sum of events on these counters.
0018   string Counter = counter;
0019 }
0020 
0021 // Issue counters can be tied to a ProcResource
0022 class PfmIssueCounter<string resource_name, string counter>
0023     : PfmCounter<counter> {
0024   // The name of the ProcResource on which uops are issued. This is used by
0025   // llvm-exegesis to compare measurements with values in the SchedModels.
0026   // If the CPU has a sched model, this should correspond to the name of a
0027   // ProcResource.
0028   string ResourceName = resource_name;
0029 }
0030 
0031 // Definition of a validation event. A validation event represents a specific
0032 // event that can be measured using performance counters that is interesting
0033 // in regard to the snippet state.
0034 class ValidationEvent <int event_number> {
0035   int EventNumber = event_number;
0036 }
0037 
0038 // TableGen names for events defined in `llvm::exegesis::ValidationEvent`.
0039 def InstructionRetired  : ValidationEvent<0>;
0040 def L1DCacheLoadMiss : ValidationEvent<1>;
0041 def L1DCacheStoreMiss : ValidationEvent<2>;
0042 def L1ICacheLoadMiss : ValidationEvent<3>;
0043 def DataTLBLoadMiss : ValidationEvent<4>;
0044 def DataTLBStoreMiss : ValidationEvent<5>;
0045 def InstructionTLBLoadMiss : ValidationEvent<6>;
0046 def BranchPredictionMiss : ValidationEvent<7>;
0047 
0048 
0049 // PfmValidationCounter provides a mapping between the events that are
0050 // are interesting in regards to the snippet execution environment and
0051 // a concrete performance counter name that can be looked up in libpfm.
0052 class PfmValidationCounter<ValidationEvent event_type, string counter>
0053     : PfmCounter<counter> {
0054   // The name of the event that the validation counter detects.
0055   ValidationEvent EventType = event_type;
0056 }
0057 
0058 def NoPfmCounter : PfmCounter <""> {}
0059 
0060 // Set of PfmCounters for measuring sched model characteristics.
0061 class ProcPfmCounters {
0062   // Processors can define how to measure cycles by defining a CycleCounter.
0063   PfmCounter CycleCounter = NoPfmCounter;
0064   // Processors can define how to measure uops by defining a UopsCounter.
0065   PfmCounter UopsCounter = NoPfmCounter;
0066   // Processors can define how to measure issued uops by defining IssueCounters.
0067   list<PfmIssueCounter> IssueCounters = [];
0068   // Processor can list mappings between validation events and real counters
0069   // to measure the specified events.
0070   list<PfmValidationCounter> ValidationCounters = [];
0071 }
0072 
0073 // A binding of a set of counters to a CPU.
0074 class PfmCountersBinding<string cpu_name, ProcPfmCounters counters> {
0075   string CpuName = cpu_name;
0076   ProcPfmCounters Counters = counters;
0077 }
0078 
0079 // Declares the default binding for unbound CPUs for the target.
0080 class PfmCountersDefaultBinding<ProcPfmCounters counters>
0081     : PfmCountersBinding<"", counters> {}