[PATCH] D107800: [CSSPGO][llvm-profgen] Cap context stack to reduce memory usage
Lei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 11 15:03:16 PDT 2021
wlei added inline comments.
================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:73
+int CSProfileGenerator::MaxContextDepth = -1;
+
----------------
spupyrev wrote:
> The default value of "no trimming" sounds strange to me. Do we know if trimming may affect performance? If yes, we shouldn't trim. If no, we should have a reasonable bound here.
> Do we know if trimming may affect performance?
It depends on how compiler consumes the context, if the profile context is [a @ b @ c @ d] but compiler only inline d to c and stop inlining at c, then the [a @ b @] can be trimmed. Another things is the profile size tradeoff, before we did merge and trim cold profile after all samples is generated. This patch tried to move the merging ahead as we encountered the memory issues. it doesn't drop the sample.
>If no, we should have a reasonable bound here.
Good question, but I don't know what's the reasonable bound yet. As you see the above comments, SPEC benchmark's max inline depth can vary from 5 to 26, the clang-10 binary even have a 51 max depth. and we didn't get memory issue for SPEC, so SPEC can set to -1.
so it's the tradeoff between many things, what's in my mind is to default it `-1` and we can tune it on-demand. what do you think?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107800/new/
https://reviews.llvm.org/D107800
More information about the llvm-commits
mailing list