From 54ff26171d63e42c31a28f9f56461cfa2b4787a9 Mon Sep 17 00:00:00 2001 From: Duncan McBain Date: Tue, 3 Apr 2018 21:25:27 +0100 Subject: [PATCH] Fix warnings and typos in samples and tests Various small fixes have been implemented in this commit, including: * A comment that hadn't been updated to reflect 1.2.1 changes * A sneaky extraneous semicolon * some unused variables and using statements in tests * and some unsigned/signed comparisons. --- cmake/Modules/FindComputeCpp.cmake | 2 +- samples/smart-pointer/smart-pointer.cpp | 4 ++-- .../template-function-object.cpp | 2 +- tests/legacy-pointer/basic.cc | 3 --- tests/legacy-pointer/offset.cc | 1 - tests/vptr/basic.cc | 4 ++-- tests/vptr/offset.cc | 1 - tests/vptr/space.cc | 9 +-------- 8 files changed, 7 insertions(+), 19 deletions(-) diff --git a/cmake/Modules/FindComputeCpp.cmake b/cmake/Modules/FindComputeCpp.cmake index f2f9b15..aa012d4 100644 --- a/cmake/Modules/FindComputeCpp.cmake +++ b/cmake/Modules/FindComputeCpp.cmake @@ -143,7 +143,7 @@ else() endif() # Obtain the ComputeCpp include directory -set(COMPUTECPP_INCLUDE_DIRECTORY ${COMPUTECPP_PACKAGE_ROOT_DIR}/include/) +set(COMPUTECPP_INCLUDE_DIRECTORY ${COMPUTECPP_PACKAGE_ROOT_DIR}/include) if (NOT EXISTS ${COMPUTECPP_INCLUDE_DIRECTORY}) message(FATAL_ERROR "ComputeCpp includes - Not found!") else() diff --git a/samples/smart-pointer/smart-pointer.cpp b/samples/smart-pointer/smart-pointer.cpp index e79bbdb..722fe16 100644 --- a/samples/smart-pointer/smart-pointer.cpp +++ b/samples/smart-pointer/smart-pointer.cpp @@ -156,8 +156,8 @@ int main() { } } /* Normally data is copied to the host when buffers are destroyed, which - * would happen here, but since a map_allocator and host_accessor were - * used in concert no data copy happens (i.e., it has already happened. */ + * would happen here, but since `use_host_ptr` and a host accessor were + * used in concert no data copy happens (i.e., has *already* happened). */ } return correct ? 0 : 1; diff --git a/samples/template-function-object/template-function-object.cpp b/samples/template-function-object/template-function-object.cpp index 6189e06..2b996bc 100644 --- a/samples/template-function-object/template-function-object.cpp +++ b/samples/template-function-object/template-function-object.cpp @@ -79,7 +79,7 @@ void vector_add(buffer* a, buffer* b, buffer* c, cgh.parallel_for(range<1>(count), vector_add_kernel(a_dev, b_dev, c_dev)); -}; +} /* Using the code above, two vector additions are performed: one on ints, * the other on floats. */ diff --git a/tests/legacy-pointer/basic.cc b/tests/legacy-pointer/basic.cc index e759264..f123bc5 100644 --- a/tests/legacy-pointer/basic.cc +++ b/tests/legacy-pointer/basic.cc @@ -32,9 +32,6 @@ #include "legacy-pointer/legacy_pointer.hpp" -using sycl_acc_target = cl::sycl::access::target; -const sycl_acc_target sycl_acc_host = sycl_acc_target::host_buffer; - using sycl_acc_mode = cl::sycl::access::mode; const sycl_acc_mode sycl_acc_rw = sycl_acc_mode::read_write; diff --git a/tests/legacy-pointer/offset.cc b/tests/legacy-pointer/offset.cc index 4c13032..455ec32 100644 --- a/tests/legacy-pointer/offset.cc +++ b/tests/legacy-pointer/offset.cc @@ -33,7 +33,6 @@ #include "legacy-pointer/legacy_pointer.hpp" using sycl_acc_target = cl::sycl::access::target; -const sycl_acc_target sycl_acc_host = sycl_acc_target::host_buffer; const sycl_acc_target sycl_acc_buffer = sycl_acc_target::global_buffer; using sycl_acc_mode = cl::sycl::access::mode; diff --git a/tests/vptr/basic.cc b/tests/vptr/basic.cc index ed6a207..49fa0e5 100644 --- a/tests/vptr/basic.cc +++ b/tests/vptr/basic.cc @@ -277,7 +277,7 @@ TEST(pointer_mapper, multiple_alloc_free) { { int* ptrToFree = nullptr; - for (auto i = 0; i < numAllocations / 2; i++) { + for (auto i = 0u; i < numAllocations / 2; i++) { int* current = static_cast(SYCLmalloc(uniform_dist(e1) * sizeof(int), pMap)); // We choose a random pointer to free from the entire range @@ -289,7 +289,7 @@ TEST(pointer_mapper, multiple_alloc_free) { SYCLfree(ptrToFree, pMap); ASSERT_EQ(pMap.count(), (numAllocations / 2) - 1); int* ptrInBetween = static_cast(SYCLmalloc(50 * sizeof(int), pMap)); - for (auto i = 0; i < numAllocations / 2; i++) { + for (auto i = 0u; i < numAllocations / 2; i++) { int* current = static_cast(SYCLmalloc(uniform_dist(e1) * sizeof(int), pMap)); // We choose a random pointer to free from the entire range diff --git a/tests/vptr/offset.cc b/tests/vptr/offset.cc index 0a45b80..1917ec3 100644 --- a/tests/vptr/offset.cc +++ b/tests/vptr/offset.cc @@ -34,7 +34,6 @@ #include "vptr/virtual_ptr.hpp" using sycl_acc_target = cl::sycl::access::target; -const sycl_acc_target sycl_acc_host = sycl_acc_target::host_buffer; const sycl_acc_target sycl_acc_buffer = sycl_acc_target::global_buffer; using sycl_acc_mode = cl::sycl::access::mode; diff --git a/tests/vptr/space.cc b/tests/vptr/space.cc index 08c78b5..9e9334e 100644 --- a/tests/vptr/space.cc +++ b/tests/vptr/space.cc @@ -33,18 +33,11 @@ #include "vptr/pointer_alias.hpp" #include "vptr/virtual_ptr.hpp" -using sycl_acc_target = cl::sycl::access::target; -const sycl_acc_target sycl_acc_host = sycl_acc_target::host_buffer; -const sycl_acc_target sycl_acc_buffer = sycl_acc_target::global_buffer; - -using sycl_acc_mode = cl::sycl::access::mode; -const sycl_acc_mode sycl_acc_rw = sycl_acc_mode::read_write; - using namespace cl::sycl::codeplay; using buffer_t = PointerMapper::buffer_t; -int n = 10000; +constexpr int n = 10000; int startCount = 5; TEST(space, add_only) {