From 81fa9e19222592d420bc5af847dd7bc440d72ffe Mon Sep 17 00:00:00 2001 From: Tom Deakin Date: Wed, 11 May 2016 12:23:21 +0100 Subject: [PATCH] Require SYCL array size to be multiple of WGSIZE --- SYCLStream.cpp | 8 ++++++++ SYCLStream.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/SYCLStream.cpp b/SYCLStream.cpp index e8eee42..4f14590 100644 --- a/SYCLStream.cpp +++ b/SYCLStream.cpp @@ -24,6 +24,14 @@ SYCLStream::SYCLStream(const unsigned int ARRAY_SIZE, const int device_index) if (!cached) getDeviceList(); + // The array size must be divisible by WGSIZE + if (ARRAY_SIZE % WGSIZE != 0) + { + std::stringstream ss; + ss << "Array size must be a multiple of " << WGSIZE; + throw std::runtime_error(ss.str()); + } + array_size = ARRAY_SIZE; if (device_index >= devices.size()) diff --git a/SYCLStream.h b/SYCLStream.h index 4c0c681..8bc515d 100644 --- a/SYCLStream.h +++ b/SYCLStream.h @@ -7,6 +7,8 @@ #pragma once +#include + #include "Stream.h" #include "CL/sycl.hpp"