MLIR  19.0.0git
TransformInterpreterPassBase.cpp
Go to the documentation of this file.
1 //===- TransformInterpreterPassBase.cpp -----------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Base class with shared implementation for transform dialect interpreter
10 // passes.
11 //
12 //===----------------------------------------------------------------------===//
13 
20 #include "mlir/IR/BuiltinOps.h"
21 #include "mlir/IR/Verifier.h"
22 #include "mlir/IR/Visitors.h"
24 #include "mlir/Parser/Parser.h"
25 #include "mlir/Pass/Pass.h"
27 #include "llvm/ADT/ScopeExit.h"
28 #include "llvm/ADT/StringRef.h"
29 #include "llvm/Support/Debug.h"
30 #include "llvm/Support/FileSystem.h"
31 #include "llvm/Support/FormatVariadic.h"
32 #include "llvm/Support/Mutex.h"
33 #include "llvm/Support/Path.h"
34 #include "llvm/Support/SourceMgr.h"
35 #include "llvm/Support/raw_ostream.h"
36 
37 using namespace mlir;
38 
39 #define DEBUG_TYPE "transform-dialect-interpreter"
40 #define DBGS() (llvm::dbgs() << "[" DEBUG_TYPE << "]: ")
41 #define DEBUG_TYPE_DUMP_STDERR "transform-dialect-dump-repro"
42 #define DEBUG_TYPE_DUMP_FILE "transform-dialect-save-repro"
43 
44 /// Name of the attribute used for targeting the transform dialect interpreter
45 /// at specific operations.
46 constexpr static llvm::StringLiteral kTransformDialectTagAttrName =
47  "transform.target_tag";
48 /// Value of the attribute indicating the root payload operation.
49 constexpr static llvm::StringLiteral kTransformDialectTagPayloadRootValue =
50  "payload_root";
51 /// Value of the attribute indicating the container of transform operations
52 /// (containing the top-level transform operation).
53 constexpr static llvm::StringLiteral
55 
56 /// Finds the single top-level transform operation with `root` as ancestor.
57 /// Reports an error if there is more than one such operation and returns the
58 /// first one found. Reports an error returns nullptr if no such operation
59 /// found.
60 static Operation *
61 findTopLevelTransform(Operation *root, StringRef filenameOption,
63  ::mlir::transform::TransformOpInterface topLevelTransform = nullptr;
65  [&](::mlir::transform::TransformOpInterface transformOp) {
66  if (!transformOp
67  ->hasTrait<transform::PossibleTopLevelTransformOpTrait>())
68  return WalkResult::skip();
69  if (!topLevelTransform) {
70  topLevelTransform = transformOp;
71  return WalkResult::skip();
72  }
73  if (options.getEnforceSingleToplevelTransformOp()) {
74  auto diag = transformOp.emitError()
75  << "more than one top-level transform op";
76  diag.attachNote(topLevelTransform.getLoc())
77  << "previous top-level transform op";
78  return WalkResult::interrupt();
79  }
80  return WalkResult::skip();
81  });
82  if (!topLevelTransform) {
83  auto diag = root->emitError()
84  << "could not find a nested top-level transform op";
85  diag.attachNote() << "use the '" << filenameOption
86  << "' option to provide transform as external file";
87  return nullptr;
88  }
89  return topLevelTransform;
90 }
91 
92 /// Finds an operation nested in `root` that has the transform dialect tag
93 /// attribute with the value specified as `tag`. Assumes only one operation
94 /// may have the tag. Returns nullptr if there is no such operation.
95 static Operation *findOpWithTag(Operation *root, StringRef tagKey,
96  StringRef tagValue) {
97  Operation *found = nullptr;
98  WalkResult walkResult = root->walk<WalkOrder::PreOrder>(
99  [tagKey, tagValue, &found, root](Operation *op) {
100  auto attr = op->getAttrOfType<StringAttr>(tagKey);
101  if (!attr || attr.getValue() != tagValue)
102  return WalkResult::advance();
103 
104  if (found) {
106  << "more than one operation with " << tagKey
107  << "=\"" << tagValue << "\" attribute";
108  diag.attachNote(found->getLoc()) << "first operation";
109  diag.attachNote(op->getLoc()) << "other operation";
110  return WalkResult::interrupt();
111  }
112 
113  found = op;
114  return WalkResult::advance();
115  });
116  if (walkResult.wasInterrupted())
117  return nullptr;
118 
119  if (!found) {
120  root->emitError() << "could not find the operation with " << tagKey << "=\""
121  << tagValue << "\" attribute";
122  }
123  return found;
124 }
125 
126 /// Returns the ancestor of `target` that doesn't have a parent.
128  Operation *root = target;
129  while (root->getParentOp())
130  root = root->getParentOp();
131  return root;
132 }
133 
134 /// Prints the CLI command running the repro with the current path.
135 // TODO: make binary name optional by querying LLVM command line API for the
136 // name of the current binary.
137 static llvm::raw_ostream &
138 printReproCall(llvm::raw_ostream &os, StringRef rootOpName, StringRef passName,
139  const Pass::Option<std::string> &debugPayloadRootTag,
140  const Pass::Option<std::string> &debugTransformRootTag,
141  StringRef binaryName) {
142  os << llvm::formatv(
143  "{6} --pass-pipeline=\"{0}({1}{{{2}={3} {4}={5}})\"", rootOpName,
144  passName, debugPayloadRootTag.getArgStr(),
145  debugPayloadRootTag.empty()
147  : debugPayloadRootTag,
148  debugTransformRootTag.getArgStr(),
149  debugTransformRootTag.empty()
151  : debugTransformRootTag,
152  binaryName);
153  return os;
154 }
155 
156 /// Prints the module rooted at `root` to `os` and appends
157 /// `transformContainer` if it is not nested in `root`.
158 static llvm::raw_ostream &printModuleForRepro(llvm::raw_ostream &os,
159  Operation *root,
160  Operation *transform) {
161  root->print(os);
162  if (!root->isAncestor(transform))
163  transform->print(os);
164  return os;
165 }
166 
167 /// Saves the payload and the transform IR into a temporary file and reports
168 /// the file name to `os`.
169 [[maybe_unused]] static void
170 saveReproToTempFile(llvm::raw_ostream &os, Operation *target,
171  Operation *transform, StringRef passName,
172  const Pass::Option<std::string> &debugPayloadRootTag,
173  const Pass::Option<std::string> &debugTransformRootTag,
174  const Pass::ListOption<std::string> &transformLibraryPaths,
175  StringRef binaryName) {
176  using llvm::sys::fs::TempFile;
177  Operation *root = getRootOperation(target);
178 
179  SmallVector<char, 128> tmpPath;
180  llvm::sys::path::system_temp_directory(/*erasedOnReboot=*/true, tmpPath);
181  llvm::sys::path::append(tmpPath, "transform_dialect_%%%%%%.mlir");
182  llvm::Expected<TempFile> tempFile = TempFile::create(tmpPath);
183  if (!tempFile) {
184  os << "could not open temporary file to save the repro\n";
185  return;
186  }
187 
188  llvm::raw_fd_ostream fout(tempFile->FD, /*shouldClose=*/false);
189  printModuleForRepro(fout, root, transform);
190  fout.flush();
191  std::string filename = tempFile->TmpName;
192 
193  if (tempFile->keep()) {
194  os << "could not preserve the temporary file with the repro\n";
195  return;
196  }
197 
198  os << "=== Transform Interpreter Repro ===\n";
199  printReproCall(os, root->getName().getStringRef(), passName,
200  debugPayloadRootTag, debugTransformRootTag, binaryName)
201  << " " << filename << "\n";
202  os << "===================================\n";
203 }
204 
205 // Optionally perform debug actions requested by the user to dump IR and a
206 // repro to stderr and/or a file.
208  Operation *target, Operation *transform, StringRef passName,
209  const Pass::Option<std::string> &debugPayloadRootTag,
210  const Pass::Option<std::string> &debugTransformRootTag,
211  const Pass::ListOption<std::string> &transformLibraryPaths,
212  StringRef binaryName) {
213  MLIRContext *context = target->getContext();
214 
215  // If we are not planning to print, bail early.
216  bool hasDebugFlags = false;
217  DEBUG_WITH_TYPE(DEBUG_TYPE_DUMP_STDERR, { hasDebugFlags = true; });
218  DEBUG_WITH_TYPE(DEBUG_TYPE_DUMP_FILE, { hasDebugFlags = true; });
219  if (!hasDebugFlags)
220  return;
221 
222  // We will be mutating the IR to set attributes. If this is running
223  // concurrently on several parts of a container or using a shared transform
224  // script, this would create a race. Bail in multithreaded mode and require
225  // the user to disable threading to dump repros.
226  static llvm::sys::SmartMutex<true> dbgStreamMutex;
227  if (target->getContext()->isMultithreadingEnabled()) {
228  llvm::sys::SmartScopedLock<true> lock(dbgStreamMutex);
229  llvm::dbgs() << "=======================================================\n";
230  llvm::dbgs() << "| Transform reproducers cannot be produced |\n";
231  llvm::dbgs() << "| in multi-threaded mode! |\n";
232  llvm::dbgs() << "=======================================================\n";
233  return;
234  }
235 
236  Operation *root = getRootOperation(target);
237 
238  // Add temporary debug / repro attributes, these must never leak out.
239  if (debugPayloadRootTag.empty()) {
240  target->setAttr(
243  }
244  if (debugTransformRootTag.empty()) {
245  transform->setAttr(
248  }
249 
250  DEBUG_WITH_TYPE(DEBUG_TYPE_DUMP_STDERR, {
251  llvm::dbgs() << "=== Transform Interpreter Repro ===\n";
252  printReproCall(llvm::dbgs() << "cat <<EOF | ",
253  root->getName().getStringRef(), passName,
254  debugPayloadRootTag, debugTransformRootTag, binaryName)
255  << "\n";
256  printModuleForRepro(llvm::dbgs(), root, transform);
257  llvm::dbgs() << "\nEOF\n";
258  llvm::dbgs() << "===================================\n";
259  });
260  (void)root;
261  DEBUG_WITH_TYPE(DEBUG_TYPE_DUMP_FILE, {
262  saveReproToTempFile(llvm::dbgs(), target, transform, passName,
263  debugPayloadRootTag, debugTransformRootTag,
264  transformLibraryPaths, binaryName);
265  });
266 
267  // Remove temporary attributes if they were set.
268  if (debugPayloadRootTag.empty())
270  if (debugTransformRootTag.empty())
272 }
273 
275  Operation *target, StringRef passName,
276  const std::shared_ptr<OwningOpRef<ModuleOp>> &sharedTransformModule,
277  const std::shared_ptr<OwningOpRef<ModuleOp>> &transformLibraryModule,
278  const RaggedArray<MappedValue> &extraMappings,
279  const TransformOptions &options,
280  const Pass::Option<std::string> &transformFileName,
281  const Pass::ListOption<std::string> &transformLibraryPaths,
282  const Pass::Option<std::string> &debugPayloadRootTag,
283  const Pass::Option<std::string> &debugTransformRootTag,
284  StringRef binaryName) {
285  bool hasSharedTransformModule =
286  sharedTransformModule && *sharedTransformModule;
287  bool hasTransformLibraryModule =
288  transformLibraryModule && *transformLibraryModule;
289  assert((!hasSharedTransformModule || !hasTransformLibraryModule) &&
290  "at most one of shared or library transform module can be set");
291 
292  // Step 1
293  // ------
294  // If debugPayloadRootTag was passed, then we are in user-specified selection
295  // of the transformed IR. This corresponds to REPL debug mode. Otherwise, just
296  // apply to `target`.
297  Operation *payloadRoot = target;
298  if (!debugPayloadRootTag.empty()) {
299  payloadRoot = findOpWithTag(target, kTransformDialectTagAttrName,
300  debugPayloadRootTag);
301  if (!payloadRoot)
302  return failure();
303  }
304 
305  // Step 2
306  // ------
307  // If a shared transform was specified separately, use it. Otherwise, the
308  // transform is embedded in the payload IR. If debugTransformRootTag was
309  // passed, then we are in user-specified selection of the transforming IR.
310  // This corresponds to REPL debug mode.
311  Operation *transformContainer =
312  hasSharedTransformModule ? sharedTransformModule->get() : target;
313  Operation *transformRoot =
314  debugTransformRootTag.empty()
315  ? findTopLevelTransform(transformContainer,
316  transformFileName.getArgStr(), options)
317  : findOpWithTag(transformContainer, kTransformDialectTagAttrName,
318  debugTransformRootTag);
319  if (!transformRoot)
320  return failure();
321 
322  if (!transformRoot->hasTrait<PossibleTopLevelTransformOpTrait>()) {
323  return emitError(transformRoot->getLoc())
324  << "expected the transform entry point to be a top-level transform "
325  "op";
326  }
327 
328  // Step 3
329  // ------
330  // Copy external defintions for symbols if provided. Be aware of potential
331  // concurrent execution (normally, the error shouldn't be triggered unless the
332  // transform IR modifies itself in a pass, which is also forbidden elsewhere).
333  if (hasTransformLibraryModule) {
334  if (!target->isProperAncestor(transformRoot)) {
336  transformRoot->emitError()
337  << "cannot inject transform definitions next to pass anchor op";
338  diag.attachNote(target->getLoc()) << "pass anchor op";
339  return diag;
340  }
342  SymbolTable::getNearestSymbolTable(transformRoot),
343  transformLibraryModule->get()->clone());
344  if (failed(diag)) {
345  diag.attachNote(transformRoot->getLoc())
346  << "failed to merge library symbols into transform root";
347  return diag;
348  }
349  }
350 
351  // Step 4
352  // ------
353  // Optionally perform debug actions requested by the user to dump IR and a
354  // repro to stderr and/or a file.
355  performOptionalDebugActions(target, transformRoot, passName,
356  debugPayloadRootTag, debugTransformRootTag,
357  transformLibraryPaths, binaryName);
358 
359  // Step 5
360  // ------
361  // Apply the transform to the IR
362  return applyTransforms(payloadRoot, cast<TransformOpInterface>(transformRoot),
363  extraMappings, options);
364 }
365 
367  MLIRContext *context, StringRef transformFileName,
368  ArrayRef<std::string> transformLibraryPaths,
369  std::shared_ptr<OwningOpRef<ModuleOp>> &sharedTransformModule,
370  std::shared_ptr<OwningOpRef<ModuleOp>> &transformLibraryModule,
371  function_ref<std::optional<LogicalResult>(OpBuilder &, Location)>
372  moduleBuilder) {
373  auto unknownLoc = UnknownLoc::get(context);
374 
375  // Parse module from file.
376  OwningOpRef<ModuleOp> moduleFromFile;
377  {
378  auto loc = FileLineColLoc::get(context, transformFileName, 0, 0);
379  if (failed(detail::parseTransformModuleFromFile(context, transformFileName,
380  moduleFromFile)))
381  return emitError(loc) << "failed to parse transform module";
382  if (moduleFromFile && failed(mlir::verify(*moduleFromFile)))
383  return emitError(loc) << "failed to verify transform module";
384  }
385 
386  // Assemble list of library files.
387  SmallVector<std::string> libraryFileNames;
388  if (failed(expandPathsToMLIRFiles(transformLibraryPaths, context,
389  libraryFileNames)))
390  return failure();
391 
392  // Parse modules from library files.
393  SmallVector<OwningOpRef<ModuleOp>> parsedLibraries;
394  for (const std::string &libraryFileName : libraryFileNames) {
395  OwningOpRef<ModuleOp> parsedLibrary;
396  auto loc = FileLineColLoc::get(context, libraryFileName, 0, 0);
397  if (failed(detail::parseTransformModuleFromFile(context, libraryFileName,
398  parsedLibrary)))
399  return emitError(loc) << "failed to parse transform library module";
400  if (parsedLibrary && failed(mlir::verify(*parsedLibrary)))
401  return emitError(loc) << "failed to verify transform library module";
402  parsedLibraries.push_back(std::move(parsedLibrary));
403  }
404 
405  // Build shared transform module.
406  if (moduleFromFile) {
407  sharedTransformModule =
408  std::make_shared<OwningOpRef<ModuleOp>>(std::move(moduleFromFile));
409  } else if (moduleBuilder) {
410  auto loc = FileLineColLoc::get(context, "<shared-transform-module>", 0, 0);
411  auto localModule = std::make_shared<OwningOpRef<ModuleOp>>(
412  ModuleOp::create(unknownLoc, "__transform"));
413 
414  OpBuilder b(context);
415  b.setInsertionPointToEnd(localModule->get().getBody());
416  if (std::optional<LogicalResult> result = moduleBuilder(b, loc)) {
417  if (failed(*result))
418  return (*localModule)->emitError()
419  << "failed to create shared transform module";
420  sharedTransformModule = std::move(localModule);
421  }
422  }
423 
424  if (parsedLibraries.empty())
425  return success();
426 
427  // Merge parsed libraries into one module.
428  auto loc = FileLineColLoc::get(context, "<shared-library-module>", 0, 0);
429  OwningOpRef<ModuleOp> mergedParsedLibraries =
430  ModuleOp::create(loc, "__transform");
431  {
432  mergedParsedLibraries.get()->setAttr("transform.with_named_sequence",
433  UnitAttr::get(context));
434  IRRewriter rewriter(context);
435  // TODO: extend `mergeSymbolsInto` to support multiple `other` modules.
436  for (OwningOpRef<ModuleOp> &parsedLibrary : parsedLibraries) {
437  if (failed(detail::mergeSymbolsInto(mergedParsedLibraries.get(),
438  std::move(parsedLibrary))))
439  return mergedParsedLibraries->emitError()
440  << "failed to verify merged transform module";
441  }
442  }
443 
444  // Use parsed libaries to resolve symbols in shared transform module or return
445  // as separate library module.
446  if (sharedTransformModule && *sharedTransformModule) {
447  if (failed(detail::mergeSymbolsInto(sharedTransformModule->get(),
448  std::move(mergedParsedLibraries))))
449  return (*sharedTransformModule)->emitError()
450  << "failed to merge symbols from library files "
451  "into shared transform module";
452  } else {
453  transformLibraryModule = std::make_shared<OwningOpRef<ModuleOp>>(
454  std::move(mergedParsedLibraries));
455  }
456  return success();
457 }
static std::string diag(const llvm::Value &value)
static llvm::ManagedStatic< PassManagerOptions > options
constexpr static llvm::StringLiteral kTransformDialectTagTransformContainerValue
Value of the attribute indicating the container of transform operations (containing the top-level tra...
static llvm::raw_ostream & printReproCall(llvm::raw_ostream &os, StringRef rootOpName, StringRef passName, const Pass::Option< std::string > &debugPayloadRootTag, const Pass::Option< std::string > &debugTransformRootTag, StringRef binaryName)
Prints the CLI command running the repro with the current path.
static void performOptionalDebugActions(Operation *target, Operation *transform, StringRef passName, const Pass::Option< std::string > &debugPayloadRootTag, const Pass::Option< std::string > &debugTransformRootTag, const Pass::ListOption< std::string > &transformLibraryPaths, StringRef binaryName)
#define DEBUG_TYPE_DUMP_STDERR
#define DEBUG_TYPE_DUMP_FILE
constexpr static llvm::StringLiteral kTransformDialectTagAttrName
Name of the attribute used for targeting the transform dialect interpreter at specific operations.
static Operation * findOpWithTag(Operation *root, StringRef tagKey, StringRef tagValue)
Finds an operation nested in root that has the transform dialect tag attribute with the value specifi...
static Operation * getRootOperation(Operation *target)
Returns the ancestor of target that doesn't have a parent.
static void saveReproToTempFile(llvm::raw_ostream &os, Operation *target, Operation *transform, StringRef passName, const Pass::Option< std::string > &debugPayloadRootTag, const Pass::Option< std::string > &debugTransformRootTag, const Pass::ListOption< std::string > &transformLibraryPaths, StringRef binaryName)
Saves the payload and the transform IR into a temporary file and reports the file name to os.
constexpr static llvm::StringLiteral kTransformDialectTagPayloadRootValue
Value of the attribute indicating the root payload operation.
static Operation * findTopLevelTransform(Operation *root, StringRef filenameOption, mlir::transform::TransformOptions options)
Finds the single top-level transform operation with root as ancestor.
static llvm::raw_ostream & printModuleForRepro(llvm::raw_ostream &os, Operation *root, Operation *transform)
Prints the module rooted at root to os and appends transformContainer if it is not nested in root.
This class coordinates rewriting a piece of IR outside of a pattern rewrite, providing a way to keep ...
Definition: PatternMatch.h:766
This class represents a diagnostic that is inflight and set to be reported.
Definition: Diagnostics.h:308
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Definition: Location.h:63
MLIRContext is the top-level object for a collection of MLIR operations.
Definition: MLIRContext.h:60
bool isMultithreadingEnabled()
Return true if multi-threading is enabled by the context.
This class helps build Operations.
Definition: Builders.h:209
StringRef getStringRef() const
Return the name of this operation. This always succeeds.
Operation is the basic unit of execution within MLIR.
Definition: Operation.h:88
bool hasTrait()
Returns true if the operation was registered with a particular trait, e.g.
Definition: Operation.h:745
AttrClass getAttrOfType(StringAttr name)
Definition: Operation.h:545
Operation * clone(IRMapping &mapper, CloneOptions options=CloneOptions::all())
Create a deep copy of this operation, remapping any operands that use values outside of the operation...
Definition: Operation.cpp:717
std::enable_if_t< llvm::function_traits< std::decay_t< FnT > >::num_args==1, RetT > walk(FnT &&callback)
Walk the operation by calling the callback for each nested operation (including this one),...
Definition: Operation.h:793
void print(raw_ostream &os, const OpPrintingFlags &flags=std::nullopt)
MLIRContext * getContext()
Return the context this operation is associated with.
Definition: Operation.h:216
Location getLoc()
The source location the operation was defined or derived from.
Definition: Operation.h:223
Operation * getParentOp()
Returns the closest surrounding operation that contains this operation or nullptr if this is a top-le...
Definition: Operation.h:234
InFlightDiagnostic emitError(const Twine &message={})
Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers tha...
Definition: Operation.cpp:268
void setAttr(StringAttr name, Attribute value)
If the an attribute exists with the specified name, change it to the new value.
Definition: Operation.h:577
OperationName getName()
The name of an operation is the key identifier for it.
Definition: Operation.h:119
bool isAncestor(Operation *other)
Return true if this operation is an ancestor of the other operation.
Definition: Operation.h:263
Attribute removeAttr(StringAttr name)
Remove the attribute with the specified name if it exists.
Definition: Operation.h:595
bool isProperAncestor(Operation *other)
Return true if this operation is a proper ancestor of the other operation.
Definition: Operation.cpp:219
OpTy get() const
Allow accessing the internal op.
Definition: OwningOpRef.h:51
A 2D array where each row may have different length.
Definition: RaggedArray.h:18
static Operation * getNearestSymbolTable(Operation *from)
Returns the nearest symbol table from a given operation from.
A utility result that is used to signal how to proceed with an ongoing walk:
Definition: Visitors.h:34
static WalkResult skip()
Definition: Visitors.h:53
static WalkResult advance()
Definition: Visitors.h:52
bool wasInterrupted() const
Returns true if the walk was interrupted.
Definition: Visitors.h:56
static WalkResult interrupt()
Definition: Visitors.h:51
This trait is supposed to be attached to Transform dialect operations that can be standalone top-leve...
Options controlling the application of transform operations by the TransformState.
LogicalResult interpreterBaseInitializeImpl(MLIRContext *context, StringRef transformFileName, ArrayRef< std::string > transformLibraryPaths, std::shared_ptr< OwningOpRef< ModuleOp >> &module, std::shared_ptr< OwningOpRef< ModuleOp >> &libraryModule, function_ref< std::optional< LogicalResult >(OpBuilder &, Location)> moduleBuilder=nullptr)
Template-free implementation of TransformInterpreterPassBase::initialize.
LogicalResult parseTransformModuleFromFile(MLIRContext *context, llvm::StringRef transformFileName, OwningOpRef< ModuleOp > &transformModule)
Utility to parse and verify the content of a transformFileName MLIR file containing a transform diale...
LogicalResult interpreterBaseRunOnOperationImpl(Operation *target, StringRef passName, const std::shared_ptr< OwningOpRef< ModuleOp >> &sharedTransformModule, const std::shared_ptr< OwningOpRef< ModuleOp >> &libraryModule, const RaggedArray< MappedValue > &extraMappings, const TransformOptions &options, const Pass::Option< std::string > &transformFileName, const Pass::ListOption< std::string > &transformLibraryPaths, const Pass::Option< std::string > &debugPayloadRootTag, const Pass::Option< std::string > &debugTransformRootTag, StringRef binaryName)
Template-free implementation of TransformInterpreterPassBase::runOnOperation.
InFlightDiagnostic mergeSymbolsInto(Operation *target, OwningOpRef< Operation * > other)
Merge all symbols from other into target.
Definition: Utils.cpp:79
LogicalResult expandPathsToMLIRFiles(ArrayRef< std::string > paths, MLIRContext *context, SmallVectorImpl< std::string > &fileNames)
Expands the given list of paths to a list of .mlir files.
LogicalResult applyTransforms(Operation *payloadRoot, TransformOpInterface transform, const RaggedArray< MappedValue > &extraMapping={}, const TransformOptions &options=TransformOptions(), bool enforceToplevelTransformOp=true)
Entry point to the Transform dialect infrastructure.
Include the generated interface declarations.
LogicalResult failure(bool isFailure=true)
Utility function to generate a LogicalResult.
Definition: LogicalResult.h:62
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
Definition: LogicalResult.h:56
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
LogicalResult verify(Operation *op, bool verifyRecursively=true)
Perform (potentially expensive) checks of invariants, used to detect compiler bugs,...
Definition: Verifier.cpp:421
bool failed(LogicalResult result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value.
Definition: LogicalResult.h:72
This class represents an efficient way to signal success or failure.
Definition: LogicalResult.h:26
This class represents a specific pass option that contains a list of values of the provided data type...
Definition: Pass.h:105
This class represents a specific pass option, with a provided data type.
Definition: Pass.h:93