-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL] Fix diagnostic about non-globally-visible kernel name #928
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
bader
merged 4 commits into
intel:sycl
from
AlexeySachkov:private/asachkov/fix-error-about-unnamed-lambda
Mar 24, 2020
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
89886da
[SYCL] Fix diagnostic about non-globally-visible kernel name
AlexeySachkov 208f23f
[SYCL] Improve diagnostic about invalid kernel name
AlexeySachkov a9803cc
[SYCL] Apply clang-format to test
AlexeySachkov d410017
[SYCL] Fix failing LIT test
AlexeySachkov 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// RUN: %clang_cc1 -I %S/Inputs -fsycl -fsycl-is-device -fsycl-int-header=%t.h -fsyntax-only -verify %s | ||
// RUN: %clang_cc1 -I %S/Inputs -fsycl -fsycl-is-device -fsycl-int-header=%t.h -fsycl-unnamed-lambda -fsyntax-only -verify %s | ||
#include <sycl.hpp> | ||
|
||
#ifdef __SYCL_UNNAMED_LAMBDA__ | ||
// expected-no-diagnostics | ||
#endif | ||
|
||
namespace namespace1 { | ||
template <typename T> | ||
class KernelName; | ||
} | ||
|
||
struct MyWrapper { | ||
private: | ||
class InvalidKernelName0 {}; | ||
class InvalidKernelName3 {}; | ||
class InvalidKernelName4 {}; | ||
class InvalidKernelName5 {}; | ||
|
||
public: | ||
void test() { | ||
cl::sycl::queue q; | ||
#ifndef __SYCL_UNNAMED_LAMBDA__ | ||
// expected-error@+5 {{kernel needs to have a globally-visible name}} | ||
// expected-note@+2 {{InvalidKernelName1 declared here}} | ||
#endif | ||
class InvalidKernelName1 {}; | ||
q.submit([&](cl::sycl::handler &h) { | ||
h.single_task<InvalidKernelName1>([] {}); | ||
}); | ||
|
||
#ifndef __SYCL_UNNAMED_LAMBDA__ | ||
// expected-error@+5 {{kernel needs to have a globally-visible name}} | ||
// expected-note@+2 {{InvalidKernelName2 declared here}} | ||
#endif | ||
class InvalidKernelName2 {}; | ||
q.submit([&](cl::sycl::handler &h) { | ||
h.single_task<namespace1::KernelName<InvalidKernelName2>>([] {}); | ||
}); | ||
|
||
#ifndef __SYCL_UNNAMED_LAMBDA__ | ||
// expected-error@+4 {{kernel needs to have a globally-visible name}} | ||
// expected-note@16 {{InvalidKernelName0 declared here}} | ||
#endif | ||
q.submit([&](cl::sycl::handler &h) { | ||
h.single_task<InvalidKernelName0>([] {}); | ||
}); | ||
|
||
#ifndef __SYCL_UNNAMED_LAMBDA__ | ||
// expected-error@+4 {{kernel needs to have a globally-visible name}} | ||
// expected-note@17 {{InvalidKernelName3 declared here}} | ||
#endif | ||
q.submit([&](cl::sycl::handler &h) { | ||
h.single_task<namespace1::KernelName<InvalidKernelName3>>([] {}); | ||
}); | ||
|
||
using ValidAlias = MyWrapper; | ||
q.submit([&](cl::sycl::handler &h) { | ||
h.single_task<ValidAlias>([] {}); | ||
}); | ||
|
||
using InvalidAlias = InvalidKernelName4; | ||
#ifndef __SYCL_UNNAMED_LAMBDA__ | ||
// expected-error@+4 {{kernel needs to have a globally-visible name}} | ||
// expected-note@18 {{InvalidKernelName4 declared here}} | ||
#endif | ||
q.submit([&](cl::sycl::handler &h) { | ||
h.single_task<InvalidAlias>([] {}); | ||
}); | ||
|
||
using InvalidAlias1 = InvalidKernelName5; | ||
#ifndef __SYCL_UNNAMED_LAMBDA__ | ||
// expected-error@+4 {{kernel needs to have a globally-visible name}} | ||
// expected-note@19 {{InvalidKernelName5 declared here}} | ||
#endif | ||
q.submit([&](cl::sycl::handler &h) { | ||
h.single_task<namespace1::KernelName<InvalidAlias1>>([] {}); | ||
}); | ||
} | ||
}; | ||
|
||
int main() { | ||
cl::sycl::queue q; | ||
#ifndef __SYCL_UNNAMED_LAMBDA__ | ||
// expected-error@+2 {{kernel name is missing}} | ||
#endif | ||
q.submit([&](cl::sycl::handler &h) { h.single_task([] {}); }); | ||
|
||
return 0; | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.
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 suggest to convert these ("expected compilation error") to negative compilation tests together with removal. Or leave it as is if there are no resource now.
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 preserved these negative test cases in the new test, this is mentioned in commit message