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 tests for sycl_ext_intel_device_architecture for AOT #1322
Merged
dm-vodopyanov
merged 11 commits into
intel:intel
from
dm-vodopyanov:dvodopya/device_architecture_ext_aot
Oct 26, 2022
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6e33195
[SYCL] Add tests for sycl_ext_intel_device_architecture for AOT
dm-vodopyanov 3a0d9c2
Fix clang-format
dm-vodopyanov 4921894
Merge branch 'intel:intel' into dvodopya/device_architecture_ext_aot
dm-vodopyanov a5e52c0
Rewrite the test to make in dependent on the single HW
dm-vodopyanov 5995137
Merge branch 'dvodopya/device_architecture_ext_aot' of https://github…
dm-vodopyanov dff7078
Minor fix
dm-vodopyanov 8170b06
Apply CR comments
dm-vodopyanov 95a8316
Remove w/a as fix PR #7108 was merged
dm-vodopyanov 17c8bde
Merge branch 'intel:intel' into dvodopya/device_architecture_ext_aot
dm-vodopyanov fe1a85f
Dump commit to trigger CI to use latest intel/llvm
dm-vodopyanov a37bfd1
Merge branch 'dvodopya/device_architecture_ext_aot' of https://github…
dm-vodopyanov 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,69 @@ | ||
// REQUIRES: opencl-aot, cpu | ||
|
||
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %s -o %t.out | ||
// RUN: %t.out | ||
|
||
#include <sycl/ext/intel/experimental/device_architecture.hpp> | ||
#include <sycl/sycl.hpp> | ||
|
||
using namespace sycl; | ||
using namespace sycl::ext::intel::experimental; | ||
|
||
int main() { | ||
std::vector<int> vec(2); | ||
{ | ||
buffer<int> buf(vec.data(), vec.size()); | ||
|
||
queue q(cpu_selector_v); | ||
|
||
// test if_architecture_is | ||
q.submit([&](handler &cgh) { | ||
auto acc = buf.get_access<access::mode::read_write>(cgh); | ||
cgh.single_task([=]() { | ||
if_architecture_is<architecture::x86_64>([&]() { | ||
acc[0] = 1; | ||
}).otherwise([&]() { acc[0] = 0; }); | ||
}); | ||
}); | ||
|
||
// test else_if_architecture_is | ||
q.submit([&](handler &cgh) { | ||
auto acc = buf.get_access<access::mode::read_write>(cgh); | ||
cgh.single_task([=]() { | ||
if_architecture_is<architecture::intel_gpu_dg1>([&]() { | ||
acc[1] = 0; | ||
}).else_if_architecture_is<architecture::x86_64>([&]() { | ||
acc[1] = 2; | ||
}).otherwise([&]() { acc[1] = 0; }); | ||
}); | ||
}); | ||
|
||
// test otherwise | ||
q.submit([&](handler &cgh) { | ||
auto acc = buf.get_access<access::mode::read_write>(cgh); | ||
cgh.single_task([=]() { | ||
if_architecture_is<architecture::intel_gpu_dg1>([&]() { | ||
acc[2] = 0; | ||
}).otherwise([&]() { acc[2] = 3; }); | ||
}); | ||
}); | ||
|
||
// test more than one architecture template parameter is passed to | ||
// if_architecture_is | ||
q.submit([&](handler &cgh) { | ||
auto acc = buf.get_access<access::mode::read_write>(cgh); | ||
cgh.single_task([=]() { | ||
if_architecture_is<architecture::intel_gpu_dg1, architecture::x86_64>( | ||
[&]() { acc[3] = 4; }) | ||
.otherwise([&]() { acc[3] = 0; }); | ||
}); | ||
}); | ||
} | ||
|
||
assert(vec[0] == 1); | ||
assert(vec[1] == 2); | ||
assert(vec[2] == 3); | ||
assert(vec[3] == 4); | ||
|
||
return 0; | ||
} | ||
dm-vodopyanov marked this conversation as resolved.
Show resolved
Hide resolved
|
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.