-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL] Disallow zero length arrays in SYCL kernels #1135
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
Conversation
Signed-off-by: Chris Perkins <[email protected]>
I want to understand the delayed diagnostics bug you found while testing this before accepting this review. |
@erichkeane, I understand "issue" was used as a verb. |
Not sure what you mean? In this case, when staging this patch @cperkinsintel discovered a problem where his diagnostic wasn't firing in a certain common lambda construction. I'm simply suggesting we hold onto this patch until I understand that bug. |
Sorry for the misunderstanding - I wasn't aware of any discussion taking place elsewhere, so I wrongly assumed your comment addressed the commit message's wording 🥇 |
:D Makes sense. I'm only back home from Prague a few hours now (and am not working today) so I know I did a poor job clarifying my position on this PR before we figure out the problem. |
What is the problem with 0-size array in SYCL? |
@keryell ,
zero sized arrays outside SYCL kernels are not rejected (and do not cause link failures) |
I am curious about what is specific to SYCL for this case. Is this mentioned in the specification? |
It is in the C++ specs, it is illegal http://eel.is/c++draft/dcl.array#1
You make the validity of the code depends on optimizations, what if someone wants to run its code at O0 ? |
@@ -10429,6 +10429,8 @@ def err_conflicting_sycl_kernel_attributes : Error< | |||
"conflicting attributes applied to a SYCL kernel">; | |||
def err_conflicting_sycl_function_attributes : Error< | |||
"%0 attribute conflicts with '%1' attribute">; | |||
def err_sycl_typecheck_zero_array_size : Error< | |||
"zero-length arrays are not permitted in SYCL 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.
I think we can use err_typecheck_zero_array_size
diagnostics.
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.
If we do, that will output the message "zero-length arrays are not permitted in C++" when a zero length array is encountered from a SYCL kernel ( * ). Is that ok?
I think the "zero-length arrays are not permitted in SYCL kernels" is more accurate. But the decision is yours, @bader
( * ) - Zero length arrays elsewhere will still be accepted ( and I don't think we should change that behavior).
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.
If you want customize the message, you can make this diagnostics parameterized and emit different wording for SYCL.
I'm fine with the original message.
Thank you for the clarification. |
Your comment makes a bit more sense now, sorry... I haven't dug much, but I think 0 length array can't be represented in SPIR-V https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#OpTypeArray |
Was asked to move PR from a private fork and to change diagnostic message. Have done both in a new PR here: #1153 Am closing this one. |
zero length arrays in SYCL kernels are not allowed. Adding code to issue a deferred diagnostic error.
Signed-off-by: Chris Perkins [email protected]