MLIR
20.0.0git
|
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... | |
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 659 of file Diagnostics.h.
ParallelDiagnosticHandler::ParallelDiagnosticHandler | ( | MLIRContext * | ctx | ) |
Definition at line 1024 of file Diagnostics.cpp.
|
default |
void ParallelDiagnosticHandler::eraseOrderIDForThread | ( | ) |
Remove the order id for the current thread.
This removes the thread from diagnostics tracking.
Definition at line 1035 of file Diagnostics.cpp.
Referenced by mlir::failableParallelForEach().
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 1029 of file Diagnostics.cpp.
Referenced by mlir::failableParallelForEach().