diff --git a/include/accessor.h b/include/accessor.h index 2aae76c2f..b92c4b0a2 100644 --- a/include/accessor.h +++ b/include/accessor.h @@ -155,7 +155,7 @@ class buffer_allocation_window { friend class accessor; }; -#define CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR [[deprecated("Creating accessor from const buffer is deprecated, capture buffer by reference instead")]] +#define CELERITY_DETAIL_ACCESSOR_DEPRECATED_CTOR [[deprecated("Creating accessor from const buffer is deprecated, capture buffer by reference instead")]] /** * Celerity wrapper around SYCL accessors. @@ -186,14 +186,6 @@ class accessor : public detail::accessor_base const property::no_init& /* no_init */) : accessor(ctor_internal_tag(), buff, cgh, rmfn) {} - template - accessor(buffer& buff, handler& cgh, const Functor& rmfn, const detail::access_tag /* tag */, - const property_list& /* prop_list */) { - static_assert(detail::constexpr_false, - "Currently it is not accepted to pass a property list to an accessor constructor. Please use the property celerity::no_init " - "as a last argument in the constructor"); - } - template = 0> accessor(buffer& buff, handler& cgh) : accessor(buff, cgh, access::all()) {} @@ -210,50 +202,32 @@ class accessor : public detail::accessor_base : accessor(buff, cgh, access::all(), tag, prop_list) {} template - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh, const Functor& rmfn) + CELERITY_DETAIL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh, const Functor& rmfn) : accessor(ctor_internal_tag(), buff, cgh, rmfn) {} template - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor( + CELERITY_DETAIL_ACCESSOR_DEPRECATED_CTOR accessor( const buffer& buff, handler& cgh, const Functor& rmfn, const detail::access_tag /* tag */) : accessor(ctor_internal_tag(), buff, cgh, rmfn) {} template - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh, const Functor& rmfn, + CELERITY_DETAIL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh, const Functor& rmfn, const detail::access_tag /* tag */, const property::no_init& /* no_init */) : accessor(ctor_internal_tag(), buff, cgh, rmfn) {} template - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh, const Functor& rmfn, + CELERITY_DETAIL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh, const Functor& rmfn, const detail::access_tag /* tag */, const property_list& /* prop_list */) { static_assert(detail::constexpr_false, "Currently it is not accepted to pass a property list to an accessor constructor. Please use the property celerity::no_init " "as a last argument in the constructor"); } - template = 0> - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh) : accessor(buff, cgh, access::all()) {} - - template = 0> - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor( - const buffer& buff, handler& cgh, const detail::access_tag tag) - : accessor(buff, cgh, access::all(), tag) {} - - template = 0> - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor( - const buffer& buff, handler& cgh, const detail::access_tag tag, const property::no_init& no_init) - : accessor(buff, cgh, access::all(), tag, no_init) {} - - template = 0> - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor( - const buffer& buff, handler& cgh, const detail::access_tag tag, const property_list& prop_list) - : accessor(buff, cgh, access::all(), tag, prop_list) {} - // explicitly defaulted because we define operator=(value_type) for Dims == 0 accessor(accessor&&) noexcept = default; accessor& operator=(accessor&&) noexcept = default; -#if !defined(__SYCL_DEVICE_ONLY__) && !defined(SYCL_DEVICE_ONLY) +#if !defined(__SYCL_DEVICE_ONLY__) accessor(const accessor& other) { copy_and_hydrate(other); } accessor& operator=(const accessor& other) { @@ -341,13 +315,14 @@ class accessor : public detail::accessor_base accessor(const ctor_internal_tag /* tag */, const buffer& buff, handler& cgh, const Functor& rmfn) { using range_mapper = detail::range_mapper>; // decay function type to function pointer const auto hid = detail::add_requirement(cgh, detail::get_buffer_id(buff), std::make_unique(rmfn, Mode, buff.get_range())); - detail::extend_lifetime(cgh, detail::get_lifetime_extending_state(buff)); + detail::extend_lifetime(cgh, std::move(detail::get_lifetime_extending_state(buff))); m_device_ptr = detail::embed_hydration_id(hid); } // Constructor for tests, called through accessor_testspy. - accessor(DataT* ptr, id index_offset, range buffer_range) : m_device_ptr(ptr), m_index_offset(index_offset), m_buffer_range(buffer_range) { -#if defined(__SYCL_DEVICE_ONLY__) || defined(SYCL_DEVICE_ONLY) + accessor(DataT* const ptr, const id& index_offset, const range& buffer_range) + : m_device_ptr(ptr), m_index_offset(index_offset), m_buffer_range(buffer_range) { +#if defined(__SYCL_DEVICE_ONLY__) #if CELERITY_WORKAROUND_HIPSYCL // hipSYCL does not yet implement is_device_copyable_v static_assert(std::is_trivially_copyable_v); #else @@ -357,7 +332,7 @@ class accessor : public detail::accessor_base } // Constructor for tests, called through accessor_testspy. - accessor(detail::hydration_id hid, id index_offset, range buffer_range) + accessor(const detail::hydration_id hid, const id& index_offset, const range& buffer_range) : accessor(detail::embed_hydration_id(hid), index_offset, buffer_range) {} void copy_and_hydrate(const accessor& other) { @@ -365,7 +340,7 @@ class accessor : public detail::accessor_base m_index_offset = other.m_index_offset; m_buffer_range = other.m_buffer_range; -#if !defined(__SYCL_DEVICE_ONLY__) && !defined(SYCL_DEVICE_ONLY) +#if !defined(__SYCL_DEVICE_ONLY__) if(detail::is_embedded_hydration_id(m_device_ptr)) { if(detail::cgf_diagnostics::is_available()) { detail::cgf_diagnostics::get_instance().register_accessor(detail::extract_hydration_id(m_device_ptr), target::device); @@ -411,14 +386,6 @@ class accessor : public detail::accessor_b const property::no_init& /* no_init */) : accessor(ctor_internal_tag{}, buff, cgh, rmfn) {} - template - accessor(buffer& buff, handler& cgh, const Functor& rmfn, const detail::access_tag /* tag */, - const property_list& /* prop_list */) { - static_assert(detail::constexpr_false, - "Currently it is not accepted to pass a property list to an accessor constructor. Please use the property celerity::no_init " - "as a last argument in the constructor"); - } - template = 0> accessor(buffer& buff, handler& cgh) : accessor(buff, cgh, access::all()) {} @@ -435,11 +402,11 @@ class accessor : public detail::accessor_b : accessor(buff, cgh, access::all(), tag, prop_list) {} template - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh, const Functor& rmfn) + CELERITY_DETAIL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh, const Functor& rmfn) : accessor(ctor_internal_tag{}, buff, cgh, rmfn) {} template - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor( + CELERITY_DETAIL_ACCESSOR_DEPRECATED_CTOR accessor( const buffer& buff, handler& cgh, const Functor& rmfn, const detail::access_tag /* tag */) : accessor(ctor_internal_tag{}, buff, cgh, rmfn) {} @@ -448,36 +415,18 @@ class accessor : public detail::accessor_b * but once they do this should be replace for a constructor that takes a prop list as an argument. */ template > - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh, const Functor& rmfn, + CELERITY_DETAIL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh, const Functor& rmfn, const detail::access_tag /* tag */, const property::no_init& /* no_init */) : accessor(ctor_internal_tag{}, buff, cgh, rmfn) {} template - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh, const Functor& rmfn, + CELERITY_DETAIL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh, const Functor& rmfn, const detail::access_tag /* tag */, const property_list& /* prop_list */) { static_assert(detail::constexpr_false, "Currently it is not accepted to pass a property list to an accessor constructor. Please use the property celerity::no_init " "as a last argument in the constructor"); } - template = 0> - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor(const buffer& buff, handler& cgh) : accessor(buff, cgh, access::all()) {} - - template = 0> - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor( - const buffer& buff, handler& cgh, const detail::access_tag tag) - : accessor(buff, cgh, access::all(), tag) {} - - template = 0> - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor( - const buffer& buff, handler& cgh, const detail::access_tag tag, const property::no_init& no_init) - : accessor(buff, cgh, access::all(), tag, no_init) {} - - template = 0> - CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR accessor( - const buffer& buff, handler& cgh, const detail::access_tag tag, const property_list& prop_list) - : accessor(buff, cgh, access::all(), tag, prop_list) {} - // explicitly defaulted because we define operator=(value_type) for Dims == 0 accessor(accessor&&) noexcept = default; accessor& operator=(accessor&&) noexcept = default; @@ -650,22 +599,21 @@ class accessor : public detail::accessor_b template accessor(ctor_internal_tag /* tag */, const buffer& buff, handler& cgh, const Functor& rmfn) : m_virtual_buffer_range(buff.get_range()) { - static_assert(!std::is_same_v>, "The accessor constructor overload for master-access tasks (now called 'host tasks') has " - "been removed with Celerity 0.2.0. Please provide a range mapper instead."); using range_mapper = detail::range_mapper>; // decay function type to function pointer const auto hid = detail::add_requirement(cgh, detail::get_buffer_id(buff), std::make_unique(rmfn, Mode, buff.get_range())); - detail::extend_lifetime(cgh, detail::get_lifetime_extending_state(buff)); + detail::extend_lifetime(cgh, std::move(detail::get_lifetime_extending_state(buff))); m_host_ptr = detail::embed_hydration_id(hid); } // Constructor for tests, called through accessor_testspy. - accessor(subrange mapped_subrange, DataT* ptr, id backing_buffer_offset, range backing_buffer_range, range virtual_buffer_range) + accessor(const subrange mapped_subrange, DataT* const ptr, const id& backing_buffer_offset, const range& backing_buffer_range, + const range& virtual_buffer_range) : m_mapped_subrange(mapped_subrange), m_index_offset(backing_buffer_offset), m_buffer_range(backing_buffer_range), m_virtual_buffer_range(virtual_buffer_range), m_host_ptr(ptr) {} // Constructor for tests, called through accessor_testspy. - accessor(subrange mapped_subrange, detail::hydration_id hid, id backing_buffer_offset, range backing_buffer_range, - range virtual_buffer_range) + accessor(const subrange& mapped_subrange, const detail::hydration_id hid, const id& backing_buffer_offset, + const range& backing_buffer_range, range virtual_buffer_range) : accessor(mapped_subrange, detail::embed_hydration_id(hid), backing_buffer_offset, backing_buffer_range, virtual_buffer_range) {} void copy_and_hydrate(const accessor& other) { @@ -693,7 +641,7 @@ class accessor : public detail::accessor_b size_t get_linear_offset(const id& index) const { return detail::get_linear_index(m_buffer_range, index - m_index_offset); } }; -#undef CELERITY_INTERNAL_ACCESSOR_DEPRECATED_CTOR +#undef CELERITY_DETAIL_ACCESSOR_DEPRECATED_CTOR // TODO: Make buffer non-const once corresponding (deprecated!) constructor overloads are removed template @@ -746,7 +694,7 @@ class local_accessor { template > local_accessor(handler& cgh) : local_accessor(range<0>(), cgh) {} -#if !defined(__SYCL_DEVICE_ONLY__) && !defined(SYCL_DEVICE_ONLY) +#if !defined(__SYCL_DEVICE_ONLY__) local_accessor(const range& allocation_size, handler& cgh) : m_sycl_acc{}, m_allocation_size(allocation_size) {} local_accessor(const local_accessor& other) @@ -826,7 +774,7 @@ class local_accessor { sycl::range sycl_allocation_size() const { return sycl::range(detail::range_cast(m_allocation_size)); } // Constructor for tests, called through accessor_testspy. - local_accessor(const range& allocation_size) : m_sycl_acc{}, m_allocation_size(allocation_size) {} + explicit local_accessor(const range& allocation_size) : m_sycl_acc{}, m_allocation_size(allocation_size) {} }; } // namespace celerity diff --git a/include/buffer.h b/include/buffer.h index f429c661f..80e986230 100644 --- a/include/buffer.h +++ b/include/buffer.h @@ -85,28 +85,18 @@ class buffer : public detail::lifetime_extending_state_wrapper { return get_access(cgh, rmfn); } - template = 0> - [[deprecated("Calling get_access on a const buffer is deprecated")]] accessor get_access(handler& cgh) const { - return get_access(cgh); - } - template 0), int> = 0> [[deprecated("Calling get_access on a const buffer is deprecated")]] accessor get_access(handler& cgh, Functor rmfn) const { return accessor(*this, cgh, rmfn); } - template = 0> - [[deprecated("Calling get_access on a const buffer is deprecated")]] accessor get_access(handler& cgh) const { - return accessor(*this, cgh); - } - const range& get_range() const { return m_impl->range; } protected: std::shared_ptr get_lifetime_extending_state() const override { return m_impl; } private: - struct impl : public detail::lifetime_extending_state { + struct impl final : public detail::lifetime_extending_state { impl(range rng, const DataT* host_init_ptr) : range(rng) { if(!detail::runtime::is_initialized()) { detail::runtime::init(nullptr, nullptr); } id = detail::runtime::get_instance().get_buffer_manager().register_buffer(detail::range_cast<3>(range), host_init_ptr); @@ -115,7 +105,7 @@ class buffer : public detail::lifetime_extending_state_wrapper { impl(impl&&) = delete; impl& operator=(const impl&) = delete; impl& operator=(impl&&) = delete; - ~impl() noexcept override { detail::runtime::get_instance().get_buffer_manager().unregister_buffer(id); } + ~impl() override { detail::runtime::get_instance().get_buffer_manager().unregister_buffer(id); } detail::buffer_id id; celerity::range range; std::string debug_name; diff --git a/include/handler.h b/include/handler.h index 360d10984..84b9ec6c0 100644 --- a/include/handler.h +++ b/include/handler.h @@ -235,44 +235,20 @@ namespace detail { class reduction_descriptor; template - auto make_sycl_reduction(const reduction_descriptor& d, DataT* ptr, const bool is_initializer) { + auto make_sycl_reduction(const reduction_descriptor& d, void* ptr, const bool is_initializer) { #if !CELERITY_FEATURE_SCALAR_REDUCTIONS static_assert(detail::constexpr_false, "Reductions are not supported by your SYCL implementation"); #else cl::sycl::property_list props; if(!d.m_include_current_buffer_value || !is_initializer) { props = {cl::sycl::property::reduction::initialize_to_identity{}}; } if constexpr(WithExplicitIdentity) { - return sycl::reduction(ptr, d.m_identity, d.m_op, props); + return sycl::reduction(static_cast(ptr), d.m_identity, d.m_op, props); } else { - return sycl::reduction(ptr, d.m_op, props); + return sycl::reduction(static_cast(ptr), d.m_op, props); } #endif } - // Stateful helper type to pair a parameter pack of reduction descriptors to a list of pointers - // TODO: Add tests for this in case this remains in place for the planned custom SYCL-agnostic reduction implementation - class batch_sycl_reduction_maker { - public: - batch_sycl_reduction_maker(const std::vector& ptrs, const bool is_initializer) : m_ptrs(ptrs), m_is_initializer(is_initializer) {} - ~batch_sycl_reduction_maker() { assert(m_next_idx == m_ptrs.size()); } - - batch_sycl_reduction_maker(const batch_sycl_reduction_maker&) = delete; - batch_sycl_reduction_maker(batch_sycl_reduction_maker&&) = delete; - batch_sycl_reduction_maker& operator=(const batch_sycl_reduction_maker&) = delete; - batch_sycl_reduction_maker& operator=(batch_sycl_reduction_maker&&) = delete; - - template - auto make(const reduction_descriptor& desc) && { - assert(m_next_idx < m_ptrs.size()); - return make_sycl_reduction(desc, static_cast(m_ptrs[m_next_idx++]), m_is_initializer); - } - - private: - const std::vector& m_ptrs; - bool m_is_initializer; - size_t m_next_idx = 0; - }; - template class reduction_descriptor { public: @@ -280,7 +256,7 @@ namespace detail { : m_bid(bid), m_op(combiner), m_include_current_buffer_value(include_current_buffer_value) {} private: - friend auto make_sycl_reduction(const reduction_descriptor&, DataT*, const bool); + friend auto make_sycl_reduction(const reduction_descriptor&, void*, const bool); buffer_id m_bid; BinaryOperation m_op; @@ -294,7 +270,7 @@ namespace detail { : m_bid(bid), m_op(combiner), m_identity(identity), m_include_current_buffer_value(include_current_buffer_value) {} private: - friend auto make_sycl_reduction(const reduction_descriptor&, DataT*, const bool); + friend auto make_sycl_reduction(const reduction_descriptor&, void*, const bool); buffer_id m_bid; BinaryOperation m_op; @@ -318,7 +294,7 @@ namespace detail { const auto rid = detail::runtime::get_instance().get_reduction_manager().create_reduction(bid, op, identity); add_reduction(cgh, reduction_info{rid, bid, include_current_buffer_value}); - extend_lifetime(cgh, get_lifetime_extending_state(vars)); + extend_lifetime(cgh, std::move(get_lifetime_extending_state(vars))); return detail::reduction_descriptor{bid, op, identity, include_current_buffer_value}; #endif @@ -459,7 +435,8 @@ class handler { } } const detail::task_geometry geometry{Dims, detail::range_cast<3>(global_range), detail::id_cast<3>(global_offset), granularity}; - auto launcher = make_device_kernel_launcher(global_range, global_offset, local_range, kernel, reductions...); + auto launcher = make_device_kernel_launcher( + global_range, global_offset, local_range, kernel, std::index_sequence_for(), reductions...); create_device_compute_task(geometry, detail::kernel_debug_name(), std::move(launcher)); } @@ -517,9 +494,10 @@ class handler { m_task = detail::task::make_master_node(m_tid, std::move(launcher), std::move(m_access_map), std::move(m_side_effects)); } - template + template auto make_device_kernel_launcher(const range& global_range, const id& global_offset, - typename detail::kernel_flavor_traits::local_size_type local_range, Kernel kernel, Reductions... reductions) { + typename detail::kernel_flavor_traits::local_size_type local_range, Kernel kernel, + std::index_sequence /* indices */, Reductions... reductions) { static_assert(std::is_copy_constructible_v>, "Kernel functor must be copyable"); // Required for hydration // Check whether all accessors are being captured by value etc. @@ -534,13 +512,13 @@ class handler { if constexpr(std::is_same_v) { const auto sycl_global_range = sycl::range(detail::range_cast(execution_sr.range)); detail::invoke_sycl_parallel_for(cgh, sycl_global_range, - detail::batch_sycl_reduction_maker(reduction_ptrs, is_reduction_initializer).make(reductions)..., + detail::make_sycl_reduction(reductions, reduction_ptrs[ReductionIndices], is_reduction_initializer)..., detail::bind_simple_kernel(hydrated_kernel, global_range, global_offset, detail::id_cast(execution_sr.offset))); } else if constexpr(std::is_same_v) { const auto sycl_global_range = sycl::range(detail::range_cast(execution_sr.range)); const auto sycl_local_range = sycl::range(detail::range_cast(local_range)); detail::invoke_sycl_parallel_for(cgh, cl::sycl::nd_range{sycl_global_range, sycl_local_range}, - detail::batch_sycl_reduction_maker(reduction_ptrs, is_reduction_initializer).make(reductions)..., + detail::make_sycl_reduction(reductions, reduction_ptrs[ReductionIndices], is_reduction_initializer)..., detail::bind_nd_range_kernel(hydrated_kernel, global_range, global_offset, detail::id_cast(execution_sr.offset), global_range / local_range, detail::id_cast(execution_sr.offset) / local_range)); } else { diff --git a/include/host_object.h b/include/host_object.h index 1d069b89c..518abc3dd 100644 --- a/include/host_object.h +++ b/include/host_object.h @@ -98,7 +98,7 @@ namespace celerity::experimental { * - `host_object` does not carry internal state and can be used to track access to global variables or functions like `printf()`. */ template -class host_object : public detail::lifetime_extending_state_wrapper { +class host_object final : public detail::lifetime_extending_state_wrapper { static_assert(std::is_object_v); // disallow host_object and host_object public: @@ -139,7 +139,7 @@ class host_object : public detail::lifetime_extending_state_wrapper { }; template -class host_object : public detail::lifetime_extending_state_wrapper { +class host_object final : public detail::lifetime_extending_state_wrapper { public: using instance_type = T; @@ -157,7 +157,7 @@ class host_object : public detail::lifetime_extending_state_wrapper { template friend typename experimental::host_object::instance_type& detail::get_host_object_instance(const experimental::host_object& ho); - struct state : detail::host_object_tracker { + struct state final : detail::host_object_tracker { T& instance; explicit state(T& instance) : instance{instance} {} @@ -170,7 +170,7 @@ class host_object : public detail::lifetime_extending_state_wrapper { }; template <> -class host_object : public detail::lifetime_extending_state_wrapper { +class host_object final : public detail::lifetime_extending_state_wrapper { public: using instance_type = void; @@ -183,7 +183,7 @@ class host_object : public detail::lifetime_extending_state_wrapper { template friend detail::host_object_id detail::get_host_object_id(const experimental::host_object& ho); - struct state : detail::host_object_tracker {}; + struct state final : detail::host_object_tracker {}; detail::host_object_id get_id() const { return m_shared_state->id; } diff --git a/include/task.h b/include/task.h index a3de58d98..c22aa6ff4 100644 --- a/include/task.h +++ b/include/task.h @@ -268,7 +268,7 @@ namespace detail { assert(this->m_side_effects.empty() || type == task_type::host_compute || type == task_type::collective || type == task_type::master_node || type == task_type::fence); } - }; // namespace detail + }; } // namespace detail } // namespace celerity diff --git a/test/accessor_tests.cc b/test/accessor_tests.cc index c47a3b788..288eda9fa 100644 --- a/test/accessor_tests.cc +++ b/test/accessor_tests.cc @@ -42,9 +42,12 @@ namespace detail { using buf0d_t = buffer&; SECTION("device accessors") { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // This currently throws an error at runtime, because we cannot infer whether the access is a discard_* from the property list parameter. using acc0 = decltype(accessor{std::declval(), std::declval(), one_to_one{}, celerity::write_only, celerity::property_list{}}); STATIC_REQUIRE(std::is_same_v, acc0>); +#pragma GCC diagnostic pop using acc1 = decltype(accessor{std::declval(), std::declval(), one_to_one{}, celerity::write_only}); STATIC_REQUIRE(std::is_same_v, acc1>); @@ -61,9 +64,12 @@ namespace detail { using acc5 = decltype(accessor{std::declval(), std::declval(), one_to_one{}, celerity::read_write, celerity::no_init}); STATIC_REQUIRE(std::is_same_v, acc5>); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // This currently throws an error at runtime, because we cannot infer whether the access is a discard_* from the property list parameter. using acc6 = decltype(accessor{std::declval(), std::declval(), all(), celerity::write_only, celerity::property_list{}}); STATIC_REQUIRE(std::is_same_v, acc6>); +#pragma GCC diagnostic pop using acc7 = decltype(accessor{std::declval(), std::declval(), all(), celerity::read_only}); STATIC_REQUIRE(std::is_same_v, acc7>); @@ -83,10 +89,13 @@ namespace detail { } SECTION("host accessors") { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // This currently throws an error at runtime, because we cannot infer whether the access is a discard_* from the property list parameter. using acc0 = decltype(accessor{std::declval(), std::declval(), one_to_one{}, celerity::write_only_host_task, celerity::property_list{}}); STATIC_REQUIRE(std::is_same_v, acc0>); +#pragma GCC diagnostic pop using acc1 = decltype(accessor{std::declval(), std::declval(), one_to_one{}, celerity::write_only_host_task}); STATIC_REQUIRE(std::is_same_v, acc1>); @@ -103,10 +112,13 @@ namespace detail { using acc5 = decltype(accessor{std::declval(), std::declval(), one_to_one{}, celerity::read_write_host_task, celerity::no_init}); STATIC_REQUIRE(std::is_same_v, acc5>); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // This currently throws an error at runtime, because we cannot infer whether the access is a discard_* from the property list parameter. using acc6 = decltype(accessor{std::declval(), std::declval(), all(), celerity::write_only_host_task, celerity::property_list{}}); STATIC_REQUIRE(std::is_same_v, acc6>); +#pragma GCC diagnostic pop using acc7 = decltype(accessor{std::declval(), std::declval(), all(), celerity::read_only_host_task}); STATIC_REQUIRE(std::is_same_v, acc7>); @@ -549,8 +561,9 @@ namespace detail { detail::range_cast<1>(bm.get_buffer_info(bid).range)); CHECK(accessor_testspy::get_pointer(acc) != access_info.ptr); closure_hydrator::get_instance().arm(target::host_task, std::move(infos)); - closure_hydrator::get_instance().hydrate( + const auto run_check = closure_hydrator::get_instance().hydrate( [&, hydrated_acc = acc] { CHECK(accessor_testspy::get_pointer(hydrated_acc) == access_info.ptr); }); + run_check(); } SECTION("device accessor") { diff --git a/test/buffer_manager_test_utils.h b/test/buffer_manager_test_utils.h index 039b802e5..f6c52bfff 100644 --- a/test/buffer_manager_test_utils.h +++ b/test/buffer_manager_test_utils.h @@ -24,7 +24,7 @@ namespace detail { template static local_accessor make_local_accessor(Args&&... args) { - return {std::forward(args)...}; + return local_accessor{std::forward(args)...}; } template