Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions mlir/lib/IR/MLIRContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,16 @@ class MLIRContextImpl {
if (threadingIsEnabled) {
ownedThreadPool = std::make_unique<llvm::DefaultThreadPool>();
threadPool = ownedThreadPool.get();
} else {
disableUniquerMultithreading(true);
}
}
/// Update the threading mode for each of the uniquers.
void disableUniquerMultithreading(bool disable) {
affineUniquer.disableMultithreading(disable);
attributeUniquer.disableMultithreading(disable);
typeUniquer.disableMultithreading(disable);
}
~MLIRContextImpl() {
for (auto typeMapping : registeredTypes)
typeMapping.second->~AbstractType();
Expand Down Expand Up @@ -624,10 +632,7 @@ void MLIRContext::disableMultithreading(bool disable) {

impl->threadingIsEnabled = !disable;

// Update the threading mode for each of the uniquers.
impl->affineUniquer.disableMultithreading(disable);
impl->attributeUniquer.disableMultithreading(disable);
impl->typeUniquer.disableMultithreading(disable);
impl->disableUniquerMultithreading(disable);

// Destroy thread pool (stop all threads) if it is no longer needed, or create
// a new one if multithreading was re-enabled.
Expand Down
Loading