This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Transform] Fix implementation of the generic apply that is based on applyToOne.
ClosedPublic

Authored by nicolasvasilache on Jun 23 2022, 2:34 AM.

Details

Summary

The result of applying an N-result producing transformation to M payload ops
is an M-wide result, each containing N result operations.
This requires a transposition of the results obtained by calling applyToOne.

This revision fixes the issue and adds more advanced tests that exercise the behavior.

Diff Detail

Event Timeline

nicolasvasilache requested review of this revision.Jun 23 2022, 2:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2022, 2:34 AM

Finish impl and add tests.

Drop spurious dump.

ftynse accepted this revision.Jun 23 2022, 5:09 AM
ftynse added inline comments.
mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h
799

static, otherwise we may run into multiple definitions

839–858

This error sounds like a misuse of the TransformEachTrait by the IR designer: the trait should not be attached to the transform ops that produce a different number of results for different inputs. I'd rather make it an assertion, or at least a definite failure, not a silenceable one. I understand the diagnostic interface is more convenient so we can emit a diagnostic and then llvm::report_fatal_error("trait misused") I suppose.

845

Nit: there's emitSilenceableError() declared in the interface.

mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
61 ↗(On Diff #439336)

Leftover debug.

This revision is now accepted and ready to land.Jun 23 2022, 5:09 AM
nicolasvasilache marked 4 inline comments as done.

Address comments.

This revision was landed with ongoing or failed builds.Jun 23 2022, 5:29 AM
This revision was automatically updated to reflect the committed changes.