Skip to content

[SYCL] Remove buffer.hpp's dependency on context.hpp/event.hpp #13497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions sycl/include/sycl/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,18 @@

#include <sycl/access/access.hpp>
#include <sycl/backend_types.hpp>
#include <sycl/context.hpp>
#include <sycl/detail/array.hpp>
#include <sycl/detail/common.hpp>
#include <sycl/detail/defines_elementary.hpp>
#include <sycl/detail/export.hpp>
#include <sycl/detail/helpers.hpp>
#include <sycl/detail/iostream_proxy.hpp>
#include <sycl/detail/is_device_copyable.hpp>
#include <sycl/detail/owner_less_base.hpp>
#include <sycl/detail/pi.h> // for pi_native_handle and PI_ERROR_INVAL
#include <sycl/detail/property_helper.hpp>
#include <sycl/detail/stl_type_traits.hpp>
#include <sycl/detail/sycl_mem_obj_allocator.hpp>
#include <sycl/event.hpp>
#include <sycl/exception.hpp>
#include <sycl/ext/oneapi/accessor_property_list.hpp>
#include <sycl/id.hpp>
#include <sycl/property_list.hpp>
Expand All @@ -46,6 +44,8 @@ inline namespace _V1 {

class handler;
class queue;
class context;
class event;
template <int dimensions> class range;

template <typename DataT>
Expand All @@ -67,8 +67,8 @@ class buffer_impl;

template <typename T, int Dimensions, typename AllocatorT>
buffer<T, Dimensions, AllocatorT, void>
make_buffer_helper(pi_native_handle Handle, const context &Ctx, event Evt = {},
bool OwnNativeHandle = true) {
make_buffer_helper(pi_native_handle Handle, const context &Ctx,
const event &Evt, bool OwnNativeHandle = true) {
return buffer<T, Dimensions, AllocatorT, void>(Handle, Ctx, OwnNativeHandle,
Evt);
}
Expand Down Expand Up @@ -111,9 +111,9 @@ class __SYCL_EXPORT buffer_plain {
std::unique_ptr<detail::SYCLMemObjAllocator> Allocator,
bool IsConstPtr);

buffer_plain(pi_native_handle MemObject, context SyclContext,
buffer_plain(pi_native_handle MemObject, const context &SyclContext,
std::unique_ptr<detail::SYCLMemObjAllocator> Allocator,
bool OwnNativeHandle, event AvailableEvent);
bool OwnNativeHandle, const event &AvailableEvent);

buffer_plain(const std::shared_ptr<detail::buffer_impl> &impl) : impl(impl) {}

Expand Down Expand Up @@ -730,7 +730,8 @@ class buffer : public detail::buffer_plain,
friend class accessor;
template <typename HT, int HDims, typename HAllocT>
friend buffer<HT, HDims, HAllocT, void>
detail::make_buffer_helper(pi_native_handle, const context &, event, bool);
detail::make_buffer_helper(pi_native_handle, const context &, const event &,
bool);
template <typename SYCLObjT> friend class ext::oneapi::weak_object;

// NOTE: These members are required for reconstructing the buffer, but are not
Expand All @@ -745,12 +746,12 @@ class buffer : public detail::buffer_plain,
// Interop constructor
template <int N = dimensions, typename = EnableIfOneDimension<N>>
buffer(pi_native_handle MemObject, const context &SyclContext,
bool OwnNativeHandle, event AvailableEvent = {},
bool OwnNativeHandle, const event &AvailableEvent,
const detail::code_location CodeLoc = detail::code_location::current())
: buffer_plain(MemObject, SyclContext,
std::make_unique<
detail::SYCLMemObjAllocatorHolder<AllocatorT, T>>(),
OwnNativeHandle, std::move(AvailableEvent)),
OwnNativeHandle, AvailableEvent),
Range{0} {

Range[0] = buffer_plain::getSize() / sizeof(T);
Expand Down
10 changes: 5 additions & 5 deletions sycl/source/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ buffer_plain::buffer_plain(
}

buffer_plain::buffer_plain(
pi_native_handle MemObject, context SyclContext,
pi_native_handle MemObject, const context &SyclContext,
std::unique_ptr<detail::SYCLMemObjAllocator> Allocator,
bool OwnNativeHandle, event AvailableEvent) {
impl = std::make_shared<detail::buffer_impl>(
MemObject, std::move(SyclContext), std::move(Allocator), OwnNativeHandle,
std::move(AvailableEvent));
bool OwnNativeHandle, const event &AvailableEvent) {
impl = std::make_shared<detail::buffer_impl>(MemObject, SyclContext,
std::move(Allocator),
OwnNativeHandle, AvailableEvent);
}

void buffer_plain::set_final_data_internal() { impl->set_final_data(nullptr); }
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/abi/sycl_symbols_linux.dump
Original file line number Diff line number Diff line change
Expand Up @@ -3223,13 +3223,13 @@ _ZN4sycl3_V16detail12buffer_plainC1EPKvmmRKNS0_13property_listESt10unique_ptrINS
_ZN4sycl3_V16detail12buffer_plainC1EPvmmRKNS0_13property_listESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteIS8_EE
_ZN4sycl3_V16detail12buffer_plainC1ERKSt10shared_ptrIKvEmmRKNS0_13property_listESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteISC_EEb
_ZN4sycl3_V16detail12buffer_plainC1ERKSt8functionIFvPvEEmmRKNS0_13property_listESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteISD_EEb
_ZN4sycl3_V16detail12buffer_plainC1EmNS0_7contextESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteIS5_EEbNS0_5eventE
_ZN4sycl3_V16detail12buffer_plainC1EmRKNS0_7contextESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteIS7_EEbRKNS0_5eventE
_ZN4sycl3_V16detail12buffer_plainC1EmmRKNS0_13property_listESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteIS7_EE
_ZN4sycl3_V16detail12buffer_plainC2EPKvmmRKNS0_13property_listESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteIS9_EE
_ZN4sycl3_V16detail12buffer_plainC2EPvmmRKNS0_13property_listESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteIS8_EE
_ZN4sycl3_V16detail12buffer_plainC2ERKSt10shared_ptrIKvEmmRKNS0_13property_listESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteISC_EEb
_ZN4sycl3_V16detail12buffer_plainC2ERKSt8functionIFvPvEEmmRKNS0_13property_listESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteISD_EEb
_ZN4sycl3_V16detail12buffer_plainC2EmNS0_7contextESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteIS5_EEbNS0_5eventE
_ZN4sycl3_V16detail12buffer_plainC2EmRKNS0_7contextESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteIS7_EEbRKNS0_5eventE
_ZN4sycl3_V16detail12buffer_plainC2EmmRKNS0_13property_listESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteIS7_EE
_ZN4sycl3_V16detail12compile_implERKNS0_13kernel_bundleILNS0_12bundle_stateE0EEERKSt6vectorINS0_6deviceESaIS8_EERKNS0_13property_listE
_ZN4sycl3_V16detail12isOutOfRangeENS0_3vecIiLi4EEENS0_15addressing_modeENS0_5rangeILi3EEE
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/abi/sycl_symbols_windows.dump
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@
??0buffer_plain@detail@_V1@sycl@@IEAA@PEAX_K1AEBVproperty_list@23@V?$unique_ptr@VSYCLMemObjAllocator@detail@_V1@sycl@@U?$default_delete@VSYCLMemObjAllocator@detail@_V1@sycl@@@std@@@std@@@Z
??0buffer_plain@detail@_V1@sycl@@IEAA@PEBX_K1AEBVproperty_list@23@V?$unique_ptr@VSYCLMemObjAllocator@detail@_V1@sycl@@U?$default_delete@VSYCLMemObjAllocator@detail@_V1@sycl@@@std@@@std@@@Z
??0buffer_plain@detail@_V1@sycl@@IEAA@_K0AEBVproperty_list@23@V?$unique_ptr@VSYCLMemObjAllocator@detail@_V1@sycl@@U?$default_delete@VSYCLMemObjAllocator@detail@_V1@sycl@@@std@@@std@@@Z
??0buffer_plain@detail@_V1@sycl@@IEAA@_KVcontext@23@V?$unique_ptr@VSYCLMemObjAllocator@detail@_V1@sycl@@U?$default_delete@VSYCLMemObjAllocator@detail@_V1@sycl@@@std@@@std@@_NVevent@23@@Z
??0buffer_plain@detail@_V1@sycl@@IEAA@_KAEBVcontext@23@V?$unique_ptr@VSYCLMemObjAllocator@detail@_V1@sycl@@U?$default_delete@VSYCLMemObjAllocator@detail@_V1@sycl@@@std@@@std@@_NAEBVevent@23@@Z
??0buffer_plain@detail@_V1@sycl@@QEAA@$$QEAV0123@@Z
??0buffer_plain@detail@_V1@sycl@@QEAA@AEBV0123@@Z
??0context@_V1@sycl@@AEAA@V?$shared_ptr@Vcontext_impl@detail@_V1@sycl@@@std@@@Z
Expand Down
47 changes: 23 additions & 24 deletions sycl/test/include_deps/sycl_accessor.hpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@
// CHECK-NEXT: detail/boost/mp11/detail/mp_with_index.hpp
// CHECK-NEXT: detail/boost/mp11/integer_sequence.hpp
// CHECK-NEXT: buffer.hpp
// CHECK-NEXT: context.hpp
// CHECK-NEXT: async_handler.hpp
// CHECK-NEXT: detail/info_desc_helpers.hpp
// CHECK-NEXT: id.hpp
// CHECK-NEXT: detail/array.hpp
// CHECK-NEXT: exception.hpp
// CHECK-NEXT: detail/cl.h
Expand All @@ -73,13 +69,35 @@
// CHECK-NEXT: CL/cl_platform.h
// CHECK-NEXT: CL/cl_ext.h
// CHECK-NEXT: detail/common.hpp
// CHECK-NEXT: detail/is_device_copyable.hpp
// CHECK-NEXT: detail/owner_less_base.hpp
// CHECK-NEXT: detail/impl_utils.hpp
// CHECK-NEXT: ext/oneapi/weak_object_base.hpp
// CHECK-NEXT: detail/property_helper.hpp
// CHECK-NEXT: detail/stl_type_traits.hpp
// CHECK-NEXT: detail/sycl_mem_obj_allocator.hpp
// CHECK-NEXT: detail/aligned_allocator.hpp
// CHECK-NEXT: ext/oneapi/accessor_property_list.hpp
// CHECK-NEXT: detail/property_list_base.hpp
// CHECK-NEXT: property_list.hpp
// CHECK-NEXT: properties/property_traits.hpp
// CHECK-NEXT: id.hpp
// CHECK-NEXT: range.hpp
// CHECK-NEXT: detail/accessor_iterator.hpp
// CHECK-NEXT: detail/generic_type_traits.hpp
// CHECK-NEXT: ext/oneapi/bfloat16.hpp
// CHECK-NEXT: detail/handler_proxy.hpp
// CHECK-NEXT: pointers.hpp
// CHECK-NEXT: properties/accessor_properties.hpp
// CHECK-NEXT: properties/buffer_properties.hpp
// CHECK-NEXT: context.hpp
// CHECK-NEXT: async_handler.hpp
// CHECK-NEXT: detail/info_desc_helpers.hpp
// CHECK-NEXT: info/info_desc.hpp
// CHECK-NEXT: ext/oneapi/experimental/device_architecture.hpp
// CHECK-NEXT: ext/oneapi/experimental/architectures.def
// CHECK-NEXT: ext/oneapi/experimental/forward_progress.hpp
// CHECK-NEXT: ext/oneapi/matrix/query-types.hpp
// CHECK-NEXT: ext/oneapi/bfloat16.hpp
// CHECK-NEXT: ext/oneapi/matrix/matrix-unified-utils.hpp
// CHECK-NEXT: info/platform_traits.def
// CHECK-NEXT: info/context_traits.def
Expand All @@ -94,29 +112,10 @@
// CHECK-NEXT: info/ext_intel_device_traits.def
// CHECK-NEXT: info/ext_oneapi_device_traits.def
// CHECK-NEXT: info/sycl_backend_traits.def
// CHECK-NEXT: detail/owner_less_base.hpp
// CHECK-NEXT: detail/impl_utils.hpp
// CHECK-NEXT: ext/oneapi/weak_object_base.hpp
// CHECK-NEXT: platform.hpp
// CHECK-NEXT: detail/string.hpp
// CHECK-NEXT: detail/string_view.hpp
// CHECK-NEXT: detail/util.hpp
// CHECK-NEXT: device_selector.hpp
// CHECK-NEXT: property_list.hpp
// CHECK-NEXT: detail/property_helper.hpp
// CHECK-NEXT: detail/property_list_base.hpp
// CHECK-NEXT: properties/property_traits.hpp
// CHECK-NEXT: detail/is_device_copyable.hpp
// CHECK-NEXT: detail/stl_type_traits.hpp
// CHECK-NEXT: detail/sycl_mem_obj_allocator.hpp
// CHECK-NEXT: detail/aligned_allocator.hpp
// CHECK-NEXT: event.hpp
// CHECK-NEXT: ext/oneapi/accessor_property_list.hpp
// CHECK-NEXT: detail/accessor_iterator.hpp
// CHECK-NEXT: detail/generic_type_traits.hpp
// CHECK-NEXT: detail/handler_proxy.hpp
// CHECK-NEXT: pointers.hpp
// CHECK-NEXT: properties/accessor_properties.hpp
// CHECK-NEXT: properties/buffer_properties.hpp
// CHECK-NEXT: sampler.hpp
// CHECK-EMPTY:
90 changes: 12 additions & 78 deletions sycl/test/include_deps/sycl_buffer.hpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,101 +12,35 @@
// CHECK-NEXT: detail/defines.hpp
// CHECK-NEXT: detail/export.hpp
// CHECK-NEXT: backend_types.hpp
// CHECK-NEXT: context.hpp
// CHECK-NEXT: async_handler.hpp
// CHECK-NEXT: detail/helpers.hpp
// CHECK-NEXT: detail/pi.hpp
// CHECK-NEXT: detail/os_util.hpp
// CHECK-NEXT: detail/array.hpp
// CHECK-NEXT: detail/pi.h
// CHECK-NEXT: detail/pi_error.def
// CHECK-NEXT: detail/pi.def
// CHECK-NEXT: memory_enums.hpp
// CHECK-NEXT: CL/__spirv/spirv_vars.hpp
// CHECK-NEXT: detail/info_desc_helpers.hpp
// CHECK-NEXT: aspects.hpp
// CHECK-NEXT: info/aspects.def
// CHECK-NEXT: info/aspects_deprecated.def
// CHECK-NEXT: id.hpp
// CHECK-NEXT: detail/array.hpp
// CHECK-NEXT: exception.hpp
// CHECK-NEXT: detail/cl.h
// CHECK-NEXT: CL/cl.h
// CHECK-NEXT: CL/cl_version.h
// CHECK-NEXT: CL/cl_platform.h
// CHECK-NEXT: CL/cl_ext.h
// CHECK-NEXT: detail/common.hpp
// CHECK-NEXT: range.hpp
// CHECK-NEXT: info/info_desc.hpp
// CHECK-NEXT: detail/type_traits.hpp
// CHECK-NEXT: detail/generic_type_lists.hpp
// CHECK-NEXT: detail/type_list.hpp
// CHECK-NEXT: detail/boost/mp11/algorithm.hpp
// CHECK-NEXT: detail/boost/mp11/list.hpp
// CHECK-NEXT: detail/boost/mp11/integral.hpp
// CHECK-NEXT: detail/boost/mp11/version.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_value.hpp
// CHECK-NEXT: detail/boost/mp11/detail/config.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_list.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_list_v.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_is_list.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_is_value_list.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_front.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_rename.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_defer.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_append.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_count.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_plus.hpp
// CHECK-NEXT: detail/boost/mp11/utility.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_fold.hpp
// CHECK-NEXT: detail/boost/mp11/set.hpp
// CHECK-NEXT: detail/boost/mp11/function.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_min_element.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_void.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_copy_if.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_remove_if.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_map_find.hpp
// CHECK-NEXT: detail/boost/mp11/detail/mp_with_index.hpp
// CHECK-NEXT: detail/boost/mp11/integer_sequence.hpp
// CHECK-NEXT: ext/oneapi/experimental/device_architecture.hpp
// CHECK-NEXT: ext/oneapi/experimental/architectures.def
// CHECK-NEXT: ext/oneapi/experimental/forward_progress.hpp
// CHECK-NEXT: ext/oneapi/matrix/query-types.hpp
// CHECK-NEXT: ext/oneapi/bfloat16.hpp
// CHECK-NEXT: aliases.hpp
// CHECK-NEXT: half_type.hpp
// CHECK-NEXT: bit_cast.hpp
// CHECK-NEXT: detail/helpers.hpp
// CHECK-NEXT: detail/pi.hpp
// CHECK-NEXT: detail/os_util.hpp
// CHECK-NEXT: memory_enums.hpp
// CHECK-NEXT: CL/__spirv/spirv_vars.hpp
// CHECK-NEXT: detail/iostream_proxy.hpp
// CHECK-NEXT: detail/vector_traits.hpp
// CHECK-NEXT: ext/oneapi/matrix/matrix-unified-utils.hpp
// CHECK-NEXT: info/platform_traits.def
// CHECK-NEXT: info/context_traits.def
// CHECK-NEXT: info/device_traits_deprecated.def
// CHECK-NEXT: info/device_traits.def
// CHECK-NEXT: info/queue_traits.def
// CHECK-NEXT: info/kernel_traits.def
// CHECK-NEXT: info/kernel_device_specific_traits.def
// CHECK-NEXT: info/event_traits.def
// CHECK-NEXT: info/event_profiling_traits.def
// CHECK-NEXT: info/ext_codeplay_device_traits.def
// CHECK-NEXT: info/ext_intel_device_traits.def
// CHECK-NEXT: info/ext_oneapi_device_traits.def
// CHECK-NEXT: info/sycl_backend_traits.def
// CHECK-NEXT: detail/is_device_copyable.hpp
// CHECK-NEXT: detail/owner_less_base.hpp
// CHECK-NEXT: detail/impl_utils.hpp
// CHECK-NEXT: ext/oneapi/weak_object_base.hpp
// CHECK-NEXT: platform.hpp
// CHECK-NEXT: detail/string.hpp
// CHECK-NEXT: detail/string_view.hpp
// CHECK-NEXT: detail/util.hpp
// CHECK-NEXT: device_selector.hpp
// CHECK-NEXT: property_list.hpp
// CHECK-NEXT: detail/property_helper.hpp
// CHECK-NEXT: detail/property_list_base.hpp
// CHECK-NEXT: properties/property_traits.hpp
// CHECK-NEXT: detail/is_device_copyable.hpp
// CHECK-NEXT: detail/stl_type_traits.hpp
// CHECK-NEXT: detail/sycl_mem_obj_allocator.hpp
// CHECK-NEXT: detail/aligned_allocator.hpp
// CHECK-NEXT: event.hpp
// CHECK-NEXT: ext/oneapi/accessor_property_list.hpp
// CHECK-NEXT: detail/property_list_base.hpp
// CHECK-NEXT: property_list.hpp
// CHECK-NEXT: properties/property_traits.hpp
// CHECK-NEXT: id.hpp
// CHECK-NEXT: range.hpp
// CHECK-EMPTY:
Loading
Loading