Did you hand-write this IR? bufferization.to_memref
and bufferization.to_tensor
are ops that are sometimes inserted by the bufferization framework (when something cannot be bufferized) and are rarely used standalone.
mlir-opt -one-shot-bufferize="bufferize-function-boundaries"
can lower these ops. But there are some limitations. E.g., you need the restrict
attribute on to_tensor
.
Ideally, you’d write “full” tensor IR without any memrefs (maybe except for the function boundary) and let One-Shot Bufferize take care of the lowering from tensor->memref. (However, I’m not sure how that would work for gpu.launch
.)