MLIR 22.0.0git
mlir::remark Namespace Reference

Namespaces

namespace  detail

Classes

struct  RemarkCategories
 Define an the set of categories to accept. More...
class  RemarkEmittingPolicyAll
 Policy that emits all remarks. More...
class  RemarkEmittingPolicyFinal
 Policy that emits final remarks. More...
struct  RemarkOpts
 Options to create a Remark. More...

Enumerations

enum class  RemarkKind {
  RemarkUnknown = 0 , RemarkPassed , RemarkMissed , RemarkFailure ,
  RemarkAnalysis
}
 Categories describe the outcome of an transformation, not the mechanics of emitting/serializing remarks. More...

Functions

template<class... Ts>
detail::LazyTextBuild reason (const char *fmt, Ts &&...ts)
 Create a Reason with llvm::formatv formatting.
template<class... Ts>
detail::LazyTextBuild suggest (const char *fmt, Ts &&...ts)
 Create a Suggestion with llvm::formatv formatting.
template<class... Ts>
detail::LazyTextBuild add (const char *fmt, Ts &&...ts)
 Create a Remark with llvm::formatv formatting.
template<class V>
detail::LazyTextBuild metric (StringRef key, V &&v)
detail::InFlightRemark passed (Location loc, RemarkOpts opts)
 Report an optimization remark that was passed.
detail::InFlightRemark missed (Location loc, RemarkOpts opts)
 Report an optimization remark that was missed.
detail::InFlightRemark failed (Location loc, RemarkOpts opts)
 Report an optimization remark that failed.
detail::InFlightRemark analysis (Location loc, RemarkOpts opts)
 Report an optimization analysis remark.
LogicalResult enableOptimizationRemarks (MLIRContext &ctx, std::unique_ptr< remark::detail::MLIRRemarkStreamerBase > streamer, std::unique_ptr< remark::detail::RemarkEmittingPolicyBase > remarkEmittingPolicy, const remark::RemarkCategories &cats, bool printAsEmitRemarks=false)
 Setup remarks for the context.
LogicalResult enableOptimizationRemarksWithLLVMStreamer (MLIRContext &ctx, StringRef filePath, llvm::remarks::Format fmt, std::unique_ptr< detail::RemarkEmittingPolicyBase > remarkEmittingPolicy, const RemarkCategories &cat, bool printAsEmitRemarks=false)
 Enable optimization remarks to a file with the given path and format.

Enumeration Type Documentation

◆ RemarkKind

enum class mlir::remark::RemarkKind
strong

Categories describe the outcome of an transformation, not the mechanics of emitting/serializing remarks.

Enumerator
RemarkUnknown 
RemarkPassed 

An optimization was applied.

RemarkMissed 

A profitable optimization opportunity was found but not applied.

RemarkFailure 

The compiler attempted the optimization but failed (e.g., legality checks, or better opportunites).

RemarkAnalysis 

Informational context (e.g., analysis numbers) without a pass/fail outcome.

Definition at line 36 of file Remarks.h.

Function Documentation

◆ add()

template<class... Ts>
detail::LazyTextBuild mlir::remark::add ( const char * fmt,
Ts &&... ts )
inline

Create a Remark with llvm::formatv formatting.

Definition at line 533 of file Remarks.h.

◆ analysis()

detail::InFlightRemark mlir::remark::analysis ( Location loc,
RemarkOpts opts )
inline

Report an optimization analysis remark.

Definition at line 567 of file Remarks.h.

References mlir::remark::detail::RemarkEngine::emitOptimizationRemarkAnalysis().

◆ enableOptimizationRemarks()

LogicalResult mlir::remark::enableOptimizationRemarks ( MLIRContext & ctx,
std::unique_ptr< remark::detail::MLIRRemarkStreamerBase > streamer,
std::unique_ptr< remark::detail::RemarkEmittingPolicyBase > remarkEmittingPolicy,
const remark::RemarkCategories & cats,
bool printAsEmitRemarks = false )

Setup remarks for the context.

This function will enable the remark engine and set the streamer to be used for optimization remarks. The remark categories are used to filter the remarks that will be emitted by the remark engine. If a category is not specified, it will not be emitted. If printAsEmitRemarks is true, the remarks will be printed as mlir::emitRemarks. 'streamer' must inherit from MLIRRemarkStreamerBase and will be used to stream the remarks.

Referenced by enableOptimizationRemarksWithLLVMStreamer(), and performActions().

◆ enableOptimizationRemarksWithLLVMStreamer()

LogicalResult mlir::remark::enableOptimizationRemarksWithLLVMStreamer ( MLIRContext & ctx,
StringRef filePath,
llvm::remarks::Format fmt,
std::unique_ptr< detail::RemarkEmittingPolicyBase > remarkEmittingPolicy,
const RemarkCategories & cat,
bool printAsEmitRemarks = false )

Enable optimization remarks to a file with the given path and format.

The remark categories are used to filter the remarks that are emitted. If the printAsEmitRemarks flag is set, remarks will also be printed using mlir::emitRemarks.

Definition at line 61 of file RemarkStreamer.cpp.

References mlir::remark::detail::LLVMRemarkStreamer::createToFile(), enableOptimizationRemarks(), and failed().

Referenced by performActions().

◆ failed()

detail::InFlightRemark mlir::remark::failed ( Location loc,
RemarkOpts opts )
inline

Report an optimization remark that failed.

Definition at line 561 of file Remarks.h.

References mlir::remark::detail::RemarkEngine::emitOptimizationRemarkFailure().

Referenced by enableOptimizationRemarksWithLLVMStreamer().

◆ metric()

template<class V>
detail::LazyTextBuild mlir::remark::metric ( StringRef key,
V && v )
inline

Definition at line 538 of file Remarks.h.

References mlir::remark::detail::Remark::Arg::val.

◆ missed()

detail::InFlightRemark mlir::remark::missed ( Location loc,
RemarkOpts opts )
inline

Report an optimization remark that was missed.

Definition at line 555 of file Remarks.h.

References mlir::remark::detail::RemarkEngine::emitOptimizationRemarkMiss().

◆ passed()

detail::InFlightRemark mlir::remark::passed ( Location loc,
RemarkOpts opts )
inline

Report an optimization remark that was passed.

Definition at line 550 of file Remarks.h.

References mlir::remark::detail::RemarkEngine::emitOptimizationRemark().

◆ reason()

template<class... Ts>
detail::LazyTextBuild mlir::remark::reason ( const char * fmt,
Ts &&... ts )
inline

Create a Reason with llvm::formatv formatting.

Definition at line 521 of file Remarks.h.

◆ suggest()

template<class... Ts>
detail::LazyTextBuild mlir::remark::suggest ( const char * fmt,
Ts &&... ts )
inline

Create a Suggestion with llvm::formatv formatting.

Definition at line 527 of file Remarks.h.