From 7f1637d6799d5e6dcc237de1f1e2dd5823bc2c6a Mon Sep 17 00:00:00 2001 From: Tom Deakin Date: Mon, 11 May 2020 17:10:48 +0100 Subject: [PATCH 1/3] [SYCL] Remove unused program variable --- SYCLStream.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/SYCLStream.cpp b/SYCLStream.cpp index 8e33588..76b916a 100644 --- a/SYCLStream.cpp +++ b/SYCLStream.cpp @@ -15,7 +15,6 @@ using namespace cl::sycl; bool cached = false; std::vector devices; void getDeviceList(void); -program * p; template SYCLStream::SYCLStream(const unsigned int ARRAY_SIZE, const int device_index) @@ -81,7 +80,6 @@ SYCLStream::~SYCLStream() delete d_b; delete d_c; delete d_sum; - delete p; delete queue; devices.clear(); } From 1d6da069b3e5ac6054e2b5f6ec77061f402dee75 Mon Sep 17 00:00:00 2001 From: Tom Deakin Date: Mon, 11 May 2020 17:13:36 +0100 Subject: [PATCH 2/3] [SYCL] Pass explicit async_handler to queue constructor --- CHANGELOG.md | 1 + SYCLStream.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a3a36d..b350b45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. ### Changed - Use cl::sycl::id parameters instead of cl::sycl::item. - Update local copy of OpenCL C++ header file. +- Ensure correct SYCL queue constructor with explicit async_handler. ### Removed - Pre-building of kernels in SYCL version to ensure compatibility with SYCL 1.2.1. diff --git a/SYCLStream.cpp b/SYCLStream.cpp index 76b916a..7f51b75 100644 --- a/SYCLStream.cpp +++ b/SYCLStream.cpp @@ -45,7 +45,7 @@ SYCLStream::SYCLStream(const unsigned int ARRAY_SIZE, const int device_index) std::cout << "Driver: " << getDeviceDriver(device_index) << std::endl; std::cout << "Reduction kernel config: " << dot_num_groups << " groups of size " << dot_wgsize << std::endl; - queue = new cl::sycl::queue(dev, [&](cl::sycl::exception_list l) + queue = new cl::sycl::queue(dev, cl::sycl::async_handler{[&](cl::sycl::exception_list l) { bool error = false; for(auto e: l) @@ -64,7 +64,7 @@ SYCLStream::SYCLStream(const unsigned int ARRAY_SIZE, const int device_index) { throw std::runtime_error("SYCL errors detected"); } - }); + }}); // Create buffers d_a = new buffer(array_size); From 0919d95aa40befee37e828814bfc9b56b46eafb3 Mon Sep 17 00:00:00 2001 From: Tom Deakin Date: Mon, 11 May 2020 17:16:47 +0100 Subject: [PATCH 3/3] [SYCL] Use SYCL runtime device discovery Fixes #63 --- CHANGELOG.md | 1 + SYCLStream.cpp | 11 ++--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b350b45..70f4460 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. - Use cl::sycl::id parameters instead of cl::sycl::item. - Update local copy of OpenCL C++ header file. - Ensure correct SYCL queue constructor with explicit async_handler. +- Use built in SYCL runtime device discovery. ### Removed - Pre-building of kernels in SYCL version to ensure compatibility with SYCL 1.2.1. diff --git a/SYCLStream.cpp b/SYCLStream.cpp index 7f51b75..8960530 100644 --- a/SYCLStream.cpp +++ b/SYCLStream.cpp @@ -228,15 +228,8 @@ void SYCLStream::read_arrays(std::vector& a, std::vector& b, std::vecto void getDeviceList(void) { - // Get list of platforms - std::vector platforms = platform::get_platforms(); - - // Enumerate devices - for (unsigned i = 0; i < platforms.size(); i++) - { - std::vector plat_devices = platforms[i].get_devices(); - devices.insert(devices.end(), plat_devices.begin(), plat_devices.end()); - } + // Ask SYCL runtime for all devices in system + devices = cl::sycl::device::get_devices(); cached = true; }