Skip to content

Commit bad4e55

Browse files
authored
[SYCL] Add test for free function kernels extension that checks emitted diagnostics if kernel violates restrictions (#17954)
This PR adds test for free function kernels extension that checks emitted diagnostics if kernel violates restrictions specified in spec for declaration of free function kernel. https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/proposed/sycl_ext_oneapi_free_function_kernels.asciidoc#defining-a-free-function-kernel Test introduced based on test plan: #17886
1 parent 8f2510f commit bad4e55

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// RUN: %clangxx -fsyntax-only -fsycl-device-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s
2+
#include <sycl/sycl.hpp>
3+
4+
namespace syclexp = sycl::ext::oneapi::experimental;
5+
6+
// expected-error@+2 {{'int &' cannot be used as the type of a kernel parameter}}
7+
SYCL_EXT_ONEAPI_FUNCTION_PROPERTY(syclexp::single_task_kernel)
8+
void singleTaskKernelReference(int &Ref) {}
9+
10+
// expected-error@+2 {{'int &' cannot be used as the type of a kernel parameter}}
11+
SYCL_EXT_ONEAPI_FUNCTION_PROPERTY(syclexp::nd_range_kernel<2>)
12+
void ndRangeKernelReference(int &Ref) {}
13+
14+
// Diagnostic for these violations of the restrictions haven't been implemented
15+
// yet.
16+
// TODO: Add expected error when it will be implemented.
17+
SYCL_EXT_ONEAPI_FUNCTION_PROPERTY(syclexp::single_task_kernel)
18+
void singleTaskKernelVariadic(...) {}
19+
20+
// TODO: Add expected error when it will be implemented.
21+
SYCL_EXT_ONEAPI_FUNCTION_PROPERTY(syclexp::nd_range_kernel<3>)
22+
void ndRangeKernelVariadic(...) {}
23+
24+
// TODO: Add expected error when it will be implemented.
25+
SYCL_EXT_ONEAPI_FUNCTION_PROPERTY(syclexp::single_task_kernel)
26+
void singleTaskKernelDefaultValues(int Value = 1) {}
27+
28+
// TODO: Add expected error when it will be implemented.
29+
SYCL_EXT_ONEAPI_FUNCTION_PROPERTY(syclexp::nd_range_kernel<1>)
30+
void ndRangeKernelDefaultValues(int Value = 1) {}

0 commit comments

Comments
 (0)