allocs that have users outside of loops are guaranteed to fail in
multibuffer.
Instead of exposing ourselves to that failure in the transform dialect,
filter out the allocs that fall in this category.
To be able to do this filtering we have to change the multibuffer
transform op from TransformEachOpTrait to a plain TransformOp. This is
because TransformEachOpTrait expects that every successful applyToOne
returns a non-empty result.
Couple of notes:
- I changed the assembly syntax to make sure we only get alloc ops as input. (And added a test case to make sure we reject invalid inputs.)
- multibuffer can still fail pretty easily when you know its limitations. See the updated op failed to multibuffer test case for instance. Longer term, instead of leaking/coupling the actual implementation (in this case the checks normally done in memref::multiBuffer) with the transform dialect (the added check in ::apply), we may want to refactor how we structure the underlying implementation. E.g., we could imagine a canApply method for all the implementations that we want to hook up in the transform dialect. This has some implications on how not to duplicate work between canApply and the actual implementation but I thought I throw that here to have us think about it :).
I'm guessing I need to modify some bazel files because of this new dependency, right?
(And looks like I dropped the CMakeFiles.txt changes as well and nothing broke x))