-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Preserve original message and code of kernel/program build result #1108
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
Changes from all commits
2985a52
eb8f4f5
96e92a8
5495889
0c19b88
5e64424
be30bc3
0a4dbad
44fa8c5
4e7bcb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %CPU_RUN_PLACEHOLDER %t.out | ||
|
||
#include <CL/sycl.hpp> | ||
|
||
SYCL_EXTERNAL | ||
void undefined(); | ||
|
||
void test() { | ||
cl::sycl::queue Queue; | ||
|
||
auto Kernel = []() { | ||
#ifdef __SYCL_DEVICE_ONLY__ | ||
undefined(); | ||
#endif | ||
}; | ||
|
||
std::string Msg; | ||
int Result; | ||
|
||
for (int Idx = 0; Idx < 2; ++Idx) { | ||
try { | ||
Queue.submit([&](cl::sycl::handler &CGH) { | ||
CGH.single_task<class SingleTask>(Kernel); | ||
}); | ||
assert(false && "There must be compilation error"); | ||
} catch (const cl::sycl::compile_program_error &e) { | ||
fprintf(stderr, "Exception: %s, %d\n", e.what(), e.get_cl_code()); | ||
if (Idx == 0) { | ||
Msg = e.what(); | ||
Result = e.get_cl_code(); | ||
} else { | ||
// Exception constantly adds info on its error code in the message | ||
assert(Msg.find_first_of(e.what()) == 0 && "Exception text differs"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
assert(Result == e.get_cl_code() && "Exception code differs"); | ||
} | ||
} catch (...) { | ||
assert(false && "There must be cl::sycl::compile_program_error"); | ||
} | ||
} | ||
} | ||
|
||
int main() { | ||
test(); | ||
|
||
return 0; | ||
} |
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.
Isn't
!Msg.empty()
==FilledIn
?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 believe it may be. Though, flag is more explicit data and more understandable to read. On the other hand the struct may have a distinct method
bool isFilledIn() const
.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.
+1 for replacing this flag with public member function.
FilledIn
seems to duplicate information available in two other fields and maintaining is not necessary.