[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-26 Thread Alexandre Ganea via cfe-commits
aganea wrote: Thanks for pointing that out @MaskRay ! https://github.com/llvm/llvm-project/pull/88427 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-25 Thread Fangrui Song via cfe-commits
MaskRay wrote: (BTW: https://discourse.llvm.org/t/hidden-emails-on-github-should-we-do-something-about-it/74223 The recommendation is to avoid the github "hidden email" feature.) https://github.com/llvm/llvm-project/pull/88427 ___ cfe-commits

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-25 Thread Alexandre Ganea via cfe-commits
https://github.com/aganea closed https://github.com/llvm/llvm-project/pull/88427 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-24 Thread Alexandre Ganea via cfe-commits
aganea wrote: > LGTM, thanks! Thanks for the review! > (Out of interest, what machine are you seeing the contention with?) It's a ThreadRipper Pro 3975WX 32c/64t running on with Windows 11. https://github.com/llvm/llvm-project/pull/88427 ___

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-24 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: (Out of interest, what machine are you seeing the contention with?) https://github.com/llvm/llvm-project/pull/88427 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/88427 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-24 Thread Alexandre Ganea via cfe-commits
@@ -1293,6 +1293,10 @@ compileModuleImpl(CompilerInstance , SourceLocation ImportLoc, diag::remark_module_build_done) << ModuleName; + // Propagate the statistics to the parent FileManager. + if

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-24 Thread Alexandre Ganea via cfe-commits
https://github.com/aganea updated https://github.com/llvm/llvm-project/pull/88427 >From 1b11d526e2cde1df64c7c4e05b2698b6d40926c3 Mon Sep 17 00:00:00 2001 From: Alexandre Ganea Date: Thu, 11 Apr 2024 13:02:30 -0400 Subject: [PATCH 1/3] [clang-scan-deps] Fix atomic contention when updating

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-18 Thread Jan Svoboda via cfe-commits
@@ -1293,6 +1293,10 @@ compileModuleImpl(CompilerInstance , SourceLocation ImportLoc, diag::remark_module_build_done) << ModuleName; + // Propagate the statistics to the parent FileManager. + if

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-17 Thread Alexandre Ganea via cfe-commits
aganea wrote: > As an alternative approach: could we turn these into member variables, make > them non-atomic and take care to update the stats of the superior > `FileManager` whenever an inferior `FileManager` goes out of scope? (e.g. > after implicitly building a module) As suggested.

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-17 Thread Alexandre Ganea via cfe-commits
https://github.com/aganea updated https://github.com/llvm/llvm-project/pull/88427 >From 1b11d526e2cde1df64c7c4e05b2698b6d40926c3 Mon Sep 17 00:00:00 2001 From: Alexandre Ganea Date: Thu, 11 Apr 2024 13:02:30 -0400 Subject: [PATCH 1/2] [clang-scan-deps] Fix atomic contention when updating

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-13 Thread Alexandre Ganea via cfe-commits
aganea wrote: I think in the short term @jansvoboda11's suggestion should be good enough. Bit if we want `Statistics` to be always cheap, we should make them `thread_local` instead, not atomic. `getValue()` could do the "collection" of data over all active, or past threads. It would also

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-12 Thread Volodymyr Sapsai via cfe-commits
vsapsai wrote: The bigger idea is that not enabled stats should be negligibly cheap. As for me, the problem is in that not being true. Let me check how we have expensive stats all the time. Extra fixes are good but I'm concerned they help only with these specific stats while others might

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-12 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: I'd like for @vsapsai to chime in. As an alternative approach: could we turn these into member variables, make them non-atomic and take care to update the stats of the superior `FileManager` whenever an inferior `FileManager` goes out of scope? (e.g. after implicitly

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-11 Thread Alexandre Ganea via cfe-commits
https://github.com/aganea edited https://github.com/llvm/llvm-project/pull/88427 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-11 Thread Alexandre Ganea via cfe-commits
https://github.com/aganea edited https://github.com/llvm/llvm-project/pull/88427 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-11 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Alexandre Ganea (aganea) Changes `FileManager::getDirectoryRef` and `FileManager::getFileRef` are hot code paths in `clang-scan-deps`. In these functions, we update a couple of atomic variables related to printing statistics, which

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-11 Thread Alexandre Ganea via cfe-commits
https://github.com/aganea created https://github.com/llvm/llvm-project/pull/88427 `FileManager::getDirectoryRef` and `FileManager::getFileRef` are hot code paths in `clang-scan-deps`. In these functions, we update a couple of atomic variables related to printing statistics, which causes