Skip to content

Commit

Permalink
Merge pull request #203 from krasznaa/SYCL2020Comp-main-20221101
Browse files Browse the repository at this point in the history
SYCL2020 Compatibility Fix, main branch (2022.11.01.)
  • Loading branch information
krasznaa authored Nov 1, 2022
2 parents bcf1f5a + 24f8cd3 commit bdf5466
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 103 deletions.
4 changes: 1 addition & 3 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# VecMem project, part of the ACTS project (R&D line)
#
# (c) 2021 CERN for the benefit of the ACTS project
# (c) 2021-2022 CERN for the benefit of the ACTS project
#
# Mozilla Public License Version 2.0

Expand Down Expand Up @@ -28,8 +28,6 @@ vecmem_add_library( vecmem_sycl sycl
"src/utils/sycl/copy.sycl"
"include/vecmem/utils/sycl/queue_wrapper.hpp"
"src/utils/sycl/queue_wrapper.sycl"
"src/utils/sycl/device_selector.hpp"
"src/utils/sycl/device_selector.sycl"
"src/utils/sycl/get_queue.hpp"
"src/utils/sycl/get_queue.sycl"
"src/utils/sycl/opaque_queue.hpp" )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** VecMem project, part of the ACTS project (R&D line)
*
* (c) 2021 CERN for the benefit of the ACTS project
* (c) 2021-2022 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand All @@ -23,7 +23,7 @@ class VECMEM_SYCL_EXPORT memory_resource_base

public:
/// Constructor on top of a user-provided queue
memory_resource_base(const queue_wrapper& queue = {""});
memory_resource_base(const queue_wrapper& queue = {});

protected:
/// The queue that the allocations are made for/on
Expand Down
4 changes: 2 additions & 2 deletions sycl/include/vecmem/utils/sycl/copy.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* VecMem project, part of the ACTS project (R&D line)
*
* (c) 2021 CERN for the benefit of the ACTS project
* (c) 2021-2022 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand All @@ -25,7 +25,7 @@ class VECMEM_SYCL_EXPORT copy : public vecmem::copy {

public:
/// Constructor on top of a user-provided queue
copy(const queue_wrapper& queue = {""});
copy(const queue_wrapper& queue = {});

protected:
/// Perform a memory copy using SYCL
Expand Down
14 changes: 10 additions & 4 deletions sycl/include/vecmem/utils/sycl/queue_wrapper.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** VecMem project, part of the ACTS project (R&D line)
*
* (c) 2021 CERN for the benefit of the ACTS project
* (c) 2021-2022 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand All @@ -11,7 +11,6 @@

// System include(s).
#include <memory>
#include <string>

namespace vecmem::sycl {

Expand All @@ -35,8 +34,8 @@ class opaque_queue;
class VECMEM_SYCL_EXPORT queue_wrapper {

public:
/// Construct a queue for a device with a specific name
queue_wrapper(const std::string& deviceName = "");
/// Construct a queue for the default device
queue_wrapper();
/// Wrap an existing @c cl::sycl::queue object
///
/// Without taking ownership of it!
Expand All @@ -49,6 +48,13 @@ class VECMEM_SYCL_EXPORT queue_wrapper {
queue_wrapper(queue_wrapper&& parent);

/// Destructor
///
/// The destructor is declared and implemented explicitly as an empty
/// function to make sure that client code would not try to generate it
/// itself. Leading to problems about the symbols of
/// @c vecmem::sycl::details::opaque_queue not being available in
/// client code.
///
~queue_wrapper();

/// Copy assignment
Expand Down
36 changes: 0 additions & 36 deletions sycl/src/utils/sycl/device_selector.hpp

This file was deleted.

42 changes: 0 additions & 42 deletions sycl/src/utils/sycl/device_selector.sycl

This file was deleted.

6 changes: 2 additions & 4 deletions sycl/src/utils/sycl/queue_wrapper.sycl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

// Local include(s).
#include "device_selector.hpp"
#include "get_queue.hpp"
#include "opaque_queue.hpp"
#include "vecmem/utils/debug.hpp"
Expand All @@ -17,10 +16,9 @@

namespace vecmem::sycl {

queue_wrapper::queue_wrapper(const std::string& deviceName)
queue_wrapper::queue_wrapper()
: m_queue(nullptr),
m_managedQueue(std::make_unique<details::opaque_queue>(
device_selector(deviceName))) {
m_managedQueue(std::make_unique<details::opaque_queue>()) {

m_queue = m_managedQueue.get();
VECMEM_DEBUG_MSG(1,
Expand Down
2 changes: 0 additions & 2 deletions tests/sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,5 @@ endif()
vecmem_add_test( sycl
"test_sycl_memory_resources.cpp"
"test_sycl_containers.sycl" "test_sycl_jagged_containers.sycl"
"${CMAKE_CURRENT_SOURCE_DIR}/../../sycl/src/utils/sycl/device_selector.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../../sycl/src/utils/sycl/device_selector.sycl"
LINK_LIBRARIES vecmem::core vecmem::sycl GTest::gtest_main
vecmem_testing_common )
11 changes: 5 additions & 6 deletions tests/sycl/test_sycl_containers.sycl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <CL/sycl.hpp>

// Local include(s).
#include "../../sycl/src/utils/sycl/device_selector.hpp"
#include "vecmem/containers/array.hpp"
#include "vecmem/containers/const_device_array.hpp"
#include "vecmem/containers/const_device_vector.hpp"
Expand All @@ -33,7 +32,7 @@ class sycl_containers_test : public testing::Test {};
TEST_F(sycl_containers_test, shared_memory) {

// Create the SYCL queue that we'll be using in the test.
cl::sycl::queue queue{vecmem::sycl::device_selector()};
cl::sycl::queue queue;

// The shared memory resource.
vecmem::sycl::shared_memory_resource resource(&queue);
Expand Down Expand Up @@ -90,7 +89,7 @@ TEST_F(sycl_containers_test, shared_memory) {
TEST_F(sycl_containers_test, device_memory) {

// Create the SYCL queue that we'll be using in the test.
cl::sycl::queue queue{vecmem::sycl::device_selector()};
cl::sycl::queue queue;

// The memory resources.
vecmem::sycl::host_memory_resource host_resource(&queue);
Expand Down Expand Up @@ -163,7 +162,7 @@ TEST_F(sycl_containers_test, device_memory) {
TEST_F(sycl_containers_test, atomic_memory) {

// Create the SYCL queue that we'll be using in the test.
cl::sycl::queue queue{vecmem::sycl::device_selector()};
cl::sycl::queue queue;

// The memory resources.
vecmem::sycl::shared_memory_resource resource(&queue);
Expand Down Expand Up @@ -216,7 +215,7 @@ TEST_F(sycl_containers_test, atomic_memory) {
TEST_F(sycl_containers_test, extendable_memory) {

// Create the SYCL queue that we'll be using in the test.
cl::sycl::queue queue{vecmem::sycl::device_selector()};
cl::sycl::queue queue;

// The memory resources.
vecmem::sycl::host_memory_resource host_resource(&queue);
Expand Down Expand Up @@ -277,7 +276,7 @@ TEST_F(sycl_containers_test, extendable_memory) {
TEST_F(sycl_containers_test, array_memory) {

// Create the SYCL queue that we'll be using in the test.
cl::sycl::queue queue{vecmem::sycl::device_selector()};
cl::sycl::queue queue;

// The memory resource(s).
vecmem::sycl::shared_memory_resource shared_resource(&queue);
Expand Down
3 changes: 1 addition & 2 deletions tests/sycl/test_sycl_jagged_containers.sycl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <CL/sycl.hpp>

// VecMem include(s).
#include "../../sycl/src/utils/sycl/device_selector.hpp"
#include "vecmem/containers/array.hpp"
#include "vecmem/containers/data/jagged_vector_buffer.hpp"
#include "vecmem/containers/device_array.hpp"
Expand All @@ -35,7 +34,7 @@ class sycl_jagged_containers_test : public testing::Test {
public:
/// Constructor, setting up the input data for the tests.
sycl_jagged_containers_test()
: m_queue(vecmem::sycl::device_selector()),
: m_queue(),
m_mem(&m_queue),
m_vec({vecmem::vector<int>({1, 2, 3, 4}, &m_mem),
vecmem::vector<int>({5, 6}, &m_mem),
Expand Down

0 comments on commit bdf5466

Please sign in to comment.