MLIR  19.0.0git
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
mlir::MlirOptMainConfig Class Reference

Configuration options for the mlir-opt tool. More...

#include "mlir/Tools/mlir-opt/MlirOptMain.h"

Public Member Functions

MlirOptMainConfigallowUnregisteredDialects (bool allow)
 Options. More...
 
bool shouldAllowUnregisteredDialects () const
 
MlirOptMainConfigsetDebugConfig (tracing::DebugConfig config)
 Set the debug configuration to use. More...
 
tracing::DebugConfiggetDebugConfig ()
 
const tracing::DebugConfiggetDebugConfig () const
 
MlirOptMainConfigdumpPassPipeline (bool dump)
 Print the pass-pipeline as text before executing. More...
 
bool shouldDumpPassPipeline () const
 
MlirOptMainConfigemitBytecode (bool emit)
 Set the output format to bytecode instead of textual IR. More...
 
bool shouldEmitBytecode () const
 
bool shouldElideResourceDataFromBytecode () const
 
MlirOptMainConfigsetIrdlFile (StringRef file)
 Set the IRDL file to load before processing the input. More...
 
StringRef getIrdlFile () const
 
MlirOptMainConfigsetEmitBytecodeVersion (int64_t version)
 Set the bytecode version to emit. More...
 
std::optional< int64_t > bytecodeVersionToEmit () const
 
MlirOptMainConfigsetPassPipelineSetupFn (std::function< LogicalResult(PassManager &)> callback)
 Set the callback to populate the pass manager. More...
 
MlirOptMainConfigsetPassPipelineParser (const PassPipelineCLParser &parser)
 Set the parser to use to populate the pass manager. More...
 
LogicalResult setupPassPipeline (PassManager &pm) const
 Populate the passmanager, if any callback was set. More...
 
MlirOptMainConfigrunReproducer (bool enableReproducer)
 Enable running the reproducer information stored in resources (if present). More...
 
bool shouldRunReproducer () const
 Return true if the reproducer should be run. More...
 
MlirOptMainConfigshowDialects (bool show)
 Show the registered dialects before trying to load the input file. More...
 
bool shouldShowDialects () const
 
MlirOptMainConfigsplitInputFile (bool split=true)
 Set whether to split the input file based on the // ----- marker into pieces and process each chunk independently. More...
 
bool shouldSplitInputFile () const
 
MlirOptMainConfiguseExplicitModule (bool useExplicitModule)
 Disable implicit addition of a top-level module op during parsing. More...
 
bool shouldUseExplicitModule () const
 
MlirOptMainConfigverifyDiagnostics (bool verify)
 Set whether to check that emitted diagnostics match expected-* lines on the corresponding line. More...
 
bool shouldVerifyDiagnostics () const
 
MlirOptMainConfigverifyPasses (bool verify)
 Set whether to run the verifier after each transformation pass. More...
 
bool shouldVerifyPasses () const
 
MlirOptMainConfigverifyRoundtrip (bool verify)
 Set whether to run the verifier after each transformation pass. More...
 
bool shouldVerifyRoundtrip () const
 
StringRef getReproducerFilename () const
 Reproducer file generation (no crash required). More...
 

Static Public Member Functions

static void registerCLOptions (DialectRegistry &dialectRegistry)
 Register the options as global LLVM command line options. More...
 
static MlirOptMainConfig createFromCLOptions ()
 Create a new config with the default set from the CL options. More...
 

Protected Attributes

bool allowUnregisteredDialectsFlag = false
 Allow operation with no registered dialects. More...
 
tracing::DebugConfig debugConfig
 Configuration for the debugging hooks. More...
 
bool dumpPassPipelineFlag = false
 Print the pipeline that will be run. More...
 
bool emitBytecodeFlag = false
 Emit bytecode instead of textual assembly when generating output. More...
 
bool elideResourceDataFromBytecodeFlag = false
 Elide resources when generating bytecode. More...
 
bool enableDebuggerActionHookFlag = false
 Enable the Debugger action hook: Debugger can intercept MLIR Actions. More...
 
std::string irdlFileFlag = ""
 IRDL file to register before processing the input. More...
 
std::vector< tracing::BreakpointManager * > logActionLocationFilter
 Location Breakpoints to filter the action logging. More...
 
std::optional< int64_t > emitBytecodeVersion = std::nullopt
 Emit bytecode at given version. More...
 
std::function< LogicalResult(PassManager &)> passPipelineCallback
 The callback to populate the pass manager. More...
 
bool runReproducerFlag = false
 Enable running the reproducer. More...
 
bool showDialectsFlag = false
 Show the registered dialects before trying to load the input file. More...
 
bool splitInputFileFlag = false
 Split the input file based on the // ----- marker into pieces and process each chunk independently. More...
 
bool useExplicitModuleFlag = false
 Use an explicit top-level module op during parsing. More...
 
bool verifyDiagnosticsFlag = false
 Set whether to check that emitted diagnostics match expected-* lines on the corresponding line. More...
 
bool verifyPassesFlag = true
 Run the verifier after each transformation pass. More...
 
bool verifyRoundtripFlag = false
 Verify that the input IR round-trips perfectly. More...
 
std::string generateReproducerFileFlag = ""
 The reproducer output filename (no crash required). More...
 

Detailed Description

Configuration options for the mlir-opt tool.

This is intended to help building tools like mlir-opt by collecting the supported options. The API is fluent, and the options are sorted in alphabetical order below. The options can be exposed to the LLVM command line by registering them with MlirOptMainConfig::registerCLOptions(DialectRegistry &); and creating a config using auto config = MlirOptMainConfig::createFromCLOptions();.

Definition at line 41 of file MlirOptMain.h.

Member Function Documentation

◆ allowUnregisteredDialects()

MlirOptMainConfig& mlir::MlirOptMainConfig::allowUnregisteredDialects ( bool  allow)
inline

Options.

Allow operation with no registered dialects. This option is for convenience during testing only and discouraged in general.

Definition at line 56 of file MlirOptMain.h.

References allowUnregisteredDialectsFlag.

◆ bytecodeVersionToEmit()

std::optional<int64_t> mlir::MlirOptMainConfig::bytecodeVersionToEmit ( ) const
inline

Definition at line 101 of file MlirOptMain.h.

References emitBytecodeVersion.

◆ createFromCLOptions()

MlirOptMainConfig MlirOptMainConfig::createFromCLOptions ( )
static

Create a new config with the default set from the CL options.

Definition at line 199 of file MlirOptMain.cpp.

References clOptionsConfig, and mlir::tracing::DebugConfig::createFromCLOptions().

Referenced by mlir::MlirOptMain().

◆ dumpPassPipeline()

MlirOptMainConfig& mlir::MlirOptMainConfig::dumpPassPipeline ( bool  dump)
inline

Print the pass-pipeline as text before executing.

Definition at line 73 of file MlirOptMain.h.

References dumpPassPipelineFlag.

◆ emitBytecode()

MlirOptMainConfig& mlir::MlirOptMainConfig::emitBytecode ( bool  emit)
inline

Set the output format to bytecode instead of textual IR.

Definition at line 80 of file MlirOptMain.h.

References emitBytecodeFlag.

◆ getDebugConfig() [1/2]

tracing::DebugConfig& mlir::MlirOptMainConfig::getDebugConfig ( )
inline

Definition at line 69 of file MlirOptMain.h.

References debugConfig.

◆ getDebugConfig() [2/2]

const tracing::DebugConfig& mlir::MlirOptMainConfig::getDebugConfig ( ) const
inline

Definition at line 70 of file MlirOptMain.h.

References debugConfig.

◆ getIrdlFile()

StringRef mlir::MlirOptMainConfig::getIrdlFile ( ) const
inline

Definition at line 94 of file MlirOptMain.h.

References irdlFileFlag.

◆ getReproducerFilename()

StringRef mlir::MlirOptMainConfig::getReproducerFilename ( ) const
inline

Reproducer file generation (no crash required).

Definition at line 177 of file MlirOptMain.h.

References generateReproducerFileFlag.

◆ registerCLOptions()

void MlirOptMainConfig::registerCLOptions ( DialectRegistry dialectRegistry)
static

Register the options as global LLVM command line options.

Definition at line 194 of file MlirOptMain.cpp.

References clOptionsConfig, and mlir::tracing::DebugConfig::registerCLOptions().

Referenced by mlir::registerAndParseCLIOptions().

◆ runReproducer()

MlirOptMainConfig& mlir::MlirOptMainConfig::runReproducer ( bool  enableReproducer)
inline

Enable running the reproducer information stored in resources (if present).

Definition at line 124 of file MlirOptMain.h.

References runReproducerFlag.

◆ setDebugConfig()

MlirOptMainConfig& mlir::MlirOptMainConfig::setDebugConfig ( tracing::DebugConfig  config)
inline

Set the debug configuration to use.

Definition at line 65 of file MlirOptMain.h.

References debugConfig.

◆ setEmitBytecodeVersion()

MlirOptMainConfig& mlir::MlirOptMainConfig::setEmitBytecodeVersion ( int64_t  version)
inline

Set the bytecode version to emit.

Definition at line 97 of file MlirOptMain.h.

References emitBytecodeVersion.

◆ setIrdlFile()

MlirOptMainConfig& mlir::MlirOptMainConfig::setIrdlFile ( StringRef  file)
inline

Set the IRDL file to load before processing the input.

Definition at line 90 of file MlirOptMain.h.

References irdlFileFlag.

◆ setPassPipelineParser()

MlirOptMainConfig & MlirOptMainConfig::setPassPipelineParser ( const PassPipelineCLParser parser)

Set the parser to use to populate the pass manager.

Definition at line 204 of file MlirOptMain.cpp.

References mlir::PassPipelineCLParser::addToPipeline(), mlir::emitError(), mlir::failed(), mlir::failure(), mlir::get(), and mlir::success().

◆ setPassPipelineSetupFn()

MlirOptMainConfig& mlir::MlirOptMainConfig::setPassPipelineSetupFn ( std::function< LogicalResult(PassManager &)>  callback)
inline

Set the callback to populate the pass manager.

Definition at line 107 of file MlirOptMain.h.

References passPipelineCallback.

◆ setupPassPipeline()

LogicalResult mlir::MlirOptMainConfig::setupPassPipeline ( PassManager pm) const
inline

Populate the passmanager, if any callback was set.

Definition at line 116 of file MlirOptMain.h.

References passPipelineCallback, and mlir::success().

◆ shouldAllowUnregisteredDialects()

bool mlir::MlirOptMainConfig::shouldAllowUnregisteredDialects ( ) const
inline

Definition at line 60 of file MlirOptMain.h.

References allowUnregisteredDialectsFlag.

◆ shouldDumpPassPipeline()

bool mlir::MlirOptMainConfig::shouldDumpPassPipeline ( ) const
inline

Definition at line 77 of file MlirOptMain.h.

References dumpPassPipelineFlag.

◆ shouldElideResourceDataFromBytecode()

bool mlir::MlirOptMainConfig::shouldElideResourceDataFromBytecode ( ) const
inline

Definition at line 85 of file MlirOptMain.h.

References elideResourceDataFromBytecodeFlag.

◆ shouldEmitBytecode()

bool mlir::MlirOptMainConfig::shouldEmitBytecode ( ) const
inline

Definition at line 84 of file MlirOptMain.h.

References emitBytecodeFlag.

◆ shouldRunReproducer()

bool mlir::MlirOptMainConfig::shouldRunReproducer ( ) const
inline

Return true if the reproducer should be run.

Definition at line 130 of file MlirOptMain.h.

References runReproducerFlag.

Referenced by performActions().

◆ shouldShowDialects()

bool mlir::MlirOptMainConfig::shouldShowDialects ( ) const
inline

Definition at line 137 of file MlirOptMain.h.

References showDialectsFlag.

Referenced by mlir::MlirOptMain().

◆ shouldSplitInputFile()

bool mlir::MlirOptMainConfig::shouldSplitInputFile ( ) const
inline

Definition at line 145 of file MlirOptMain.h.

References splitInputFileFlag.

◆ shouldUseExplicitModule()

bool mlir::MlirOptMainConfig::shouldUseExplicitModule ( ) const
inline

Definition at line 152 of file MlirOptMain.h.

References useExplicitModuleFlag.

◆ shouldVerifyDiagnostics()

bool mlir::MlirOptMainConfig::shouldVerifyDiagnostics ( ) const
inline

Definition at line 160 of file MlirOptMain.h.

References verifyDiagnosticsFlag.

◆ shouldVerifyPasses()

bool mlir::MlirOptMainConfig::shouldVerifyPasses ( ) const
inline

Definition at line 167 of file MlirOptMain.h.

References verifyPassesFlag.

◆ shouldVerifyRoundtrip()

bool mlir::MlirOptMainConfig::shouldVerifyRoundtrip ( ) const
inline

Definition at line 174 of file MlirOptMain.h.

References verifyRoundtripFlag.

◆ showDialects()

MlirOptMainConfig& mlir::MlirOptMainConfig::showDialects ( bool  show)
inline

Show the registered dialects before trying to load the input file.

Definition at line 133 of file MlirOptMain.h.

References showDialectsFlag.

◆ splitInputFile()

MlirOptMainConfig& mlir::MlirOptMainConfig::splitInputFile ( bool  split = true)
inline

Set whether to split the input file based on the // ----- marker into pieces and process each chunk independently.

Definition at line 141 of file MlirOptMain.h.

References splitInputFileFlag.

◆ useExplicitModule()

MlirOptMainConfig& mlir::MlirOptMainConfig::useExplicitModule ( bool  useExplicitModule)
inline

Disable implicit addition of a top-level module op during parsing.

Definition at line 148 of file MlirOptMain.h.

References useExplicitModuleFlag.

◆ verifyDiagnostics()

MlirOptMainConfig& mlir::MlirOptMainConfig::verifyDiagnostics ( bool  verify)
inline

Set whether to check that emitted diagnostics match expected-* lines on the corresponding line.

This is meant for implementing diagnostic tests.

Definition at line 156 of file MlirOptMain.h.

References mlir::verify(), and verifyDiagnosticsFlag.

◆ verifyPasses()

MlirOptMainConfig& mlir::MlirOptMainConfig::verifyPasses ( bool  verify)
inline

Set whether to run the verifier after each transformation pass.

Definition at line 163 of file MlirOptMain.h.

References mlir::verify(), and verifyPassesFlag.

◆ verifyRoundtrip()

MlirOptMainConfig& mlir::MlirOptMainConfig::verifyRoundtrip ( bool  verify)
inline

Set whether to run the verifier after each transformation pass.

Definition at line 170 of file MlirOptMain.h.

References mlir::verify(), and verifyRoundtripFlag.

Member Data Documentation

◆ allowUnregisteredDialectsFlag

bool mlir::MlirOptMainConfig::allowUnregisteredDialectsFlag = false
protected

Allow operation with no registered dialects.

This option is for convenience during testing only and discouraged in general.

Definition at line 183 of file MlirOptMain.h.

Referenced by allowUnregisteredDialects(), and shouldAllowUnregisteredDialects().

◆ debugConfig

tracing::DebugConfig mlir::MlirOptMainConfig::debugConfig
protected

Configuration for the debugging hooks.

Definition at line 186 of file MlirOptMain.h.

Referenced by getDebugConfig(), and setDebugConfig().

◆ dumpPassPipelineFlag

bool mlir::MlirOptMainConfig::dumpPassPipelineFlag = false
protected

Print the pipeline that will be run.

Definition at line 189 of file MlirOptMain.h.

Referenced by dumpPassPipeline(), and shouldDumpPassPipeline().

◆ elideResourceDataFromBytecodeFlag

bool mlir::MlirOptMainConfig::elideResourceDataFromBytecodeFlag = false
protected

Elide resources when generating bytecode.

Definition at line 195 of file MlirOptMain.h.

Referenced by shouldElideResourceDataFromBytecode().

◆ emitBytecodeFlag

bool mlir::MlirOptMainConfig::emitBytecodeFlag = false
protected

Emit bytecode instead of textual assembly when generating output.

Definition at line 192 of file MlirOptMain.h.

Referenced by emitBytecode(), and shouldEmitBytecode().

◆ emitBytecodeVersion

std::optional<int64_t> mlir::MlirOptMainConfig::emitBytecodeVersion = std::nullopt
protected

Emit bytecode at given version.

Definition at line 207 of file MlirOptMain.h.

Referenced by bytecodeVersionToEmit(), and setEmitBytecodeVersion().

◆ enableDebuggerActionHookFlag

bool mlir::MlirOptMainConfig::enableDebuggerActionHookFlag = false
protected

Enable the Debugger action hook: Debugger can intercept MLIR Actions.

Definition at line 198 of file MlirOptMain.h.

◆ generateReproducerFileFlag

std::string mlir::MlirOptMainConfig::generateReproducerFileFlag = ""
protected

The reproducer output filename (no crash required).

Definition at line 236 of file MlirOptMain.h.

Referenced by getReproducerFilename().

◆ irdlFileFlag

std::string mlir::MlirOptMainConfig::irdlFileFlag = ""
protected

IRDL file to register before processing the input.

Definition at line 201 of file MlirOptMain.h.

Referenced by getIrdlFile(), and setIrdlFile().

◆ logActionLocationFilter

std::vector<tracing::BreakpointManager *> mlir::MlirOptMainConfig::logActionLocationFilter
protected

Location Breakpoints to filter the action logging.

Definition at line 204 of file MlirOptMain.h.

◆ passPipelineCallback

std::function<LogicalResult(PassManager &)> mlir::MlirOptMainConfig::passPipelineCallback
protected

The callback to populate the pass manager.

Definition at line 210 of file MlirOptMain.h.

Referenced by setPassPipelineSetupFn(), and setupPassPipeline().

◆ runReproducerFlag

bool mlir::MlirOptMainConfig::runReproducerFlag = false
protected

Enable running the reproducer.

Definition at line 213 of file MlirOptMain.h.

Referenced by runReproducer(), and shouldRunReproducer().

◆ showDialectsFlag

bool mlir::MlirOptMainConfig::showDialectsFlag = false
protected

Show the registered dialects before trying to load the input file.

Definition at line 216 of file MlirOptMain.h.

Referenced by shouldShowDialects(), and showDialects().

◆ splitInputFileFlag

bool mlir::MlirOptMainConfig::splitInputFileFlag = false
protected

Split the input file based on the // ----- marker into pieces and process each chunk independently.

Definition at line 220 of file MlirOptMain.h.

Referenced by shouldSplitInputFile(), and splitInputFile().

◆ useExplicitModuleFlag

bool mlir::MlirOptMainConfig::useExplicitModuleFlag = false
protected

Use an explicit top-level module op during parsing.

Definition at line 223 of file MlirOptMain.h.

Referenced by shouldUseExplicitModule(), and useExplicitModule().

◆ verifyDiagnosticsFlag

bool mlir::MlirOptMainConfig::verifyDiagnosticsFlag = false
protected

Set whether to check that emitted diagnostics match expected-* lines on the corresponding line.

This is meant for implementing diagnostic tests.

Definition at line 227 of file MlirOptMain.h.

Referenced by shouldVerifyDiagnostics(), and verifyDiagnostics().

◆ verifyPassesFlag

bool mlir::MlirOptMainConfig::verifyPassesFlag = true
protected

Run the verifier after each transformation pass.

Definition at line 230 of file MlirOptMain.h.

Referenced by shouldVerifyPasses(), and verifyPasses().

◆ verifyRoundtripFlag

bool mlir::MlirOptMainConfig::verifyRoundtripFlag = false
protected

Verify that the input IR round-trips perfectly.

Definition at line 233 of file MlirOptMain.h.

Referenced by shouldVerifyRoundtrip(), and verifyRoundtrip().


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