This repository was archived by the owner on Mar 28, 2023. It is now read-only.
forked from llvm/llvm-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 130
[SYCL] Adds regression test for ensuring SYCL_EXTERNAL is ignored by kernel bundles #486
Merged
vladimirlaz
merged 2 commits into
intel:intel
from
steffenlarsen:steffen/test_kernel_bundle_ignore_sycl_external
Oct 5, 2021
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out | ||
| // RUN: %HOST_RUN_PLACEHOLDER %t.out | ||
| // RUN: %GPU_RUN_PLACEHOLDER %t.out | ||
| // RUN: %CPU_RUN_PLACEHOLDER %t.out | ||
| // RUN: %ACC_RUN_PLACEHOLDER %t.out | ||
| // | ||
| // XFAIL: cuda || hip | ||
|
|
||
| #include <CL/sycl.hpp> | ||
|
|
||
| class KernelName; | ||
|
|
||
| SYCL_EXTERNAL | ||
| int f(int a) { return a + 1; } | ||
|
|
||
| int main() { | ||
| const sycl::device Dev{sycl::default_selector{}}; | ||
| const sycl::context Ctx{Dev}; | ||
| sycl::queue Q{Ctx, Dev}; | ||
|
|
||
| // No support for host device so far. | ||
| if (Q.is_host()) | ||
| return 0; | ||
|
|
||
| assert(sycl::get_kernel_ids().size() == 1); | ||
|
|
||
| sycl::kernel_bundle EmptyKernelBundle = | ||
| sycl::get_kernel_bundle<sycl::bundle_state::executable>(Ctx, {Dev}, {}); | ||
|
|
||
| assert(EmptyKernelBundle.get_kernel_ids().size() == 0); | ||
|
|
||
| sycl::kernel_bundle KernelBundle = | ||
| sycl::get_kernel_bundle<sycl::bundle_state::executable>(Ctx, {Dev}); | ||
| sycl::kernel_id KernelID = sycl::get_kernel_id<KernelName>(); | ||
|
|
||
| assert(KernelBundle.get_kernel_ids().size() == 1); | ||
| assert(KernelBundle.has_kernel(KernelID)); | ||
|
|
||
| cl::sycl::buffer<int, 1> Buf(sycl::range<1>{1}); | ||
| Q.submit([&](sycl::handler &CGH) { | ||
| auto Acc = Buf.get_access<sycl::access::mode::write>(CGH); | ||
| CGH.use_kernel_bundle(KernelBundle); | ||
| CGH.single_task<KernelName>([=]() { Acc[0] = 42; }); | ||
| }); | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to run on the host device if the test skips execution on such a device(line 22)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I don't think so, so I have removed it.