|
MLIR 24.0.0git
|
This is the implementation of the MLIRContext class, using the pImpl idiom. More...
Classes | |
| struct | TransientScopeState |
| Bundled state dynamically allocated when in a transient scope. More... | |
Public Member Functions | |
| MLIRContextImpl (bool threadingIsEnabled) | |
| void | setThreadSafeLocking (bool enable) |
| Update the locking mode for context access and each of the uniquers. | |
| ~MLIRContextImpl () | |
Public Attributes | |
| std::unique_ptr< remark::detail::RemarkEngine > | remarkEngine |
| std::function< void(function_ref< void()>, const tracing::Action &)> | actionHandler |
| An action handler for handling actions that are dispatched through this context. | |
| DiagnosticEngine | diagEngine |
| bool | allowUnregisteredDialects = false |
| In most cases, creating operation in unregistered dialect is not desired and indicate a misconfiguration of the compiler. | |
| bool | threadingIsEnabled = true |
| Enable support for multi-threading within MLIR. | |
| bool | threadSafeLockingIsEnabled = true |
| Enable locking for context access independently of parallel execution. | |
| std::atomic< int > | multiThreadedExecutionContext {0} |
| Track if we are currently executing in a threaded execution environment (like the pass-manager): this is only a debugging feature to help reducing the chances of data races one some context APIs. | |
| bool | printOpOnDiagnostic = true |
| If the operation should be attached to diagnostics printed via the Operation::emit methods. | |
| bool | printStackTraceOnDiagnostic = false |
| If the current stack trace should be attached when emitting diagnostics. | |
| llvm::ThreadPoolInterface * | threadPool = nullptr |
| This points to the ThreadPool used when processing MLIR tasks in parallel. | |
| std::unique_ptr< llvm::ThreadPoolInterface > | ownedThreadPool |
| In case where the thread pool is owned by the context, this ensures destruction with the context. | |
| llvm::BumpPtrAllocator | abstractDialectSymbolAllocator |
| An allocator used for AbstractAttribute and AbstractType objects. | |
| llvm::StringMap< std::unique_ptr< OperationName::Impl > > | unregisteredOperationsByName |
| This is a mapping from unregistered operation name to the operation info describing it. | |
| llvm::DenseMap< TypeID, RegisteredOperationName > | registeredOperations |
| A vector of operation info specifically for registered operations. | |
| llvm::StringMap< std::unique_ptr< OperationName::Impl >, llvm::BumpPtrAllocator > | registeredOperationsByName |
| SmallVector< RegisteredOperationName, 0 > | sortedRegisteredOperations |
| This is a sorted container of registered operations for a deterministic and efficient getRegisteredOperations implementation. | |
| DenseMap< StringRef, std::unique_ptr< Dialect > > | loadedDialects |
| This is a list of dialects that are created referring to this context. | |
| DialectRegistry | dialectsRegistry |
| llvm::sys::SmartRWMutex< true > | operationInfoMutex |
| A mutex used when accessing operation information. | |
| StorageUniquer | affineUniquer |
| DenseMap< TypeID, AbstractType * > | registeredTypes |
| StorageUniquer | typeUniquer |
| llvm::DenseMap< StringRef, AbstractType * > | nameToType |
| This is a mapping from type name to the abstract type describing it. | |
| BFloat16Type | bf16Ty |
| Cached Type Instances. | |
| Float16Type | f16Ty |
| FloatTF32Type | tf32Ty |
| Float32Type | f32Ty |
| Float64Type | f64Ty |
| Float80Type | f80Ty |
| Float128Type | f128Ty |
| IndexType | indexTy |
| IntegerType | int1Ty |
| IntegerType | int8Ty |
| IntegerType | int16Ty |
| IntegerType | int32Ty |
| IntegerType | int64Ty |
| IntegerType | int128Ty |
| NoneType | noneType |
| DenseMap< TypeID, AbstractAttribute * > | registeredAttributes |
| StorageUniquer | attributeUniquer |
| llvm::DenseMap< StringRef, AbstractAttribute * > | nameToAttribute |
| This is a mapping from attribute name to the abstract attribute describing it. | |
| BoolAttr | falseAttr |
| Cached Attribute Instances. | |
| BoolAttr | trueAttr |
| UnitAttr | unitAttr |
| UnknownLoc | unknownLocAttr |
| DictionaryAttr | emptyDictionaryAttr |
| StringAttr | emptyStringAttr |
| llvm::sys::SmartMutex< true > | dialectRefStrAttrMutex |
| Map of string attributes that may reference a dialect, that are awaiting that dialect to be loaded. | |
| DenseMap< StringRef, SmallVector< StringAttrStorage * > > | dialectReferencingStrAttrs |
| DistinctAttributeAllocator | distinctAttributeAllocator |
| A distinct attribute allocator that allocates every time since the address of the distinct attribute storage serves as unique identifier. | |
| std::unique_ptr< TransientScopeState > | transientState |
This is the implementation of the MLIRContext class, using the pImpl idiom.
This class is completely private to this file, so everything is public.
Definition at line 121 of file MLIRContext.cpp.
|
inline |
Definition at line 291 of file MLIRContext.cpp.
References ownedThreadPool, setThreadSafeLocking(), threadingIsEnabled, and threadPool.
|
inline |
Definition at line 307 of file MLIRContext.cpp.
References registeredAttributes, and registeredTypes.
Update the locking mode for context access and each of the uniquers.
Definition at line 301 of file MLIRContext.cpp.
References affineUniquer, attributeUniquer, threadSafeLockingIsEnabled, and typeUniquer.
Referenced by MLIRContextImpl().
| llvm::BumpPtrAllocator mlir::MLIRContextImpl::abstractDialectSymbolAllocator |
An allocator used for AbstractAttribute and AbstractType objects.
Definition at line 186 of file MLIRContext.cpp.
| std::function<void(function_ref<void()>, const tracing::Action &)> mlir::MLIRContextImpl::actionHandler |
An action handler for handling actions that are dispatched through this context.
Definition at line 135 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::getActionHandler(), mlir::MLIRContext::getActionHandler(), mlir::MLIRContext::hasActionHandler(), and mlir::MLIRContext::registerActionHandler().
| StorageUniquer mlir::MLIRContextImpl::affineUniquer |
Definition at line 216 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::beginTransientScope(), mlir::MLIRContext::endTransientScope(), and setThreadSafeLocking().
In most cases, creating operation in unregistered dialect is not desired and indicate a misconfiguration of the compiler.
This option enables to detect such use cases
Definition at line 149 of file MLIRContext.cpp.
| StorageUniquer mlir::MLIRContextImpl::attributeUniquer |
Definition at line 249 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::beginTransientScope(), mlir::MLIRContext::endTransientScope(), and setThreadSafeLocking().
| BFloat16Type mlir::MLIRContextImpl::bf16Ty |
Cached Type Instances.
Definition at line 233 of file MLIRContext.cpp.
| DiagnosticEngine mlir::MLIRContextImpl::diagEngine |
Definition at line 140 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::getDiagEngine().
| DenseMap<StringRef, SmallVector<StringAttrStorage *> > mlir::MLIRContextImpl::dialectReferencingStrAttrs |
Definition at line 270 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::beginTransientScope(), and mlir::MLIRContext::endTransientScope().
| llvm::sys::SmartMutex<true> mlir::MLIRContextImpl::dialectRefStrAttrMutex |
Map of string attributes that may reference a dialect, that are awaiting that dialect to be loaded.
Definition at line 268 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::beginTransientScope(), and mlir::MLIRContext::endTransientScope().
| DialectRegistry mlir::MLIRContextImpl::dialectsRegistry |
Definition at line 206 of file MLIRContext.cpp.
| DistinctAttributeAllocator mlir::MLIRContextImpl::distinctAttributeAllocator |
A distinct attribute allocator that allocates every time since the address of the distinct attribute storage serves as unique identifier.
The allocator is thread safe and frees the allocated storage after its destruction.
Definition at line 276 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::beginTransientScope(), and mlir::MLIRContext::endTransientScope().
| DictionaryAttr mlir::MLIRContextImpl::emptyDictionaryAttr |
Definition at line 263 of file MLIRContext.cpp.
| StringAttr mlir::MLIRContextImpl::emptyStringAttr |
Definition at line 264 of file MLIRContext.cpp.
| Float128Type mlir::MLIRContextImpl::f128Ty |
Definition at line 239 of file MLIRContext.cpp.
| Float16Type mlir::MLIRContextImpl::f16Ty |
Definition at line 234 of file MLIRContext.cpp.
| Float32Type mlir::MLIRContextImpl::f32Ty |
Definition at line 236 of file MLIRContext.cpp.
| Float64Type mlir::MLIRContextImpl::f64Ty |
Definition at line 237 of file MLIRContext.cpp.
| Float80Type mlir::MLIRContextImpl::f80Ty |
Definition at line 238 of file MLIRContext.cpp.
| BoolAttr mlir::MLIRContextImpl::falseAttr |
Cached Attribute Instances.
Definition at line 260 of file MLIRContext.cpp.
Referenced by mlir::BoolAttr::get().
| IndexType mlir::MLIRContextImpl::indexTy |
Definition at line 240 of file MLIRContext.cpp.
| IntegerType mlir::MLIRContextImpl::int128Ty |
Definition at line 241 of file MLIRContext.cpp.
Referenced by getCachedIntegerType().
| IntegerType mlir::MLIRContextImpl::int16Ty |
Definition at line 241 of file MLIRContext.cpp.
Referenced by getCachedIntegerType().
| IntegerType mlir::MLIRContextImpl::int1Ty |
Definition at line 241 of file MLIRContext.cpp.
Referenced by getCachedIntegerType().
| IntegerType mlir::MLIRContextImpl::int32Ty |
Definition at line 241 of file MLIRContext.cpp.
Referenced by getCachedIntegerType().
| IntegerType mlir::MLIRContextImpl::int64Ty |
Definition at line 241 of file MLIRContext.cpp.
Referenced by getCachedIntegerType().
| IntegerType mlir::MLIRContextImpl::int8Ty |
Definition at line 241 of file MLIRContext.cpp.
Referenced by getCachedIntegerType().
This is a list of dialects that are created referring to this context.
The MLIRContext owns the objects. These need to be declared after the registered operations to ensure correct destruction order.
Definition at line 205 of file MLIRContext.cpp.
| std::atomic<int> mlir::MLIRContextImpl::multiThreadedExecutionContext {0} |
Track if we are currently executing in a threaded execution environment (like the pass-manager): this is only a debugging feature to help reducing the chances of data races one some context APIs.
Definition at line 161 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::beginTransientScope(), and mlir::MLIRContext::endTransientScope().
| llvm::DenseMap<StringRef, AbstractAttribute *> mlir::MLIRContextImpl::nameToAttribute |
This is a mapping from attribute name to the abstract attribute describing it.
It is used by AbstractType::lookup to get an AbstractType from a name. As this map needs to be populated before StringAttr is loaded, we cannot use StringAttr as the key. The context does not take ownership of the key, so the StringRef must outlive the context.
Definition at line 257 of file MLIRContext.cpp.
| llvm::DenseMap<StringRef, AbstractType *> mlir::MLIRContextImpl::nameToType |
This is a mapping from type name to the abstract type describing it.
It is used by AbstractType::lookup to get an AbstractType from a name. As this map needs to be populated before StringAttr is loaded, we cannot use StringAttr as the key. The context does not take ownership of the key, so the StringRef must outlive the context.
Definition at line 230 of file MLIRContext.cpp.
| NoneType mlir::MLIRContextImpl::noneType |
Definition at line 242 of file MLIRContext.cpp.
| llvm::sys::SmartRWMutex<true> mlir::MLIRContextImpl::operationInfoMutex |
A mutex used when accessing operation information.
Definition at line 209 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::beginTransientScope(), mlir::MLIRContext::endTransientScope(), and mlir::OperationName::OperationName().
| std::unique_ptr<llvm::ThreadPoolInterface> mlir::MLIRContextImpl::ownedThreadPool |
In case where the thread pool is owned by the context, this ensures destruction with the context.
Definition at line 183 of file MLIRContext.cpp.
Referenced by MLIRContextImpl().
If the operation should be attached to diagnostics printed via the Operation::emit methods.
Definition at line 166 of file MLIRContext.cpp.
If the current stack trace should be attached when emitting diagnostics.
Definition at line 169 of file MLIRContext.cpp.
| DenseMap<TypeID, AbstractAttribute *> mlir::MLIRContextImpl::registeredAttributes |
Definition at line 248 of file MLIRContext.cpp.
Referenced by ~MLIRContextImpl().
| llvm::DenseMap<TypeID, RegisteredOperationName> mlir::MLIRContextImpl::registeredOperations |
A vector of operation info specifically for registered operations.
Definition at line 194 of file MLIRContext.cpp.
| llvm::StringMap<std::unique_ptr<OperationName::Impl>, llvm::BumpPtrAllocator> mlir::MLIRContextImpl::registeredOperationsByName |
Definition at line 196 of file MLIRContext.cpp.
Referenced by mlir::OperationName::OperationName().
| DenseMap<TypeID, AbstractType *> mlir::MLIRContextImpl::registeredTypes |
Definition at line 222 of file MLIRContext.cpp.
Referenced by ~MLIRContextImpl().
| std::unique_ptr<remark::detail::RemarkEngine> mlir::MLIRContextImpl::remarkEngine |
Definition at line 126 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::getRemarkEngine(), and mlir::MLIRContext::setRemarkEngine().
| SmallVector<RegisteredOperationName, 0> mlir::MLIRContextImpl::sortedRegisteredOperations |
This is a sorted container of registered operations for a deterministic and efficient getRegisteredOperations implementation.
Definition at line 200 of file MLIRContext.cpp.
| FloatTF32Type mlir::MLIRContextImpl::tf32Ty |
Definition at line 235 of file MLIRContext.cpp.
Enable support for multi-threading within MLIR.
Definition at line 152 of file MLIRContext.cpp.
Referenced by MLIRContextImpl().
| llvm::ThreadPoolInterface* mlir::MLIRContextImpl::threadPool = nullptr |
This points to the ThreadPool used when processing MLIR tasks in parallel.
It can't be nullptr when multi-threading is enabled. Otherwise if multi-threading is disabled, and the threadpool wasn't externally provided using setThreadPool, this will be nullptr.
Definition at line 179 of file MLIRContext.cpp.
Referenced by MLIRContextImpl().
Enable locking for context access independently of parallel execution.
Definition at line 155 of file MLIRContext.cpp.
Referenced by setThreadSafeLocking().
| std::unique_ptr<TransientScopeState> mlir::MLIRContextImpl::transientState |
Definition at line 288 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::beginTransientScope(), mlir::MLIRContext::endTransientScope(), and mlir::MLIRContext::isInTransientScope().
| BoolAttr mlir::MLIRContextImpl::trueAttr |
Definition at line 260 of file MLIRContext.cpp.
Referenced by mlir::BoolAttr::get().
| StorageUniquer mlir::MLIRContextImpl::typeUniquer |
Definition at line 223 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::beginTransientScope(), mlir::MLIRContext::endTransientScope(), and setThreadSafeLocking().
| UnitAttr mlir::MLIRContextImpl::unitAttr |
Definition at line 261 of file MLIRContext.cpp.
| UnknownLoc mlir::MLIRContextImpl::unknownLocAttr |
Definition at line 262 of file MLIRContext.cpp.
| llvm::StringMap<std::unique_ptr<OperationName::Impl> > mlir::MLIRContextImpl::unregisteredOperationsByName |
This is a mapping from unregistered operation name to the operation info describing it.
Definition at line 191 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::beginTransientScope(), mlir::MLIRContext::endTransientScope(), and mlir::OperationName::OperationName().