Skip to content

Commit

Permalink
[ABI Break][SYCL] Remove deprecated is_host() for SYCL objects and re…
Browse files Browse the repository at this point in the history
…lated handler ctor param (#14258)

Host device support is deprecated long time ago. 
Removes:
1) is_host() API deprecated long time ago, SYCL2020 deprecations group.
2) remove isHost ctor param and corresponding field from handler class.
Handler instance is always created by RT. User deals with handler
instance by creating kernel lambda which accepts handler as parameter
and then calls methods of handler.

---------

Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
  • Loading branch information
KseniyaTikhomirova authored Jul 5, 2024
1 parent 7a7619d commit 4cb0518
Show file tree
Hide file tree
Showing 38 changed files with 48 additions and 334 deletions.
7 changes: 0 additions & 7 deletions sycl/include/sycl/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,6 @@ class __SYCL_EXPORT context : public detail::OwnerLessBase<context> {
cl_context get() const;
#endif

/// Checks if this context is a SYCL host context.
///
/// \return true if this context is a SYCL host context.
__SYCL2020_DEPRECATED(
"is_host() is deprecated as the host device is no longer supported.")
bool is_host() const;

/// Returns the backend associated with this context.
///
/// \return the backend associated with this context.
Expand Down
6 changes: 3 additions & 3 deletions sycl/include/sycl/detail/image_accessor_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// This file includes some utilities that are used by image accessors on host
// device
// This file includes some utilities that are used by image accessors in host
// code
//

#pragma once
Expand Down Expand Up @@ -685,7 +685,7 @@ convertWriteData(const half4 WriteData,
}

// imageWriteHostImpl method is called by the write API in image accessors for
// host device. Steps:
// host code. Steps:
// 1. Calculates the offset from the base ptr of the image where the pixel
// denoted by Coord is located.(getImageOffset method.)
// 2. Converts the ptr to the appropriate datatype based on
Expand Down
13 changes: 1 addition & 12 deletions sycl/include/sycl/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,6 @@ class __SYCL_EXPORT device : public detail::OwnerLessBase<device> {
cl_device_id get() const;
#endif

/// Check if device is a host device
///
/// \return true if SYCL device is a host device
__SYCL2020_DEPRECATED(
"is_host() is deprecated as the host device is no longer supported.")
bool is_host() const;

/// Check if device is a CPU device
///
/// \return true if SYCL device is a CPU device
Expand All @@ -145,8 +138,7 @@ class __SYCL_EXPORT device : public detail::OwnerLessBase<device> {
///
/// If this SYCL device is an OpenCL device then the SYCL platform
/// must encapsulate the OpenCL cl_plaform_id associated with the
/// underlying OpenCL cl_device_id of this SYCL device. If this SYCL device
/// is a host device then the SYCL platform must be a host platform.
/// underlying OpenCL cl_device_id of this SYCL device.
/// The value returned must be equal to that returned by
/// get_info<info::device::platform>().
///
Expand Down Expand Up @@ -240,9 +232,6 @@ class __SYCL_EXPORT device : public detail::OwnerLessBase<device> {

/// Query available SYCL devices
///
/// The returned std::vector must contain a single SYCL device
/// that is a host device, permitted by the deviceType parameter
///
/// \param deviceType is one of the values described in A.3 of SYCL Spec
/// \return a std::vector containing all SYCL devices available in the system
/// of the device type specified
Expand Down
12 changes: 0 additions & 12 deletions sycl/include/sycl/device_selector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,6 @@ __SYCL2020_DEPRECATED("Use the callable sycl::accelerator_selector_v instead.")
int operator()(const device &dev) const override;
};

/// Selects SYCL host device.
///
/// \sa device
///
/// \ingroup sycl_api_dev_sel
class __SYCL_EXPORT
__SYCL2020_DEPRECATED("Host device is no longer supported.") host_selector
: public device_selector {
public:
int operator()(const device &dev) const override;
};

// -------------- SYCL 2020

// SYCL 2020 standalone selectors
Expand Down
7 changes: 0 additions & 7 deletions sycl/include/sycl/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ class __SYCL_EXPORT event : public detail::OwnerLessBase<event> {

bool operator!=(const event &rhs) const;

/// Checks if this event is a SYCL host event.
///
/// \return true if this event is a SYCL host event.
__SYCL2020_DEPRECATED(
"is_host() is deprecated as the host device is no longer supported.")
bool is_host() const;

/// Return the list of events that this event waits for.
///
/// Only direct dependencies are returned. Already completed events are not
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/group_barrier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ group_barrier(Group G, memory_scope FenceScope = Group::fence_scope) {
(void)G;
(void)FenceScope;
throw sycl::exception(make_error_code(errc::feature_not_supported),
"Barriers are not supported on host device");
"Barriers are not supported on host");
#endif
}

Expand Down
115 changes: 2 additions & 113 deletions sycl/include/sycl/handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,32 +465,9 @@ class __SYCL_EXPORT handler {
/// Constructs SYCL handler from queue.
///
/// \param Queue is a SYCL queue.
/// \param IsHost indicates if this handler is created for SYCL host device.
/// TODO: Unused. Remove with ABI break.
handler(std::shared_ptr<detail::queue_impl> Queue, bool /*Unused*/);

/// Constructs SYCL handler from the associated queue and the submission's
/// primary and secondary queue.
///
/// \param Queue is a SYCL queue. This is equal to either PrimaryQueue or
/// SecondaryQueue.
/// \param PrimaryQueue is the primary SYCL queue of the submission.
/// \param SecondaryQueue is the secondary SYCL queue of the submission. This
/// is null if no secondary queue is associated with the submission.
/// TODO: Unused. Remove with ABI break.
handler(std::shared_ptr<detail::queue_impl> Queue,
std::shared_ptr<detail::queue_impl> PrimaryQueue,
std::shared_ptr<detail::queue_impl> SecondaryQueue,
bool /* Unused */);

/// Constructs SYCL handler from queue.
///
/// \param Queue is a SYCL queue.
/// \param IsHost indicates if this handler is created for SYCL host device.
/// \param CallerNeedsEvent indicates if the event resulting from this handler
/// is needed by the caller.
handler(std::shared_ptr<detail::queue_impl> Queue,
bool /* ABI break: remove */, bool CallerNeedsEvent);
handler(std::shared_ptr<detail::queue_impl> Queue, bool CallerNeedsEvent);

/// Constructs SYCL handler from the associated queue and the submission's
/// primary and secondary queue.
Expand All @@ -500,13 +477,12 @@ class __SYCL_EXPORT handler {
/// \param PrimaryQueue is the primary SYCL queue of the submission.
/// \param SecondaryQueue is the secondary SYCL queue of the submission. This
/// is null if no secondary queue is associated with the submission.
/// \param IsHost indicates if this handler is created for SYCL host device.
/// \param CallerNeedsEvent indicates if the event resulting from this handler
/// is needed by the caller.
handler(std::shared_ptr<detail::queue_impl> Queue,
std::shared_ptr<detail::queue_impl> PrimaryQueue,
std::shared_ptr<detail::queue_impl> SecondaryQueue,
bool /* ABI break: remove */, bool CallerNeedsEvent);
bool CallerNeedsEvent);

/// Constructs SYCL handler from Graph.
///
Expand Down Expand Up @@ -652,9 +628,6 @@ class __SYCL_EXPORT handler {

~handler() = default;

// TODO: Private and unusued. Remove when ABI break is allowed.
bool is_host() { return false; }

#ifdef __SYCL_DEVICE_ONLY__
// In device compilation accessor isn't inherited from host base classes, so
// can't detect by it. Since we don't expect it to be ever called in device
Expand Down Expand Up @@ -784,12 +757,6 @@ class __SYCL_EXPORT handler {
&DynamicParamBase,
int ArgIndex);

// TODO: Unusued. Remove when ABI break is allowed.
void verifyKernelInvoc(const kernel &Kernel) {
std::ignore = Kernel;
return;
}

/* The kernel passed to StoreLambda can take an id, an item or an nd_item as
* its argument. Since esimd plugin directly invokes the kernel (doesn’t use
* piKernelSetArg), the kernel argument type must be known to the plugin.
Expand Down Expand Up @@ -1110,7 +1077,6 @@ class __SYCL_EXPORT handler {
///
/// \param Src is a source SYCL accessor.
/// \param Dst is a destination SYCL accessor.
// ABI break: to remove whole method
template <typename TSrc, int DimSrc, access::mode ModeSrc,
access::target TargetSrc, typename TDst, int DimDst,
access::mode ModeDst, access::target TargetDst,
Expand All @@ -1121,81 +1087,6 @@ class __SYCL_EXPORT handler {
return false;
}

#ifndef __SYCL_DEVICE_ONLY__
// ABI break: to remove whole method
/// Copies the content of memory object accessed by Src into the memory
/// pointed by Dst.
///
/// \param Src is a source SYCL accessor.
/// \param Dst is a pointer to destination memory.
template <typename TSrc, typename TDst, int Dim, access::mode AccMode,
access::target AccTarget, access::placeholder IsPH>
std::enable_if_t<(Dim > 0)>
copyAccToPtrHost(accessor<TSrc, Dim, AccMode, AccTarget, IsPH> Src,
TDst *Dst) {
range<Dim> Range = Src.get_range();
parallel_for<__copyAcc2Ptr<TSrc, TDst, Dim, AccMode, AccTarget, IsPH>>(
Range, [=](id<Dim> Index) {
const size_t LinearIndex = detail::getLinearIndex(Index, Range);
using TSrcNonConst = typename std::remove_const_t<TSrc>;
(reinterpret_cast<TSrcNonConst *>(Dst))[LinearIndex] = Src[Index];
});
}

// ABI break: to remove whole method
/// Copies 1 element accessed by 0-dimensional accessor Src into the memory
/// pointed by Dst.
///
/// \param Src is a source SYCL accessor.
/// \param Dst is a pointer to destination memory.
template <typename TSrc, typename TDst, int Dim, access::mode AccMode,
access::target AccTarget, access::placeholder IsPH>
std::enable_if_t<Dim == 0>
copyAccToPtrHost(accessor<TSrc, Dim, AccMode, AccTarget, IsPH> Src,
TDst *Dst) {
single_task<__copyAcc2Ptr<TSrc, TDst, Dim, AccMode, AccTarget, IsPH>>(
[=]() {
using TSrcNonConst = typename std::remove_const_t<TSrc>;
*(reinterpret_cast<TSrcNonConst *>(Dst)) = *(Src.get_pointer());
});
}

// ABI break: to remove whole method
/// Copies the memory pointed by Src into the memory accessed by Dst.
///
/// \param Src is a pointer to source memory.
/// \param Dst is a destination SYCL accessor.
template <typename TSrc, typename TDst, int Dim, access::mode AccMode,
access::target AccTarget, access::placeholder IsPH>
std::enable_if_t<(Dim > 0)>
copyPtrToAccHost(TSrc *Src,
accessor<TDst, Dim, AccMode, AccTarget, IsPH> Dst) {
range<Dim> Range = Dst.get_range();
parallel_for<__copyPtr2Acc<TSrc, TDst, Dim, AccMode, AccTarget, IsPH>>(
Range, [=](id<Dim> Index) {
const size_t LinearIndex = detail::getLinearIndex(Index, Range);
Dst[Index] = (reinterpret_cast<const TDst *>(Src))[LinearIndex];
});
}

// ABI break: to remove whole method
/// Copies 1 element pointed by Src to memory accessed by 0-dimensional
/// accessor Dst.
///
/// \param Src is a pointer to source memory.
/// \param Dst is a destination SYCL accessor.
template <typename TSrc, typename TDst, int Dim, access::mode AccMode,
access::target AccTarget, access::placeholder IsPH>
std::enable_if_t<Dim == 0>
copyPtrToAccHost(TSrc *Src,
accessor<TDst, Dim, AccMode, AccTarget, IsPH> Dst) {
single_task<__copyPtr2Acc<TSrc, TDst, Dim, AccMode, AccTarget, IsPH>>(
[=]() {
*(Dst.get_pointer()) = *(reinterpret_cast<const TDst *>(Src));
});
}
#endif // __SYCL_DEVICE_ONLY__

constexpr static bool isConstOrGlobal(access::target AccessTarget) {
return AccessTarget == access::target::device ||
AccessTarget == access::target::constant_buffer;
Expand Down Expand Up @@ -3426,8 +3317,6 @@ class __SYCL_EXPORT handler {
/// Storage for the CG created when handling graph nodes added explicitly.
std::unique_ptr<detail::CG> MGraphNodeCG;

bool MIsHost = false; // ABI break: to remove

detail::code_location MCodeLoc = {};
bool MIsFinalized = false;
event MLastEvent;
Expand Down
10 changes: 1 addition & 9 deletions sycl/include/sycl/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,13 @@ class __SYCL_EXPORT kernel : public detail::OwnerLessBase<kernel> {
/// Get a valid OpenCL kernel handle
///
/// If this kernel encapsulates an instance of OpenCL kernel, a valid
/// cl_kernel will be returned. If this kernel is a host kernel,
/// an invalid_object_error exception will be thrown.
/// cl_kernel will be returned.
///
/// \return a valid cl_kernel instance
#ifdef __SYCL_INTERNAL_API
cl_kernel get() const;
#endif

/// Check if the associated SYCL context is a SYCL host context.
///
/// \return true if this SYCL kernel is a host kernel.
__SYCL2020_DEPRECATED(
"is_host() is deprecated as the host device is no longer supported.")
bool is_host() const;

/// Get the context that this kernel is defined for.
///
/// The value returned must be equal to that returned by
Expand Down
8 changes: 3 additions & 5 deletions sycl/include/sycl/kernel_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ class __SYCL_TYPE(kernel_handler) kernel_handler {
#ifdef __SYCL_DEVICE_ONLY__
return getSpecializationConstantOnDevice<S>();
#else
// TODO: add support of host device
throw sycl::feature_not_supported(
"kernel_handler::get_specialization_constant() is not yet supported by "
"host device.",
PI_ERROR_INVALID_OPERATION);
throw sycl::feature_not_supported("kernel_handler::get_specialization_"
"constant() is not supported on host",
PI_ERROR_INVALID_OPERATION);
#endif // __SYCL_DEVICE_ONLY__
}

Expand Down
7 changes: 0 additions & 7 deletions sycl/include/sycl/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,6 @@ class __SYCL_EXPORT platform : public detail::OwnerLessBase<platform> {
"use platform::has() function with aspects APIs instead")
bool has_extension(const std::string &ExtensionName) const;

/// Checks if this SYCL platform is a host platform.
///
/// \return true if this SYCL platform is a host platform.
__SYCL2020_DEPRECATED(
"is_host() is deprecated as the host device is no longer supported.")
bool is_host() const;

/// Returns all SYCL devices associated with this platform.
///
/// If this SYCL platform is a host platform, resulting vector contains only
Expand Down
5 changes: 0 additions & 5 deletions sycl/include/sycl/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,6 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
ext::oneapi::experimental::graph_state::modifiable>
ext_oneapi_get_graph() const;

/// \return true if this queue is a SYCL host queue.
__SYCL2020_DEPRECATED(
"is_host() is deprecated as the host device is no longer supported.")
bool is_host() const;

/// Queries SYCL queue for information.
///
/// The return type depends on information being queried.
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/reduction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ namespace reduction {
inline void finalizeHandler(handler &CGH) { CGH.finalize(); }
template <class FunctorTy> void withAuxHandler(handler &CGH, FunctorTy Func) {
event E = CGH.finalize();
handler AuxHandler(CGH.MQueue, CGH.MIsHost, CGH.eventNeeded());
handler AuxHandler(CGH.MQueue, CGH.eventNeeded());
if (!createSyclObjFromImpl<queue>(CGH.MQueue).is_in_order())
AuxHandler.depends_on(E);
AuxHandler.saveCodeLoc(CGH.MCodeLoc);
Expand Down
5 changes: 0 additions & 5 deletions sycl/include/sycl/stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1042,8 +1042,6 @@ class __SYCL_EXPORT __SYCL_SPECIAL_CLASS __SYCL_TYPE(stream) stream
WIOffset = GlobalOffset[1].fetch_add(FlushBufferSize);

// Initialize flush subbuffer's offset for each work item on device.
// Initialization on host device is performed via submition of additional
// host task.
SetFlushBufOffset(GlobalFlushBuf, WIOffset, 0);
}

Expand All @@ -1052,9 +1050,6 @@ class __SYCL_EXPORT __SYCL_SPECIAL_CLASS __SYCL_TYPE(stream) stream
// necessary if user hasn't yet flushed data on its own and kernel execution
// is finished
// NOTE: A call to this function will be generated by compiler
// NOTE: In the current implementation user should explicitly flush data on
// the host device. Data is not flushed automatically after kernel execution
// because of the missing feature in scheduler.
flushBuffer(GlobalOffset, GlobalBuf, GlobalFlushBuf, WIOffset);
}
#endif
Expand Down
5 changes: 0 additions & 5 deletions sycl/source/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ context::get_backend_info() const {

cl_context context::get() const { return impl->get(); }

bool context::is_host() const {
assert(false && "context::is_host should not be called in implementation.");
return false;
}

backend context::get_backend() const noexcept { return impl->getBackend(); }

platform context::get_platform() const {
Expand Down
3 changes: 0 additions & 3 deletions sycl/source/detail/platform_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,6 @@ platform_impl::get_devices(info::device_type DeviceType) const {
std::vector<device> Res;

ods_target_list *OdsTargetList = SYCLConfig<ONEAPI_DEVICE_SELECTOR>::get();

// If any DeviceType other than host was requested for host platform,
// an empty vector will be returned.
if (DeviceType == info::device_type::host)
return Res;

Expand Down
Loading

0 comments on commit 4cb0518

Please sign in to comment.