Skip to content

[mlir][transform] Fix handling of transitive include in interpreter. #67560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions mlir/include/mlir/Dialect/Transform/IR/TransformDialect.td
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ def Transform_Dialect : Dialect {
constexpr const static ::llvm::StringLiteral kArgReadOnlyAttrName =
"transform.readonly";

/// Names of the attributes indicating whether an argument of an external
/// transform dialect symbol is consumed or only read.
StringAttr getConsumedAttrName() const {
return StringAttr::get(getContext(), kArgConsumedAttrName);
}
StringAttr getReadOnlyAttrName() const {
return StringAttr::get(getContext(), kArgReadOnlyAttrName);
}

template <typename DataTy>
const DataTy &getExtraData() const {
return *static_cast<const DataTy *>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ LogicalResult interpreterBaseRunOnOperationImpl(
/// transform script. If empty, `debugTransformRootTag` is considered or the
/// pass root operation must contain a single top-level transform op that
/// will be interpreted.
/// - transformLibraryFileName: if non-empty, the name of the file containing
/// definitions of external symbols referenced in the transform script.
/// These definitions will be used to replace declarations.
/// - transformLibraryFileName: if non-empty, the module in this file will be
/// merged into the main transform script run by the interpreter before
/// execution. This allows to provide definitions for external functions
/// used in the main script. Other public symbols in the library module may
/// lead to collisions with public symbols in the main script.
/// - debugPayloadRootTag: if non-empty, the value of the attribute named
/// `kTransformDialectTagAttrName` indicating the single op that is
/// considered the payload root of the transform interpreter; otherwise, the
Expand All @@ -85,7 +87,7 @@ LogicalResult interpreterBaseRunOnOperationImpl(
/// as template arguments. They are *not* expected to to implement `initialize`
/// or `runOnOperation`. They *are* expected to call the copy constructor of
/// this class in their copy constructors, short of which the file-based
/// transform dialect script injection facility will become nonoperational.
/// transform dialect script injection facility will become non-operational.
///
/// Concrete passes may implement the `runBeforeInterpreter` and
/// `runAfterInterpreter` to customize the behavior of the pass.
Expand Down
17 changes: 17 additions & 0 deletions mlir/include/mlir/IR/SymbolTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,23 @@ class SymbolTable {
/// after insertion as attribute.
StringAttr insert(Operation *symbol, Block::iterator insertPt = {});

/// Renames the given op or the op refered to by the given name to the given
/// new name and updates the symbol table and all usages of the symbol
/// accordingly. Fails if the updating of the usages fails.
LogicalResult rename(StringAttr from, StringAttr to);
LogicalResult rename(Operation *op, StringAttr to);
LogicalResult rename(StringAttr from, StringRef to);
LogicalResult rename(Operation *op, StringRef to);

/// Renames the given op or the op refered to by the given name to the a name
/// that is unique within this and the provided other symbol tables and
/// updates the symbol table and all usages of the symbol accordingly. Returns
/// the new name or failure if the renaming fails.
FailureOr<StringAttr> renameToUnique(StringAttr from,
ArrayRef<SymbolTable *> others);
FailureOr<StringAttr> renameToUnique(Operation *op,
ArrayRef<SymbolTable *> others);

/// Return the name of the attribute used for symbol names.
static StringRef getSymbolAttrName() { return "sym_name"; }

Expand Down
Loading