|
MLIR 24.0.0git
|
MLIRContext is the top-level object for a collection of MLIR operations. More...
#include "mlir/IR/MLIRContext.h"
Classes | |
| class | TransientScope |
| RAII scope guard that calls beginTransientScope() on construction and endTransientScope() on destruction. More... | |
Public Types | |
| enum class | Threading { DISABLED , ENABLED } |
| using | HandlerTy |
| Signatures for the action handler that can be registered with the context. | |
Public Member Functions | |
| MLIRContext (Threading multithreading=Threading::ENABLED) | |
| Create a new Context. | |
| MLIRContext (const DialectRegistry ®istry, Threading multithreading=Threading::ENABLED) | |
| ~MLIRContext () | |
| std::vector< Dialect * > | getLoadedDialects () |
| Return information about all IR dialects loaded in the context. | |
| const DialectRegistry & | getDialectRegistry () |
| Return the dialect registry associated with this context. | |
| void | appendDialectRegistry (const DialectRegistry ®istry) |
| Append the contents of the given dialect registry to the registry associated with this context. | |
| std::vector< StringRef > | getAvailableDialects () |
| Return information about all available dialects in the registry in this context. | |
| Dialect * | getLoadedDialect (StringRef name) |
| Get a registered IR dialect with the given namespace. | |
| template<typename T> | |
| T * | getLoadedDialect () |
| Get a registered IR dialect for the given derived dialect type. | |
| template<typename T> | |
| T * | getOrLoadDialect () |
| Get (or create) a dialect for the given derived dialect type. | |
| template<typename Dialect> | |
| void | loadDialect () |
| Load a dialect in the context. | |
| template<typename Dialect, typename OtherDialect, typename... MoreDialects> | |
| void | loadDialect () |
| Load a list dialects in the context. | |
| DynamicDialect * | getOrLoadDynamicDialect (StringRef dialectNamespace, function_ref< void(DynamicDialect *)> ctor) |
| Get (or create) a dynamic dialect for the given name. | |
| void | loadAllAvailableDialects () |
| Load all dialects available in the registry in this context. | |
| Dialect * | getOrLoadDialect (StringRef name) |
| Get (or create) a dialect for the given derived dialect name. | |
| bool | allowsUnregisteredDialects () |
| Return true if we allow to create operation for unregistered dialects. | |
| void | allowUnregisteredDialects (bool allow=true) |
| Enables creating operations in unregistered dialects. | |
| void | beginTransientScope () |
| Begins a transient scope on the context, freezing the current state (all loaded dialects, registered operations, types, attributes, affine expressions, and singletons) as the base state. | |
| void | endTransientScope () |
| Ends the transient scope and resets the context to the base state, pruning all types, attributes, affine expressions, distinct attributes, and unregistered operations created during the transient scope. | |
| bool | isInTransientScope () const |
| Returns true if the context is currently in a transient scope. | |
| bool | isMultithreadingEnabled () |
| Return true if multi-threading is enabled by the context. | |
| void | disableMultithreading (bool disable=true) |
| Set the flag specifying if multi-threading is disabled by the context. | |
| void | enableMultithreading (bool enable=true) |
| bool | isThreadSafeLockingEnabled () |
| Return true if thread-safe locking is enabled for context access. | |
| void | enableThreadSafeLocking () |
| Enable thread-safe locking for context access, including uniquing types, attributes, affine expressions, and operation names. | |
| void | setThreadPool (llvm::ThreadPoolInterface &pool) |
| Set a new thread pool to be used in this context. | |
| unsigned | getNumThreads () |
| Return the number of threads used by the thread pool in this context. | |
| llvm::ThreadPoolInterface & | getThreadPool () |
| Return the thread pool used by this context. | |
| bool | shouldPrintOpOnDiagnostic () |
| Return true if we should attach the operation to diagnostics emitted via Operation::emit. | |
| void | printOpOnDiagnostic (bool enable) |
| Set the flag specifying if we should attach the operation to diagnostics emitted via Operation::emit. | |
| bool | shouldPrintStackTraceOnDiagnostic () |
| Return true if we should attach the current stacktrace to diagnostics when emitted. | |
| void | printStackTraceOnDiagnostic (bool enable) |
| Set the flag specifying if we should attach the current stacktrace when emitting diagnostics. | |
| ArrayRef< RegisteredOperationName > | getRegisteredOperations () |
| Return a sorted array containing the information about all registered operations. | |
| ArrayRef< RegisteredOperationName > | getRegisteredOperationsByDialect (StringRef dialectName) |
| Return a sorted array containing the information for registered operations filtered by dialect name. | |
| bool | isOperationRegistered (StringRef name) |
| Return true if this operation name is registered in this context. | |
| MLIRContextImpl & | getImpl () |
| const MLIRContextImpl & | getImpl () const |
| DiagnosticEngine & | getDiagEngine () |
| Returns the diagnostic engine for this context. | |
| remark::detail::RemarkEngine * | getRemarkEngine () |
| Returns the remark engine for this context, or nullptr if none has been set. | |
| void | setRemarkEngine (std::unique_ptr< remark::detail::RemarkEngine > engine) |
| Set the remark engine for this context. | |
| StorageUniquer & | getAffineUniquer () |
| Returns the storage uniquer used for creating affine constructs. | |
| StorageUniquer & | getTypeUniquer () |
| Returns the storage uniquer used for constructing type storage instances. | |
| StorageUniquer & | getAttributeUniquer () |
| Returns the storage uniquer used for constructing attribute storage instances. | |
| void | enterMultiThreadedExecution () |
| These APIs are tracking whether the context will be used in a multithreading environment: this has no effect other than enabling assertions on misuses of some APIs. | |
| void | exitMultiThreadedExecution () |
| Dialect * | getOrLoadDialect (StringRef dialectNamespace, TypeID dialectID, function_ref< std::unique_ptr< Dialect >()> ctor) |
| Get a dialect for the provided namespace and TypeID: abort the program if a dialect exist for this namespace with different TypeID. | |
| llvm::hash_code | getRegistryHash () |
| Returns a hash of the registry of the context that may be used to give a rough indicator of if the state of the context registry has changed. | |
| void | registerActionHandler (HandlerTy handler) |
| Register a handler for handling actions that are dispatched through this context. | |
| const HandlerTy & | getActionHandler () const |
| Return a reference to the currently registered action handler. | |
| HandlerTy & | getActionHandler () |
| bool | hasActionHandler () |
| Return true if a valid ActionHandler is set. | |
| void | executeAction (function_ref< void()> actionFn, const tracing::Action &action) |
| Dispatch the provided action to the handler if any, or just execute it. | |
| template<typename ActionTy, typename... Args> | |
| void | executeAction (function_ref< void()> actionFn, ArrayRef< IRUnit > irUnits, Args &&...args) |
| Dispatch the provided action to the handler if any, or just execute it. | |
MLIRContext is the top-level object for a collection of MLIR operations.
It holds immortal uniqued objects like types, and the tables used to unique them.
MLIRContext gets a redundant "MLIR" prefix because otherwise it ends up with a very generic name ("Context") and because it is uncommon for clients to interact with it.
The context wrap some multi-threading facilities, and in particular by default it will implicitly create a thread pool. This can be undesirable if multiple context exists at the same time or if a process will be long-lived and create and destroy contexts. To control better thread spawning, an externally owned ThreadPool can be injected in the context. For example:
llvm::DefaultThreadPool myThreadPool; while (auto *request = nextCompilationRequests()) { MLIRContext ctx(registry, MLIRContext::Threading::DISABLED); ctx.setThreadPool(myThreadPool); processRequest(request, ctx); }
Clients that manage their own threads can enable thread-safe context access without creating a thread pool or enabling parallel execution within MLIR. Required dialects must be loaded before accessing the context concurrently:
MLIRContext ctx(registry, MLIRContext::Threading::DISABLED); ctx.enableThreadSafeLocking();
Definition at line 71 of file MLIRContext.h.
Signatures for the action handler that can be registered with the context.
Definition at line 345 of file MLIRContext.h.
|
strong |
| Enumerator | |
|---|---|
| DISABLED | |
| ENABLED | |
Definition at line 73 of file MLIRContext.h.
|
explicit |
Create a new Context.
Definition at line 316 of file MLIRContext.cpp.
References MLIRContext().
Referenced by MLIRContext(), mlir::MLIRContext::TransientScope::operator=(), and mlir::MLIRContext::TransientScope::TransientScope().
|
explicit |
Types. Floating-point Types.
Index Type.
Integer Types.
None Type.
of the above types internally. Unknown Location Attribute.
Bool Attributes.
Unit Attribute.
The empty dictionary attribute.
The empty string attribute.
Definition at line 319 of file MLIRContext.cpp.
References mlir::DialectRegistry::appendTo(), clOptions, ENABLED, mlir::detail::AttributeUniquer::get(), mlir::detail::TypeUniquer::get(), getOrLoadDialect(), and isThreadingGloballyDisabled().
| MLIRContext::~MLIRContext | ( | ) |
Definition at line 387 of file MLIRContext.cpp.
|
nodiscard |
Return true if we allow to create operation for unregistered dialects.
Definition at line 615 of file MLIRContext.cpp.
Referenced by doVerifyRoundTrip().
Enables creating operations in unregistered dialects.
This option is heavily discouraged: it is convenient during testing but it is not a good practice to use it in production code. Some system invariants can be broken (like loading a dialect after creating operations) without being caught by assertions or other means.
Definition at line 619 of file MLIRContext.cpp.
Referenced by mlir::lsp::MLIRServer::convertFromBytecode(), doVerifyRoundTrip(), mlir::mlirQueryMain(), mlir::mlirReduceMain(), and mlirTranslateMainImpl().
| void MLIRContext::appendDialectRegistry | ( | const DialectRegistry & | registry | ) |
Append the contents of the given dialect registry to the registry associated with this context.
Definition at line 441 of file MLIRContext.cpp.
References mlir::DialectRegistry::appendTo(), mlir::DialectRegistry::applyExtensions(), and mlir::DialectRegistry::isSubsetOf().
Referenced by doVerifyRoundTrip(), loadIRDLDialects(), mlir::registerAllDialects(), mlir::registerArmNeonDialectTranslation(), mlir::registerArmSMEDialectTranslation(), mlir::registerArmSVEDialectTranslation(), mlir::registerBuiltinDialectTranslation(), mlir::registerGPUDialectTranslation(), mlir::registerLLVMDialectImport(), mlir::registerLLVMDialectTranslation(), mlir::registerNVVMDialectImport(), mlir::registerNVVMDialectTranslation(), mlir::NVVM::registerNVVMTargetInterfaceExternalModels(), mlir::registerOpenMPDialectTranslation(), mlir::registerPtrDialectTranslation(), mlir::registerROCDLDialectTranslation(), mlir::ROCDL::registerROCDLTargetInterfaceExternalModels(), mlir::linalg::registerShardingInterfaceExternalModels(), mlir::registerSPIRVDialectTranslation(), mlir::spirv::registerSPIRVTargetInterfaceExternalModels(), mlir::registerVCIXDialectTranslation(), and mlir::xevm::registerXeVMTargetInterfaceExternalModels().
| void MLIRContext::beginTransientScope | ( | ) |
Begins a transient scope on the context, freezing the current state (all loaded dialects, registered operations, types, attributes, affine expressions, and singletons) as the base state.
Subsequent types, attributes, and expressions allocated will belong to the transient layer.
Preconditions:
Definition at line 711 of file MLIRContext.cpp.
References mlir::MLIRContextImpl::affineUniquer, mlir::MLIRContextImpl::attributeUniquer, mlir::detail::DistinctAttributeAllocator::beginTransientScope(), mlir::StorageUniquer::beginTransientScope(), mlir::MLIRContextImpl::dialectReferencingStrAttrs, mlir::MLIRContextImpl::dialectRefStrAttrMutex, mlir::MLIRContextImpl::distinctAttributeAllocator, getImpl(), mlir::MLIRContextImpl::multiThreadedExecutionContext, mlir::MLIRContextImpl::operationInfoMutex, mlir::MLIRContextImpl::transientState, mlir::MLIRContextImpl::typeUniquer, and mlir::MLIRContextImpl::unregisteredOperationsByName.
Set the flag specifying if multi-threading is disabled by the context.
Return true if multi-threading is enabled by the context.
Enabling multi-threading also enables thread-safe locking. Disabling it also disables thread-safe locking, which can be re-enabled independently with enableThreadSafeLocking(). The command line debugging flag --mlir-disable-threading is overriding this call and making it a no-op!
Set the flag specifying if multi-threading is disabled by the context.
Definition at line 632 of file MLIRContext.cpp.
References isThreadingGloballyDisabled().
Referenced by mlir::PassReproducerOptions::apply(), enableMultithreading(), and performActions().
Definition at line 215 of file MLIRContext.h.
References disableMultithreading().
Referenced by performActions(), and setThreadPool().
| void MLIRContext::enableThreadSafeLocking | ( | ) |
Enable thread-safe locking for context access, including uniquing types, attributes, affine expressions, and operation names.
This does not create a thread pool or change isMultithreadingEnabled(). For example, clients using their own threads can construct a context with Threading::DISABLED and then call enableThreadSafeLocking().
Disabling multi-threading also disables locking. This method must be called when no other threads are accessing the context. Dialects must still be loaded before accessing the context concurrently. Unlike enableMultithreading(), this is not overridden by the debugging flag –mlir-disable-threading.
Definition at line 670 of file MLIRContext.cpp.
| void MLIRContext::endTransientScope | ( | ) |
Ends the transient scope and resets the context to the base state, pruning all types, attributes, affine expressions, distinct attributes, and unregistered operations created during the transient scope.
Preconditions:
Definition at line 742 of file MLIRContext.cpp.
References mlir::MLIRContextImpl::affineUniquer, mlir::MLIRContextImpl::attributeUniquer, mlir::MLIRContextImpl::dialectReferencingStrAttrs, mlir::MLIRContextImpl::dialectRefStrAttrMutex, mlir::MLIRContextImpl::distinctAttributeAllocator, mlir::detail::DistinctAttributeAllocator::endTransientScope(), mlir::StorageUniquer::endTransientScope(), getImpl(), mlir::MLIRContextImpl::multiThreadedExecutionContext, mlir::MLIRContextImpl::operationInfoMutex, mlir::MLIRContextImpl::transientState, mlir::MLIRContextImpl::typeUniquer, and mlir::MLIRContextImpl::unregisteredOperationsByName.
| void MLIRContext::enterMultiThreadedExecution | ( | ) |
These APIs are tracking whether the context will be used in a multithreading environment: this has no effect other than enabling assertions on misuses of some APIs.
Definition at line 700 of file MLIRContext.cpp.
|
inline |
Dispatch the provided action to the handler if any, or just execute it.
Definition at line 371 of file MLIRContext.h.
References hasActionHandler().
|
inline |
Dispatch the provided action to the handler if any, or just execute it.
Definition at line 361 of file MLIRContext.h.
References hasActionHandler().
Referenced by applyConversion(), mlir::PatternApplicator::matchAndRewrite(), and mlir::walkAndApplyPatterns().
| void MLIRContext::exitMultiThreadedExecution | ( | ) |
Definition at line 705 of file MLIRContext.cpp.
| MLIRContext::HandlerTy & MLIRContext::getActionHandler | ( | ) |
Definition at line 404 of file MLIRContext.cpp.
References mlir::MLIRContextImpl::actionHandler, and getImpl().
| const MLIRContext::HandlerTy & MLIRContext::getActionHandler | ( | ) | const |
Return a reference to the currently registered action handler.
Its target can be used to gain access to the handler's state, if any.
Definition at line 400 of file MLIRContext.cpp.
References mlir::MLIRContextImpl::actionHandler, and getImpl().
| StorageUniquer & MLIRContext::getAffineUniquer | ( | ) |
Returns the storage uniquer used for creating affine constructs.
Definition at line 1317 of file MLIRContext.cpp.
References mlir::OperationName::getImpl().
Referenced by mlir::AffineExpr::ceilDiv(), mlir::AffineExpr::floorDiv(), mlir::AffineExpr::operator%(), and mlir::AffineExpr::operator*().
| StorageUniquer & MLIRContext::getAttributeUniquer | ( | ) |
Returns the storage uniquer used for constructing attribute storage instances.
This should not be used directly.
Definition at line 1256 of file MLIRContext.cpp.
References mlir::OperationName::getImpl().
Referenced by mlir::detail::AttributeUniquer::getWithTypeID(), mlir::detail::AttributeUniquer::getWithTypeID(), mlir::detail::AttributeUniquer::mutate(), and mlir::detail::AttributeUniquer::registerAttribute().
| std::vector< StringRef > MLIRContext::getAvailableDialects | ( | ) |
Return information about all available dialects in the registry in this context.
Definition at line 473 of file MLIRContext.cpp.
References result.
Referenced by loadAllAvailableDialects(), and mlir::translateLLVMIRToModule().
| DiagnosticEngine & MLIRContext::getDiagEngine | ( | ) |
Returns the diagnostic engine for this context.
Definition at line 422 of file MLIRContext.cpp.
References mlir::MLIRContextImpl::diagEngine, and getImpl().
Referenced by emitDiag(), and mlir::detail::ParallelDiagnosticHandlerImpl::ParallelDiagnosticHandlerImpl().
| const DialectRegistry & MLIRContext::getDialectRegistry | ( | ) |
Return the dialect registry associated with this context.
Definition at line 457 of file MLIRContext.cpp.
Referenced by doVerifyRoundTrip(), and roundTripModule().
|
inline |
Definition at line 294 of file MLIRContext.h.
Referenced by beginTransientScope(), endTransientScope(), mlir::BoolAttr::get(), getActionHandler(), getActionHandler(), getCachedIntegerType(), getDiagEngine(), getOrLoadDialect(), getOrLoadDynamicDialect(), getRemarkEngine(), hasActionHandler(), mlir::detail::StringAttrStorage::initialize(), isInTransientScope(), mlir::AbstractAttribute::lookup(), mlir::AbstractType::lookup(), mlir::RegisteredOperationName::lookup(), mlir::RegisteredOperationName::lookup(), mlir::OperationName::OperationName(), registerActionHandler(), and setRemarkEngine().
|
inline |
Definition at line 295 of file MLIRContext.h.
|
inline |
Get a registered IR dialect for the given derived dialect type.
The derived type must provide a static 'getDialectNamespace' method.
Definition at line 101 of file MLIRContext.h.
References getLoadedDialect().
Referenced by getLoadedDialect(), and getOrLoadDialect().
| Dialect * MLIRContext::getLoadedDialect | ( | StringRef | name | ) |
Get a registered IR dialect with the given namespace.
If an exact match is not found, then return nullptr.
If none is found, then return nullptr.
Definition at line 482 of file MLIRContext.cpp.
Referenced by mlir::NVVM::SerializeGPUModuleBase::appendStandardLibs(), mlir::DialectRegistry::applyExtensions(), mlir::DialectRegistry::applyExtensions(), combineOneSpec(), mlir::detail::StringAttrStorage::initialize(), mlir::LLVM::isCompatibleType(), keepHostOpInDevice(), mlir::dataflow::maybeReplaceWithConstant(), mergeInto(), movePaddingToFillOrGenericOp(), mlir::populateGpuToROCDLConversionPatterns(), and mlir::writeBytecodeToFile().
| std::vector< Dialect * > MLIRContext::getLoadedDialects | ( | ) |
Return information about all IR dialects loaded in the context.
Return information about all registered IR dialects.
Definition at line 462 of file MLIRContext.cpp.
References result.
Referenced by mlir::DialectRegistry::applyExtensions(), and mlir::detail::DialectInterfaceCollectionBase::DialectInterfaceCollectionBase().
| unsigned MLIRContext::getNumThreads | ( | ) |
Return the number of threads used by the thread pool in this context.
The number of computed hardware threads can change over the lifetime of a process based on affinity changes, so users should use the number of threads actually in the thread pool for dispatching work. Returns 1 if multithreading is disabled.
Definition at line 682 of file MLIRContext.cpp.
References isMultithreadingEnabled().
|
inline |
Get (or create) a dialect for the given derived dialect type.
The derived type must provide a static 'getDialectNamespace' method.
Definition at line 108 of file MLIRContext.h.
References mlir::TypeID::get(), and getOrLoadDialect().
Referenced by mlir::DialectResourceBlobHandle< BuiltinDialect >::getManagerInterface(), getOrLoadDialect(), getOrLoadDynamicDialect(), mlir::transform::detail::getPreloadedTransformModule(), mlir::DialectRegistry::insert(), loadAllAvailableDialects(), loadDialect(), mlir::ROCDL::TargetInfo::migrateArchFeaturesToModuleFlags(), MLIRContext(), mlir::FieldParser< AttributeT, std::enable_if_t< std::is_base_of< Attribute, AttributeT >::value, AttributeT > >::parse(), mlir::FieldParser< std::optional< AttributeT >, std::enable_if_t< std::is_base_of< Attribute, AttributeT >::value, std::optional< AttributeT > > >::parse(), mlir::detail::Parser::parseAttributeDict(), mlir::AsmParser::parseResourceHandle(), performActions(), mlir::DialectRegistry::preloadSelectDialects(), prepareLLVMModule(), mlir::func::registerInlinerExtension(), mlir::acc::registerLLVMInterfaces(), mlir::acc::registerMemRefInterfaces(), and mlir::linalg::registerShardingInterfaceExternalModels().
| Dialect * MLIRContext::getOrLoadDialect | ( | StringRef | dialectNamespace, |
| TypeID | dialectID, | ||
| function_ref< std::unique_ptr< Dialect >()> | ctor ) |
Get a dialect for the provided namespace and TypeID: abort the program if a dialect exist for this namespace with different TypeID.
If a dialect has not been loaded for this namespace/TypeID yet, use the provided ctor to create one on the fly and load it. Returns a pointer to the dialect owned by the context. The use of this method is in general discouraged in favor of 'getOrLoadDialect<DialectClass>()'.
Returns a pointer to the dialect owned by the context.
Definition at line 501 of file MLIRContext.cpp.
References getImpl(), and mlir::detail::StringAttrStorage::referencedDialect.
| Dialect * MLIRContext::getOrLoadDialect | ( | StringRef | name | ) |
Get (or create) a dialect for the given derived dialect name.
The dialect will be loaded from the registry if no dialect is found. If no dialect is loaded for this name and none is available in the registry, returns nullptr.
Definition at line 488 of file MLIRContext.cpp.
References getLoadedDialect().
| DynamicDialect * MLIRContext::getOrLoadDynamicDialect | ( | StringRef | dialectNamespace, |
| function_ref< void(DynamicDialect *)> | ctor ) |
Get (or create) a dynamic dialect for the given name.
Definition at line 566 of file MLIRContext.cpp.
References getImpl(), and getOrLoadDialect().
Referenced by mlir::DialectRegistry::insertDynamic(), and loadEmptyDialects().
| ArrayRef< RegisteredOperationName > MLIRContext::getRegisteredOperations | ( | ) |
Return a sorted array containing the information about all registered operations.
Return information about all registered operations.
Definition at line 831 of file MLIRContext.cpp.
| ArrayRef< RegisteredOperationName > MLIRContext::getRegisteredOperationsByDialect | ( | StringRef | dialectName | ) |
Return a sorted array containing the information for registered operations filtered by dialect name.
Return information for registered operations by dialect.
Definition at line 837 of file MLIRContext.cpp.
| llvm::hash_code MLIRContext::getRegistryHash | ( | ) |
Returns a hash of the registry of the context that may be used to give a rough indicator of if the state of the context registry has changed.
The context registry correlates to loaded dialects and their entities (attributes, operations, types, etc.).
Definition at line 605 of file MLIRContext.cpp.
References hash().
| remark::detail::RemarkEngine * MLIRContext::getRemarkEngine | ( | ) |
Returns the remark engine for this context, or nullptr if none has been set.
Definition at line 433 of file MLIRContext.cpp.
References getImpl(), and mlir::MLIRContextImpl::remarkEngine.
Referenced by mlir::acc::emitRemark(), mlir::remark::importLLVMRemarks(), mlirContextEnableOptimizationRemarks(), mlirContextEnableOptimizationRemarksToFile(), mlirContextEnableOptimizationRemarksWithCallback(), performActions(), and mlir::remark::detail::withEngine().
| llvm::ThreadPoolInterface & MLIRContext::getThreadPool | ( | ) |
Return the thread pool used by this context.
This method requires that multithreading be enabled within the context, and should generally not be used directly. Users should instead prefer the threading utilities within Threading.h.
Definition at line 692 of file MLIRContext.cpp.
References isMultithreadingEnabled().
Referenced by mlir::failableParallelForEachWithWorkerId().
| StorageUniquer & MLIRContext::getTypeUniquer | ( | ) |
Returns the storage uniquer used for constructing type storage instances.
This should not be used directly.
Definition at line 1169 of file MLIRContext.cpp.
References mlir::OperationName::getImpl().
Referenced by mlir::detail::TypeUniquer::getWithTypeID(), mlir::detail::TypeUniquer::getWithTypeID(), mlir::detail::TypeUniquer::mutate(), and mlir::detail::TypeUniquer::registerType().
| bool MLIRContext::hasActionHandler | ( | ) |
Return true if a valid ActionHandler is set.
Definition at line 415 of file MLIRContext.cpp.
References mlir::MLIRContextImpl::actionHandler, and getImpl().
Referenced by executeAction(), and executeAction().
| bool MLIRContext::isInTransientScope | ( | ) | const |
Returns true if the context is currently in a transient scope.
Definition at line 796 of file MLIRContext.cpp.
References getImpl(), and mlir::MLIRContextImpl::transientState.
|
inline |
Return true if multi-threading is enabled by the context.
This controls parallel execution within MLIR. Use isThreadSafeLockingEnabled() to query locking for context access.
Definition at line 205 of file MLIRContext.h.
Referenced by mlir::applyPassManagerCLOptions(), mlir::failableParallelForEachWithWorkerId(), getNumThreads(), getThreadPool(), mlir::detail::PassCrashReproducerGenerator::initialize(), performActions(), and setThreadPool().
| bool MLIRContext::isOperationRegistered | ( | StringRef | name | ) |
Return true if this operation name is registered in this context.
Definition at line 858 of file MLIRContext.cpp.
References mlir::RegisteredOperationName::lookup().
|
inline |
Return true if thread-safe locking is enabled for context access.
This does not imply that parallel execution within MLIR is enabled.
Definition at line 224 of file MLIRContext.h.
Referenced by mlir::OperationName::OperationName().
| void MLIRContext::loadAllAvailableDialects | ( | ) |
Load all dialects available in the registry in this context.
Definition at line 600 of file MLIRContext.cpp.
References getAvailableDialects(), and getOrLoadDialect().
Referenced by roundTripModule(), and mlir::translateLLVMIRToModule().
Load a dialect in the context.
Definition at line 118 of file MLIRContext.h.
References getOrLoadDialect().
Referenced by mlir::transform::TransformDialectExtension< DerivedTy, ExtraDialects... >::declareDependentDialect(), mlir::transform::TransformDialectExtension< DerivedTy, ExtraDialects... >::declareGeneratedDialect(), deserializeModule(), mlir::query::extractFunction(), loadDialect(), and mlir::linalg::registerRuntimeVerifiableOpInterfaceExternalModels().
|
inline |
Load a list dialects in the context.
Definition at line 127 of file MLIRContext.h.
References loadDialect().
Set the flag specifying if we should attach the operation to diagnostics emitted via Operation::emit.
Definition at line 808 of file MLIRContext.cpp.
Referenced by mlirTranslateMainImpl().
Set the flag specifying if we should attach the current stacktrace when emitting diagnostics.
Definition at line 823 of file MLIRContext.cpp.
Register a handler for handling actions that are dispatched through this context.
A nullptr handler can be set to disable a previously set handler.
Definition at line 396 of file MLIRContext.cpp.
References mlir::MLIRContextImpl::actionHandler, and getImpl().
Referenced by mlir::tracing::InstallDebugHandler::Impl::Impl().
| void MLIRContext::setRemarkEngine | ( | std::unique_ptr< remark::detail::RemarkEngine > | engine | ) |
Set the remark engine for this context.
Definition at line 428 of file MLIRContext.cpp.
References getImpl(), and mlir::MLIRContextImpl::remarkEngine.
| void MLIRContext::setThreadPool | ( | llvm::ThreadPoolInterface & | pool | ) |
Set a new thread pool to be used in this context.
This method requires that multithreading is disabled for this context prior to the call. This allows to share a thread pool across multiple contexts, as well as decoupling the lifetime of the threads from the contexts. The thread pool must outlive the context. Multi-threading will be enabled as part of this method. The command line debugging flag --mlir-disable-threading will still prevent threading from being enabled and threading won't be enabled after this call in this case.
Definition at line 674 of file MLIRContext.cpp.
References enableMultithreading(), and isMultithreadingEnabled().
| bool MLIRContext::shouldPrintOpOnDiagnostic | ( | ) |
Return true if we should attach the operation to diagnostics emitted via Operation::emit.
Definition at line 802 of file MLIRContext.cpp.
| bool MLIRContext::shouldPrintStackTraceOnDiagnostic | ( | ) |
Return true if we should attach the current stacktrace to diagnostics when emitted.
Definition at line 817 of file MLIRContext.cpp.
Referenced by emitDiag().