This is an archive of the discontinued LLVM Phabricator instance.

tsan: remove the stats subsystem
ClosedPublic

Authored by dvyukov on Jul 19 2021, 7:22 AM.

Details

Summary

I don't think the stat subsystem was ever used since tsan
development in 2012. But it adds lots of code and this
effectively dead code needs to be updated if the runtime
code changes, which adds maintanance cost for no benefit.
Normal profiler usually gives enough info and that info
is more trustworthy.
Remove the stats subsystem.

Diff Detail

Event Timeline

dvyukov created this revision.Jul 19 2021, 7:22 AM
dvyukov requested review of this revision.Jul 19 2021, 7:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2021, 7:22 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.Jul 19 2021, 11:26 AM
This revision is now accepted and ready to land.Jul 19 2021, 11:26 AM
This revision was landed with ongoing or failed builds.Jul 19 2021, 10:47 PM
This revision was automatically updated to reflect the committed changes.

Too bad I missed the few hours between the post of the review and the actual commit.

The stats helped a lot in understanding terrific runtime overhead, that we see for certain OpenMP applications doing massively shared reads (like all threads concurrently read the shared vector in a matrix-vector multiplication). I hope to post a patch for review soon to reduce the runtime overhead in such situations.

Too bad I missed the few hours between the post of the review and the actual commit.

The stats helped a lot in understanding terrific runtime overhead, that we see for certain OpenMP applications doing massively shared reads (like all threads concurrently read the shared vector in a matrix-vector multiplication). I hope to post a patch for review soon to reduce the runtime overhead in such situations.

Interesting. You recompiled tsan runtime with stats enabled? What exactly did you observe in the stats that allowed you to pinpoint the problem?
Is this problem visible in the normal profile (e.g. perf)? Perf should point to this place as well, and it provides stacks and pointer to the user code that triggers this, and it's much more trustable and actionable (shows actual percent of time spent rather than some abstract numbers). In my experience perf is just a better answer for all situations.

compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp