From cTuning.org
(Difference between revisions)
(New page: {{CMenu:CTools|MilepostGCC}} '''Static Features available in MILEPOST GCC V2.1''': * Mircea Namolaru (IBM) developed the first version of the feature extractor for MILEPOST GCC and Grigo...) |
Current revision (23:11, 16 March 2010) (view source) |
||
Line 192: | Line 192: | ||
| ft57 | | ft57 | ||
| | | | ||
+ | CYCLOMATIC COMPLEXITY | ||
+ | N == number of return instrs in fn | ||
+ | N1 == number of cond instrs in fn | ||
+ | N2 == N1-N | ||
+ | N3 == N2+2. definition of cyclomatic complexity from: | ||
+ | http://en.wikipedia.org/wiki/Cyclomatic_complexity | ||
|- | |- | ||
| ft58 | | ft58 | ||
| | | | ||
+ | Jeremy Singer addition: | ||
+ | HALSTEAD's METRICS described at http://en.wikipedia.org/wiki/Halstead_complexity_measures | ||
+ | |||
+ | HN2 is total number of operands (Halstead N2) | ||
|- | |- | ||
| ft59 | | ft59 | ||
- | | | + | | Hn2 is number of distinct operands (Halstead n2) |
|- | |- | ||
| ft60 | | ft60 | ||
- | | | + | | N is num var defs (should be == Halstead n2 or Halstead N2?) |
|- | |- | ||
| ft61 | | ft61 | ||
- | | | + | | HN1 is total number of operators (Halstead N1) (approx due to abstraction) |
|- | |- | ||
| ft62 | | ft62 | ||
- | | | + | | Hn1 is number of distinct operators (Halstead n1) (approx due to abstraction) |
|- | |- | ||
| ft63 | | ft63 | ||
| | | | ||
+ | approx of Halstead difficulty D == Hn1/2 * (HN2 / Hn2) | ||
+ | (NB uses the aver routine to avoid problems with 0 divisor in | ||
+ | computation of HN2/Hn2) | ||
|- | |- | ||
| ft64 | | ft64 | ||
| | | | ||
+ | approx of Halstead volume | ||
+ | volume == HN *log_2(Hn) | ||
+ | where HN == HN1+HN2 | ||
+ | and Hn == Hn1+Hn2 | ||
|- | |- | ||
| ft65 | | ft65 | ||
| | | | ||
+ | approx of Halstead effort, which | ||
+ | == Difficulty * Volume | ||
|} | |} | ||
- | |||
- |
Current revision
Navigation: cTuning.org > CTools > MilepostGCC
Static Features available in MILEPOST GCC V2.1:
- Mircea Namolaru (IBM) developed the first version of the feature extractor for MILEPOST GCC and Grigori Fursin (INRIA/UVSQ) integrated it within the MILEPOST GCC and cTuning framework together with the machine learning support to predict good optimizations.
- Jeremy Singer (University of Manchester) provided extensions
- We are currently extending feature extractor to improve program characterization and mapping with beneficial optimizations.
- We are looking for volunteers to add more features such as polyhedral representation features, hardware counter features, etc.
File featlstn.P - 55 features (removed duplicate feature ft21)
ft1 | Number of basic blocks in the method |
ft2 | Number of basic blocks with a single successor |
ft3 | Number of basic blocks with two successors |
ft4 | Number of basic blocks with more then two successors |
ft5 | Number of basic blocks with a single predecessor |
ft6 | Number of basic blocks with two predecessors |
ft7 | Number of basic blocks with more then two predecessors |
ft8 | Number of basic blocks with a single predecessor and a single successor |
ft9 | Number of basic blocks with a single predecessor and two successors |
ft10 | Number of basic blocks with a two predecessors and one successor |
ft11 | Number of basic blocks with two successors and two predecessors |
ft12 | Number of basic blocks with more then two successors and more then two predecessors |
ft13 | Number of basic blocks with number of instructions less then 15 |
ft14 | Number of basic blocks with number of instructions in the interval [15, 500] |
ft15 | Number of basic blocks with number of instructions greater then 500 |
ft16 | Number of edges in the control flow graph |
ft17 | Number of critical edges in the control flow graph |
ft18 | Number of abnormal edges in the control flow graph |
ft19 | Number of direct calls in the method |
ft20 | Number of conditional branches in the method |
ft21 | Number of assignment instructions in the method |
ft22 | Number of binary integer operations in the method |
ft23 | Number of binary floating point operations in the method |
ft24 | Number of instructions in the method |
ft25 | Average of number of instructions in basic blocks |
ft26 | Average of number of phi-nodes at the beginning of a basic block |
ft27 | Average of arguments for a phi-node |
ft28 | Number of basic blocks with no phi nodes |
ft29 | Number of basic blocks with phi nodes in the interval [0, 3] |
ft30 | Number of basic blocks with more then 3 phi nodes |
ft31 | Number of basic block where total number of arguments for all phi-nodes is in greater then 5 |
ft32 | Number of basic block where total number of arguments for all phi-nodes is in the interval [1, 5] |
ft33 | Number of switch instructions in the method |
ft34 | Number of unary operations in the method |
ft35 | Number of instruction that do pointer arithmetic in the method |
ft36 | Number of indirect references via pointers ("*" in C) |
ft37 | Number of times the address of a variables is taken ("\&" in C) |
ft38 | Number of times the address of a function is taken ("\&" in C) |
ft39 | Number of indirect calls (i.e. done via pointers) in the method |
ft40 | Number of assignment instructions with the left operand an integer constant in the method |
ft41 | Number of binary operations with one of the operands an integer constant in the method |
ft42 | Number of calls with pointers as arguments |
ft42 | Number of calls with the number of arguments is greater then 4 |
ft44 | Number of calls that return a pointer |
ft45 | Number of calls that return an integer |
ft46 | Number of occurrences of integer constant zero |
ft47 | Number of occurrences of 32-bit integer constants |
ft48 | Number of occurrences of integer constant one |
ft49 | Number of occurrences of 64-bit integer constants |
ft50 | Number of references of a local variables in the method |
ft51 | Number of references (def/use) of static/extern variables in the method |
ft52 | Number of local variables referred in the method |
ft53 | Number of static/extern variables referred in the method |
ft54 | Number of local variables that are pointers in the method |
ft55 | Number of static/extern variables that are pointers in the method |
File featlstn1.P - 56 features (move duplicate feature to ft56)
ft56 | Number of unconditional branches in the method |
File featlstn2.P - 65 features (ft57-65 features have been added by Jeremy Singer)
ft57 |
CYCLOMATIC COMPLEXITY N == number of return instrs in fn N1 == number of cond instrs in fn N2 == N1-N N3 == N2+2. definition of cyclomatic complexity from: http://en.wikipedia.org/wiki/Cyclomatic_complexity |
ft58 |
Jeremy Singer addition: HALSTEAD's METRICS described at http://en.wikipedia.org/wiki/Halstead_complexity_measures HN2 is total number of operands (Halstead N2) |
ft59 | Hn2 is number of distinct operands (Halstead n2) |
ft60 | N is num var defs (should be == Halstead n2 or Halstead N2?) |
ft61 | HN1 is total number of operators (Halstead N1) (approx due to abstraction) |
ft62 | Hn1 is number of distinct operators (Halstead n1) (approx due to abstraction) |
ft63 |
approx of Halstead difficulty D == Hn1/2 * (HN2 / Hn2) (NB uses the aver routine to avoid problems with 0 divisor in computation of HN2/Hn2) |
ft64 |
approx of Halstead volume volume == HN *log_2(Hn) where HN == HN1+HN2 and Hn == Hn1+Hn2 |
ft65 |
approx of Halstead effort, which == Difficulty * Volume |