Skip to content

Commit 4f86d64

Browse files
authored
[SYCL][NFC] Move circular_buffer.hpp to the source directory (#2171)
1 parent f4f7b83 commit 4f86d64

File tree

5 files changed

+22
-13
lines changed

5 files changed

+22
-13
lines changed

sycl/source/detail/scheduler/scheduler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#pragma once
1010

1111
#include <CL/sycl/detail/cg.hpp>
12-
#include <CL/sycl/detail/circular_buffer.hpp>
1312
#include <CL/sycl/detail/sycl_mem_obj_i.hpp>
13+
#include <detail/circular_buffer.hpp>
1414
#include <detail/scheduler/commands.hpp>
1515

1616
#include <cstddef>

sycl/test/function-pointers/pass-fp-through-buffer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include <CL/sycl.hpp>
1313

14+
#include <algorithm>
1415
#include <iostream>
1516
#include <vector>
1617

sycl/unittests/misc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ set(sycl_lib_dir $<TARGET_FILE_DIR:sycl>)
22
add_definitions(-DSYCL_LIB_DIR="${sycl_lib_dir}")
33
add_sycl_unittest(MiscTests SHARED
44
OsUtils.cpp
5+
CircularBuffer.cpp
56
)

sycl/test/basic_tests/circular_buffer.cpp renamed to sycl/unittests/misc/CircularBuffer.cpp

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
// RUN: %clangxx -fsycl %s -o %t.out
2-
// RUN: %t.out
1+
//==---- CircularBuffer.cpp ------------------------------------------------==//
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+
//===----------------------------------------------------------------------===//
38

4-
#include <CL/sycl/detail/circular_buffer.hpp>
9+
#include <gtest/gtest.h>
10+
11+
#include <detail/circular_buffer.hpp>
512

613
#include <algorithm>
714
#include <cassert>
@@ -11,30 +18,30 @@
1118
// This test contains basic checks for cl::sycl::detail::CircularBuffer
1219
void checkEquality(const cl::sycl::detail::CircularBuffer<int> &CB,
1320
const std::vector<int> &V) {
14-
assert(std::equal(CB.begin(), CB.end(), V.begin()));
21+
ASSERT_TRUE(std::equal(CB.begin(), CB.end(), V.begin()));
1522
}
1623

17-
int main() {
24+
TEST(CircularBufferTest, CircularBufferTest) {
1825
const std::size_t Capacity = 6;
1926
cl::sycl::detail::CircularBuffer<int> CB{Capacity};
20-
assert(CB.capacity() == Capacity);
21-
assert(CB.empty());
27+
ASSERT_TRUE(CB.capacity() == Capacity);
28+
ASSERT_TRUE(CB.empty());
2229

23-
int nextValue = 0;
30+
size_t nextValue = 0;
2431
for (; nextValue < Capacity; ++nextValue) {
25-
assert(CB.size() == nextValue);
32+
ASSERT_TRUE(CB.size() == nextValue);
2633
CB.push_back(nextValue);
2734
}
28-
assert(CB.full() && CB.size() == CB.capacity());
35+
ASSERT_TRUE(CB.full() && CB.size() == CB.capacity());
2936
checkEquality(CB, {0, 1, 2, 3, 4, 5});
3037

3138
CB.push_back(nextValue++);
3239
checkEquality(CB, {1, 2, 3, 4, 5, 6});
3340
CB.push_front(nextValue++);
3441
checkEquality(CB, {7, 1, 2, 3, 4, 5});
3542

36-
assert(CB.front() == 7);
37-
assert(CB.back() == 5);
43+
ASSERT_TRUE(CB.front() == 7);
44+
ASSERT_TRUE(CB.back() == 5);
3845

3946
CB.erase(CB.begin() + 2);
4047
checkEquality(CB, {7, 1, 3, 4, 5});

0 commit comments

Comments
 (0)