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
[SYCL] Add work_group_num_dim metadata #13600
base: sycl
Are you sure you want to change the base?
Conversation
Corresponding UR work: oneapi-src/unified-runtime#954 |
Fixes: #9353 |
@jchlanda, could you please add FE test? |
Regarding the naming, would this problem (and solution) not also apply to |
I think you are right, the spec this about the hint:
I'm happy to rename it to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SYCL changes LGTM 🚀
To prevent accidental merge, I'll approve the PR after the UR PR gets merged and the UR tag gets updated accordingly.
Yeah... We've perhaps got a short window to rename it once it's merged but it'd be better to get it right first time, before downstream users start relying on the name! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sycl-post-link part looks OK to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! Am I understanding this right that the problem is due to the AMD target expecting all 3 dimensions in the "reqd_work_group_size" metadata node? If so, I can see how the current implementation is problematic. The alternative it to change it in upstream, but I suppose the padding may as well be done ASAP and then we can have the "specified dimensions" information separately for the SYCL case.
As for the approach on how to fix it, I think this is reasonable. However, I would prefer if metadata would be the same for all paths. Would it be possible to change the current implementation to always do the padding and then have the dimensions node on the side. It would simplify the general case of checking how many dimensions were specified, and cases that don't care can have a valid 3D value. Note that it might require changes to the SPIR-V translator.
That's exactly right, we had a couple of goes at it in the past:
The feedback that we received was that we piggy packed on already existing metadata and we should not modify its semantics, something that I tend to agree with. Preserving the notion of the number of specified dimensions seems like the most elegant solution.
I've not worked much with non-GPU targets, so please correct me if I'm wrong here, the reason for padding only for AMD/NVIDIA targets is that those two are the only ones that use the metadata mechanism: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FE changes LGTM.
Emit metadata to describe number of dimensions specified in reqd_work_group_size. This is needed in order to be able to use that metadata correctly, since it was specified for OpenCL, and SYCL piggy-backs on it, backends correctly assert if all 3 dimensions are not provided. work_group_num_dim allows the compiler to pad the missing dimensions with 1, while preserving the notion of how many dimensions were specified.
bace41b
to
c2ead3f
Compare
Emit metadata to describe number of dimensions specified in
reqd_work_group_size
. This is needed in order to be able to use that metadata correctly, since it was specified for OpenCL, and SYCL piggy-backs on it, backends correctly assert if all3
dimensions are not provided.work_group_num_dim
allows the compiler to pad the missing dimensions with1
, while preserving the notion of how many dimensions were specified.