-
Notifications
You must be signed in to change notification settings - Fork 750
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Add check that accessor class declared in cl::sycl namespace.
Signed-off-by: Vladimir Lazarev <vladimir.lazarev@intel.com>
- Loading branch information
1 parent
124a88a
commit 2ad1d20
Showing
3 changed files
with
87 additions
and
13 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 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,19 @@ | ||
// RUN: %clang -S --sycl -Xclang -ast-dump %s | FileCheck %s | ||
// XFAIL: * | ||
#include <CL/sycl.hpp> | ||
|
||
int main() { | ||
int data = 5; | ||
cl::sycl::queue deviceQueue; | ||
cl::sycl::buffer<int, 1> bufferA(&data, cl::sycl::range<1>(1)); | ||
|
||
deviceQueue.submit([&](cl::sycl::handler &cgh) { | ||
auto accessorA = bufferA.template get_access<cl::sycl::access::mode::read_write>(cgh); | ||
cgh.single_task<class kernel_function>( | ||
[=]() { | ||
accessorA[0] += data; | ||
}); | ||
}); | ||
return 0; | ||
} | ||
// CHECK: kernel_function 'void (__global int *__global, int) |
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,56 @@ | ||
// RUN: %clang -S --sycl -Xclang -ast-dump %s | FileCheck %s | ||
// XFAIL: * | ||
#include <CL/sycl.hpp> | ||
|
||
namespace foo { | ||
namespace cl { | ||
namespace sycl { | ||
class accessor { | ||
public: | ||
int field; | ||
}; | ||
} // namespace sycl | ||
} // namespace cl | ||
} // namespace foo | ||
|
||
class accessor { | ||
public: | ||
int field; | ||
}; | ||
|
||
typedef cl::sycl::accessor<int, 1, cl::sycl::access::mode::read_write, | ||
cl::sycl::access::target::global_buffer> | ||
MyAccessorTD; | ||
|
||
using MyAccessorA = cl::sycl::accessor<int, 1, cl::sycl::access::mode::read_write, | ||
cl::sycl::access::target::global_buffer>; | ||
|
||
int main() { | ||
int data = 5; | ||
cl::sycl::queue deviceQueue; | ||
cl::sycl::buffer<int, 1> bufferA(&data, cl::sycl::range<1>(1)); | ||
foo::cl::sycl::accessor acc = {1}; | ||
accessor acc1 = {1}; | ||
|
||
deviceQueue.submit([&](cl::sycl::handler &cgh) { | ||
auto accessorA = bufferA.template get_access<cl::sycl::access::mode::read_write>(cgh); | ||
MyAccessorTD accessorB = bufferA.template get_access<cl::sycl::access::mode::read_write>(cgh); | ||
MyAccessorA accessorC = bufferA.template get_access<cl::sycl::access::mode::read_write>(cgh); | ||
cgh.single_task<class fake_accessors>( | ||
[=]() { | ||
accessorA[0] = acc.field + acc1.field; | ||
}); | ||
cgh.single_task<class accessor_typedef>( | ||
[=]() { | ||
accessorB[0] = acc.field + acc1.field; | ||
}); | ||
cgh.single_task<class accessor_alias>( | ||
[=]() { | ||
accessorC[0] = acc.field + acc1.field; | ||
}); | ||
}); | ||
return 0; | ||
} | ||
// CHECK: fake_accessors 'void (__global int *__global, foo::cl::sycl::accessor, accessor) | ||
// CHECK: accessor_typedef 'void (__global int *__global, foo::cl::sycl::accessor, accessor) | ||
// CHECK: accessor_alias 'void (__global int *__global, foo::cl::sycl::accessor, accessor) |