Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify GPUTileSwizzleUtils and avoid creating unit dims. #19105

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

bjacob
Copy link
Contributor

@bjacob bjacob commented Nov 11, 2024

In getIntrinsicSwizzle, we had a slightly roundabout way of constructing the swizzle from the SingleSubgroupLayout. We started from the thread dims, which we used unconditionally even if they had the value 1, leading to unit dims; and then we inserted the element dims on the inside, which required custom manipulation of the swizzle field. Now we just start from the element dims and work our way outwards from there, which means we can reuse the same helper that used to be named unroll and that we rename here to expand in preparation for #19102, and which we also move to be a static helper since it's no longer used outside of this file.

@bjacob bjacob marked this pull request as ready for review November 12, 2024 16:18
@bjacob bjacob force-pushed the users/bjacob/cdna1-cdna2-data-tiling branch from a89bc41 to e5899d6 Compare November 12, 2024 16:25
@bjacob bjacob requested a review from benvanik as a code owner November 12, 2024 16:25
@bjacob bjacob force-pushed the users/bjacob/simplify-unroll branch from 7c3f370 to d0eb097 Compare November 12, 2024 16:25
Comment on lines +79 to +81
// expected-remark @above {{layout of result #0 is #iree_vector_ext.layout<<[ BATCHX, LANEX], [1, 16]>, <[ BATCHY, VECTORX], [1, 16]>>}}
%rhs = vector.transfer_read %b[%c0, %c0], %cst_0 {in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16>
// expected-remark @above {{layout of result #0 is #iree_vector_ext.layout<<[ BATCHX, LANEX], [1, 16]>, <[ BATCHY, LANEY, VECTORX], [1, 1, 16]>>}}
// expected-remark @above {{layout of result #0 is #iree_vector_ext.layout<<[ BATCHX, LANEX], [1, 16]>, <[ BATCHY, VECTORX], [1, 16]>>}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know that the patch would update the test. I thought that the TileSwizzle things are only used on data-tiling path. Is it used by other work today?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as of #18953, it is also used to compute iree_vector_ext.layout.

@bjacob bjacob force-pushed the users/bjacob/simplify-unroll branch from d0eb097 to 47232f2 Compare November 12, 2024 19:35
Copy link
Contributor

@hanhanW hanhanW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

Base automatically changed from users/bjacob/cdna1-cdna2-data-tiling to main November 12, 2024 19:59
@bjacob bjacob enabled auto-merge (squash) November 12, 2024 20:00
Signed-off-by: Benoit Jacob <[email protected]>
@bjacob bjacob force-pushed the users/bjacob/simplify-unroll branch from 47232f2 to 3081305 Compare November 13, 2024 18:32
@bjacob bjacob merged commit ab35e1b into main Nov 13, 2024
36 of 39 checks passed
@bjacob bjacob deleted the users/bjacob/simplify-unroll branch November 13, 2024 19:07
Groverkss pushed a commit to Groverkss/iree that referenced this pull request Dec 1, 2024
…19105)

In `getIntrinsicSwizzle`, we had a slightly roundabout way of
constructing the swizzle from the `SingleSubgroupLayout`. We started
from the `thread` dims, which we used unconditionally even if they had
the value 1, leading to unit dims; and then we inserted the `element`
dims *on the inside*, which required custom manipulation of the
`swizzle` field. Now we just start from the `element` dims and work our
way outwards from there, which means we can reuse the same helper that
used to be named `unroll` and that we rename here to `expand` in
preparation for iree-org#19102, and which
we also move to be a `static` helper since it's no longer used outside
of this file.

---------

Signed-off-by: Benoit Jacob <[email protected]>
giacs-epic pushed a commit to giacs-epic/iree that referenced this pull request Dec 4, 2024
…19105)

In `getIntrinsicSwizzle`, we had a slightly roundabout way of
constructing the swizzle from the `SingleSubgroupLayout`. We started
from the `thread` dims, which we used unconditionally even if they had
the value 1, leading to unit dims; and then we inserted the `element`
dims *on the inside*, which required custom manipulation of the
`swizzle` field. Now we just start from the `element` dims and work our
way outwards from there, which means we can reuse the same helper that
used to be named `unroll` and that we rename here to `expand` in
preparation for iree-org#19102, and which
we also move to be a `static` helper since it's no longer used outside
of this file.

---------

Signed-off-by: Benoit Jacob <[email protected]>
Signed-off-by: Giacomo Serafini <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants