How to bufferize "vector.print"?

When I tried mlir-opt -empty-tensor-to-alloc-tensor --one-shot-bufferize on:

module {
  func.func private @func1(%arg0: f32, %arg1: tensor<8xf32>) {
    %1 = tensor.empty() : tensor<8xi1>
    vector.print %1 : tensor<8xi1>
    return
  }
}

It said:

temp.mlir:4:5: error: op was not bufferized
    vector.print %1 : tensor<8xi1>

Can the vector.print be bufferized?

vector.print needs a vector operand, but it seems the verifier is too lenient (cc @aartbik for a quickfix).

You can use vector.transfer_read to get that vector out of the tensor (e.g. llvm-project/ops.mlir at main · llvm/llvm-project · GitHub but in your case you can drop the permutation_map since it is trivial).

2 Likes

Taken care of in ⚙ D143423 [mlir][vector] add proper verification to vector.print operation

2 Likes