Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit bbaa966

Browse files
committed
[SYCL] Add test covering loading kernel images from file
Also rename config folder to COnfig to match llvm-test-suite naming scheme.
1 parent d33754c commit bbaa966

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

SYCL/Basic/config/allowlist.cpp renamed to SYCL/Basic/Config/allowlist.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ using namespace cl;
2020

2121
static void replaceSpecialCharacters(std::string &Str) {
2222
// Replace common special symbols with '.' which matches to any character
23-
std::replace_if(Str.begin(), Str.end(),
24-
[](const char Sym) { return '(' == Sym || ')' == Sym; }, '.');
23+
std::replace_if(
24+
Str.begin(), Str.end(),
25+
[](const char Sym) { return '(' == Sym || ')' == Sym; }, '.');
2526
}
2627

2728
int main() {
File renamed without changes.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// UNSUPPORTED: cuda
2+
// CUDA does not support SPIR-V.
3+
4+
// RUN: %clangxx -fsycl-device-only -fno-sycl-use-bitcode -Xclang -fsycl-int-header=%t.h -c %s -o %t.spv -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning -Wno-sycl-strict
5+
// RUN: %clangxx -include %t.h %s -o %t.out -lsycl -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning
6+
// RUN: env SYCL_BE=%sycl_be SYCL_USE_KERNEL_SPV=%t.spv %t.out | FileCheck %s
7+
// CHECK: Passed
8+
9+
#include <CL/sycl.hpp>
10+
#include <iostream>
11+
12+
using namespace cl::sycl;
13+
14+
int main(int argc, char **argv) {
15+
int data = 5;
16+
17+
try {
18+
queue myQueue;
19+
buffer<int, 1> buf(&data, range<1>(1));
20+
21+
event e = myQueue.submit([&](handler &cgh) {
22+
auto ptr = buf.get_access<access::mode::read_write>(cgh);
23+
24+
cgh.single_task<class my_kernel>([=]() { ptr[0]++; });
25+
});
26+
e.wait_and_throw();
27+
28+
} catch (cl::sycl::exception const &e) {
29+
std::cerr << "SYCL exception caught:\n";
30+
std::cerr << e.what() << "\n";
31+
return 2;
32+
} catch (...) {
33+
std::cerr << "unknown exception caught\n";
34+
return 1;
35+
}
36+
37+
if (data == 6) {
38+
std::cout << "Passed\n";
39+
return 0;
40+
} else {
41+
std::cout << "Failed: " << data << "!= 6(gold)\n";
42+
return 1;
43+
}
44+
}

0 commit comments

Comments
 (0)