Page MenuHomePhabricator

[mlir][linalg] Replace linalg.fill by OpDSL variant.

Authored by gysit on Mar 1 2022, 7:04 AM.



The revision removes the linalg.fill operation and renames the OpDSL generated linalg.fill_tensor operation to replace it. After the change, all named structured operations are defined via OpDSL and there are no handwritten operations left.

A side-effect of the change is that the pretty printed form changes from:

%1 = linalg.fill(%cst, %0) : f32, tensor<?x?xf32> -> tensor<?x?xf32>

changes to

%1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<?x?xf32>) -> tensor<?x?xf32>

Additionally, the builder signature now takes input and output value ranges as it is the case for all other OpDSL operations:

rewriter.create<linalg::FillOp>(loc, val, output)

changes to

rewriter.create<linalg::FillOp>(loc, ValueRange{val}, ValueRange{output})

All other changes remain minimal. In particular, the canonicalization patterns are the same and the value(), output(), and result() methods are now implemented by the FillOpInterface.

Depends On D120726

Diff Detail

Event Timeline

gysit created this revision.Mar 1 2022, 7:04 AM
gysit requested review of this revision.Mar 1 2022, 7:04 AM
gysit updated this revision to Diff 414020.Mar 9 2022, 12:09 AM


Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2022, 12:09 AM
gysit retitled this revision from [mlir][linalg] WIP Replace linalg.fill (do not commit). to [mlir][linalg] Replace linalg.fill by OpDSL variant..Mar 9 2022, 12:09 AM
This revision is now accepted and ready to land.Mar 11 2022, 1:45 AM
gysit updated this revision to Diff 415029.Mar 14 2022, 1:38 AM


This revision was automatically updated to reflect the committed changes.