This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Transform] Add a transform.split_handles operation and fix general silenceable bugs.
ClosedPublic

Authored by nicolasvasilache on Oct 7 2022, 12:07 AM.

Details

Summary

The transform.split_handles op is useful for ensuring a statically known number of operations are
tracked by the source handle and to extract them into individual handles
that can be further manipulated in isolation.

In the process of making the op robust wrt to silenceable errors and the suppress mode, issues were
uncovered and fixed.

The main issue was that silenceable errors were short-circuited too early and the payloads were not
set. This resulted in suppressed silenceable errors not propagating correctly.
Fixing the issue triggered a few test failures: silenceable error returns now must properly set the results state.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptOct 7 2022, 12:07 AM
nicolasvasilache requested review of this revision.Oct 7 2022, 12:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 7 2022, 12:07 AM
springerm accepted this revision.Oct 7 2022, 12:26 AM
springerm added inline comments.
mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
229–231

Why not a silenceable error?

mlir/lib/Dialect/Transform/IR/TransformOps.cpp
488

drop

490

Documentation says that this operation always succeeds.

492–493

nit: Could use llvm::enumerate

mlir/test/Dialect/Transform/test-interpreter.mlir
775

Check number of payload ops:

// expected-remark @below {{1}}
transform.test_print_number_of_associated_payload_ir_ops %h#0

etc.

This revision is now accepted and ready to land.Oct 7 2022, 12:26 AM
ftynse added inline comments.Oct 7 2022, 1:23 AM
mlir/lib/Dialect/Transform/IR/TransformOps.cpp
490

It feels strange if the op fails to do what its name suggests it would (split the handle) and still succeeds, so I think the documentation is wrong. Also, this should be a silenceable failure, we are not irreversibly modifying the IR. There seems to be a confusion as to what a silenceable failure means: it's not just a compiler warning that the interpreter will step over and continue, it is still a failure and the interpretation will be interrupted. It can just recover and start in a different place.

mlir/test/Dialect/Transform/test-interpreter.mlir
779

Also check the user-visible error message.

ftynse requested changes to this revision.Oct 7 2022, 1:38 AM
This revision now requires changes to proceed.Oct 7 2022, 1:38 AM
nicolasvasilache marked 5 inline comments as done.
nicolasvasilache edited the summary of this revision. (Show Details)

Address.

Investigate deeper into suppres mode.

nicolasvasilache retitled this revision from [mlir][Transform] Add a transform.split_handles operation to [mlir][Transform] Add a transform.split_handles operation and fix general silenceable bugs..
nicolasvasilache edited the summary of this revision. (Show Details)

Bugfixes.

nicolasvasilache marked 2 inline comments as done.Oct 7 2022, 5:01 AM
nicolasvasilache edited the summary of this revision. (Show Details)

Fix commit msg.

ftynse accepted this revision.Oct 7 2022, 7:21 AM
ftynse added inline comments.
mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp
295–296 ↗(On Diff #466045)

Leftover debug?

This revision is now accepted and ready to land.Oct 7 2022, 7:21 AM
nicolasvasilache marked an inline comment as done.Oct 7 2022, 9:21 AM
nicolasvasilache added inline comments.
mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp
295–296 ↗(On Diff #466045)

no, it's legit

But maybe I can fold it as part of emitRemark() << state.getPayloadOps(getHandle()).size();

will try