Description
Go PGO documentation shows support for merging multiple PGO profiles. However, as far as I see, there is no support for adding a weight to each profile. I quickly checked the pprof
merge implementation and also didn't find a way to add weights to profiles for the merge operation.
In the current guideline already there is a note about merging multiple profiles into one:
Merge profiles across workloads: take profiles from each workload (weighted by total footprint) and merge them into a single “fleet-wide” profile used to build a single common profile used to build. This likely provides modest performance improvements for all workloads.
But it also says nothing about adding weights to the profiles.
The use case for such functionality is the following. We gathered N profiles from different workloads. According to our needs, one workload is our primary workload, and others are secondaries. So we want to add some multiplier to optimize as much as possible for our main workload, and optimize for our secondary workloads too but with a lower priority.
llvm-profdata
tool supports weighted merge (here are some invocation examples).
Right now I see the following ways, how it can be mitigated:
- (an easy way) If we want to perform merging for profiles A and B with weights 2 and 1 correspondingly, we need to copy A profile, then merge 3 profiles: A, A_copy, B. In theory, it would be equal to the weight 2 near the A profile. However, not the best UX.
- (a hard way) Parse PGO profiles somehow and tweak internal counters with some weight multiplier. Doable but hard to implement.
If you think having such functionality is important for PGO users in Go, I kindly ask implement it. Before the weight implementation, we can put the temporal mitigations to the documentation (of course if they work - I didn't test them yet). Probably it will require some changes on the pprof
side.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status