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] Add E2E tests for device code instrumentation #484
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3c35bbd
[SYCL] Add E2E tests for device code instrumentation
dd09c3c
Update CODEOWNERS
8f9c61d
Mark new tests unsupported on CUDA
c33ce41
Don't launch the barrier test on HOST
1be3175
Fix typo in CODEOWNERS
3dbc866
Merge remote-tracking branch 'origin/intel' into instr-device-code
c39c662
Mark HIP as an unsupported target
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 |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // UNSUPPORTED: cuda | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-instrument-device-code %s -o %t.out | ||
| // RUN: %HOST_RUN_PLACEHOLDER %t.out | ||
| // RUN: %CPU_RUN_PLACEHOLDER %t.out | ||
| // RUN: %GPU_RUN_PLACEHOLDER %t.out | ||
| // RUN: %ACC_RUN_PLACEHOLDER %t.out | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-instrument-device-code %s -o %t.cpu.out \ | ||
| // RUN: -fsycl-targets=spir64_x86_64-unknown-unknown | ||
| // RUN: %CPU_RUN_PLACEHOLDER %t.cpu.out | ||
|
|
||
| #include "CL/sycl.hpp" | ||
|
|
||
| using namespace sycl; | ||
|
|
||
| int main() { | ||
| queue q{}; | ||
|
|
||
| int source = 42; | ||
| int target = 0; | ||
| { | ||
| buffer<int> source_buf(&source, 1); | ||
| buffer<int> target_buf(&target, 1); | ||
|
|
||
| // Ensure that a simple kernel gets run when instrumented with | ||
| // ITT start/finish annotations and ITT atomic start/finish annotations. | ||
| q.submit([&](handler &cgh) { | ||
| auto source_acc = | ||
| source_buf.template get_access<access::mode::read_write>(cgh); | ||
| auto target_acc = | ||
| target_buf.template get_access<access::mode::discard_write>(cgh); | ||
| cgh.single_task<class simple_atomic_kernel>([=]() { | ||
| auto source_atomic = | ||
| ext::oneapi::atomic_ref<int, memory_order::relaxed, | ||
| memory_scope::device, | ||
| access::address_space::global_space>( | ||
| source_acc[0]); | ||
| // Store source value into target | ||
| target_acc[0] = source_atomic.load(); | ||
| // Nullify source | ||
| source_atomic.store(0); | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| return 0; | ||
| } |
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 @@ | ||
| // UNSUPPORTED: cuda | ||
AGindinson marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-instrument-device-code %s -o %t.out | ||
| // RUN: %CPU_RUN_PLACEHOLDER %t.out | ||
| // RUN: %GPU_RUN_PLACEHOLDER %t.out | ||
| // RUN: %ACC_RUN_PLACEHOLDER %t.out | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-instrument-device-code %s -o %t.cpu.out \ | ||
| // RUN: -fsycl-targets=spir64_x86_64-unknown-unknown | ||
| // RUN: %CPU_RUN_PLACEHOLDER %t.cpu.out | ||
|
|
||
| #include "CL/sycl.hpp" | ||
| #include <vector> | ||
|
|
||
| using namespace sycl; | ||
|
|
||
| int main() { | ||
| queue q{}; | ||
|
|
||
| std::vector<int> data_vec(/*size*/ 10, /*value*/ 0); | ||
| { | ||
| range<1> num_items(data_vec.size()); | ||
| buffer<int> buf(data_vec.data(), num_items); | ||
| range<1> local_range(2); | ||
|
|
||
| // Ensure that a simple kernel gets run when instrumented with | ||
| // ITT start/finish annotations and ITT wg_barrier/wi_resume annotations. | ||
| q.submit([&](handler &cgh) { | ||
| auto acc = buf.get_access<access::mode::read_write>(cgh); | ||
| accessor<int, 1, access::mode::read_write, access::target::local> | ||
| local_acc(local_range, cgh); | ||
| cgh.parallel_for<class simple_barrier_kernel>( | ||
| nd_range<1>(num_items, local_range), [=](nd_item<1> item) { | ||
| size_t idx = item.get_global_linear_id(); | ||
| int pos = idx & 1; | ||
| int opp = pos ^ 1; | ||
| local_acc[pos] = acc[idx]; | ||
| item.barrier(access::fence_space::local_space); | ||
| acc[idx] = local_acc[opp]; | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
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.