PSA: Convert linalg.fill to an OpDSL Operation

linalg.fill is the only handwritten structured operation left in the Linalg dialect. I plan to replace it by an equivalent operation defined using OpDSL. In fact, I will rename the existing linalg.fill_tensor to linalg.fill and remove the existing linalg.fill.

This change has two main consequences:

  1. the pretty printed form of linalg.fill changes from:
%1 = linalg.fill(%cst, %0) : f32, tensor<?x?xf32> -> tensor<?x?xf32>

to

%1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<?x?xf32>) -> tensor<?x?xf32>
  1. the builder signature changes from
rewriter.create<linalg::FillOp>(loc, val, output)

to

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

The two value ranges specify the inputs and outputs of the operation, respectively.

There is a work in progress revision that implements the change ⚙ D120728 [mlir][linalg] Replace linalg.fill by OpDSL variant.. It bases on two smaller changes that need to land first (⚙ D120725 [mlir][linalg] Add a FillOpInterface. and ⚙ D120726 [mlir][OpDSL] Add support for adding canonicalization patterns.).

I plan to land the change sometime next week.

1 Like