MLIR 24.0.0git
mlir::detail::ParallelDiagnosticHandlerImpl Struct Reference
Inheritance diagram for mlir::detail::ParallelDiagnosticHandlerImpl:

Classes

struct  ThreadDiagnostic

Public Member Functions

 ParallelDiagnosticHandlerImpl (MLIRContext *ctx)
 ~ParallelDiagnosticHandlerImpl () override
void emitDiagnostics (llvm::function_ref< void(Diagnostic &)> emitFn) const
 Utility method to emit any held diagnostics.
void setOrderIDForThread (size_t orderID)
 Set the order id for the current thread.
void eraseOrderIDForThread ()
 Remove the order id for the current thread.
void print (raw_ostream &os) const override
 Dump the current diagnostics that were inflight.

Public Attributes

llvm::sys::SmartMutex< true > mutex
 A smart mutex to lock access to the internal state.
DenseMap< uint64_t, size_t > threadToOrderID
 Order ids, keyed by thread id, for threads nested past what the thread-local stack holds: more enclosing parallel loops on one thread than entries.
std::vector< ThreadDiagnostic > diagnostics
 An unordered list of diagnostics that were emitted.
DiagnosticEngine::HandlerID handlerID = 0
 The unique id for the parallel handler.
const uint64_t handlerUniqueID
 Unique id naming this handler in the thread-local order-id stack.
MLIRContext * context
 The context to emit the diagnostics to.

Detailed Description

Definition at line 771 of file Diagnostics.cpp.

Constructor & Destructor Documentation

◆ ParallelDiagnosticHandlerImpl()

mlir::detail::ParallelDiagnosticHandlerImpl::ParallelDiagnosticHandlerImpl ( MLIRContext * ctx)
inline

◆ ~ParallelDiagnosticHandlerImpl()

mlir::detail::ParallelDiagnosticHandlerImpl::~ParallelDiagnosticHandlerImpl ( )
inlineoverride

Definition at line 811 of file Diagnostics.cpp.

References context, diagnostics, emitDiagnostics(), and handlerID.

Member Function Documentation

◆ emitDiagnostics()

void mlir::detail::ParallelDiagnosticHandlerImpl::emitDiagnostics ( llvm::function_ref< void(Diagnostic &)> emitFn) const
inline

Utility method to emit any held diagnostics.

Definition at line 826 of file Diagnostics.cpp.

References diagnostics.

Referenced by print(), and ~ParallelDiagnosticHandlerImpl().

◆ eraseOrderIDForThread()

void mlir::detail::ParallelDiagnosticHandlerImpl::eraseOrderIDForThread ( )
inline

Remove the order id for the current thread.

Definition at line 854 of file Diagnostics.cpp.

References handlerID, handlerUniqueID, mutex, mlir::detail::threadOrderDepth, mlir::detail::threadOrderStack, and threadToOrderID.

◆ print()

void mlir::detail::ParallelDiagnosticHandlerImpl::print ( raw_ostream & os) const
inlineoverride

Dump the current diagnostics that were inflight.

Definition at line 866 of file Diagnostics.cpp.

References diagnostics, emitDiagnostics(), mlir::Error, mlir::Note, mlir::Remark, and mlir::Warning.

◆ setOrderIDForThread()

void mlir::detail::ParallelDiagnosticHandlerImpl::setOrderIDForThread ( size_t orderID)
inline

Member Data Documentation

◆ context

MLIRContext* mlir::detail::ParallelDiagnosticHandlerImpl::context

The context to emit the diagnostics to.

Definition at line 918 of file Diagnostics.cpp.

Referenced by ParallelDiagnosticHandlerImpl(), and ~ParallelDiagnosticHandlerImpl().

◆ diagnostics

std::vector<ThreadDiagnostic> mlir::detail::ParallelDiagnosticHandlerImpl::diagnostics
mutable

An unordered list of diagnostics that were emitted.

Definition at line 908 of file Diagnostics.cpp.

Referenced by emitDiagnostics(), ParallelDiagnosticHandlerImpl(), print(), and ~ParallelDiagnosticHandlerImpl().

◆ handlerID

DiagnosticEngine::HandlerID mlir::detail::ParallelDiagnosticHandlerImpl::handlerID = 0

The unique id for the parallel handler.

Definition at line 911 of file Diagnostics.cpp.

Referenced by eraseOrderIDForThread(), ParallelDiagnosticHandlerImpl(), setOrderIDForThread(), and ~ParallelDiagnosticHandlerImpl().

◆ handlerUniqueID

const uint64_t mlir::detail::ParallelDiagnosticHandlerImpl::handlerUniqueID
Initial value:
=
nextHandlerUniqueID.fetch_add(1, std::memory_order_relaxed)
static std::atomic< uint64_t > nextHandlerUniqueID
Unique ids for parallel diagnostic handlers, so the thread-local slot below can name a handler withou...

Unique id naming this handler in the thread-local order-id stack.

Definition at line 914 of file Diagnostics.cpp.

Referenced by eraseOrderIDForThread(), ParallelDiagnosticHandlerImpl(), and setOrderIDForThread().

◆ mutex

llvm::sys::SmartMutex<true> mlir::detail::ParallelDiagnosticHandlerImpl::mutex

A smart mutex to lock access to the internal state.

Definition at line 898 of file Diagnostics.cpp.

Referenced by eraseOrderIDForThread(), ParallelDiagnosticHandlerImpl(), and setOrderIDForThread().

◆ threadToOrderID

DenseMap<uint64_t, size_t> mlir::detail::ParallelDiagnosticHandlerImpl::threadToOrderID

Order ids, keyed by thread id, for threads nested past what the thread-local stack holds: more enclosing parallel loops on one thread than entries.

Guarded by mutex. A thread in neither the stack nor this map is not tracked, and its diagnostics pass on to the next handler.

Definition at line 905 of file Diagnostics.cpp.

Referenced by eraseOrderIDForThread(), ParallelDiagnosticHandlerImpl(), and setOrderIDForThread().


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