MLIR  20.0.0git
Public Member Functions | Public Attributes | List of all members
mlir::MLIRContextImpl Class Reference

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, RegisteredOperationNameregisteredOperations
 A vector of operation info specifically for registered operations. More...
 
llvm::StringMap< RegisteredOperationNameregisteredOperationsByName
 
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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MLIRContextImpl()

mlir::MLIRContextImpl::MLIRContextImpl ( bool  threadingIsEnabled)
inline

Definition at line 281 of file MLIRContext.cpp.

◆ ~MLIRContextImpl()

mlir::MLIRContextImpl::~MLIRContextImpl ( )
inline

Definition at line 288 of file MLIRContext.cpp.

Member Data Documentation

◆ abstractDialectSymbolAllocator

llvm::BumpPtrAllocator mlir::MLIRContextImpl::abstractDialectSymbolAllocator

An allocator used for AbstractAttribute and AbstractType objects.

Definition at line 180 of file MLIRContext.cpp.

◆ actionHandler

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().

◆ affineUniquer

StorageUniquer mlir::MLIRContextImpl::affineUniquer

Definition at line 207 of file MLIRContext.cpp.

◆ allowUnregisteredDialects

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.

◆ attributeUniquer

StorageUniquer mlir::MLIRContextImpl::attributeUniquer

Definition at line 251 of file MLIRContext.cpp.

◆ bf16Ty

BFloat16Type mlir::MLIRContextImpl::bf16Ty

Definition at line 235 of file MLIRContext.cpp.

◆ diagEngine

DiagnosticEngine mlir::MLIRContextImpl::diagEngine

Definition at line 137 of file MLIRContext.cpp.

Referenced by mlir::MLIRContext::getDiagEngine().

◆ dialectReferencingStrAttrs

DenseMap<StringRef, SmallVector<StringAttrStorage *> > mlir::MLIRContextImpl::dialectReferencingStrAttrs

Definition at line 272 of file MLIRContext.cpp.

◆ dialectRefStrAttrMutex

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.

◆ dialectsRegistry

DialectRegistry mlir::MLIRContextImpl::dialectsRegistry

Definition at line 197 of file MLIRContext.cpp.

◆ distinctAttributeAllocator

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.

◆ emptyDictionaryAttr

DictionaryAttr mlir::MLIRContextImpl::emptyDictionaryAttr

Definition at line 265 of file MLIRContext.cpp.

◆ emptyStringAttr

StringAttr mlir::MLIRContextImpl::emptyStringAttr

Definition at line 266 of file MLIRContext.cpp.

◆ f128Ty

Float128Type mlir::MLIRContextImpl::f128Ty

Definition at line 241 of file MLIRContext.cpp.

◆ f16Ty

Float16Type mlir::MLIRContextImpl::f16Ty

Definition at line 236 of file MLIRContext.cpp.

◆ f32Ty

Float32Type mlir::MLIRContextImpl::f32Ty

Definition at line 238 of file MLIRContext.cpp.

◆ f4E2M1FNTy

Float4E2M1FNType mlir::MLIRContextImpl::f4E2M1FNTy

Cached Type Instances.

Definition at line 224 of file MLIRContext.cpp.

◆ f64Ty

Float64Type mlir::MLIRContextImpl::f64Ty

Definition at line 239 of file MLIRContext.cpp.

◆ f6E2M3FNTy

Float6E2M3FNType mlir::MLIRContextImpl::f6E2M3FNTy

Definition at line 225 of file MLIRContext.cpp.

◆ f6E3M2FNTy

Float6E3M2FNType mlir::MLIRContextImpl::f6E3M2FNTy

Definition at line 226 of file MLIRContext.cpp.

◆ f80Ty

Float80Type mlir::MLIRContextImpl::f80Ty

Definition at line 240 of file MLIRContext.cpp.

◆ f8E3M4Ty

Float8E3M4Type mlir::MLIRContextImpl::f8E3M4Ty

Definition at line 233 of file MLIRContext.cpp.

◆ f8E4M3B11FNUZTy

Float8E4M3B11FNUZType mlir::MLIRContextImpl::f8E4M3B11FNUZTy

Definition at line 232 of file MLIRContext.cpp.

◆ f8E4M3FNTy

Float8E4M3FNType mlir::MLIRContextImpl::f8E4M3FNTy

Definition at line 229 of file MLIRContext.cpp.

◆ f8E4M3FNUZTy

Float8E4M3FNUZType mlir::MLIRContextImpl::f8E4M3FNUZTy

Definition at line 231 of file MLIRContext.cpp.

◆ f8E4M3Ty

Float8E4M3Type mlir::MLIRContextImpl::f8E4M3Ty

Definition at line 228 of file MLIRContext.cpp.

◆ f8E5M2FNUZTy

Float8E5M2FNUZType mlir::MLIRContextImpl::f8E5M2FNUZTy

Definition at line 230 of file MLIRContext.cpp.

◆ f8E5M2Ty

Float8E5M2Type mlir::MLIRContextImpl::f8E5M2Ty

Definition at line 227 of file MLIRContext.cpp.

◆ f8E8M0FNUTy

Float8E8M0FNUType mlir::MLIRContextImpl::f8E8M0FNUTy

Definition at line 234 of file MLIRContext.cpp.

◆ falseAttr

BoolAttr mlir::MLIRContextImpl::falseAttr

Cached Attribute Instances.

Definition at line 262 of file MLIRContext.cpp.

Referenced by mlir::BoolAttr::get().

◆ indexTy

IndexType mlir::MLIRContextImpl::indexTy

Definition at line 242 of file MLIRContext.cpp.

◆ int128Ty

IntegerType mlir::MLIRContextImpl::int128Ty

Definition at line 243 of file MLIRContext.cpp.

Referenced by getCachedIntegerType().

◆ int16Ty

IntegerType mlir::MLIRContextImpl::int16Ty

Definition at line 243 of file MLIRContext.cpp.

Referenced by getCachedIntegerType().

◆ int1Ty

IntegerType mlir::MLIRContextImpl::int1Ty

Definition at line 243 of file MLIRContext.cpp.

Referenced by getCachedIntegerType().

◆ int32Ty

IntegerType mlir::MLIRContextImpl::int32Ty

Definition at line 243 of file MLIRContext.cpp.

Referenced by getCachedIntegerType().

◆ int64Ty

IntegerType mlir::MLIRContextImpl::int64Ty

Definition at line 243 of file MLIRContext.cpp.

Referenced by getCachedIntegerType().

◆ int8Ty

IntegerType mlir::MLIRContextImpl::int8Ty

Definition at line 243 of file MLIRContext.cpp.

Referenced by getCachedIntegerType().

◆ loadedDialects

DenseMap<StringRef, std::unique_ptr<Dialect> > mlir::MLIRContextImpl::loadedDialects

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.

◆ multiThreadedExecutionContext

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.

◆ nameToAttribute

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.

◆ nameToType

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

NoneType mlir::MLIRContextImpl::noneType

Definition at line 244 of file MLIRContext.cpp.

◆ operationInfoMutex

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().

◆ operations

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().

◆ ownedThreadPool

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.

◆ printOpOnDiagnostic

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.

◆ printStackTraceOnDiagnostic

bool mlir::MLIRContextImpl::printStackTraceOnDiagnostic = false

If the current stack trace should be attached when emitting diagnostics.

Definition at line 163 of file MLIRContext.cpp.

◆ registeredAttributes

DenseMap<TypeID, AbstractAttribute *> mlir::MLIRContextImpl::registeredAttributes

Definition at line 250 of file MLIRContext.cpp.

◆ registeredOperations

llvm::DenseMap<TypeID, RegisteredOperationName> mlir::MLIRContextImpl::registeredOperations

A vector of operation info specifically for registered operations.

Definition at line 186 of file MLIRContext.cpp.

◆ registeredOperationsByName

llvm::StringMap<RegisteredOperationName> mlir::MLIRContextImpl::registeredOperationsByName

Definition at line 187 of file MLIRContext.cpp.

Referenced by mlir::OperationName::OperationName().

◆ registeredTypes

DenseMap<TypeID, AbstractType *> mlir::MLIRContextImpl::registeredTypes

Definition at line 213 of file MLIRContext.cpp.

◆ sortedRegisteredOperations

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.

◆ tf32Ty

FloatTF32Type mlir::MLIRContextImpl::tf32Ty

Definition at line 237 of file MLIRContext.cpp.

◆ threadingIsEnabled

bool mlir::MLIRContextImpl::threadingIsEnabled = true

Enable support for multi-threading within MLIR.

Definition at line 149 of file MLIRContext.cpp.

◆ threadPool

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.

◆ trueAttr

BoolAttr mlir::MLIRContextImpl::trueAttr

Definition at line 262 of file MLIRContext.cpp.

Referenced by mlir::BoolAttr::get().

◆ typeUniquer

StorageUniquer mlir::MLIRContextImpl::typeUniquer

Definition at line 214 of file MLIRContext.cpp.

◆ unitAttr

UnitAttr mlir::MLIRContextImpl::unitAttr

Definition at line 263 of file MLIRContext.cpp.

◆ unknownLocAttr

UnknownLoc mlir::MLIRContextImpl::unknownLocAttr

Definition at line 264 of file MLIRContext.cpp.


The documentation for this class was generated from the following file: