Page MenuHomePhabricator

[mlir][spirv] Add RewriteInserts pass.
ClosedPublic

Authored by denis13 on Fri, Jun 19, 8:14 AM.

Details

Summary

Add a pass to rewrite sequential chains of spirv::CompositeInsert
operations into spirv::CompositeConstruct operations.

Diff Detail

Event Timeline

denis13 created this revision.Fri, Jun 19, 8:14 AM

Could this be conveyed as a simple canonicalization pattern on spv.CompositeInsert instead?

mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
73

How is this valid? The operation is required to be use_empty on destructure, otherwise it will assert. Seems like you want to iterate in reverse(llvm::reverse).

83

nit: Please remove user names from todos.

100

nit: getDefiningOp<spirv::CompositeInsertOp>()

denis13 marked an inline comment as done.Fri, Jun 19, 11:55 AM
denis13 added inline comments.
mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
73

Got your point, thanks.

antiagainst accepted this revision.Fri, Jun 26, 6:48 AM

Awesome!

This revision is now accepted and ready to land.Fri, Jun 26, 6:48 AM
This revision was automatically updated to reflect the committed changes.