-
Notifications
You must be signed in to change notification settings - Fork 797
[SYCL] Add clang support for code_location in KernelInfo #5335
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 20 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b4f196f
[SYCL] Add clang support for KernelInfo code_location() method
schittir 4fada17
Fix NDEBUG typo
schittir 3bc31c7
Populate code_location members
schittir 457b97b
Populate fields
schittir 5ed0c13
Make changes per Erich's comments
schittir 114d8cd
Populate "FuncionName" and change the test
schittir 7be77e7
Delete int_header2.cpp
schittir 622d27a
Update FunctionName and test
schittir a04d561
Fix format
schittir d0007da
Tidying up
schittir e7e29b9
Remove extra space
schittir 08a8d15
Remove temporary variables and path information from filename
schittir c848a82
Fix test and add more cases
schittir 7201467
Remove comments
schittir 338bff0
Fix format
schittir 99242c8
Add NDEBUG cases
schittir c067405
Remove NDEBUG from kernel_desc.hpp
schittir 4c59038
Fix quotes
schittir 2b10cbf
Emit fully qualified name
schittir 14124ff
Add an -fsycl-is-host RUN line with the int header as FileCheck input
schittir 16d6af3
Emit NDEBUG case to integration header
schittir 190a44d
Undo accidental deletion of __SYCL_DLL_LOCAL
schittir 76a77f4
Add Functor test case
schittir 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem -sycl-std=2020 -fsycl-int-header=%t.h %s -o %t.out | ||
// RUN: FileCheck -input-file=%t.h %s | ||
// RUN: %clang_cc1 -fsycl-is-host -sycl-std=2020 %s | FileCheck -input-file=%t.h %s | ||
// : %clang_cc1 -fsycl-is-device -internal-isystem -sycl-std=2020 -DNDEBUG -fsycl-int-header=%t2.h %s -o %t2.out | ||
// : FileCheck -input-file=%t2.h %s | ||
#include "Inputs/sycl.hpp" | ||
#ifndef NDEBUG | ||
int test1() { | ||
cl::sycl::queue q; | ||
q.submit([&](cl::sycl::handler &h) { h.single_task([] {}); }); | ||
q.submit([&](cl::sycl::handler &h) { h.single_task<class KernelName>([]() {}); }); | ||
schittir marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return 0; | ||
} | ||
// Specializations of KernelInfo for kernel function types: | ||
// CHECK: template <> struct KernelInfoData<'_', 'Z', 'T', 'S', 'Z', 'Z', '5', 't', 'e', 's', 't', '1', 'v', 'E', 'N', 'K', 'U', 'l', 'R', 'N', '2', 'c', 'l', '4', 's', 'y', 'c', 'l', '7', 'h', 'a', 'n', 'd', 'l', 'e', 'r', 'E', 'E', '_', 'c', 'l', 'E', 'S', '2', '_', 'E', 'U', 'l', 'v', 'E', '_'> { | ||
// CHECK: static constexpr const char* getFileName() { return "code_location.cpp"; } | ||
// CHECK: static constexpr const char* getFunctionName() { return ""; } | ||
// CHECK: static constexpr unsigned getLineNumber() { return 10; } | ||
// CHECK: static constexpr unsigned getColumnNumber() { return 54; } | ||
//}; | ||
|
||
// CHECK: template <> struct KernelInfo<KernelName> { | ||
// CHECK: static constexpr const char* getFileName() { return "code_location.cpp"; } | ||
// CHECK: static constexpr const char* getFunctionName() { return "KernelName"; } | ||
// CHECK: static constexpr unsigned getLineNumber() { return 11; } | ||
// CHECK: static constexpr unsigned getColumnNumber() { return 72; } | ||
//}; | ||
|
||
class KernelName2; | ||
int test2() { | ||
cl::sycl::queue q; | ||
q.submit([&](cl::sycl::handler &h) { h.single_task( | ||
[] { int i = 2; }); }); | ||
q.submit([&](cl::sycl::handler &h) { h.single_task<KernelName2>( | ||
[] { int i = 2; }); }); | ||
return 0; | ||
} | ||
|
||
// CHECK: template <> struct KernelInfoData<'_', 'Z', 'T', 'S', 'Z', 'Z', '5', 't', 'e', 's', 't', '2', 'v', 'E', 'N', 'K', 'U', 'l', 'R', 'N', '2', 'c', 'l', '4', 's', 'y', 'c', 'l', '7', 'h', 'a', 'n', 'd', 'l', 'e', 'r', 'E', 'E', '_', 'c', 'l', 'E', 'S', '2', '_', 'E', 'U', 'l', 'v', 'E', '_'> { | ||
// CHECK: static constexpr const char* getFileName() { return "code_location.cpp"; } | ||
// CHECK: static constexpr const char* getFunctionName() { return ""; } | ||
// CHECK: static constexpr unsigned getLineNumber() { return 33; } | ||
// CHECK: static constexpr unsigned getColumnNumber() { return 44; } | ||
//}; | ||
// CHECK: template <> struct KernelInfo<::KernelName2> { | ||
// CHECK: static constexpr const char* getFileName() { return "code_location.cpp"; } | ||
// CHECK: static constexpr const char* getFunctionName() { return "::KernelName2"; } | ||
// CHECK: static constexpr unsigned getLineNumber() { return 35; } | ||
// CHECK: static constexpr unsigned getColumnNumber() { return 44; } | ||
//}; | ||
|
||
template <typename T> class KernelName3; | ||
int test3() { | ||
cl::sycl::queue q; | ||
q.submit([&](cl::sycl::handler &h) { h.single_task<KernelName3<KernelName2>>( | ||
[] { int i = 3; }); }); | ||
return 0; | ||
} | ||
|
||
// CHECK: template <> struct KernelInfo<::KernelName3<::KernelName2>> { | ||
// CHECK: static constexpr const char* getFileName() { return "code_location.cpp"; } | ||
// CHECK: static constexpr const char* getFunctionName() { return "::KernelName3<::KernelName2>"; } | ||
// CHECK: static constexpr unsigned getLineNumber() { return 56; } | ||
// CHECK: static constexpr unsigned getColumnNumber() { return 44; } | ||
//}; | ||
|
||
auto l4 = []() { return 4; }; | ||
int test4() { | ||
cl::sycl::queue q; | ||
q.submit([=](cl::sycl::handler &h) { h.single_task<class KernelName4>(l4); }); | ||
return 0; | ||
} | ||
|
||
// CHECK: template <> struct KernelInfo<KernelName4> { | ||
// CHECK: static constexpr const char* getFileName() { return "code_location.cpp"; } | ||
// CHECK: static constexpr const char* getFunctionName() { return "KernelName4"; } | ||
// CHECK: static constexpr unsigned getLineNumber() { return 67; } | ||
// CHECK: static constexpr unsigned getColumnNumber() { return 11; } | ||
//}; | ||
|
||
#else | ||
int test5() { | ||
cl::sycl::queue q; | ||
q.submit([&](cl::sycl::handler &h) { h.single_task([] {}); }); | ||
q.submit([&](cl::sycl::handler &h) { h.single_task<class KernelName5>([]() {}); }); | ||
return 0; | ||
} | ||
|
||
// HECK: template <> struct KernelInfoData<'_', 'Z', 'T', 'S', 'Z', 'Z', '5', 't', 'e', 's', 't', '5', 'v', 'E', 'N', 'K', 'U', 'l', 'R', 'N', '2', 'c', 'l', '4', 's', 'y', 'c', 'l', '7', 'h', 'a', 'n', 'd', 'l', 'e', 'r', 'E', 'E', '_', 'c', 'l', 'E', 'S', '2', '_', 'E', 'U', 'l', 'v', 'E', '_'> { | ||
// HECK: static constexpr const char* getFileName() { return ; } | ||
// HECK: static constexpr const char* getFunctionName() { return ; } | ||
// HECK: static constexpr unsigned getLineNumber() { return 0; } | ||
// HECK: static constexpr unsigned getColumnNumber() { return 0; } | ||
//}; | ||
// HECK: template <> struct KernelInfo<KernelName5> { | ||
// HECK: static constexpr const char* getFileName() { return ; } | ||
// HECK: static constexpr const char* getFunctionName() { return ; } | ||
// HECK: static constexpr unsigned getLineNumber() { return 0; } | ||
// HECK: static constexpr unsigned getColumnNumber() { return 0; } | ||
//}; | ||
#endif |
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.
Uh oh!
There was an error while loading. Please reload this page.