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

Commit 5038bee

Browse files
author
aidan.belton
committed
Merge branch 'intel' of https://github.com/AidanBeltonS/llvm-test-suite into local_accessor
2 parents ba6a9fd + 8c8996a commit 5038bee

File tree

119 files changed

+6505
-1660
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+6505
-1660
lines changed

SYCL/Assert/assert_in_simultaneous_kernels.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// REQUIRES: linux
2+
// FIXME: Flaky on HIP
3+
// UNSUPPORTED: hip
24
// RUN: %clangxx -DSYCL_FALLBACK_ASSERT=1 -fsycl -fsycl-targets=%sycl_triple %s -o %t.out %threads_lib
35
// RUN: %CPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
46
// RUN: %CPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt

SYCL/Assert/assert_in_simultaneously_multiple_tus.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// FIXME flaky output on Level Zero
2-
// UNSUPPORTED: level_zero
1+
// FIXME flaky fail on CUDA and HIP
2+
// UNSUPPORTED: cuda || hip
3+
//
34
// RUN: %clangxx -DSYCL_FALLBACK_ASSERT=1 -fsycl -fsycl-targets=%sycl_triple -I %S/Inputs %s %S/Inputs/kernels_in_file2.cpp -o %t.out %threads_lib
45
// RUN: %CPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
56
// RUN: %CPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt

SYCL/AtomicRef/assignment_atomic64.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
// RUN: %GPU_RUN_PLACEHOLDER %t.out
55
// RUN: %ACC_RUN_PLACEHOLDER %t.out
66

7-
// XFAIL: hip
8-
// Expected failure because hip does not have atomic64 check implementation
9-
107
#include "assignment.h"
118
#include <iostream>
129
using namespace sycl;

SYCL/Basic/aspects.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
// Hip is missing some of the parameters tested here so it fails with NVIDIA
55
// XFAIL: hip_nvidia
66

7-
// XFAIL: hip
8-
// Expected failure because hip does not have atomic64 check implementation
9-
107
//==--------------- aspects.cpp - SYCL device test ------------------------==//
118
//
129
// Returns the various aspects of a device and platform.

SYCL/Basic/buffer/buffer_allocator.cpp

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// RUN: %clangxx -fsycl -DSYCL2020_CONFORMANT_APIS -fsycl-targets=%sycl_triple %s -o %t.out
2-
// RUN: env SYCL_DEVICE_FILTER=opencl %CPU_RUN_PLACEHOLDER %t.out
3-
// RUN: env SYCL_DEVICE_FILTER=opencl %GPU_RUN_PLACEHOLDER %t.out
4-
// RUN: env SYCL_DEVICE_FILTER=opencl %ACC_RUN_PLACEHOLDER %t.out
51
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
62
// RUN: env SYCL_DEVICE_FILTER=opencl %CPU_RUN_PLACEHOLDER %t.out
73
// RUN: env SYCL_DEVICE_FILTER=opencl %GPU_RUN_PLACEHOLDER %t.out
@@ -15,9 +11,9 @@
1511
//
1612
//===----------------------------------------------------------------------===//
1713

18-
// Tests that the default (and explicit with SYCL 2020) buffer_allocator used by
19-
// buffers are as defined by the spec and will allocate the right amount of
20-
// memory on the device.
14+
// Tests that the default and explicit buffer_allocator used by buffers are as
15+
// defined by the spec and will allocate the right amount of memory on the
16+
// device.
2117

2218
#include <iostream>
2319
#include <sycl/sycl.hpp>
@@ -45,40 +41,27 @@ bool checkResult(sycl::buffer<T, 1, AllocT> &Buf, size_t N, std::string &TName,
4541
template <typename T> bool runTest(sycl::queue &Q, std::string TName) {
4642
sycl::buffer<T, 1> DefaultBuf{NumElems};
4743

48-
#ifdef SYCL2020_CONFORMANT_APIS
4944
static_assert(std::is_same_v<decltype(DefaultBuf),
5045
sycl::buffer<T, 1, sycl::buffer_allocator<T>>>);
5146

5247
sycl::buffer<T, 1, sycl::buffer_allocator<char>> CharAllocBuf{NumElems};
5348
sycl::buffer<T, 1, sycl::buffer_allocator<long>> LongAllocBuf{NumElems};
54-
#else
55-
static_assert(std::is_same_v<decltype(DefaultBuf),
56-
sycl::buffer<T, 1, sycl::buffer_allocator>>);
57-
#endif
5849

5950
Q.submit([&](sycl::handler &CGH) {
6051
auto DefaultAcc = DefaultBuf.get_access(CGH);
61-
#ifdef SYCL2020_CONFORMANT_APIS
6252
auto CharAllocAcc = CharAllocBuf.get_access(CGH);
6353
auto LongAllocAcc = LongAllocBuf.get_access(CGH);
64-
#endif
6554
CGH.parallel_for<TestKernel<T>>(NumElems, [=](sycl::item<1> It) {
6655
DefaultAcc[It] = static_cast<T>(It[0]);
67-
#ifdef SYCL2020_CONFORMANT_APIS
6856
CharAllocAcc[It] = static_cast<T>(It[0]);
6957
LongAllocAcc[It] = static_cast<T>(It[0]);
70-
#endif
7158
});
7259
}).wait();
7360

74-
#ifdef SYCL2020_CONFORMANT_APIS
7561
return checkResult(DefaultBuf, NumElems, TName,
7662
"buffer_allocator<" + TName + ">") &&
7763
checkResult(CharAllocBuf, NumElems, TName, "buffer_allocator<char>") &&
7864
checkResult(LongAllocBuf, NumElems, TName, "buffer_allocator<long>");
79-
#else
80-
return checkResult(DefaultBuf, NumElems, TName, "buffer_allocator");
81-
#endif
8265
}
8366

8467
#define RUN_TEST(TYPE, Q) runTest<TYPE>(Q, #TYPE)

SYCL/Basic/buffer/buffer_dev_to_dev.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// FIXME flaky fail on HIP
2+
// UNSUPPORTED: hip
13
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
24
// RUN: %HOST_RUN_PLACEHOLDER %t.out
35
// RUN: %CPU_RUN_PLACEHOLDER %t.out

SYCL/Basic/code_location_e2e.cpp

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
// UNSUPPORTED: hip || cuda
2+
3+
// RUN: %clangxx -fsycl -DNDEBUG %s -o %t.out
4+
// RUN: %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
5+
// RUN: %GPU_RUN_PLACEHOLDER %t.out %GPU_CHECK_PLACEHOLDER
6+
// RUN: %ACC_RUN_PLACEHOLDER %t.out %ACC_CHECK_PLACEHOLDER
7+
8+
// RUN: %clangxx -fsycl %s -o %t.out
9+
// RUN: %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
10+
// RUN: %GPU_RUN_PLACEHOLDER %t.out %GPU_CHECK_PLACEHOLDER
11+
// RUN: %ACC_RUN_PLACEHOLDER %t.out %ACC_CHECK_PLACEHOLDER
12+
13+
/*
14+
clang++ -fsycl -DNDEBUG -o smyl.bin code_location_e2e.cpp // <<--- NDEBUG
15+
will suppress fileLocation
16+
17+
-DNDEBUG <-- not debugging, meaning fileName should not be retrievable (for
18+
data privacy reasons)
19+
20+
Between having to test against NDEBUG and test from kernel code,
21+
using assert/abort type of logic is not available. This test just
22+
outputs strings that it checks with FileCheck.
23+
24+
This test uses hardcoded file code location positions. If modified, those
25+
may change. pass in any value to signal "report only" and not run tests.
26+
27+
*/
28+
29+
#include <sycl/sycl.hpp>
30+
using namespace sycl;
31+
32+
// llvm/sycl/doc/design/DeviceLibExtensions.rst
33+
// Our devicelib support for <cstring> only includes three memory
34+
// operations, none of the string ones. So we need to provide
35+
// our own string comparison for kernel calls.
36+
bool stringsAreSameP(const char *a, const char *b) {
37+
// If both are nullptr, then they are the same,
38+
if ((a == nullptr) && (b == nullptr))
39+
return true;
40+
// but if only one, they are not.
41+
if ((a == nullptr) || (b == nullptr))
42+
return false;
43+
44+
int index = 0;
45+
while (true) {
46+
if (a[index] != b[index]) {
47+
return false;
48+
}
49+
if (a[index] == '\0') {
50+
return true;
51+
} // If we are on this line we know a[i]==b[i].
52+
index++;
53+
}
54+
// We will never arrive here.
55+
return true;
56+
}
57+
58+
template <typename OS> void report(OS &out, detail::code_location code_loc) {
59+
out << "function {line:col} => " << code_loc.functionName() << " {"
60+
<< code_loc.lineNumber() << ":" << code_loc.columnNumber() << "}"
61+
<< "\n";
62+
63+
auto fileName = code_loc.fileName();
64+
if (fileName == nullptr)
65+
out << "nullptr for fileName"
66+
<< "\n";
67+
else
68+
out << "fileName: " << code_loc.fileName() << "\n";
69+
}
70+
71+
template <typename OS>
72+
void test(OS &out, detail::code_location &code_loc, const char *fileName,
73+
const char *funcName, int line, int col) {
74+
75+
// functionName
76+
auto funcNameStr = code_loc.functionName();
77+
auto fNameResult =
78+
((funcNameStr != nullptr) && stringsAreSameP(funcNameStr, funcName))
79+
? "OK"
80+
: "WRONG";
81+
out << "code_location.functionName: " << fNameResult << "\n";
82+
83+
// lineNumber
84+
auto lineNumberResult = (code_loc.lineNumber() == line) ? "OK" : "WRONG";
85+
out << "code_location.lineNumber: " << lineNumberResult << "\n";
86+
87+
// columnNumber
88+
auto colNumberResult = (code_loc.columnNumber() == col) ? "OK" : "WRONG";
89+
out << "code_location.columnNumber: " << colNumberResult << "\n";
90+
91+
// fileName
92+
auto fileNameStr = code_loc.fileName();
93+
#ifdef NDEBUG
94+
// NDEBUG == not debugging == no fileName (for security).
95+
auto fileNameResult =
96+
(fileNameStr == nullptr)
97+
? "OK"
98+
: "WRONG - fileName should not be present when NDEBUG defined";
99+
#else
100+
auto fileNameResult = stringsAreSameP(fileName, fileNameStr) ? "OK" : "WRONG";
101+
#endif
102+
out << "code_location.fileName: " << fileNameResult << "\n";
103+
}
104+
105+
int main(int argc, char **argv) {
106+
bool testing =
107+
(argc <= 1); // Passing in ANY argument means report only, do not test.
108+
auto code_loc = sycl::detail::code_location::current(); // <--
109+
int EXPECTED_LINE = __LINE__ - 1;
110+
#ifdef NDEBUG
111+
std::cout << "NDEBUG, therefore no fileName" << std::endl;
112+
#else
113+
std::cout << "NDEBUG NOT DEFINED, make sure file name isn't a full path "
114+
<< std::endl;
115+
std::cout << "file name: " << code_loc.fileName() << std::endl;
116+
#endif
117+
std::cout << "------- host test -------" << std::endl;
118+
report(std::cout, code_loc);
119+
120+
if (testing)
121+
test(std::cout, code_loc, "code_location_e2e.cpp", "main", EXPECTED_LINE,
122+
19);
123+
124+
std::cout << "------- kernel test -------" << std::endl;
125+
126+
queue q;
127+
q.submit([testing](handler &cgh) {
128+
sycl::stream out(2024, 400, cgh);
129+
cgh.single_task<class KHALID>([=]() {
130+
auto kernel_loc = sycl::detail::code_location::current(); // <--
131+
int EXPECTED_LINE = __LINE__ - 1;
132+
report(out, kernel_loc);
133+
134+
if (testing)
135+
test(out, kernel_loc, "code_location_e2e.cpp", "operator()",
136+
EXPECTED_LINE, 25);
137+
138+
out << "-------" << sycl::endl;
139+
});
140+
});
141+
q.wait();
142+
143+
return 0;
144+
}
145+
146+
// CHECK: ------- host test -------
147+
// CHECK: code_location.functionName: OK
148+
// CHECK-NEXT: code_location.lineNumber: OK
149+
// CHECK-NEXT: code_location.columnNumber: OK
150+
// XHECK-NEXT: code_location.fileName: OK
151+
152+
// CHECK: ------- kernel test -------
153+
// CHECK: code_location.functionName: OK
154+
// CHECK-NEXT: code_location.lineNumber: OK
155+
// CHECK-NEXT: code_location.columnNumber: OK
156+
// XHECK-NEXT: code_location.fileName: OK

SYCL/Basic/context-with-multiple-devices.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// UNSUPPORTED: windows || linux
2-
// temporarily disabled
3-
41
// REQUIRES: accelerator, opencl-aot
52

63
// RUN: %clangxx -fsycl -fintelfpga -fsycl-unnamed-lambda %s -o %t2.out

SYCL/Basic/default_device.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//==--------- default_device.cpp - SYCL device default ctor test -----------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
10+
// RUN: %HOST_RUN_PLACEHOLDER %t.out
11+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
12+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
13+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
14+
15+
#include <sycl/sycl.hpp>
16+
17+
int main() {
18+
sycl::device Dev;
19+
assert(Dev == sycl::device{sycl::default_selector_v});
20+
return 0;
21+
}

SYCL/Basic/default_platform.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//==------- default_platform.cpp - SYCL platform default ctor test ---------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
10+
// RUN: %HOST_RUN_PLACEHOLDER %t.out
11+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
12+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
13+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
14+
15+
#include <sycl/sycl.hpp>
16+
17+
int main() {
18+
sycl::platform Plt;
19+
assert(Plt == sycl::platform{sycl::default_selector_v});
20+
return 0;
21+
}

0 commit comments

Comments
 (0)