Repository navigation
Move Shared Mem Transpose Detection Logic to LinalgOpTrait - #10495
Conversation
96a6bf8 to
a9954bf
Compare
dcaballe
left a comment
There was a problem hiding this comment.
Awesome! Thanks for the refactoring!
I think in general the idea is to keep in LinalgOpInfo only the code that is generic enough to be reusable. We can extend this class to take a couple of lambda filters, one for AffineMap and another one for LinalgOp, to pass specific constraints from each client that are not generic enough to be reusable but should be used to make the transpose property more specific. I'm adding more comments inline. Happy to quickly discuss this over GVC!
|
@dcaballe on closer inspection, I've realized the If I'm bypassing all of that logic, there is very little I can reuse on the GPU side that isn't just single function calls. I'm now thinking it might make more sense to consolidate the transpose code in a LLVMGPU specific shared header that can be reused throughout. |
This logic is not detecting anything specific to CPUs or any specific transposes. It's just detecting any transpose operation. There are, of course, some TODOs that will be incrementally addressed but it's nothing specific. The map inversion is due to the indexing map semantics in a LinalgOp. They represent how to transform the iteration space indexes for a specific input/output. However, to actually model the memory transformations that will happen out of those indexing maps, we have to transform them accordingly, hence the inversions that you see. Again, this is nothing specific. The inversion and related code is what we use to generate the actual transfer ops and transpose operations out of the generic op.
That's why I mentioned that the filter should add extra constraints, not just replace the existing one. The existing one is generic and will match all the transposes (eventually). An extra filter should build on top of the generic one and add more constraints to narrow down the output.
I guess that's up to you but as you can see the logic will get complicated the moment to try to match more cases than the current one for the FVD. |
a9954bf to
6b02384
Compare
|
I've reworked the transpose info to support some more general traits that are useful for GPU. I've also removed the specific shared mem transpose code and added to a separate header. This is supplied as an additional filter for transposed ops. |
dcaballe
left a comment
There was a problem hiding this comment.
Looks great! Just a couple of comments. Thanks!
6b02384 to
afe989d
Compare
afe989d to
fcbf5b8
Compare
Cleanup to consolidate code and improve readability.
Related to #10005