MLIR
20.0.0git
|
This is the implementation of the MLIRContext class, using the pImpl idiom. More...
Public Member Functions | |
MLIRContextImpl (bool threadingIsEnabled) | |
~MLIRContextImpl () | |
Public Attributes | |
std::function< void(function_ref< void()>, const tracing::Action &)> | actionHandler |
An action handler for handling actions that are dispatched through this context. More... | |
DiagnosticEngine | diagEngine |
bool | allowUnregisteredDialects = false |
In most cases, creating operation in unregistered dialect is not desired and indicate a misconfiguration of the compiler. More... | |
bool | threadingIsEnabled = true |
Enable support for multi-threading within MLIR. More... | |
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. More... | |
bool | printOpOnDiagnostic = true |
If the operation should be attached to diagnostics printed via the Operation::emit methods. More... | |
bool | printStackTraceOnDiagnostic = false |
If the current stack trace should be attached when emitting diagnostics. More... | |
llvm::ThreadPoolInterface * | threadPool = nullptr |
This points to the ThreadPool used when processing MLIR tasks in parallel. More... | |
std::unique_ptr< llvm::ThreadPoolInterface > | ownedThreadPool |
In case where the thread pool is owned by the context, this ensures destruction with the context. More... | |
llvm::BumpPtrAllocator | abstractDialectSymbolAllocator |
An allocator used for AbstractAttribute and AbstractType objects. More... | |
llvm::StringMap< std::unique_ptr< OperationName::Impl > > | operations |
This is a mapping from operation name to the operation info describing it. More... | |
llvm::DenseMap< TypeID, RegisteredOperationName > | registeredOperations |
A vector of operation info specifically for registered operations. More... | |
llvm::StringMap< RegisteredOperationName > | registeredOperationsByName |
SmallVector< RegisteredOperationName, 0 > | sortedRegisteredOperations |
This is a sorted container of registered operations for a deterministic and efficient getRegisteredOperations implementation. More... | |
DenseMap< StringRef, std::unique_ptr< Dialect > > | loadedDialects |
This is a list of dialects that are created referring to this context. More... | |
DialectRegistry | dialectsRegistry |
llvm::sys::SmartRWMutex< true > | operationInfoMutex |
A mutex used when accessing operation information. More... | |
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. More... | |
Float4E2M1FNType | f4E2M1FNTy |
Cached Type Instances. More... | |
Float6E2M3FNType | f6E2M3FNTy |
Float6E3M2FNType | f6E3M2FNTy |
Float8E5M2Type | f8E5M2Ty |
Float8E4M3Type | f8E4M3Ty |
Float8E4M3FNType | f8E4M3FNTy |
Float8E5M2FNUZType | f8E5M2FNUZTy |
Float8E4M3FNUZType | f8E4M3FNUZTy |
Float8E4M3B11FNUZType | f8E4M3B11FNUZTy |
Float8E3M4Type | f8E3M4Ty |
Float8E8M0FNUType | f8E8M0FNUTy |
BFloat16Type | bf16Ty |
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. More... | |
BoolAttr | falseAttr |
Cached Attribute Instances. More... | |
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. More... | |
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. More... | |
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 123 of file MLIRContext.cpp.
|
inline |
Definition at line 281 of file MLIRContext.cpp.
|
inline |
Definition at line 288 of file MLIRContext.cpp.
llvm::BumpPtrAllocator mlir::MLIRContextImpl::abstractDialectSymbolAllocator |
An allocator used for AbstractAttribute and AbstractType objects.
Definition at line 180 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 132 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::hasActionHandler(), and mlir::MLIRContext::registerActionHandler().
StorageUniquer mlir::MLIRContextImpl::affineUniquer |
Definition at line 207 of file MLIRContext.cpp.
bool mlir::MLIRContextImpl::allowUnregisteredDialects = false |
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 146 of file MLIRContext.cpp.
StorageUniquer mlir::MLIRContextImpl::attributeUniquer |
Definition at line 251 of file MLIRContext.cpp.
BFloat16Type mlir::MLIRContextImpl::bf16Ty |
Definition at line 235 of file MLIRContext.cpp.
DiagnosticEngine mlir::MLIRContextImpl::diagEngine |
Definition at line 137 of file MLIRContext.cpp.
Referenced by mlir::MLIRContext::getDiagEngine().
DenseMap<StringRef, SmallVector<StringAttrStorage *> > mlir::MLIRContextImpl::dialectReferencingStrAttrs |
Definition at line 272 of file MLIRContext.cpp.
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 270 of file MLIRContext.cpp.
DialectRegistry mlir::MLIRContextImpl::dialectsRegistry |
Definition at line 197 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 278 of file MLIRContext.cpp.
DictionaryAttr mlir::MLIRContextImpl::emptyDictionaryAttr |
Definition at line 265 of file MLIRContext.cpp.
StringAttr mlir::MLIRContextImpl::emptyStringAttr |
Definition at line 266 of file MLIRContext.cpp.
Float128Type mlir::MLIRContextImpl::f128Ty |
Definition at line 241 of file MLIRContext.cpp.
Float16Type mlir::MLIRContextImpl::f16Ty |
Definition at line 236 of file MLIRContext.cpp.
Float32Type mlir::MLIRContextImpl::f32Ty |
Definition at line 238 of file MLIRContext.cpp.
Float4E2M1FNType mlir::MLIRContextImpl::f4E2M1FNTy |
Cached Type Instances.
Definition at line 224 of file MLIRContext.cpp.
Float64Type mlir::MLIRContextImpl::f64Ty |
Definition at line 239 of file MLIRContext.cpp.
Float6E2M3FNType mlir::MLIRContextImpl::f6E2M3FNTy |
Definition at line 225 of file MLIRContext.cpp.
Float6E3M2FNType mlir::MLIRContextImpl::f6E3M2FNTy |
Definition at line 226 of file MLIRContext.cpp.
Float80Type mlir::MLIRContextImpl::f80Ty |
Definition at line 240 of file MLIRContext.cpp.
Float8E3M4Type mlir::MLIRContextImpl::f8E3M4Ty |
Definition at line 233 of file MLIRContext.cpp.
Float8E4M3B11FNUZType mlir::MLIRContextImpl::f8E4M3B11FNUZTy |
Definition at line 232 of file MLIRContext.cpp.
Float8E4M3FNType mlir::MLIRContextImpl::f8E4M3FNTy |
Definition at line 229 of file MLIRContext.cpp.
Float8E4M3FNUZType mlir::MLIRContextImpl::f8E4M3FNUZTy |
Definition at line 231 of file MLIRContext.cpp.
Float8E4M3Type mlir::MLIRContextImpl::f8E4M3Ty |
Definition at line 228 of file MLIRContext.cpp.
Float8E5M2FNUZType mlir::MLIRContextImpl::f8E5M2FNUZTy |
Definition at line 230 of file MLIRContext.cpp.
Float8E5M2Type mlir::MLIRContextImpl::f8E5M2Ty |
Definition at line 227 of file MLIRContext.cpp.
Float8E8M0FNUType mlir::MLIRContextImpl::f8E8M0FNUTy |
Definition at line 234 of file MLIRContext.cpp.
BoolAttr mlir::MLIRContextImpl::falseAttr |
Cached Attribute Instances.
Definition at line 262 of file MLIRContext.cpp.
Referenced by mlir::BoolAttr::get().
IndexType mlir::MLIRContextImpl::indexTy |
Definition at line 242 of file MLIRContext.cpp.
IntegerType mlir::MLIRContextImpl::int128Ty |
Definition at line 243 of file MLIRContext.cpp.
Referenced by getCachedIntegerType().
IntegerType mlir::MLIRContextImpl::int16Ty |
Definition at line 243 of file MLIRContext.cpp.
Referenced by getCachedIntegerType().
IntegerType mlir::MLIRContextImpl::int1Ty |
Definition at line 243 of file MLIRContext.cpp.
Referenced by getCachedIntegerType().
IntegerType mlir::MLIRContextImpl::int32Ty |
Definition at line 243 of file MLIRContext.cpp.
Referenced by getCachedIntegerType().
IntegerType mlir::MLIRContextImpl::int64Ty |
Definition at line 243 of file MLIRContext.cpp.
Referenced by getCachedIntegerType().
IntegerType mlir::MLIRContextImpl::int8Ty |
Definition at line 243 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 196 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 155 of file MLIRContext.cpp.
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 259 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 221 of file MLIRContext.cpp.
NoneType mlir::MLIRContextImpl::noneType |
Definition at line 244 of file MLIRContext.cpp.
llvm::sys::SmartRWMutex<true> mlir::MLIRContextImpl::operationInfoMutex |
A mutex used when accessing operation information.
Definition at line 200 of file MLIRContext.cpp.
Referenced by mlir::OperationName::OperationName().
llvm::StringMap<std::unique_ptr<OperationName::Impl> > mlir::MLIRContextImpl::operations |
This is a mapping from operation name to the operation info describing it.
Definition at line 183 of file MLIRContext.cpp.
Referenced by 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 177 of file MLIRContext.cpp.
bool mlir::MLIRContextImpl::printOpOnDiagnostic = true |
If the operation should be attached to diagnostics printed via the Operation::emit methods.
Definition at line 160 of file MLIRContext.cpp.
bool mlir::MLIRContextImpl::printStackTraceOnDiagnostic = false |
If the current stack trace should be attached when emitting diagnostics.
Definition at line 163 of file MLIRContext.cpp.
DenseMap<TypeID, AbstractAttribute *> mlir::MLIRContextImpl::registeredAttributes |
Definition at line 250 of file MLIRContext.cpp.
llvm::DenseMap<TypeID, RegisteredOperationName> mlir::MLIRContextImpl::registeredOperations |
A vector of operation info specifically for registered operations.
Definition at line 186 of file MLIRContext.cpp.
llvm::StringMap<RegisteredOperationName> mlir::MLIRContextImpl::registeredOperationsByName |
Definition at line 187 of file MLIRContext.cpp.
Referenced by mlir::OperationName::OperationName().
DenseMap<TypeID, AbstractType *> mlir::MLIRContextImpl::registeredTypes |
Definition at line 213 of file MLIRContext.cpp.
SmallVector<RegisteredOperationName, 0> mlir::MLIRContextImpl::sortedRegisteredOperations |
This is a sorted container of registered operations for a deterministic and efficient getRegisteredOperations
implementation.
Definition at line 191 of file MLIRContext.cpp.
FloatTF32Type mlir::MLIRContextImpl::tf32Ty |
Definition at line 237 of file MLIRContext.cpp.
bool mlir::MLIRContextImpl::threadingIsEnabled = true |
Enable support for multi-threading within MLIR.
Definition at line 149 of file MLIRContext.cpp.
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 173 of file MLIRContext.cpp.
BoolAttr mlir::MLIRContextImpl::trueAttr |
Definition at line 262 of file MLIRContext.cpp.
Referenced by mlir::BoolAttr::get().
StorageUniquer mlir::MLIRContextImpl::typeUniquer |
Definition at line 214 of file MLIRContext.cpp.
UnitAttr mlir::MLIRContextImpl::unitAttr |
Definition at line 263 of file MLIRContext.cpp.
UnknownLoc mlir::MLIRContextImpl::unknownLocAttr |
Definition at line 264 of file MLIRContext.cpp.