Skip to content

[SYCL] Add replacement API in sycl::stream class #8196

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 1 commit into from
Feb 6, 2023
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
8 changes: 8 additions & 0 deletions sycl/include/sycl/stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,16 @@ class __SYCL_EXPORT __SYCL_SPECIAL_CLASS __SYCL_TYPE(stream) stream
stream(size_t BufferSize, size_t MaxStatementSize, handler &CGH,
const property_list &PropList);

size_t size() const noexcept;

size_t get_work_item_buffer_size() const;

__SYCL2020_DEPRECATED(
"get_size() is deprecated since SYCL 2020. Please use size() instead.")
size_t get_size() const;

__SYCL2020_DEPRECATED("get_max_statement_size() is deprecated since SYCL "
"2020. Please use get_work_item_buffer_size() instead.")
size_t get_max_statement_size() const;

size_t get_precision() const { return Precision; }
Expand Down
7 changes: 7 additions & 0 deletions sycl/source/detail/stream_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ GlobalOffsetAccessorT stream_impl::accessGlobalOffset(handler &CGH) {
return ReinterpretedBuf.get_access<sycl::access::mode::atomic>(
CGH, range<1>(2), id<1>(0));
}

size_t stream_impl::size() const noexcept { return BufferSize_; }

size_t stream_impl::get_work_item_buffer_size() const {
return MaxStatementSize_;
}

size_t stream_impl::get_size() const { return BufferSize_; }

size_t stream_impl::get_max_statement_size() const { return MaxStatementSize_; }
Expand Down
6 changes: 6 additions & 0 deletions sycl/source/detail/stream_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ class __SYCL_EXPORT stream_impl {
// Remove during next ABI breaking window
void flush();

size_t size() const noexcept;

size_t get_work_item_buffer_size() const;

// TODO: Unusued. Remove when ABI-break is allowed.
size_t get_size() const;

// TODO: Unusued. Remove when ABI-break is allowed.
size_t get_max_statement_size() const;

template <typename propertyT> bool has_property() const noexcept {
Expand Down
10 changes: 8 additions & 2 deletions sycl/source/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,16 @@ stream::stream(size_t BufferSize, size_t MaxStatementSize, handler &CGH,
detail::getSyclObjImpl(GlobalFlushBuf)->PerWI = true;
}

size_t stream::get_size() const { return impl->get_size(); }
size_t stream::size() const noexcept { return impl->get_size(); }

size_t stream::get_work_item_buffer_size() const {
return impl->get_work_item_buffer_size();
}

size_t stream::get_size() const { return size(); }

size_t stream::get_max_statement_size() const {
return impl->get_max_statement_size();
return get_work_item_buffer_size();
}

bool stream::operator==(const stream &RHS) const { return (impl == RHS.impl); }
Expand Down
4 changes: 4 additions & 0 deletions sycl/test/abi/sycl_symbols_linux.dump
Original file line number Diff line number Diff line change
Expand Up @@ -4134,6 +4134,8 @@ _ZNK4sycl3_V16detail11image_plain9get_countEv
_ZNK4sycl3_V16detail11image_plain9get_pitchEv
_ZNK4sycl3_V16detail11image_plain9get_rangeEv
_ZNK4sycl3_V16detail11stream_impl22get_max_statement_sizeEv
_ZNK4sycl3_V16detail11stream_impl25get_work_item_buffer_sizeEv
_ZNK4sycl3_V16detail11stream_impl4sizeEv
_ZNK4sycl3_V16detail11stream_impl8get_sizeEv
_ZNK4sycl3_V16detail12buffer_plain12get_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEET_v
_ZNK4sycl3_V16detail12buffer_plain12get_propertyINS0_3ext6oneapi8property5queue12priority_lowEEET_v
Expand Down Expand Up @@ -4398,6 +4400,8 @@ _ZNK4sycl3_V16stream12has_propertyINS0_8property7context4cuda19use_primary_conte
_ZNK4sycl3_V16stream12has_propertyINS0_8property7no_initEEEbv
_ZNK4sycl3_V16stream12has_propertyINS0_8property9reduction22initialize_to_identityEEEbv
_ZNK4sycl3_V16stream22get_max_statement_sizeEv
_ZNK4sycl3_V16stream25get_work_item_buffer_sizeEv
_ZNK4sycl3_V16stream4sizeEv
_ZNK4sycl3_V16stream8get_sizeEv
_ZNK4sycl3_V16streameqERKS1_
_ZNK4sycl3_V16streamneERKS1_
Expand Down
4 changes: 4 additions & 0 deletions sycl/test/abi/sycl_symbols_windows.dump
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,8 @@
?get_stream_mode@stream@_V1@sycl@@QEBA?AW4stream_manipulator@23@XZ
?get_wait_list@event@_V1@sycl@@QEAA?AV?$vector@Vevent@_V1@sycl@@V?$allocator@Vevent@_V1@sycl@@@std@@@std@@XZ
?get_width@stream@_V1@sycl@@QEBA_KXZ
?get_work_item_buffer_size@stream_impl@detail@_V1@sycl@@QEBA_KXZ
?get_work_item_buffer_size@stream@_V1@sycl@@QEBA_KXZ
?gpu_selector_v@_V1@sycl@@YAHAEBVdevice@12@@Z
?handleHostData@SYCLMemObjT@detail@_V1@sycl@@QEAAXAEBV?$function@$$A6AXPEAX@Z@std@@_K_N@Z
?handleHostData@SYCLMemObjT@detail@_V1@sycl@@QEAAXAEBV?$shared_ptr@X@std@@_K_N@Z
Expand Down Expand Up @@ -1175,6 +1177,8 @@
?size@SYCLMemObjT@detail@_V1@sycl@@QEBA_KXZ
?size@exception_list@_V1@sycl@@QEBA_KXZ
?size@image_impl@detail@_V1@sycl@@QEBA_KXZ
?size@stream_impl@detail@_V1@sycl@@QEBA_KXZ
?size@stream@_V1@sycl@@QEBA_KXZ
?split_string@detail@_V1@sycl@@YA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@5@D@Z
?start@HostProfilingInfo@detail@_V1@sycl@@QEAAXXZ
?start_fusion@fusion_wrapper@experimental@codeplay@ext@_V1@sycl@@QEAAXXZ
Expand Down
8 changes: 8 additions & 0 deletions sycl/test/warnings/sycl_2020_deprecations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,5 +388,13 @@ int main() {
});
});

Queue.submit([&](sycl::handler &CGH) {
sycl::stream Stream(1024, 80, CGH);
// expected-warning@+1{{'get_size' is deprecated: get_size() is deprecated since SYCL 2020. Please use size() instead.}}
size_t StreamSize = Stream.get_size();
// expected-warning@+1{{'get_max_statement_size' is deprecated: get_max_statement_size() is deprecated since SYCL 2020. Please use get_work_item_buffer_size() instead.}}
size_t StreamMaxStatementSize = Stream.get_max_statement_size();
});

return 0;
}