I’m wondering if I can mark my function as pure? If not, I propose to add such an attribute into MLIR
It could help to give a compiler hint that operation which going to be lowered to some backend specific sub-route to have no side effects (mostly on memory). Right now if you call some custom operation MLIR thinks that this functional call has effect on memory.
"bar.foo"(%arg1) : (index) -> () {"#pure"}
A separate question if function actually changes content in a memref
, while keeping memref
shape unchanged or not performing reallocations/memory movements inside a function. Strictly speaking this function is not pure but some attribute may help to optimize such functions as well. If so, what should be the name of such attribute.
"bar.fill_zero_static_shapes"(%arg0: memref<?xf64, #map>) : (index) -> () {"#semi-pure"}
cc: @Hardcode84