-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Diagnose non-forward declarable kernel name types #4945
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] Diagnose non-forward declarable kernel name types #4945
Conversation
Add additional error emission in host mode because only on host with help of integration header possible to differentiate case like this: ``` int main() { parallel_for<class KernelName>(..); } ``` which uses technically non-forward declarable kernel name type but still allowed by SYCL spec, from case like this: ``` int main() { class KernelName; parallel_for<class KernelName>(..); } ``` which should be diagnosed, since the errors are emitted in runtime. Everything works when `KernelName` typename is used directly in `parallel_for`, because in this case when the type `KernelName` is forward declared by integration header, host uses `::KernelName` typename to access kernel info. However when `KernelName` is forward declared in non-global/namespace scope it actually produces a separate delclaration `main::KernelName` which is not visible for runtime code that submits kernels.
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 look good 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.
I haven't had a chance to review your tests yet. I will later today. Sorry for the delay.
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.
Changes LGTM
It has been approved for 5 days. Is there anything else required to merge this patch? |
intel#4945 introduced a new diagnostic that works correcly only if integration header is included. However it is possible that `-fsycl-is-host` flag can be used without integration header, so the diagnostic should be issued only if integration header is incuded. This patch adds new cc1 option that helps to understand that.
// } | ||
// The device compiler forward declares both KernelName1 and | ||
// KernelName2 in the integration header as ::KernelName1 and | ||
// ::KernelName2. The problem with the former case is the additional |
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.
So note that this (the ::KernelName1 and ::KernelName2) isn't exactly true, if the function is in a namespace, we try our best to get the name in as close of a namespace as possible (though your example uses 'main', so thats not exactly a concern).
…er (#5044) #4945 introduced a new diagnostic that works correctly only if integration header is included. However it is possible that `-fsycl-is-host` flag can be used without integration header, so the diagnostic should be issued only if integration header is included. This patch adds new cc1 option that helps to understand that.
Add additional error emission in host mode
because only on host with help of integration header possible to
differentiate case like this:
which uses technically non-forward declarable kernel name type but
still allowed by SYCL spec, from case like this:
which should be diagnosed, since the errors are emitted in runtime.
Everything works when
KernelName
typename is used directly inparallel_for
, because in this case when the typeKernelName
isforward declared by integration header, host uses
::KernelName
typename to access kernel info.
However when
KernelName
is forward declared in non-global/namespacescope it actually produces a separate delclaration
main::KernelName
which is not visible for runtime code that submits kernels.