[all-commits] [llvm/llvm-project] ebe09e: [FSAFDO] Improve FS discriminator encoding
xur-llvm via All-commits
all-commits at lists.llvm.org
Thu Mar 9 23:19:50 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ebe09e2a9556c411809f6c27f555299273442664
https://github.com/llvm/llvm-project/commit/ebe09e2a9556c411809f6c27f555299273442664
Author: Rong Xu <xur at google.com>
Date: 2023-03-09 (Thu, 09 Mar 2023)
Changed paths:
M llvm/include/llvm/IR/DebugInfoMetadata.h
M llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.cpp
M llvm/lib/CodeGen/MIRFSDiscriminator.cpp
M llvm/lib/CodeGen/MIRSampleProfile.cpp
M llvm/lib/CodeGen/PseudoProbeInserter.cpp
M llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
A llvm/test/CodeGen/X86/Inputs/fsloader_v1.afdo
M llvm/test/CodeGen/X86/fsafdo_test1.ll
M llvm/test/CodeGen/X86/fsafdo_test2.ll
M llvm/test/CodeGen/X86/fsafdo_test3.ll
M llvm/test/CodeGen/X86/fsafdo_test4.ll
Log Message:
-----------
[FSAFDO] Improve FS discriminator encoding
This change improves FS discriminators in the following ways:
(1) use call-stack debug information in the the to generate
discriminators: the same (src/line) DILs can now have same
discriminator value if they come from different call-stacks.
This effectively increases the usable discriminator values
for each round of FS discriminator pass.
(2) don't generate the FS discriminator for meta instructions
(i.e. instructions not emitted). This reduces the number
discriminators conflicts (for the case we run out of discriminator
bits for that pass).
(3) use less expensive hashing of xxHash64.
These improvements should bring better performance for FSAFDO
and they should be used by default. But this change creates
incompatible FS discriminators. For the iterative profile users,
they might see a performance drop in the first release with
this change (due to the fact that the profiles have the old
discriminators and the compiler uses the new discriminator).
We have measured that this is not more than 1.5% on several
benchmarks. Note the degradation should be gone in the second
release and one should expect a performance gain over the binary
without this change.
One possible solution to the iterative profile issue would be
separating discriminators for profile-use and the ones emitted to
the binary. This would require a mechanism to allow two sets of
discriminators to be maintained and then phasing out the first
approach. This is too much churn in the compiler and the
performance implications do not seem to be worth the effort.
Instead, we put the changes under an option so iterative profile
users can do a gradual rollout of this change. We will make the
option default value to true in a later patch and eventually
purge this option from the code base.
Differential Revision: https://reviews.llvm.org/D145171
More information about the All-commits
mailing list