-
Notifications
You must be signed in to change notification settings - Fork 739
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Move diagnostic from integration header emission (#2644)
This patch moves the diagnostic for the kernel name (kernel name cannot be a type in the "std" namespace) to the point in which the kernel is called, rather than during integration header emission.
- Loading branch information
1 parent
2ae49f5
commit 4f6ae91
Showing
5 changed files
with
96 additions
and
84 deletions.
There are no files selected for viewing
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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 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,55 @@ | ||
// RUN: %clang_cc1 -fsycl -fsycl-is-device -sycl-std=2020 -DCHECK_ERROR -verify %s | ||
|
||
#include "Inputs/sycl.hpp" | ||
|
||
namespace std { | ||
typedef long unsigned int size_t; | ||
typedef long int ptrdiff_t; | ||
typedef decltype(nullptr) nullptr_t; | ||
class T; | ||
class U; | ||
} // namespace std | ||
|
||
template <typename T> | ||
struct Templated_kernel_name; | ||
|
||
template <typename T, typename... Args> class TemplParamPack; | ||
|
||
using namespace cl::sycl; | ||
queue q; | ||
|
||
int main() { | ||
#ifdef CHECK_ERROR | ||
// expected-error@Inputs/sycl.hpp:220 5 {{kernel name cannot be a type in the "std" namespace}} | ||
q.submit([&](handler &h) { | ||
// expected-note@+1{{in instantiation of function template specialization}} | ||
h.single_task<std::nullptr_t>([=] {}); | ||
}); | ||
q.submit([&](handler &h) { | ||
// expected-note@+1{{in instantiation of function template specialization}} | ||
h.single_task<std::T>([=] {}); | ||
}); | ||
q.submit([&](handler &h) { | ||
// expected-note@+1{{in instantiation of function template specialization}} | ||
h.single_task<Templated_kernel_name<std::nullptr_t>>([=] {}); | ||
}); | ||
q.submit([&](handler &h) { | ||
// expected-note@+1{{in instantiation of function template specialization}} | ||
h.single_task<Templated_kernel_name<std::U>>([=] {}); | ||
}); | ||
q.submit([&](handler &cgh) { | ||
// expected-note@+1{{in instantiation of function template specialization}} | ||
cgh.single_task<TemplParamPack<int, float, std::nullptr_t, double>>([]() {}); | ||
}); | ||
#endif | ||
|
||
// Although in the std namespace, these resolve to builtins such as `int` that are allowed in kernel names | ||
q.submit([&](handler &h) { | ||
h.single_task<std::size_t>([=] {}); | ||
}); | ||
q.submit([&](handler &h) { | ||
h.single_task<std::ptrdiff_t>([=] {}); | ||
}); | ||
|
||
return 0; | ||
} |
This file contains 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