Add overlap functionality to llvm-profdata tool to compute the similarity between two profile files.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
llvm/docs/CommandGuide/llvm-profdata.rst | ||
---|---|---|
240 ↗ | (On Diff #196121) | match underscore length with word. |
250 ↗ | (On Diff #196121) | show --> overlap |
253 ↗ | (On Diff #196121) | as follows |
258 ↗ | (On Diff #196121) | add space between ')' and 'and' |
259 ↗ | (On Diff #196121) | what does 'unique' mean here? |
270 ↗ | (On Diff #196121) | This definition of 'overlap' captures branch probability well (relatvie), but loses the information on absolute count. There should be an option to measure that. |
llvm/docs/CommandGuide/llvm-profdata.rst | ||
---|---|---|
259 ↗ | (On Diff #196121) | I changed to "unmatched counters (or counters only existing in) " |
270 ↗ | (On Diff #196121) | You are right that it does not computer the absolute counter difference. The overlap is actually the overlap of distribution of the counts. The summary of the overlap does print out the sum of the counts for both profiles. But the absolute counter difference is not the main purpose. |
llvm/docs/CommandGuide/llvm-profdata.rst | ||
---|---|---|
268 ↗ | (On Diff #196347) | not --> no |
286 ↗ | (On Diff #196347) | -o=output or -o output |
llvm/lib/ProfileData/InstrProf.cpp | ||
1210 ↗ | (On Diff #196347) | For function level dump, the # of function is redundant -- perhaps change it to # of counters The overall dump format looks better with this:
|
1211 ↗ | (On Diff #196347) | The header and content does not match in fields. |
llvm/lib/ProfileData/InstrProfWriter.cpp | ||
190 ↗ | (On Diff #196347) | Why is this a writer method? |
llvm/tools/llvm-profdata/llvm-profdata.cpp | ||
223 ↗ | (On Diff #196347) | The title print including the summary can be pushed into FuncOverlap::dump() method |
228 ↗ | (On Diff #196347) | The title can be pushed into FunctionOverlap::dump() method. |
llvm/docs/CommandGuide/llvm-profdata.rst | ||
---|---|---|
286 ↗ | (On Diff #196347) | it does take -output. |
llvm/lib/ProfileData/InstrProf.cpp | ||
1210 ↗ | (On Diff #196347) | I will change to this format. add number of counts to function level is a good idea. |
1211 ↗ | (On Diff #196347) | why this does not match? |
llvm/lib/ProfileData/InstrProfWriter.cpp | ||
190 ↗ | (On Diff #196347) | because this reuses the merge framework (load the base profile to write context) and load the second one to do the overlap calculation. |
llvm/tools/llvm-profdata/llvm-profdata.cpp | ||
223 ↗ | (On Diff #196347) | This would require to put a flag in the structure to distinguish whether this is function level or program level. It can be done. |
228 ↗ | (On Diff #196347) | This would require add both profile file name to the structure. |
llvm/include/llvm/ProfileData/InstrProf.h | ||
---|---|---|
594 ↗ | (On Diff #196884) | How to tell if count or percentage is stored here? |
597 ↗ | (On Diff #196884) | The name EdgeCount is misleading -- it sounds like number of 'edges' in CFG. Perhaps just 'TotalCount' or 'CountSum' |
612 ↗ | (On Diff #196884) | BaseSum-->Base |
614 ↗ | (On Diff #196884) | TestSum --> Test |
llvm/lib/ProfileData/InstrProf.cpp | ||
482 ↗ | (On Diff #196884) | This is not 'getCountSums' -- but 'accumuateCounts' -- perhaps rename it. |
511 ↗ | (On Diff #196884) | The loop nest can be merged into one single loop: while (i != ie && j != je) { if (i->v == j->v) { //match: ... i++; j++; } else if (i->v > j->v) { j++; // handle mismatch case -- as one value appears in only one record (assuming count == 0) ... } else { i++; // handle mismatch } } // handle the rest of the mismatched cases. } |
553 ↗ | (On Diff #196884) | already be computed and is nonzero |
560 ↗ | (On Diff #196884) | Perhaps just check the function hash? |
596 ↗ | (On Diff #196884) | += or just = ? |
llvm/tools/llvm-profdata/llvm-profdata.cpp | ||
212 ↗ | (On Diff #196884) | -> silently I don't see a return here. |
llvm/include/llvm/ProfileData/InstrProf.h | ||
---|---|---|
594 ↗ | (On Diff #196884) | The caller should keep track of this. This data structure does not know -- it just a floating points. |
llvm/lib/ProfileData/InstrProf.cpp | ||
511 ↗ | (On Diff #196884) | Yes. The version I used is a copy from merge function. |
553 ↗ | (On Diff #196884) | Yes. it's true for call chains in this patch. |
560 ↗ | (On Diff #196884) | FuncHash already being checked (In Reader). This is just to handle the cases that escapes the hash check. |
596 ↗ | (On Diff #196884) | they are the same. the incoming value should be 0 by the initializer. |
llvm/tools/llvm-profdata/llvm-profdata.cpp | ||
---|---|---|
212 ↗ | (On Diff #196884) | fixed |
Discussed offline with David. We changed the output to a simpler: "Description: <Value>" format. This tool will mostly used in a script. Simpler format will make text grep cleaner.
llvm/lib/ProfileData/InstrProfWriter.cpp | ||
---|---|---|
219 ↗ | (On Diff #197161) | setting to zero so that the comparison always true in function InstrProfRecord::overlap() (so that we output function level information). |
Adjusted the output string with David's comments.
Also made the naming more uniformed for edge and value profiles.