> > I remember we had issues with streaming running in parallel with > threads. Can't we get here corruption without atomic updates of nndoes > and the next pointer? > > I also remember that these parlalel updates was pretty bad, because if > you have multithreaded concurent update of very frequent indirect > branch, like in firefox, the likelyness that update happens between > pruning and quite slow stream-out is high. > > One option would be to do the skipping non-destructivly while streaming > out. Other option would be to have global flag and turn off topn profile > collecting while streaming is in progress.
Actually this would be only issue if we asked for reproducible profile and in that case all this logic is useless, so I suppose parallel update is not that much of an issue. So I guess this is OK as long as we do not corrupt the datastructure. However for profile-reproducibilty=multithreaded the profile pruning will disable optimization even in case of indirect calls with fewer than 32 targets. I suppose this is something we can track incrementally for gcc12, but we should not forget completely. Perhaps by adding comment into the place we drop profile. So I think we should 1) add the dump message when profile is dropped and add TODO comment that pruning interfere with multithreaded mode next to the conditional. 2) ensure that datstructure is not corrupted And it should be good for gcc11? Honza