Repository navigation
Conversation
ca98095 to
ea3b1c7
Compare
|
Tanks for the patch! Could you add a comment with the rationale of the fix, please? And maybe a reference to a KB article or whatever Microsoft doc describing the specifics? |
|
I couldn't find a KB article or an explicit mention of this in the Microsoft documentation. I think that avoiding sparse files will reduce fragmentation and improve the performance. |
…map() This patch fixes swiftlang/llvm-project / issues / 12605 (avoid ref for now). We have reproduced the issue on x86_64 too running 2000 processes simultaneously. It is hard to create a stable test for this patch.
ea3b1c7 to
c04f8ac
Compare
|
I tried this patch with our standalone repro, and it fixes the symptom we saw in CI. The driver passes At the end,
In the repro, this patch brings the depscan failures to 0, but cc1 writes are still lost. Only when cc1 also closes the CAS before exiting do we get 0 lost writes. Since cc1 stores the compile result, I'd expect the issues later, on cache hits. Upstream already destroys one object explicitly under if (Clang->getFrontendOpts().DisableFree) {
// DiagnosticConsumer must be always destroyed.
Clang->getDiagnosticClient().~DiagnosticConsumer();
llvm::BuryPointer(std::move(Clang));The CAS needs the same: release the |
|
@tagolog CompileJobCache::initialize() calls CompilerInstance::getOrCreateCASDatabases() -> getCASOpts().createDatabases() -> CASConfiguration::createDatabases() CompileJobCache stores Note it is shared_ptr, not unique_ptr. I think it is necessary to keep CAS and Cache inside CacheBackend too. The variable Clang (CompilerInstance) inside cc1_main() does not store CAS ObjectStore or ActionCache. |
|
CAS and Cache objects are not destroyed at the end of cc1_main() because the shared_ptr ref counter is still 1. |
|
Note cc1_main() destroys JobCache and CAS & Cache objects in case of hit and early exit here |
|
Ok, Clang (CompilerInstance) stores the copy In the patch for swiftlang we need to release them at the end of cc1_main() in case of DisableFree. |
|
Agreed, let's split it. I vote for you to proceed with the mainline PR for the |
This patch fixes swiftlang/llvm-project / issues / 12605 (avoid ref for now).
We have reproduced the issue on x86_64 too running 2000 processes simultaneously.
It is hard to create a stable test for this patch.