MLIR 24.0.0git
mlir::remark::detail::RemarkEngine Class Reference

#include "mlir/IR/Remarks.h"

Public Member Functions

 RemarkEngine ()=delete
 Default constructor is deleted, use the other constructor.
 RemarkEngine (bool printAsEmitRemarks, const RemarkCategories &cats)
 Constructs Remark engine with optional category names.
 ~RemarkEngine ()
 Destructor that will close the output file and reset the main remark streamer.
LogicalResult initialize (std::unique_ptr< MLIRRemarkStreamerBase > streamer, std::unique_ptr< RemarkEmittingPolicyBase > remarkEmittingPolicy, std::string *errMsg)
 Setup the remark engine with the given output path and format.
RemarkEmittingPolicyBasegetRemarkEmittingPolicy () const
 Get the remark emitting policy.
RemarkId generateRemarkId ()
 Generate a unique ID for a new remark.
bool isMissedOptRemarkEnabled (StringRef categoryName) const
 Return true if missed optimization remarks are enabled for the given category.
bool isPassedOptRemarkEnabled (StringRef categoryName) const
 Return true if passed optimization remarks are enabled for the given category.
bool isAnalysisOptRemarkEnabled (StringRef categoryName) const
 Return true if analysis remarks are enabled for the given category.
bool isFailedOptRemarkEnabled (StringRef categoryName) const
 Return true if failed optimization remarks are enabled for the given category.
bool isRemarkEnabled (RemarkKind kind, StringRef categoryName) const
 Return true if remarks of the given kind are enabled for the given category.
bool isAnyRemarkEnabled (StringRef categoryName) const
 Return true if any kind of remark is enabled for the given category.
bool isAnyRemarkEnabled () const
 Return true if any kind of remark is enabled for any category, i.e.
SmallVector< RemarkIdfindRemarks (const RemarkOpts &opts, std::optional< RemarkKind > kind=std::nullopt) const
 Find all remarks matching the given criteria.
void report (const Remark &&remark)
 Report a remark.
InFlightRemark emitOptimizationRemark (Location loc, RemarkOpts opts)
 Report a successful remark, this will create an InFlightRemark that can be used to build the remark using the << operator.
InFlightRemark emitOptimizationRemarkMiss (Location loc, RemarkOpts opts)
 Report a missed optimization remark that can be used to build the remark using the << operator.
InFlightRemark emitOptimizationRemarkFailure (Location loc, RemarkOpts opts)
 Report a failed optimization remark, this will create an InFlightRemark that can be used to build the remark using the << operator.
InFlightRemark emitOptimizationRemarkAnalysis (Location loc, RemarkOpts opts)
 Report an analysis remark, this will create an InFlightRemark that can be used to build the remark using the << operator.

Detailed Description

Definition at line 498 of file Remarks.h.

Constructor & Destructor Documentation

◆ RemarkEngine() [1/2]

mlir::remark::detail::RemarkEngine::RemarkEngine ( )
delete

Default constructor is deleted, use the other constructor.

◆ RemarkEngine() [2/2]

RemarkEngine::RemarkEngine ( bool printAsEmitRemarks,
const RemarkCategories & cats )

Constructs Remark engine with optional category names.

If a category name is not provided, it is not enabled. The category names are used to filter the remarks that are emitted.

Definition at line 329 of file Remarks.cpp.

References mlir::remark::RemarkCategories::analysis, buildFilter(), mlir::remark::RemarkCategories::failed, if(), mlir::remark::RemarkCategories::missed, and mlir::remark::RemarkCategories::passed.

◆ ~RemarkEngine()

RemarkEngine::~RemarkEngine ( )

Destructor that will close the output file and reset the main remark streamer.

Definition at line 269 of file Remarks.cpp.

Member Function Documentation

◆ emitOptimizationRemark()

InFlightRemark RemarkEngine::emitOptimizationRemark ( Location loc,
RemarkOpts opts )

Report a successful remark, this will create an InFlightRemark that can be used to build the remark using the << operator.

Definition at line 225 of file Remarks.cpp.

References isPassedOptRemarkEnabled(), and mlir::remark::detail::Remark::loc.

Referenced by emitImportedRemark(), and mlir::remark::passed().

◆ emitOptimizationRemarkAnalysis()

InFlightRemark RemarkEngine::emitOptimizationRemarkAnalysis ( Location loc,
RemarkOpts opts )

Report an analysis remark, this will create an InFlightRemark that can be used to build the remark using the << operator.

Definition at line 243 of file Remarks.cpp.

References isAnalysisOptRemarkEnabled(), and mlir::remark::detail::Remark::loc.

Referenced by mlir::remark::analysis(), and emitImportedRemark().

◆ emitOptimizationRemarkFailure()

InFlightRemark RemarkEngine::emitOptimizationRemarkFailure ( Location loc,
RemarkOpts opts )

Report a failed optimization remark, this will create an InFlightRemark that can be used to build the remark using the << operator.

Definition at line 237 of file Remarks.cpp.

References isFailedOptRemarkEnabled(), and mlir::remark::detail::Remark::loc.

Referenced by emitImportedRemark(), and mlir::remark::failed().

◆ emitOptimizationRemarkMiss()

InFlightRemark RemarkEngine::emitOptimizationRemarkMiss ( Location loc,
RemarkOpts opts )

Report a missed optimization remark that can be used to build the remark using the << operator.

Definition at line 231 of file Remarks.cpp.

References isMissedOptRemarkEnabled(), and mlir::remark::detail::Remark::loc.

Referenced by emitImportedRemark(), and mlir::remark::missed().

◆ findRemarks()

SmallVector< RemarkId > mlir::remark::detail::RemarkEngine::findRemarks ( const RemarkOpts & opts,
std::optional< RemarkKind > kind = std::nullopt ) const

Find all remarks matching the given criteria.

Delegates to the emitting policy. Only works with policies that store remarks (e.g. RemarkEmittingPolicyFinal); returns empty for PolicyAll.

◆ generateRemarkId()

RemarkId mlir::remark::detail::RemarkEngine::generateRemarkId ( )
inline

Generate a unique ID for a new remark.

Definition at line 556 of file Remarks.h.

◆ getRemarkEmittingPolicy()

RemarkEmittingPolicyBase * mlir::remark::detail::RemarkEngine::getRemarkEmittingPolicy ( ) const
inline

Get the remark emitting policy.

Definition at line 551 of file Remarks.h.

◆ initialize()

llvm::LogicalResult RemarkEngine::initialize ( std::unique_ptr< MLIRRemarkStreamerBase > streamer,
std::unique_ptr< RemarkEmittingPolicyBase > remarkEmittingPolicy,
std::string * errMsg )

Setup the remark engine with the given output path and format.

Definition at line 277 of file Remarks.cpp.

References success().

◆ isAnalysisOptRemarkEnabled()

bool RemarkEngine::isAnalysisOptRemarkEnabled ( StringRef categoryName) const

Return true if analysis remarks are enabled for the given category.

Definition at line 200 of file Remarks.cpp.

References mlir::remark::detail::Remark::categoryName.

Referenced by emitOptimizationRemarkAnalysis(), isAnyRemarkEnabled(), and isRemarkEnabled().

◆ isAnyRemarkEnabled() [1/2]

bool mlir::remark::detail::RemarkEngine::isAnyRemarkEnabled ( ) const
inline

Return true if any kind of remark is enabled for any category, i.e.

if at least one category filter is active. This is a cheap check that external remark producers can use before doing any work to build a remark.

Definition at line 594 of file Remarks.h.

◆ isAnyRemarkEnabled() [2/2]

bool mlir::remark::detail::RemarkEngine::isAnyRemarkEnabled ( StringRef categoryName) const
inline

Return true if any kind of remark is enabled for the given category.

Definition at line 584 of file Remarks.h.

References isAnalysisOptRemarkEnabled(), isFailedOptRemarkEnabled(), isMissedOptRemarkEnabled(), and isPassedOptRemarkEnabled().

◆ isFailedOptRemarkEnabled()

bool RemarkEngine::isFailedOptRemarkEnabled ( StringRef categoryName) const

Return true if failed optimization remarks are enabled for the given category.

Definition at line 204 of file Remarks.cpp.

References mlir::remark::detail::Remark::categoryName.

Referenced by emitOptimizationRemarkFailure(), isAnyRemarkEnabled(), and isRemarkEnabled().

◆ isMissedOptRemarkEnabled()

bool RemarkEngine::isMissedOptRemarkEnabled ( StringRef categoryName) const

Return true if missed optimization remarks are enabled for the given category.

Definition at line 192 of file Remarks.cpp.

References mlir::remark::detail::Remark::categoryName.

Referenced by emitOptimizationRemarkMiss(), isAnyRemarkEnabled(), and isRemarkEnabled().

◆ isPassedOptRemarkEnabled()

bool RemarkEngine::isPassedOptRemarkEnabled ( StringRef categoryName) const

Return true if passed optimization remarks are enabled for the given category.

Definition at line 196 of file Remarks.cpp.

References mlir::remark::detail::Remark::categoryName.

Referenced by emitOptimizationRemark(), isAnyRemarkEnabled(), and isRemarkEnabled().

◆ isRemarkEnabled()

bool RemarkEngine::isRemarkEnabled ( RemarkKind kind,
StringRef categoryName ) const

◆ report()

void RemarkEngine::report ( const Remark && remark)

Report a remark.

Definition at line 264 of file Remarks.cpp.


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