-
Notifications
You must be signed in to change notification settings - Fork 772
[SYCL] Fix regression introduced by f537293/part of #1018 fix. #1019
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
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RUN: %clang_cc1 -fcxx-exceptions -fsycl-is-device -verify -fsyntax-only -std=c++17 %s | ||
|
||
template <typename name, typename Func> | ||
__attribute__((sycl_kernel)) | ||
void kernel_single_task(Func kernelFunc) { | ||
// expected-note@+1 {{called by 'kernel_single_task}} | ||
kernelFunc(); | ||
} | ||
|
||
void foo() { | ||
// expected-error@+1 {{SYCL kernel cannot use exceptions}} | ||
throw 3; | ||
} | ||
|
||
int main() { | ||
// expected-note@+1 {{called by 'operator()'}} | ||
kernel_single_task<class fake_kernel>([]() { foo(); }); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 don't really get why these notes are moving...
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.
Because we are now diagnosing earlier. We aren't instantiating the template, we are doingil it during phase 1, so we don't know the call stack yet.
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.
Still is a bit unclear for me, but it's because I don't really know a lot about templates instantiating in clang, I suppose.
It seems like we previously added note above the
kernelFunc()
call, but now we are adding note (for same error, I suppose?) above theuse2()
call, because we only know call stack for path throughuse2
, right?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.
Ah, I believe that is because we're just hitting a different error 'first', and thus getting the dump from it. This file is a 'revert' of the changes I made to this in the last patch.
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.
Yeah, I understand that it's revert, but I'm afraid it's something wrong here too. So, doesn't that mean that we are still missing some error?
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.
Sort of? Its more that the call-stack now is just different because we got there in a different way. We have a deferred diagnostic for that exception throw, and now the order that we're visiting the functions called by the kernel aren't the same. If you comment out the call to eh_not_ok in use2, it blames it on the call to useage. I think we're just doing a 'bredth-first' descent down the functions, so it is catching the 'shorter' path first (and thus taking up the 'delayed diagnostic'.).
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.
It's what I tried to understand :)
Just was a bit confused by "hitting a different error 'first'" phrase in your previous comment.
Now, let's consider the following example (sorry for typos, writing on the fly):
Will this test case diagnosed through delayed diagnostics after the current patch?
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.
Yes, this example would print the call stack kernel_single_task/operator()/some_foo. Since some_foo isn't a 'sycl_kernel' function (I'm imagining kernel_single_task has the attribute?), its diagnostic is delayed. The initial pass of kernel_single task doesn't know that it is going to be called with something that throws, so it doesn't diagnose.
That said, i tried your example, and it diagnoses 2x, so I want to figure out why.
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.
Ah... it happens 2x because we're checking 'throw' without checking to see whether it is dependent. So we see it in both phases of the template. I don't know if openmp or CUDA have the same problem, or if they've worked around it. I'm guessing this: #1018 becomes more important to figure out now.