Skip to content

Commit

Permalink
[mlir][bufferization] Add dump_alias_sets option to transform op (#…
Browse files Browse the repository at this point in the history
…68289)

Add `dump_alias_sets` to `transform.bufferization.one_shot_bufferize`.
This option is useful for debugging. Also improve the verifier to ensure
that `test_analysis_only` is set when other debugging flags are enabled.
  • Loading branch information
matthias-springer authored Oct 5, 2023
1 parent 33a194b commit 5958043
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def OneShotBufferizeOp
DefaultValuedAttr<BoolAttr, "false">:$allow_return_allocs_from_loops,
DefaultValuedAttr<BoolAttr, "false">:$allow_unknown_ops,
DefaultValuedAttr<BoolAttr, "false">:$bufferize_function_boundaries,
DefaultValuedAttr<BoolAttr, "false">:$dump_alias_sets,
DefaultValuedAttr<BoolAttr, "false">:$test_analysis_only,
DefaultValuedAttr<BoolAttr, "false">:$print_conflicts,
DefaultValuedAttr<StrAttr, "\"memref.copy\"">:$memcpy_op);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ void transform::BufferLoopHoistingOp::getEffects(
LogicalResult transform::OneShotBufferizeOp::verify() {
if (getMemcpyOp() != "memref.copy" && getMemcpyOp() != "linalg.copy")
return emitOpError() << "unsupported memcpy op";
if (getPrintConflicts() && !getTestAnalysisOnly())
return emitOpError() << "'print_conflicts' requires 'test_analysis_only'";
if (getDumpAliasSets() && !getTestAnalysisOnly())
return emitOpError() << "'dump_alias_sets' requires 'test_analysis_only'";
return success();
}

Expand All @@ -58,6 +62,7 @@ transform::OneShotBufferizeOp::apply(transform::TransformRewriter &rewriter,
options.allowReturnAllocsFromLoops = getAllowReturnAllocsFromLoops();
options.allowUnknownOps = getAllowUnknownOps();
options.bufferizeFunctionBoundaries = getBufferizeFunctionBoundaries();
options.dumpAliasSets = getDumpAliasSets();
options.testAnalysisOnly = getTestAnalysisOnly();
options.printConflicts = getPrintConflicts();
if (getFunctionBoundaryTypeConversion().has_value())
Expand Down

0 comments on commit 5958043

Please sign in to comment.