2828#include < CL/sycl/sampler.hpp>
2929#include < CL/sycl/stl.hpp>
3030
31- #include < algorithm>
3231#include < functional>
3332#include < limits>
3433#include < memory>
@@ -250,7 +249,7 @@ class __SYCL_EXPORT handler {
250249 typename std::remove_reference<T>::type>::type>
251250 F *storePlainArg (T &&Arg) {
252251 MArgsStorage.emplace_back (sizeof (T));
253- F * Storage = ( F *) MArgsStorage.back ().data ();
252+ auto Storage = reinterpret_cast < F *>( MArgsStorage.back ().data () );
254253 *Storage = Arg;
255254 return Storage;
256255 }
@@ -308,8 +307,8 @@ class __SYCL_EXPORT handler {
308307 // / Streams are then forwarded to command group and flushed in the scheduler.
309308 // /
310309 // / \param Stream is a pointer to SYCL stream.
311- void addStream (shared_ptr_class<detail::stream_impl> Stream) {
312- MStreamStorage.push_back (std::move ( Stream) );
310+ void addStream (const shared_ptr_class<detail::stream_impl> & Stream) {
311+ MStreamStorage.push_back (Stream);
313312 }
314313
315314 // / Saves buffers created by handling reduction feature in handler.
@@ -318,28 +317,16 @@ class __SYCL_EXPORT handler {
318317 // / The 'MSharedPtrStorage' suits that need.
319318 // /
320319 // / @param ReduObj is a pointer to object that must be stored.
321- void addReduction (shared_ptr_class<const void > ReduObj) {
322- MSharedPtrStorage.push_back (std::move ( ReduObj) );
320+ void addReduction (const shared_ptr_class<const void > & ReduObj) {
321+ MSharedPtrStorage.push_back (ReduObj);
323322 }
324323
325324 ~handler () = default ;
326325
327326 bool is_host () { return MIsHost; }
328327
329328 void associateWithHandler (detail::AccessorBaseHost *AccBase,
330- access::target AccTarget) {
331- detail::AccessorImplPtr AccImpl = detail::getSyclObjImpl (*AccBase);
332- detail::Requirement *Req = AccImpl.get ();
333- // Add accessor to the list of requirements.
334- MRequirements.push_back (Req);
335- // Store copy of the accessor.
336- MAccStorage.push_back (std::move (AccImpl));
337- // Add an accessor to the handler list of associated accessors.
338- // For associated accessors index does not means nothing.
339- MAssociatedAccesors.emplace_back (detail::kernel_param_kind_t ::kind_accessor,
340- Req, static_cast <int >(AccTarget),
341- /* index*/ 0 );
342- }
329+ access::target AccTarget);
343330
344331 // Recursively calls itself until arguments pack is fully processed.
345332 // The version for regular(standard layout) argument.
@@ -387,7 +374,7 @@ class __SYCL_EXPORT handler {
387374 }
388375
389376 template <typename T> void setArgHelper (int ArgIndex, T &&Arg) {
390- void * StoredArg = ( void *) storePlainArg (Arg);
377+ auto StoredArg = static_cast < void *>( storePlainArg (Arg) );
391378
392379 if (!std::is_same<cl_mem, T>::value && std::is_pointer<T>::value) {
393380 MArgs.emplace_back (detail::kernel_param_kind_t ::kind_pointer, StoredArg,
@@ -399,7 +386,7 @@ class __SYCL_EXPORT handler {
399386 }
400387
401388 void setArgHelper (int ArgIndex, sampler &&Arg) {
402- void * StoredArg = ( void *) storePlainArg (Arg);
389+ auto StoredArg = static_cast < void *>( storePlainArg (Arg) );
403390 MArgs.emplace_back (detail::kernel_param_kind_t ::kind_sampler, StoredArg,
404391 sizeof (sampler), ArgIndex);
405392 }
@@ -791,8 +778,8 @@ class __SYCL_EXPORT handler {
791778 // / Registers event dependencies on this command group.
792779 // /
793780 // / \param Events is a vector of valid SYCL events to wait on.
794- void depends_on (vector_class<event> Events) {
795- for (event &Event : Events) {
781+ void depends_on (const vector_class<event> & Events) {
782+ for (const event &Event : Events) {
796783 MEvents.push_back (detail::getSyclObjImpl (Event));
797784 }
798785 }
@@ -1572,8 +1559,8 @@ class __SYCL_EXPORT handler {
15721559 detail::AccessorImplPtr AccImpl = detail::getSyclObjImpl (*AccBase);
15731560
15741561 MRequirements.push_back (AccImpl.get ());
1575- MSrcPtr = ( void *) AccImpl.get ();
1576- MDstPtr = ( void *) Dst;
1562+ MSrcPtr = static_cast < void *>( AccImpl.get () );
1563+ MDstPtr = static_cast < void *>( Dst) ;
15771564 // Store copy of accessor to the local storage to make sure it is alive
15781565 // until we finish
15791566 MAccStorage.push_back (std::move (AccImpl));
@@ -1679,7 +1666,7 @@ class __SYCL_EXPORT handler {
16791666 detail::AccessorBaseHost *AccBase = (detail::AccessorBaseHost *)&Acc;
16801667 detail::AccessorImplPtr AccImpl = detail::getSyclObjImpl (*AccBase);
16811668
1682- MDstPtr = ( void *) AccImpl.get ();
1669+ MDstPtr = static_cast < void *>( AccImpl.get () );
16831670 MRequirements.push_back (AccImpl.get ());
16841671 MAccStorage.push_back (std::move (AccImpl));
16851672 }
@@ -1708,12 +1695,12 @@ class __SYCL_EXPORT handler {
17081695 detail::AccessorBaseHost *AccBase = (detail::AccessorBaseHost *)&Dst;
17091696 detail::AccessorImplPtr AccImpl = detail::getSyclObjImpl (*AccBase);
17101697
1711- MDstPtr = ( void *) AccImpl.get ();
1698+ MDstPtr = static_cast < void *>( AccImpl.get () );
17121699 MRequirements.push_back (AccImpl.get ());
17131700 MAccStorage.push_back (std::move (AccImpl));
17141701
17151702 MPattern.resize (sizeof (T));
1716- T * PatternPtr = ( T *) MPattern.data ();
1703+ auto PatternPtr = reinterpret_cast < T *>( MPattern.data () );
17171704 *PatternPtr = Pattern;
17181705 } else {
17191706
@@ -1741,54 +1728,30 @@ class __SYCL_EXPORT handler {
17411728 // /
17421729 // / \param WaitList is a vector of valid SYCL events that need to complete
17431730 // / before barrier command can be executed.
1744- void barrier (const vector_class<event> &WaitList) {
1745- throwIfActionIsCreated ();
1746- MCGType = detail::CG::BARRIER_WAITLIST;
1747- MEventsWaitWithBarrier.resize (WaitList.size ());
1748- std::transform (
1749- WaitList.begin (), WaitList.end (), MEventsWaitWithBarrier.begin (),
1750- [](const event &Event) { return detail::getSyclObjImpl (Event); });
1751- }
1731+ void barrier (const vector_class<event> &WaitList);
17521732
17531733 // / Copies data from one memory region to another, both pointed by
17541734 // / USM pointers.
17551735 // /
17561736 // / \param Dest is a USM pointer to the destination memory.
17571737 // / \param Src is a USM pointer to the source memory.
17581738 // / \param Count is a number of bytes to copy.
1759- void memcpy (void *Dest, const void *Src, size_t Count) {
1760- throwIfActionIsCreated ();
1761- MSrcPtr = const_cast <void *>(Src);
1762- MDstPtr = Dest;
1763- MLength = Count;
1764- MCGType = detail::CG::COPY_USM;
1765- }
1739+ void memcpy (void *Dest, const void *Src, size_t Count);
17661740
17671741 // / Fills the memory pointed by a USM pointer with the value specified.
17681742 // /
17691743 // / \param Dest is a USM pointer to the memory to fill.
17701744 // / \param Value is a value to be set. Value is cast as an unsigned char.
17711745 // / \param Count is a number of bytes to fill.
1772- void memset (void *Dest, int Value, size_t Count) {
1773- throwIfActionIsCreated ();
1774- MDstPtr = Dest;
1775- MPattern.push_back ((char )Value);
1776- MLength = Count;
1777- MCGType = detail::CG::FILL_USM;
1778- }
1746+ void memset (void *Dest, int Value, size_t Count);
17791747
17801748 // / Provides hints to the runtime library that data should be made available
17811749 // / on a device earlier than Unified Shared Memory would normally require it
17821750 // / to be available.
17831751 // /
17841752 // / \param Ptr is a USM pointer to the memory to be prefetched to the device.
17851753 // / \param Count is a number of bytes to be prefetched.
1786- void prefetch (const void *Ptr, size_t Count) {
1787- throwIfActionIsCreated ();
1788- MDstPtr = const_cast <void *>(Ptr);
1789- MLength = Count;
1790- MCGType = detail::CG::PREFETCH_USM;
1791- }
1754+ void prefetch (const void *Ptr, size_t Count);
17921755
17931756private:
17941757 shared_ptr_class<detail::queue_impl> MQueue;
@@ -1830,7 +1793,7 @@ class __SYCL_EXPORT handler {
18301793 unique_ptr_class<detail::HostTask> MHostTask;
18311794 detail::OSModuleHandle MOSModuleHandle = detail::OSUtil::ExeModuleHandle;
18321795 // Storage for a lambda or function when using InteropTasks
1833- std::unique_ptr <detail::InteropTask> MInteropTask;
1796+ unique_ptr_class <detail::InteropTask> MInteropTask;
18341797 // / The list of events that order this operation.
18351798 vector_class<detail::EventImplPtr> MEvents;
18361799 // / The list of valid SYCL events that need to complete
0 commit comments