Skip to content

[SPIR-V] Allow variable number of operands in work-group metadata #7486

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

Merged

Conversation

steffenlarsen
Copy link
Contributor

The reqd_work_group_size and work_group_size_hint metadata nodes are currently expected to have exactly 3 operands which are in turn translated to the 3 operands of their corresponding SPIR-V execution modes. This commit relaxes this requirement by allowing the metadata to have 1-3 operands, where the missing dimensions are padded with 1's in the corresponding execution mode. Note that the information about the dimensionality of the original metadata is lost after translation, so reverse translation will always result in the metadata having all three operands.

Motivation comes from #7450 where instead of doing the implicit padding during LLVM IR generation we want to simplify the metadata to only have the operands specified. Not only does it relax the requirements, it also lets us preserve information about dimensionality up until it is translated into SPIR-V.

NOTE: This is a cherry-pick of KhronosGroup/SPIRV-LLVM-Translator#1726.

The reqd_work_group_size and work_group_size_hint metadata nodes are currently expected to have exactly 3 operands which are in turn translated to the 3 operands of their corresponding SPIR-V execution modes. This commit relaxes this requirement by allowing the metadata to have 1-3 operands, where the missing dimensions are padded with 1's in the corresponding execution mode. Note that the information about the dimensionality of the original metadata is lost after translation, so reverse translation will always result in the metadata having all three operands.

Motivation comes from intel#7450 where instead of doing the implicit padding during LLVM IR generation we want to simplify the metadata to only have the operands specified. Not only does it relax the requirements, it also lets us preserve information about dimensionality up until it is translated into SPIR-V.
@steffenlarsen steffenlarsen requested a review from a team as a code owner November 22, 2022 12:05
@MrSidims
Copy link
Contributor

MrSidims commented Nov 22, 2022

While I'm OK with the change, I wonder why do we need this to be cherry-picked out of pulldown cycle?

@steffenlarsen
Copy link
Contributor Author

While I'm OK with the change, I wonder why do we need this to be cherry-picked out of pulldown cycle?

It is mostly to unblock the following patches. If pulldown is right around the corner I am okay with waiting.

@MrSidims MrSidims changed the title [SYCL] Cherry-pick of KhronosGroup/SPIRV-LLVM-Translator#1726 [SPIR-V] Allow variable number of operands in work-group metadata Nov 23, 2022
Copy link
Contributor

@MrSidims MrSidims left a comment

Choose a reason for hiding this comment

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

LGTM

@MrSidims MrSidims requested a review from a team November 23, 2022 10:17
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.

3 participants