-
Notifications
You must be signed in to change notification settings - Fork 800
[SYCL][NFC] Update FE tests to have a common infrastructure #2996
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 17 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
3207cc2
[SYCL] Update FE tests to have a common infrastructure
srividya-sundaram 39966fc
Avoid using "cl::sycl" namespace
srividya-sundaram 2d69057
Update accessors-targets.cpp
srividya-sundaram bbbba5f
Update allow-constexpr-recursion.cpp
srividya-sundaram 04b1200
Remove unused code
srividya-sundaram 2a169a4
Update array-kernel-param-neg.cpp
srividya-sundaram d1e96fa
Inline "cl" namespace and update tests
srividya-sundaram 4f006e7
Update basic-kernel-wrapper.cpp
srividya-sundaram bbd4ff7
Update half-kernel-arg.cpp
srividya-sundaram ecccf60
Update fake-accessors.cpp
srividya-sundaram 014f3e7
Update decomposition.cpp
srividya-sundaram 0a916bf
Update spec-const-kernel-arg.cpp
srividya-sundaram aca853d
Update sampler.cpp
srividya-sundaram d1cbee3
Update streams.cpp
srividya-sundaram cf36c62
Update accessor_inheritance.cpp
srividya-sundaram a35dbb8
Update wrapped-accessor.cpp
srividya-sundaram 2ccb46a
Update array-kernel-param.cpp
srividya-sundaram 184df8b
Include sycl runtime headers as system headers.
srividya-sundaram a63ea02
Address review comments
srividya-sundaram c06c365
Add -syc-std=2020
srividya-sundaram d4942b8
Fix fake-accessors test
srividya-sundaram 7a0a3bf
Remove necessary comment
srividya-sundaram 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 |
|---|---|---|
| @@ -1,65 +1,75 @@ | ||
| // RUN: %clang_cc1 -fsycl -fsycl-is-device -ast-dump %s | FileCheck %s | ||
| // RUN: %clang_cc1 -fsycl -fsycl-is-device -ast-dump -sycl-std=2020 %s | FileCheck %s | ||
|
|
||
| // This test checks inheritance support for struct types with accessors | ||
| // passed as kernel arguments, which are decomposed to individual fields. | ||
|
|
||
| #include "Inputs/sycl.hpp" | ||
|
|
||
| struct Base { | ||
| sycl::queue myQueue; | ||
|
|
||
| struct AccessorBase { | ||
| int A, B; | ||
| cl::sycl::accessor<char, 1, cl::sycl::access::mode::read> AccField; | ||
| sycl::accessor<char, 1, sycl::access::mode::read> AccField; | ||
| }; | ||
|
|
||
| struct Captured : Base, | ||
| cl::sycl::accessor<char, 1, cl::sycl::access::mode::read> { | ||
| struct AccessorDerived : AccessorBase, | ||
| sycl::accessor<char, 1, sycl::access::mode::read> { | ||
| int C; | ||
| }; | ||
|
|
||
| int main() { | ||
| Captured Obj; | ||
| cl::sycl::kernel_single_task<class kernel>( | ||
| [=]() { | ||
| Obj.use(); | ||
| }); | ||
| AccessorDerived DerivedObject; | ||
| myQueue.submit([&](sycl::handler &h) { | ||
| h.single_task<class kernel>( | ||
| [=] { | ||
| DerivedObject.use(); | ||
| }); | ||
| }); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| // Check kernel parameters | ||
| // CHECK: FunctionDecl {{.*}}kernel{{.*}} 'void (int, int, __global char *, cl::sycl::range<1>, cl::sycl::range<1>, cl::sycl::id<1>, __global char *, cl::sycl::range<1>, cl::sycl::range<1>, cl::sycl::id<1>, int)' | ||
| // CHECK: FunctionDecl {{.*}}kernel{{.*}} 'void (int, int, __global char *, sycl::range<1>, sycl::range<1>, sycl::id<1>, __global char *, sycl::range<1>, sycl::range<1>, sycl::id<1>, int)' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg_A 'int' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg_B 'int' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg_AccField '__global char *' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg_AccField 'cl::sycl::range<1>' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg_AccField 'cl::sycl::range<1>' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg_AccField 'cl::sycl::id<1>' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg_AccField 'sycl::range<1>' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg_AccField 'sycl::range<1>' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg_AccField 'sycl::id<1>' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg__base '__global char *' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg__base 'cl::sycl::range<1>' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg__base 'cl::sycl::range<1>' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg__base 'cl::sycl::id<1>' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg__base 'sycl::range<1>' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg__base 'sycl::range<1>' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg__base 'sycl::id<1>' | ||
| // CHECK: ParmVarDecl{{.*}} used _arg_C 'int' | ||
|
|
||
| // Check lambda initialization | ||
| // CHECK: VarDecl {{.*}} used '(lambda at {{.*}}accessor_inheritance.cpp | ||
| // CHECK-NEXT: InitListExpr {{.*}} | ||
| // CHECK-NEXT: InitListExpr {{.*}} 'Captured' | ||
| // CHECK-NEXT: InitListExpr {{.*}} 'Base' | ||
| // CHECK-NEXT: InitListExpr {{.*}} 'AccessorDerived' | ||
| // CHECK-NEXT: InitListExpr {{.*}} 'AccessorBase' | ||
| // CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue> | ||
| // CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} '_arg_A' 'int' | ||
| // CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue> | ||
| // CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} '_arg_B' 'int' | ||
| // CHECK-NEXT: CXXConstructExpr {{.*}} 'cl::sycl::accessor<char, 1, cl::sycl::access::mode::read>':'cl::sycl::accessor<char, 1, cl::sycl::access::mode::read, cl::sycl::access::target::global_buffer, cl::sycl::access::placeholder::false_t>' 'void () noexcept' | ||
| // CHECK-NEXT: CXXConstructExpr {{.*}} 'cl::sycl::accessor<char, 1, cl::sycl::access::mode::read>':'cl::sycl::accessor<char, 1, cl::sycl::access::mode::read, cl::sycl::access::target::global_buffer, cl::sycl::access::placeholder::false_t>' 'void () noexcept' | ||
| // CHECK-NEXT: CXXConstructExpr {{.*}} 'sycl::accessor<char, 1, sycl::access::mode::read>':'sycl::accessor<char, 1, sycl::access::mode::read, sycl::access::target::global_buffer, sycl::access::placeholder::false_t>' 'void () noexcept' | ||
| // CHECK-NEXT: CXXConstructExpr {{.*}} 'sycl::accessor<char, 1, sycl::access::mode::read>':'sycl::accessor<char, 1, sycl::access::mode::read, sycl::access::target::global_buffer, sycl::access::placeholder::false_t>' 'void () noexcept' | ||
| // CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue> | ||
| // CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} '_arg_C' 'int' | ||
|
|
||
| // Check __init calls | ||
| // CHECK: CXXMemberCallExpr {{.*}} 'void' | ||
| // CHECK-NEXT: MemberExpr {{.*}} .__init | ||
| // CHECK-NEXT: MemberExpr {{.*}} .AccField | ||
| // CHECK-NEXT: ImplicitCastExpr {{.*}} 'Base' lvalue <DerivedToBase (Base)> | ||
| // CHECK-NEXT: MemberExpr {{.*}} 'Captured' lvalue . | ||
| // CHECK-NEXT: ImplicitCastExpr {{.*}} 'AccessorBase' lvalue <DerivedToBase (AccessorBase)> | ||
| // CHECK-NEXT: MemberExpr {{.*}} 'AccessorDerived' lvalue . | ||
| // CHECK-NEXT: DeclRefExpr {{.*}}'(lambda at {{.*}}accessor_inheritance.cpp | ||
| // CHECK-NEXT: ImplicitCastExpr {{.*}} '__global char *' <LValueToRValue> | ||
| // CHECK-NEXT: DeclRefExpr {{.*}} '__global char *' lvalue ParmVar {{.*}} '_arg_AccField' '__global char *' | ||
|
|
||
| // CHECK: CXXMemberCallExpr {{.*}} 'void' | ||
| // CHECK-NEXT: MemberExpr{{.*}} lvalue .__init | ||
| // CHECK-NEXT: MemberExpr{{.*}}'Captured' lvalue . | ||
| // CHECK-NEXT: MemberExpr{{.*}}'AccessorDerived' lvalue . | ||
| // CHECK-NEXT: DeclRefExpr {{.*}} '(lambda at {{.*}}accessor_inheritance.cpp | ||
| // CHECK-NEXT: ImplicitCastExpr {{.*}} '__global char *' <LValueToRValue> | ||
| // CHECK-NEXT: DeclRefExpr {{.*}} '__global char *' lvalue ParmVar {{.*}} '_arg__base' '__global char *' | ||
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 |
|---|---|---|
| @@ -1,41 +1,47 @@ | ||
| // RUN: %clang_cc1 -fsycl -fsycl-is-device -ast-dump %s | FileCheck %s | ||
| // RUN: %clang_cc1 -fsycl -fsycl-is-device -ast-dump -sycl-std=2020 %s | FileCheck %s | ||
|
|
||
| // This test checks that compiler generates correct kernel wrapper arguments for | ||
| // This test checks that the compiler generates correct kernel wrapper arguments for | ||
| // different accessors targets. | ||
|
|
||
| #include "Inputs/sycl.hpp" | ||
srividya-sundaram marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| using namespace cl::sycl; | ||
|
|
||
| template <typename name, typename Func> | ||
| __attribute__((sycl_kernel)) void kernel(const Func &kernelFunc) { | ||
| kernelFunc(); | ||
| } | ||
| sycl::queue q; | ||
|
|
||
| int main() { | ||
|
|
||
| accessor<int, 1, access::mode::read_write, | ||
| access::target::local> | ||
| // Access work-group local memory with read and write access. | ||
| sycl::accessor<int, 1, sycl::access::mode::read_write, | ||
| sycl::access::target::local> | ||
| local_acc; | ||
| accessor<int, 1, access::mode::read_write, | ||
| access::target::global_buffer> | ||
| // Access buffer via global memory with read and write access. | ||
| sycl::accessor<int, 1, sycl::access::mode::read_write, | ||
| sycl::access::target::global_buffer> | ||
| global_acc; | ||
| accessor<int, 1, access::mode::read_write, | ||
| access::target::constant_buffer> | ||
| // Access buffer via constant memory with read and write access. | ||
| sycl::accessor<int, 1, sycl::access::mode::read_write, | ||
| sycl::access::target::constant_buffer> | ||
| constant_acc; | ||
| kernel<class use_local>( | ||
| [=]() { | ||
| local_acc.use(); | ||
| }); | ||
| kernel<class use_global>( | ||
| [=]() { | ||
| global_acc.use(); | ||
| }); | ||
| kernel<class use_constant>( | ||
| [=]() { | ||
| constant_acc.use(); | ||
| }); | ||
|
|
||
| q.submit([&](sycl::handler &h) { | ||
| h.single_task<class use_local>( | ||
| [=] { | ||
| local_acc.use(); | ||
| }); | ||
| }); | ||
|
|
||
| q.submit([&](sycl::handler &h) { | ||
| h.single_task<class use_global>( | ||
| [=] { | ||
| global_acc.use(); | ||
| }); | ||
| }); | ||
|
|
||
| q.submit([&](sycl::handler &h) { | ||
| h.single_task<class use_constant>( | ||
| [=] { | ||
| constant_acc.use(); | ||
| }); | ||
| }); | ||
| } | ||
| // CHECK: {{.*}}use_local{{.*}} 'void (__local int *, cl::sycl::range<1>, cl::sycl::range<1>, cl::sycl::id<1>)' | ||
| // CHECK: {{.*}}use_global{{.*}} 'void (__global int *, cl::sycl::range<1>, cl::sycl::range<1>, cl::sycl::id<1>)' | ||
| // CHECK: {{.*}}use_constant{{.*}} 'void (__constant int *, cl::sycl::range<1>, cl::sycl::range<1>, cl::sycl::id<1>)' | ||
| // CHECK: {{.*}}use_local{{.*}} 'void (__local int *, sycl::range<1>, sycl::range<1>, sycl::id<1>)' | ||
| // CHECK: {{.*}}use_global{{.*}} 'void (__global int *, sycl::range<1>, sycl::range<1>, sycl::id<1>)' | ||
| // CHECK: {{.*}}use_constant{{.*}} 'void (__constant int *, sycl::range<1>, sycl::range<1>, sycl::id<1>)' | ||
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
Oops, something went wrong.
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.