Repository navigation
Give inner_tiled a strict verifier and explicit semantics with boolean parameters distributed and opaque - #22369
Conversation
MaheshRavishankar
left a comment
There was a problem hiding this comment.
Ill let other people provide more detailed feedback, but IMO this implies that this op is not designed properly, and is being used in contexts where it shouldnt be. Adding extra attributes on top seems like a band-aid to me.
Btw, the new attributes added should at least be spelled out in the op description.
|
Instead of adding these attributes on the operation itself, we could instead add it to the
The reason for an attribute descriptor instead of a body region is that the kinds of transformations we needed to do (expansion/distribution) are substantially harder when dealing with regions. The price of that is verbose attributes. The reason for a single op over an interface is that patterns that transform the outer dims would necessarily have shared implementations meaning the interface would likely bloat quickly (not that the |
|
@MaheshRavishankar / @qedawkins , some high-level replies:
I think it was designed initially just right for the problem space that we were entering then, given that there was no way that we could see the destination so this would have to evolve anyway. Evolve it did -- and along the way it accrued technical debt in that some of the evolutions came at a cost in terms of clarity and definedness of semantics. You could say that "supporting distribution" was part of the initial scope so that shouldn't have compromised semantics, but that "initial scope" was a really big chunk in itself, and maybe playing fast and loose was the reasonable thing to do, particularly as in exchange for the lax semantics we got more flexibility for the subsequent evolutions. One thing that in hindsight is impressive is that even though the initial non-DT flavors relied on opaque shapes, when I did DT I was able to do strict expanded shapes without changing the framework - so the new/better/stricter form was able to evolve within the existing lax form, thanks to the laxness. Key point: This PR is not having strong opinions about anything. It's just the smallest incremental change to this op that recovers clarity and definedness of semantics. The concern about the lax verifier and loose semantics is not just an abstract concern. The lax verifier meant that we had false positives allowing ill-formed IR to pass and later cause out-of-bounds accesses in the compiler (#22284 (comment)) as mentioned in #22336. The verifier code was also convoluted. These were not incidental details but were forced by the loose semantics.
Yup, omission, doing that.
We could do that and I'm not opposed to it, but:
|
896244c to
ee7dd7c
Compare
At this point I'm not any more an owner of this op than you/others given how much it has evolved, and if this is the direction we have to go right now I don't want to cause needless churn and won't block, but I do want to share my concerns.
I don't agree. From the perspective of the
|
The other thing that changes with distribution is the shape of the tensor operands, in the inner dimensions. I can see the mental model you are laying out here, where distributedness is a property of the Kind attributes. But if we look at the current MMAAttr-like attributes and even the underlying interfaces like So I think I agree with you on the destination, but I think that getting there in a way that is really worth doing (doesn't just shift a semantics gap one step down) will take more changes than should be fitted into this PR. I think that this PR as-is is a necessary first step towards that, as by tightening the existing semantics it takes care of the hard part (climbing out of a hole of loose semantics) and leaves only a more reasonable follow-up to do (evolve design within clear constraints covered by verifiers). Do you want me to file the Issue? |
Yes, I think you hit the nail on the head here and I should have been clearer when stating my concerns. The
Part of why I said I wouldn't block was because the changes I'm asking for amounts to a substantial rewrite, and if we are on the same page then this SGTM. |
|
Just looking on from fairly far off, this operation has been rewritten once already. Going by the rule of three (you need three tries to get something right), its OK to have substantial changes and staging them, but what's missing is someone effectively owning the state and making sure that we are heading towards what is (eventually) stable. |
ee7dd7c to
cd74cb6
Compare
|
@qedawkins , @krzysz00 , what I just pushed here should have all what we discussed. |
Groverkss
left a comment
There was a problem hiding this comment.
Looks fine to me, I don't have much opinion on this
| 1. Expanded vs opaque tile shapes. | ||
| 2. On GPU: distributed vs undistributed tile shapes. | ||
| Having this split into a separate interface allows mutating those | ||
| attribtutes separately. |
There was a problem hiding this comment.
| attribtutes separately. | |
| attributes separately. |
| if (!isPermutationVector(permAttr.asArrayRef())) | ||
| return emitOpError("invalid permutation"); | ||
| for (auto [index, permAttr] : | ||
| llvm::enumerate(getPermutations()->getAsRange<DenseI64ArrayAttr>())) { |
There was a problem hiding this comment.
I believe this is missing verification that the number of permutations equals the operand count (needed to keep later indexing in bounds).
There was a problem hiding this comment.
Good catch: added several more test cases here.
Signed-off-by: Benoit Jacob <[email protected]> review comments Signed-off-by: Benoit Jacob <[email protected]> wip Signed-off-by: Benoit Jacob <[email protected]>
Signed-off-by: Benoit Jacob <[email protected]>
cd74cb6 to
96b836f
Compare
…ean parameters `distributed` and `opaque` (iree-org#22369) Fixes iree-org#22336. Discussed on Discord around https://discord.com/channels/689900678990135345/1254843174111678555/1430237660781215794 --------- Signed-off-by: Benoit Jacob <[email protected]>
…ean parameters `distributed` and `opaque` (iree-org#22369) Fixes iree-org#22336. Discussed on Discord around https://discord.com/channels/689900678990135345/1254843174111678555/1430237660781215794 --------- Signed-off-by: Benoit Jacob <[email protected]>
…ean parameters `distributed` and `opaque` (iree-org#22369) Fixes iree-org#22336. Discussed on Discord around https://discord.com/channels/689900678990135345/1254843174111678555/1430237660781215794 --------- Signed-off-by: Benoit Jacob <[email protected]>
Fixes #22336.
Discussed on Discord around https://discord.com/channels/689900678990135345/1254843174111678555/1430237660781215794