MLIR  16.0.0git
Public Member Functions | List of all members
mlir::ParallelDiagnosticHandler Class Reference

This class is a utility diagnostic handler for use when multi-threading some part of the compiler where diagnostics may be emitted. More...

#include "mlir/IR/Diagnostics.h"

Public Member Functions

 ParallelDiagnosticHandler (MLIRContext *ctx)
 
 ~ParallelDiagnosticHandler ()
 
void setOrderIDForThread (size_t orderID)
 Set the order id for the current thread. More...
 
void eraseOrderIDForThread ()
 Remove the order id for the current thread. More...
 

Detailed Description

This class is a utility diagnostic handler for use when multi-threading some part of the compiler where diagnostics may be emitted.

This handler ensures a deterministic ordering to the emitted diagnostics that mirrors that of a single-threaded compilation.

Definition at line 648 of file Diagnostics.h.

Constructor & Destructor Documentation

◆ ParallelDiagnosticHandler()

ParallelDiagnosticHandler::ParallelDiagnosticHandler ( MLIRContext ctx)

Definition at line 1021 of file Diagnostics.cpp.

◆ ~ParallelDiagnosticHandler()

ParallelDiagnosticHandler::~ParallelDiagnosticHandler ( )
default

Member Function Documentation

◆ eraseOrderIDForThread()

void ParallelDiagnosticHandler::eraseOrderIDForThread ( )

Remove the order id for the current thread.

This removes the thread from diagnostics tracking.

Definition at line 1032 of file Diagnostics.cpp.

Referenced by mlir::failableParallelForEach().

◆ setOrderIDForThread()

void ParallelDiagnosticHandler::setOrderIDForThread ( size_t  orderID)

Set the order id for the current thread.

This is required to be set by each thread that will be emitting diagnostics to this handler. The orderID corresponds to the order in which diagnostics would be emitted when executing synchronously. For example, if we were processing a list of operations [a, b, c] on a single-thread. Diagnostics emitted while processing operation 'a' would be emitted before those for 'b' or 'c'. This corresponds 1-1 with the 'orderID'. The thread that is processing 'a' should set the orderID to '0'; the thread processing 'b' should set it to '1'; and so on and so forth. This provides a way for the handler to deterministically order the diagnostics that it receives given the thread that it is receiving on.

Definition at line 1026 of file Diagnostics.cpp.

Referenced by mlir::failableParallelForEach().


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