diff --git a/sycl/doc/extensions/deprecated/sycl_ext_oneapi_discard_queue_events.asciidoc b/sycl/doc/extensions/deprecated/sycl_ext_oneapi_discard_queue_events.asciidoc new file mode 100644 index 0000000000000..c037d3e1a652a --- /dev/null +++ b/sycl/doc/extensions/deprecated/sycl_ext_oneapi_discard_queue_events.asciidoc @@ -0,0 +1,212 @@ += sycl_ext_oneapi_discard_queue_events +:source-highlighter: coderay +:coderay-linenums-mode: table + +// This section needs to be after the document title. +:doctype: book +:toc2: +:toc: left +:encoding: utf-8 +:lang: en +:dpcpp: pass:[DPC++] + +:blank: pass:[ +] + +// Set the default source code type in this document to C++, +// for syntax highlighting purposes. This is needed because +// docbook uses c++ and html5 uses cpp. +:language: {basebackend@docbook:c++:cpp} + +// This is necessary for asciidoc, but not for asciidoctor +:cpp: C++ + +== Introduction + +IMPORTANT: This specification is a draft. + +NOTE: Khronos(R) is a registered trademark and SYCL(TM) and SPIR(TM) are +trademarks of The Khronos Group Inc. OpenCL(TM) is a trademark of Apple Inc. +used by permission by Khronos. + +This document describes an extension that introduces a `discard_events` property for +SYCL queues. This property enables developers to inform a SYCL implementation that +the events returned from queue operations will not be used. + +== Notice + +Copyright (c) 2021 Intel Corporation. All rights reserved. + +== Status + +This extension has been deprecated. This extension no longer provides any +benefit. Although the interfaces defined in this specification are still +supported in {dpcpp}, we expect that they will be removed in an upcoming {dpcpp} +release. The optimizations enabled by these interfaces have already been +disabled in the compiler. The functionality of this extension has been +replaced by the sycl_ext_oneapi_enqueue_functions extension: see link:../experimental/sycl_ext_oneapi_enqueue_functions.asciidoc[here]. +*Shipping software products should stop using APIs defined in this +specification and use this alternative instead.* + +== Version + +Revision: 1 + +== Contributors + +Alexander Flegontov, Intel + +Greg Lueck, Intel + +John Pennycook, Intel + +Vlad Romanov, Intel + +== Dependencies + +This extension is written against the SYCL 2020 specification, Revision 4. + +== Feature Test Macro + +This extension provides a feature-test macro as described in the core SYCL +specification section 6.3.3 "Feature test macros". Therefore, an +implementation supporting this extension must predefine the macro +`SYCL_EXT_ONEAPI_DISCARD_QUEUE_EVENTS` to one of the values defined in the table below. +Applications can test for the existence of this macro to determine if the +implementation supports this feature, or applications can test the macro's +value to determine which of the extension's APIs the implementation supports. + +[%header,cols="1,5"] +|=== +|Value |Description +|1 |Initial extension version. Base features are supported. +|=== + +== Overview + +This extension adds `ext::oneapi::property::queue::discard_events` property for `sycl::queue`, +by using this property the application informs a SYCL implementation that it will not use the event +returned by any of the `queue` member functions. (i.e submit, parallel_for, copy, memset and others.) +When the application creates a queue with this property, +the implementation may be able to optimize some operations on the `queue`. +The `discard_events` property is incompatible with `enable_profiling`. +Attempts to construct a `queue` with both properties raises `errc::invalid`. + +Below is a usage example: +[source,c++] +---- + sycl::property_list props{ext::oneapi::property::queue::discard_events{}, + property::queue::in_order{}}; + sycl::queue Queue( props ); + + // some USM preparations .. + + sycl::event e1, e2, e3; + + // returning "invalid" events from each submission function: + e1 = Queue.parallel_for(NDRange, [=](nd_item<1> item){ do_smth1(); }); + + e2 = Queue.single_task([=](){ do_smth2(); }); + + e3 = Queue.submit([&](handler &CGH) { CGH.parallel_for(NDRange, [=](nd_item<1> item){ do_smth3(); }); }); + + Queue.wait(); +---- + +In the example above, the application doesn't use sycl events: `e1`, `e2`, `e3` +and is waiting for the end of work by `queue::wait()`. +When the queue is created with the `discard_events` property, +the returned events will be _invalid_ events, which are `sycl::event` objects that have limited capability. +See the description of behavior for this event below for details. + +Here, only those member functions for the _invalid_ event are described that have behavior different from the default event behavior: +[source,c++] +---- +// must throw an exception with the errc::invalid error code. +std::vector get_wait_list(); + +// must throw an exception with the errc::invalid error code. +void wait(); + +// if invalid event is passed into the function, must throw an exception with the errc::invalid error code. +static void wait(const std::vector &eventList); + +// must throw an exception with the errc::invalid error code. +void wait_and_throw(); + +// if invalid event is passed into the function, must throw an exception with the errc::invalid error code. +static void wait_and_throw(const std::vector &eventList); + +// must return info::event_command_status::ext_oneapi_unknown +get_info() const; +---- + +The behavior when _invalid_ event is passed into handler API: +[source,c++] +---- +// must throw an exception with the errc::invalid error code. +handler::depends_on(event Event) + +// must throw an exception with the errc::invalid error code. +handler::depends_on(const std::vector &Events) +---- + +A new enumerator value is also added to the `info::event_command_status` enumeration, +which is returned by `get_info()` as described above: +[source,c++] +---- +namespace sycl { +namespace info { + +enum class event_command_status : int { + // ... + ext_oneapi_unknown +}; + +} // namespace info +} // namespace sycl +---- + +== Optimization behavior for DPC++ + +This non-normative section describes the conditions when the DPC++ implementation provides an optimization benefit* for the `discard_events` property. + + - The queue must be constructed with the `in_order` property. + - A kernel submitted to the queue must not use the link:../supported/sycl_ext_oneapi_assert.asciidoc[fallback assert feature]. + - A queue operation submitted to the queue must not use streams or buffer / image accessors. However, local accessors do not inhibit optimization. + - Any queue operations using Level Zero backend temporarily work without optimization. + +*The benefit is that a low-level event is not created from backend, thereby saving time. + +See the behavior details for each condition below: + +=== Using out-of-order queue + +No optimization if a queue is created with the `discard_events` property and +the property list does not include `in_order` property. + +=== Using fallback assert feature + +No optimization if the application calls the `assert` macro from a command that is submitted to the queue unless +the device has native support for assertions (as specified by `aspect::ext_oneapi_native_assert`). + +=== Using streams or buffer / image accessors (excluding local accessors) + +No optimization if a queue operation that uses stream objects or buffer / image accessors is submitted to a queue created with +the `discard_events` property. But using local accessors does not affect optimization. + +=== Using Level Zero backend + +Since Level Zero adapter support is required to be able to not create a low-level event, +any queue operations using the Level Zero backend temporarily work without optimization. + + +== Issues + +None. + +== Revision History + +[cols="5,15,15,70"] +[grid="rows"] +[options="header"] +|======================================== +|Rev|Date|Author|Changes +|1|2021-11-09|Alexander Flegontov |*Initial public working draft* +|======================================== diff --git a/sycl/doc/extensions/supported/sycl_ext_oneapi_discard_queue_events.asciidoc b/sycl/doc/extensions/supported/sycl_ext_oneapi_discard_queue_events.asciidoc index f8e62d21a9a31..1aad0d0cd8490 100644 --- a/sycl/doc/extensions/supported/sycl_ext_oneapi_discard_queue_events.asciidoc +++ b/sycl/doc/extensions/supported/sycl_ext_oneapi_discard_queue_events.asciidoc @@ -1,212 +1,12 @@ -= sycl_ext_oneapi_discard_queue_events -:source-highlighter: coderay -:coderay-linenums-mode: table - -// This section needs to be after the document title. -:doctype: book -:toc2: -:toc: left -:encoding: utf-8 -:lang: en - -:blank: pass:[ +] - -// Set the default source code type in this document to C++, -// for syntax highlighting purposes. This is needed because -// docbook uses c++ and html5 uses cpp. -:language: {basebackend@docbook:c++:cpp} - -// This is necessary for asciidoc, but not for asciidoctor -:cpp: C++ - -== Introduction - -IMPORTANT: This specification is a draft. - -NOTE: Khronos(R) is a registered trademark and SYCL(TM) and SPIR(TM) are -trademarks of The Khronos Group Inc. OpenCL(TM) is a trademark of Apple Inc. -used by permission by Khronos. - -This document describes an extension that introduces a `discard_events` property for -SYCL queues. This property enables developers to inform a SYCL implementation that -the events returned from queue operations will not be used. - -== Notice - -Copyright (c) 2021 Intel Corporation. All rights reserved. - -== Status - -Working Draft - -This is a preview extension specification, intended to provide early access to -a feature for review and community feedback. When the feature matures, this -specification may be released as a formal extension. - -Because the interfaces defined by this specification are not final and are -subject to change they are not intended to be used by shipping software -products. - -== Version - -Revision: 1 - -== Contributors - -Alexander Flegontov, Intel + -Greg Lueck, Intel + -John Pennycook, Intel + -Vlad Romanov, Intel - -== Dependencies - -This extension is written against the SYCL 2020 specification, Revision 4. - -== Feature Test Macro - -This extension provides a feature-test macro as described in the core SYCL -specification section 6.3.3 "Feature test macros". Therefore, an -implementation supporting this extension must predefine the macro -`SYCL_EXT_ONEAPI_DISCARD_QUEUE_EVENTS` to one of the values defined in the table below. -Applications can test for the existence of this macro to determine if the -implementation supports this feature, or applications can test the macro's -value to determine which of the extension's APIs the implementation supports. - -[%header,cols="1,5"] -|=== -|Value |Description -|1 |Initial extension version. Base features are supported. -|=== - -== Overview - -This extension adds `ext::oneapi::property::queue::discard_events` property for `sycl::queue`, -by using this property the application informs a SYCL implementation that it will not use the event -returned by any of the `queue` member functions. (i.e submit, parallel_for, copy, memset and others.) -When the application creates a queue with this property, -the implementation may be able to optimize some operations on the `queue`. -The `discard_events` property is incompatible with `enable_profiling`. -Attempts to construct a `queue` with both properties raises `errc::invalid`. - -Below is a usage example: -[source,c++] ----- - sycl::property_list props{ext::oneapi::property::queue::discard_events{}, - property::queue::in_order{}}; - sycl::queue Queue( props ); - - // some USM preparations .. - - sycl::event e1, e2, e3; - - // returning "invalid" events from each submission function: - e1 = Queue.parallel_for(NDRange, [=](nd_item<1> item){ do_smth1(); }); - - e2 = Queue.single_task([=](){ do_smth2(); }); - - e3 = Queue.submit([&](handler &CGH) { CGH.parallel_for(NDRange, [=](nd_item<1> item){ do_smth3(); }); }); - - Queue.wait(); ----- - -In the example above, the application doesn't use sycl events: `e1`, `e2`, `e3` -and is waiting for the end of work by `queue::wait()`. -When the queue is created with the `discard_events` property, -the returned events will be _invalid_ events, which are `sycl::event` objects that have limited capability. -See the description of behavior for this event below for details. - -Here, only those member functions for the _invalid_ event are described that have behavior different from the default event behavior: -[source,c++] ----- -// must throw an exception with the errc::invalid error code. -std::vector get_wait_list(); - -// must throw an exception with the errc::invalid error code. -void wait(); - -// if invalid event is passed into the function, must throw an exception with the errc::invalid error code. -static void wait(const std::vector &eventList); - -// must throw an exception with the errc::invalid error code. -void wait_and_throw(); - -// if invalid event is passed into the function, must throw an exception with the errc::invalid error code. -static void wait_and_throw(const std::vector &eventList); - -// must return info::event_command_status::ext_oneapi_unknown -get_info() const; ----- - -The behavior when _invalid_ event is passed into handler API: -[source,c++] ----- -// must throw an exception with the errc::invalid error code. -handler::depends_on(event Event) - -// must throw an exception with the errc::invalid error code. -handler::depends_on(const std::vector &Events) ----- - -A new enumerator value is also added to the `info::event_command_status` enumeration, -which is returned by `get_info()` as described above: -[source,c++] ----- -namespace sycl { -namespace info { - -enum class event_command_status : int { - // ... - ext_oneapi_unknown -}; - -} // namespace info -} // namespace sycl ----- - -== Optimization behavior for DPC++ - -This non-normative section describes the conditions when the DPC++ implementation provides an optimization benefit* for the `discard_events` property. - - - The queue must be constructed with the `in_order` property. - - A kernel submitted to the queue must not use the link:../supported/sycl_ext_oneapi_assert.asciidoc[fallback assert feature]. - - A queue operation submitted to the queue must not use streams or buffer / image accessors. However, local accessors do not inhibit optimization. - - Any queue operations using Level Zero backend temporarily work without optimization. - -*The benefit is that a low-level event is not created from backend, thereby saving time. - -See the behavior details for each condition below: - -=== Using out-of-order queue - -No optimization if a queue is created with the `discard_events` property and -the property list does not include `in_order` property. - -=== Using fallback assert feature - -No optimization if the application calls the `assert` macro from a command that is submitted to the queue unless -the device has native support for assertions (as specified by `aspect::ext_oneapi_native_assert`). - -=== Using streams or buffer / image accessors (excluding local accessors) - -No optimization if a queue operation that uses stream objects or buffer / image accessors is submitted to a queue created with -the `discard_events` property. But using local accessors does not affect optimization. - -=== Using Level Zero backend - -Since Level Zero adapter support is required to be able to not create a low-level event, -any queue operations using the Level Zero backend temporarily work without optimization. - - -== Issues - -None. - -== Revision History - -[cols="5,15,15,70"] -[grid="rows"] -[options="header"] -|======================================== -|Rev|Date|Author|Changes -|1|2021-11-09|Alexander Flegontov |*Initial public working draft* -|======================================== +:dpcpp: pass:[DPC++] + +This extension has been deprecated, but the specification is still available +link:../deprecated/sycl_ext_oneapi_discard_queue_events.asciidoc[here]. +This extension no longer provides any benefit. Although the interfaces defined +in this specification are still supported in {dpcpp}, we expect that they will +be removed in an upcoming {dpcpp} release. The optimizations enabled by these +interfaces have already been disabled in the compiler. The functionality of +this extension has been replaced by the sycl_ext_oneapi_enqueue_functions +extension: see link:../experimental/sycl_ext_oneapi_enqueue_functions.asciidoc[here]. +*Shipping software products should stop using APIs defined in this +specification and use this alternative instead.* diff --git a/sycl/doc/extensions/supported/sycl_ext_oneapi_queue_empty.asciidoc b/sycl/doc/extensions/supported/sycl_ext_oneapi_queue_empty.asciidoc index 2d56fdafc9f0c..24659deef2d42 100644 --- a/sycl/doc/extensions/supported/sycl_ext_oneapi_queue_empty.asciidoc +++ b/sycl/doc/extensions/supported/sycl_ext_oneapi_queue_empty.asciidoc @@ -46,9 +46,10 @@ This extension is supported by {dpcpp} on all backends except OpenCL. [NOTE] ==== Currently support for OpenCL backend is limited, API introduced by this extension -can be called only for in-order queues which doesn't have `discard_events` property. -Exception is thrown if new API is called on other type of queue. OpenCL currently -doesn't have an API to get queue status. +can be called only for in-order queues that have only enqueued operations +returning events. Exception is thrown if new API is called following operations +that did not return a sycl::event, because OpenCL currently doesn't have an API +to get queue status. ==== diff --git a/sycl/include/sycl/properties/queue_properties.def b/sycl/include/sycl/properties/queue_properties.def index 6e0f3fd700952..5391f4743d306 100644 --- a/sycl/include/sycl/properties/queue_properties.def +++ b/sycl/include/sycl/properties/queue_properties.def @@ -5,12 +5,13 @@ #ifndef __SYCL_MANUALLY_DEFINED_PROP #define __SYCL_MANUALLY_DEFINED_PROP(NS_QUALIFIER, PROP_NAME) #endif +#ifndef __SYCL_DATA_LESS_PROP_DEPRECATED_ALIAS +#define __SYCL_DATA_LESS_PROP_DEPRECATED_ALIAS(NS_QUALIFIER, PROP_NAME, ENUM_VAL, WARNING) +#endif __SYCL_DATA_LESS_PROP(property::queue, in_order, InOrder) __SYCL_DATA_LESS_PROP(property::queue, enable_profiling, QueueEnableProfiling) -__SYCL_DATA_LESS_PROP(ext::oneapi::property::queue, discard_events, - DiscardEvents) __SYCL_DATA_LESS_PROP(ext::oneapi::property::queue, priority_normal, QueuePriorityNormal) __SYCL_DATA_LESS_PROP(ext::oneapi::property::queue, priority_low, @@ -31,5 +32,10 @@ __SYCL_MANUALLY_DEFINED_PROP(property::queue::cuda, use_default_stream) // Contains data field, defined explicitly. __SYCL_MANUALLY_DEFINED_PROP(ext::intel::property::queue, compute_index) +__SYCL_DATA_LESS_PROP_DEPRECATED_ALIAS( + ext::oneapi::property::queue, discard_events, DiscardEvents, + __SYCL2020_DEPRECATED("use sycl_ext_oneapi_enqueue_functions instead")) + #undef __SYCL_DATA_LESS_PROP #undef __SYCL_MANUALLY_DEFINED_PROP +#undef __SYCL_DATA_LESS_PROP_DEPRECATED_ALIAS diff --git a/sycl/include/sycl/properties/queue_properties.hpp b/sycl/include/sycl/properties/queue_properties.hpp index 1e5dbec090f3a..cb20761069376 100644 --- a/sycl/include/sycl/properties/queue_properties.hpp +++ b/sycl/include/sycl/properties/queue_properties.hpp @@ -16,11 +16,15 @@ namespace sycl { inline namespace _V1 { -#define __SYCL_DATA_LESS_PROP(NS_QUALIFIER, PROP_NAME, ENUM_VAL) \ +#define __SYCL_DATA_LESS_PROP_DEPRECATED_ALIAS(NS_QUALIFIER, PROP_NAME, \ + ENUM_VAL, WARNING) \ namespace NS_QUALIFIER { \ - class PROP_NAME \ + class WARNING PROP_NAME \ : public sycl::detail::DataLessProperty {}; \ - } + } \ + WARNING inline constexpr NS_QUALIFIER::PROP_NAME PROP_NAME; +#define __SYCL_DATA_LESS_PROP(NS_QUALIFIER, PROP_NAME, ENUM_VAL) \ + __SYCL_DATA_LESS_PROP_DEPRECATED_ALIAS(NS_QUALIFIER, PROP_NAME, ENUM_VAL, ) #include diff --git a/sycl/source/detail/event_impl.cpp b/sycl/source/detail/event_impl.cpp index 776ac77272852..f90db465f4c7b 100644 --- a/sycl/source/detail/event_impl.cpp +++ b/sycl/source/detail/event_impl.cpp @@ -498,11 +498,6 @@ ur_native_handle_t event_impl::getNative() { } std::vector event_impl::getWaitList() { - if (MState == HES_Discarded) - throw sycl::exception( - make_error_code(errc::invalid), - "get_wait_list() cannot be used for a discarded event."); - std::lock_guard Lock(MMutex); std::vector Result; diff --git a/sycl/source/detail/queue_impl.cpp b/sycl/source/detail/queue_impl.cpp index 1cfdbf134277d..01a54347bfdba 100644 --- a/sycl/source/detail/queue_impl.cpp +++ b/sycl/source/detail/queue_impl.cpp @@ -291,8 +291,6 @@ sycl::detail::optional queue_impl::getLastEvent() { std::lock_guard Lock{MMutex}; if (MGraph.expired() && !MDefaultGraphDeps.LastEventPtr) return std::nullopt; - if (MDiscardEvents) - return createDiscardedEvent(); if (!MGraph.expired() && MExtGraphDeps.LastEventPtr) return detail::createSyclObjFromImpl(MExtGraphDeps.LastEventPtr); return detail::createSyclObjFromImpl(MDefaultGraphDeps.LastEventPtr); @@ -473,8 +471,7 @@ event queue_impl::submitMemOpHelper(const std::shared_ptr &Self, // handler rather than by-passing the scheduler. if (MGraph.expired() && Scheduler::areEventsSafeForSchedulerBypass( ExpandedDepEvents, MContext)) { - if ((MDiscardEvents || !CallerNeedsEvent) && - supportsDiscardingPiEvents()) { + if (!CallerNeedsEvent && supportsDiscardingPiEvents()) { NestedCallsTracker tracker; MemOpFunc(MemOpArgs..., getUrEvents(ExpandedDepEvents), /*PiEvent*/ nullptr); @@ -518,7 +515,7 @@ event queue_impl::submitMemOpHelper(const std::shared_ptr &Self, EventToStoreIn = EventImpl; } - return discard_or_return(ResEvent); + return ResEvent; } } return submitWithHandler(Self, DepEvents, CallerNeedsEvent, HandlerFunc); @@ -759,7 +756,7 @@ ur_native_handle_t queue_impl::getNative(int32_t &NativeHandleDesc) const { bool queue_impl::queue_empty() const { // If we have in-order queue where events are not discarded then just check // the status of the last event. - if (isInOrder() && !MDiscardEvents) { + if (isInOrder()) { std::lock_guard Lock(MMutex); // If there is no last event we know that no work has been submitted, so it // must be trivially empty. @@ -799,12 +796,6 @@ bool queue_impl::queue_empty() const { return true; } -event queue_impl::discard_or_return(const event &Event) { - if (!(MDiscardEvents)) - return Event; - return createDiscardedEvent(); -} - void queue_impl::revisitUnenqueuedCommandsState( const EventImplPtr &CompletedHostTask) { if (MIsInorder) @@ -851,10 +842,13 @@ void queue_impl::doUnenqueuedCommandCleanup( void queue_impl::verifyProps(const property_list &Props) const { auto CheckDataLessProperties = [](int PropertyKind) { +#define __SYCL_DATA_LESS_PROP_DEPRECATED_ALIAS(NS_QUALIFIER, PROP_NAME, \ + ENUM_VAL, WARNING) \ + case NS_QUALIFIER::PROP_NAME::getKind(): \ + return true; #define __SYCL_DATA_LESS_PROP(NS_QUALIFIER, PROP_NAME, ENUM_VAL) \ case NS_QUALIFIER::PROP_NAME::getKind(): \ return true; -#define __SYCL_MANUALLY_DEFINED_PROP(NS_QUALIFIER, PROP_NAME) switch (PropertyKind) { #include default: @@ -862,7 +856,6 @@ void queue_impl::verifyProps(const property_list &Props) const { } }; auto CheckPropertiesWithData = [](int PropertyKind) { -#define __SYCL_DATA_LESS_PROP(NS_QUALIFIER, PROP_NAME, ENUM_VAL) #define __SYCL_MANUALLY_DEFINED_PROP(NS_QUALIFIER, PROP_NAME) \ case NS_QUALIFIER::PROP_NAME::getKind(): \ return true; diff --git a/sycl/source/detail/queue_impl.hpp b/sycl/source/detail/queue_impl.hpp index df9acb4a4e2ed..8a0a1476c2ee1 100644 --- a/sycl/source/detail/queue_impl.hpp +++ b/sycl/source/detail/queue_impl.hpp @@ -114,20 +114,12 @@ class queue_impl { : MDevice(Device), MContext(Context), MAsyncHandler(AsyncHandler), MPropList(PropList), MIsInorder(has_property()), - MDiscardEvents( - has_property()), MIsProfilingEnabled(has_property()), MQueueID{ MNextAvailableQueueID.fetch_add(1, std::memory_order_relaxed)} { verifyProps(PropList); if (has_property()) { - if (has_property()) - throw sycl::exception(make_error_code(errc::invalid), - "Queue cannot be constructed with both of " - "discard_events and enable_profiling."); - if (!MDevice.has(aspect::queue_profiling)) { - throw sycl::exception(make_error_code(errc::feature_not_supported), "Cannot enable profiling, the associated device " "does not have the queue_profiling aspect"); @@ -214,8 +206,6 @@ class queue_impl { }()), MContext(Context), MAsyncHandler(AsyncHandler), MPropList(PropList), MQueue(UrQueue), MIsInorder(has_property()), - MDiscardEvents( - has_property()), MIsProfilingEnabled(has_property()), MQueueID{ MNextAvailableQueueID.fetch_add(1, std::memory_order_relaxed)} { @@ -288,9 +278,6 @@ class queue_impl { /// \return an associated SYCL device. device get_device() const { return createSyclObjFromImpl(MDevice); } - /// \return true if the discard event property was set at time of creation. - bool hasDiscardEventsProperty() const { return MDiscardEvents; } - /// \return true if this queue allows for discarded events. bool supportsDiscardingPiEvents() const { return MIsInorder; } @@ -362,7 +349,7 @@ class queue_impl { event ResEvent = submit_impl(CGF, Self, SubmitInfo.SecondaryQueue().get(), /*CallerNeedsEvent=*/true, Loc, IsTopCodeLoc, SubmitInfo); - return discard_or_return(ResEvent); + return ResEvent; } void submit_without_event(const detail::type_erased_cgfo_ty &CGF, @@ -432,11 +419,6 @@ class queue_impl { ext::oneapi::cuda::property::queue::use_default_stream>()) { CreationFlags |= UR_QUEUE_FLAG_USE_DEFAULT_STREAM; } - if (PropList.has_property()) { - // Pass this flag to the Level Zero adapter to be able to check it from - // queue property. - CreationFlags |= UR_QUEUE_FLAG_DISCARD_EVENTS; - } // Track that priority settings are not ambiguous. bool PrioritySeen = false; if (PropList @@ -688,8 +670,6 @@ class queue_impl { #endif protected: - event discard_or_return(const event &Event); - template EventImplPtr insertHelperBarrier(const HandlerType &Handler) { auto ResEvent = std::make_shared(Handler.MQueue); @@ -1007,8 +987,6 @@ class queue_impl { CheckLockCheck> MInOrderExternalEvent; public: - // Queue constructed with the discard_events property - const bool MDiscardEvents; const bool MIsProfilingEnabled; protected: diff --git a/sycl/source/detail/scheduler/commands.cpp b/sycl/source/detail/scheduler/commands.cpp index 0483dd7318a07..783ce3b1412bb 100644 --- a/sycl/source/detail/scheduler/commands.cpp +++ b/sycl/source/detail/scheduler/commands.cpp @@ -3110,11 +3110,10 @@ ur_result_t ExecCGCommand::enqueueImpQueue() { auto RawEvents = getUrEvents(EventImpls); flushCrossQueueDeps(EventImpls, MWorkerQueue); - // We can omit creating a UR event and create a "discarded" event if either - // the queue has the discard property or the command has been explicitly - // marked as not needing an event, e.g. if the user did not ask for one, and - // if the queue supports discarded UR event and there are no requirements. - bool DiscardUrEvent = MQueue && (MQueue->MDiscardEvents || !MEventNeeded) && + // We can omit creating a UR event and create a "discarded" event if the + // command has been explicitly marked as not needing an event, e.g. if the + // user did not ask for one, and there are no requirements. + bool DiscardUrEvent = MQueue && !MEventNeeded && MQueue->supportsDiscardingPiEvents() && MCommandGroup->getRequirements().size() == 0; diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index 039d07672e0bb..1c604405d14eb 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -521,8 +521,8 @@ event handler::finalize() { const detail::EventImplPtr &LastEventImpl = detail::getSyclObjImpl(MLastEvent); - bool DiscardEvent = (MQueue->MDiscardEvents || !impl->MEventNeeded) && - MQueue->supportsDiscardingPiEvents(); + bool DiscardEvent = + !impl->MEventNeeded && MQueue->supportsDiscardingPiEvents(); if (DiscardEvent) { // Kernel only uses assert if it's non interop one bool KernelUsesAssert = diff --git a/sycl/source/queue.cpp b/sycl/source/queue.cpp index 29b4c57f20e2e..983966937db62 100644 --- a/sycl/source/queue.cpp +++ b/sycl/source/queue.cpp @@ -339,8 +339,7 @@ getBarrierEventForInorderQueueHelper(const detail::QueueImplPtr QueueImpl) { /// \return a SYCL event object, which corresponds to the queue the command /// group is being enqueued on. event queue::ext_oneapi_submit_barrier(const detail::code_location &CodeLoc) { - if (is_in_order() && !impl->hasCommandGraph() && !impl->MDiscardEvents && - !impl->MIsProfilingEnabled) { + if (is_in_order() && !impl->hasCommandGraph() && !impl->MIsProfilingEnabled) { event InOrderLastEvent = getBarrierEventForInorderQueueHelper(impl); // If the last event was discarded, fall back to enqueuing a barrier. if (!detail::getSyclObjImpl(InOrderLastEvent)->isDiscarded()) @@ -367,8 +366,8 @@ event queue::ext_oneapi_submit_barrier(const std::vector &WaitList, return (EventImpl->isDefaultConstructed() || EventImpl->isNOP()) && !EventImpl->hasCommandGraph(); }); - if (is_in_order() && !impl->hasCommandGraph() && !impl->MDiscardEvents && - !impl->MIsProfilingEnabled && AllEventsEmptyOrNop) { + if (is_in_order() && !impl->hasCommandGraph() && !impl->MIsProfilingEnabled && + AllEventsEmptyOrNop) { event InOrderLastEvent = getBarrierEventForInorderQueueHelper(impl); // If the last event was discarded, fall back to enqueuing a barrier. if (!detail::getSyclObjImpl(InOrderLastEvent)->isDiscarded()) diff --git a/sycl/test-e2e/Adapters/level_zero/batch_test.cpp b/sycl/test-e2e/Adapters/level_zero/batch_test.cpp index da3ff2359c624..8f6e4e0f6a563 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_test.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_test.cpp @@ -2,7 +2,6 @@ // RUN: %{build} -o %t.ooo.out // RUN: %{build} -DUSING_INORDER -o %t.ino.out -// RUN: %{build} -DUSING_DISCARD_EVENTS -o %t.discard_events.out // UNSUPPORTED: ze_debug, level_zero_v2_adapter // To test batching on out-of-order queue: @@ -49,28 +48,6 @@ // Set batching to 9 explicitly // RUN: env SYCL_PI_LEVEL_ZERO_BATCH_SIZE=9 SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 SYCL_UR_TRACE=2 UR_L0_DEBUG=1 %{run} %t.ino.out 2>&1 | FileCheck --check-prefixes=CKALL,CKB9 %s -// To test batching on in-order queue with discard_events: -// Set batching to 4 explicitly -// RUN: env SYCL_PI_LEVEL_ZERO_BATCH_SIZE=4 SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 SYCL_UR_TRACE=2 UR_L0_DEBUG=1 %{run} %t.discard_events.out 2>&1 | FileCheck --check-prefixes=CKALL,CKB4 %s - -// Set batching to 1 explicitly -// RUN: env SYCL_PI_LEVEL_ZERO_BATCH_SIZE=1 SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 SYCL_UR_TRACE=2 UR_L0_DEBUG=1 %{run} %t.discard_events.out 2>&1 | FileCheck --check-prefixes=CKALL,CKB1 %s - -// Set batching to 3 explicitly -// RUN: env SYCL_PI_LEVEL_ZERO_BATCH_SIZE=3 SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 SYCL_UR_TRACE=2 UR_L0_DEBUG=1 %{run} %t.discard_events.out 2>&1 | FileCheck --check-prefixes=CKALL,CKB3 %s - -// Set batching to 5 explicitly -// RUN: env SYCL_PI_LEVEL_ZERO_BATCH_SIZE=5 SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 SYCL_UR_TRACE=2 UR_L0_DEBUG=1 %{run} %t.discard_events.out 2>&1 | FileCheck --check-prefixes=CKALL,CKB5 %s - -// Set batching to 7 explicitly -// RUN: env SYCL_PI_LEVEL_ZERO_BATCH_SIZE=7 SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 SYCL_UR_TRACE=2 UR_L0_DEBUG=1 %{run} %t.discard_events.out 2>&1 | FileCheck --check-prefixes=CKALL,CKB7 %s - -// Set batching to 8 explicitly -// RUN: env SYCL_PI_LEVEL_ZERO_BATCH_SIZE=8 SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 SYCL_UR_TRACE=2 UR_L0_DEBUG=1 %{run} %t.discard_events.out 2>&1 | FileCheck --check-prefixes=CKALL,CKB8 %s - -// Set batching to 9 explicitly -// RUN: env SYCL_PI_LEVEL_ZERO_BATCH_SIZE=9 SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 SYCL_UR_TRACE=2 UR_L0_DEBUG=1 %{run} %t.discard_events.out 2>&1 | FileCheck --check-prefixes=CKALL,CKB9 %s - // level_zero_batch_test.cpp // // This tests the level zero adapter's kernel batching code. The default @@ -292,10 +269,6 @@ int main(int argc, char *argv[]) { #ifdef USING_INORDER sycl::property_list Props{sycl::property::queue::in_order{}}; -#elif USING_DISCARD_EVENTS - sycl::property_list Props{ - sycl::property::queue::in_order{}, - sycl::ext::oneapi::property::queue::discard_events{}}; #else sycl::property_list Props{}; #endif diff --git a/sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp b/sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp index 9f8688efcc3aa..0c974d2b306e6 100644 --- a/sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp +++ b/sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp @@ -3,12 +3,10 @@ // RUN: %{build} -o %t.ooo.out // RUN: %{build} -DUSING_INORDER -o %t.ino.out -// RUN: %{build} -DUSING_DISCARD_EVENTS -o %t.discard_events.out // Check that dynamic batching raises/lowers batch size // RUN: env SYCL_UR_TRACE=2 UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.ooo.out 2>&1 | FileCheck --check-prefixes=CKALL,CKDYN %s // RUN: env SYCL_UR_TRACE=2 UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.ino.out 2>&1 | FileCheck --check-prefixes=CKALL,CKDYN %s -// RUN: env SYCL_UR_TRACE=2 UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=2 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.discard_events.out 2>&1 | FileCheck --check-prefixes=CKALL,CKDYN %s // level_zero_dynamic_batch_test.cpp // @@ -67,10 +65,6 @@ int main(int argc, char *argv[]) { #ifdef USING_INORDER sycl::property_list Props{sycl::property::queue::in_order{}}; -#elif USING_DISCARD_EVENTS - sycl::property_list Props{ - sycl::property::queue::in_order{}, - sycl::ext::oneapi::property::queue::discard_events{}}; #else sycl::property_list Props{}; #endif diff --git a/sycl/test-e2e/Basic/in_order_queue_status_ext_oneapi_empty.cpp b/sycl/test-e2e/Basic/in_order_queue_status_ext_oneapi_empty.cpp index 68b8b990d1b3d..a41989fb73db7 100644 --- a/sycl/test-e2e/Basic/in_order_queue_status_ext_oneapi_empty.cpp +++ b/sycl/test-e2e/Basic/in_order_queue_status_ext_oneapi_empty.cpp @@ -66,22 +66,5 @@ int main() { queue Q1{property::queue::in_order()}; TestFunc(Q1); - // Test in-order queue with discard_events property. - sycl::property_list Props{ - property::queue::in_order{}, - sycl::ext::oneapi::property::queue::discard_events{}}; - queue Q2{Props}; - - bool ExceptionThrown = false; - try { - TestFunc(Q2); - } catch (sycl::exception &E) { - ExceptionThrown = true; - } - - // Feature is not supported for OpenCL, exception must be thrown. - if (Q2.get_device().get_backend() == backend::opencl) - return ExceptionThrown ? 0 : -1; - return 0; } diff --git a/sycl/test-e2e/Basic/in_order_queue_status_khr_empty.cpp b/sycl/test-e2e/Basic/in_order_queue_status_khr_empty.cpp index b0a6601fe9ee8..268ccc124163a 100644 --- a/sycl/test-e2e/Basic/in_order_queue_status_khr_empty.cpp +++ b/sycl/test-e2e/Basic/in_order_queue_status_khr_empty.cpp @@ -66,22 +66,5 @@ int main() { queue Q1{property::queue::in_order()}; TestFunc(Q1); - // Test in-order queue with discard_events property. - sycl::property_list Props{ - property::queue::in_order{}, - sycl::ext::oneapi::property::queue::discard_events{}}; - queue Q2{Props}; - - bool ExceptionThrown = false; - try { - TestFunc(Q2); - } catch (sycl::exception &E) { - ExceptionThrown = true; - } - - // Feature is not supported for OpenCL, exception must be thrown. - if (Q2.get_device().get_backend() == backend::opencl) - return ExceptionThrown ? 0 : -1; - return 0; } diff --git a/sycl/test-e2e/DiscardEvents/discard_events_accessors.cpp b/sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_accessors.cpp similarity index 89% rename from sycl/test-e2e/DiscardEvents/discard_events_accessors.cpp rename to sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_accessors.cpp index 59e0a7f62650f..5cdbd0f73e683 100644 --- a/sycl/test-e2e/DiscardEvents/discard_events_accessors.cpp +++ b/sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_accessors.cpp @@ -2,12 +2,10 @@ // // RUN: env SYCL_UR_TRACE=2 %{run} %t.out &> %t.txt ; FileCheck %s --input-file %t.txt // -// The test checks that the last parameter is `nullptr` for -// urEnqueueKernelLaunch for USM kernel using local accessor, but -// is not `nullptr` for kernel using buffer accessor. +// The test checks that the last parameter is not `nullptr` for +// urEnqueueKernelLaunch for a kernel using buffer accessor. // // CHECK: <--- urEnqueueKernelLaunch -// CHECK: .phEvent = nullptr // // CHECK-NOT: <--- urEnqueueKernelLaunch({{.*}}.phEvent = nullptr // CHECK: <--- urEnqueueKernelLaunch diff --git a/sycl/test-e2e/DiscardEvents/discard_events_kernel_using_assert.hpp b/sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_kernel_using_assert.hpp similarity index 100% rename from sycl/test-e2e/DiscardEvents/discard_events_kernel_using_assert.hpp rename to sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_kernel_using_assert.hpp diff --git a/sycl/test-e2e/DiscardEvents/discard_events_l0_inorder.cpp b/sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_l0_inorder.cpp similarity index 100% rename from sycl/test-e2e/DiscardEvents/discard_events_l0_inorder.cpp rename to sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_l0_inorder.cpp diff --git a/sycl/test-e2e/DiscardEvents/discard_events_l0_leak.cpp b/sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_l0_leak.cpp similarity index 100% rename from sycl/test-e2e/DiscardEvents/discard_events_l0_leak.cpp rename to sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_l0_leak.cpp diff --git a/sycl/test-e2e/DiscardEvents/discard_events_test_queue_ops.hpp b/sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_test_queue_ops.hpp similarity index 100% rename from sycl/test-e2e/DiscardEvents/discard_events_test_queue_ops.hpp rename to sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_test_queue_ops.hpp diff --git a/sycl/test-e2e/DiscardEvents/discard_events_using_assert.cpp b/sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_using_assert.cpp similarity index 100% rename from sycl/test-e2e/DiscardEvents/discard_events_using_assert.cpp rename to sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_using_assert.cpp diff --git a/sycl/test-e2e/DiscardEvents/discard_events_usm_ooo_queue.cpp b/sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_usm_ooo_queue.cpp similarity index 100% rename from sycl/test-e2e/DiscardEvents/discard_events_usm_ooo_queue.cpp rename to sycl/test-e2e/DeprecatedFeatures/DiscardEvents/discard_events_usm_ooo_queue.cpp diff --git a/sycl/test-e2e/DiscardEvents/discard_events_check_images.cpp b/sycl/test-e2e/DiscardEvents/discard_events_check_images.cpp deleted file mode 100644 index e9f8588124b07..0000000000000 --- a/sycl/test-e2e/DiscardEvents/discard_events_check_images.cpp +++ /dev/null @@ -1,203 +0,0 @@ -// UNSUPPORTED: target-amd -// REQUIRES: aspect-ext_intel_legacy_image -// -// RUN: %{build} -o %t.out -// -// RUN: %{run} %t.out image -// RUN: %{run} %t.out mixed -// -// Note that the tests use image functionality and if you have problems with -// the tests, please check if they pass without the discard_events property, if -// they don't pass then it's most likely a general issue unrelated to -// discard_events. - -// 1. There is a SPIR-V spec issue that blocks generation of valid SPIR-V code -// for the OpenCL environments support of the "Unknown" image format: -// https://github.com/KhronosGroup/SPIRV-Headers/issues/487 -// 2. The PR https://github.com/llvm/llvm-project/pull/127242 in upstream needs -// to be merged with intel/llvm to address an issue of mapping from SPIR-V -// friendly builtins to Image Read/Write instructions After the 1 issue is -// resolved and 2 is merged we will re-enable Image support. -// UNSUPPORTED: spirv-backend && arch-intel_gpu_bmg_g21 -// UNSUPPORTED-TRACKER: https://github.com/KhronosGroup/SPIRV-Headers/issues/487 - -#include "../helpers.hpp" // for printableVec -#include -#include -#include -#include -#include -#include -#include - -using namespace sycl; -static constexpr size_t BUFFER_SIZE = 1024; -static constexpr int MAX_ITER_NUM1 = 10; -static constexpr int MAX_ITER_NUM2 = 10; -static constexpr int InitialVal = MAX_ITER_NUM1; - -void TestHelper(sycl::queue Q, - const std::function ImgSize, int *Harray, - sycl::image<2> Img)> &Function) { - int *Harray = sycl::malloc_shared(BUFFER_SIZE, Q); - assert(Harray != nullptr); - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - Harray[i] = 0; - } - - const sycl::image_channel_order ChanOrder = sycl::image_channel_order::rgba; - const sycl::image_channel_type ChanType = - sycl::image_channel_type::signed_int32; - - const sycl::range<2> ImgSize(sycl::sqrt(static_cast(BUFFER_SIZE)), - sycl::sqrt(static_cast(BUFFER_SIZE))); - std::vector ImgHostData( - ImgSize.size(), {InitialVal, InitialVal, InitialVal, InitialVal}); - sycl::image<2> Img(ImgHostData.data(), ChanOrder, ChanType, ImgSize); - - Function(ImgSize, Harray, Img); - - free(Harray, Q); -} - -void IfTrueIncrementUSM(sycl::queue Q, sycl::range<1> Range, int *Harray, - int ValueToCheck) { - Q.submit([&](sycl::handler &CGH) { - CGH.parallel_for(Range, [=](sycl::item<1> itemID) { - size_t i = itemID.get_id(0); - if (Harray[i] == ValueToCheck) { - Harray[i] += 1; - } - }); - }); -} - -void IfTrueIncrementImageAndUSM(sycl::queue Q, sycl::range<2> ImgSize, - int *Harray, sycl::image<2> Img, - int HarrayValueToCheck, int ImageValueToCheck) { - Q.submit([&](sycl::handler &CGH) { - auto Img1Acc = Img.get_access(CGH); - auto Img2Acc = Img.get_access(CGH); - CGH.parallel_for(ImgSize, [=](sycl::item<2> Item) { - size_t i = Item.get_linear_id(); - if (Harray[i] == HarrayValueToCheck) { - sycl::int4 Data = Img1Acc.read(sycl::int2{Item[0], Item[1]}); - if (Data[0] == ImageValueToCheck && Data[1] == ImageValueToCheck && - Data[2] == ImageValueToCheck && Data[3] == ImageValueToCheck) { - Data[0]++; - Data[3] = Data[2] = Data[1] = Data[0]; - Img2Acc.write(sycl::int2{Item[0], Item[1]}, Data); - } - ++Harray[i]; - } - }); - }); -} - -void RunTest_ImageTest(sycl::queue Q) { - TestHelper(Q, [&](sycl::range<2> ImgSize, int *Harray, sycl::image<2> Img) { - sycl::range<1> Range(BUFFER_SIZE); - for (int i = 0; i < MAX_ITER_NUM1; ++i) - IfTrueIncrementUSM(Q, Range, Harray, (i)); - - for (int i = 0; i < MAX_ITER_NUM2; ++i) - IfTrueIncrementImageAndUSM(Q, ImgSize, Harray, Img, (MAX_ITER_NUM1 + i), - (InitialVal + i)); - Q.wait(); - - // check results - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - int expected = MAX_ITER_NUM1 + MAX_ITER_NUM2; - assert(Harray[i] == expected); - } - - { - auto HostAcc = - Img.template get_access(); - int expected = InitialVal + MAX_ITER_NUM2; - for (int X = 0; X < ImgSize[0]; ++X) - for (int Y = 0; Y < ImgSize[1]; ++Y) { - sycl::int4 Vec1 = sycl::int4(expected); - sycl::int4 Vec2 = HostAcc.read(sycl::int2{X, Y}); - if (Vec1[0] != Vec2[0] || Vec1[1] != Vec2[1] || Vec1[2] != Vec2[2] || - Vec1[3] != Vec2[3]) { - std::cerr << "Failed" << std::endl; - std::cerr << "Element [ " << X << ", " << Y << " ]" << std::endl; - std::cerr << "Expected: " << printableVec(Vec1) << std::endl; - std::cerr << " Got : " << printableVec(Vec2) << std::endl; - assert(false && "ImageTest failed!"); - } - } - } - }); -} - -void RunTest_ImageTest_Mixed(sycl::queue Q) { - TestHelper(Q, [&](sycl::range<2> ImgSize, int *Harray, sycl::image<2> Img) { - sycl::range<1> Range(BUFFER_SIZE); - - for (int i = 0; i < MAX_ITER_NUM1; ++i) { - IfTrueIncrementUSM(Q, Range, Harray, (i * 2)); - IfTrueIncrementImageAndUSM(Q, ImgSize, Harray, Img, (i * 2 + 1), - (InitialVal + i)); - } - - for (int i = 0; i < MAX_ITER_NUM2; ++i) { - IfTrueIncrementImageAndUSM(Q, ImgSize, Harray, Img, - (MAX_ITER_NUM1 * 2 + i * 2), - (InitialVal + MAX_ITER_NUM1 + i)); - IfTrueIncrementUSM(Q, Range, Harray, (MAX_ITER_NUM1 * 2 + i * 2 + 1)); - } - - Q.wait(); - - // check results - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - int expected = MAX_ITER_NUM1 * 2 + MAX_ITER_NUM2 * 2; - assert(Harray[i] == expected); - } - - { - auto HostAcc = - Img.template get_access(); - int expected = InitialVal + MAX_ITER_NUM1 + MAX_ITER_NUM2; - for (int X = 0; X < ImgSize[0]; ++X) - for (int Y = 0; Y < ImgSize[1]; ++Y) { - sycl::int4 Vec1 = sycl::int4(expected); - sycl::int4 Vec2 = HostAcc.read(sycl::int2{X, Y}); - if (Vec1[0] != Vec2[0] || Vec1[1] != Vec2[1] || Vec1[2] != Vec2[2] || - Vec1[3] != Vec2[3]) { - std::cerr << "Failed" << std::endl; - std::cerr << "Element [ " << X << ", " << Y << " ]" << std::endl; - std::cerr << "Expected: " << printableVec(Vec1) << std::endl; - std::cerr << " Got : " << printableVec(Vec2) << std::endl; - assert(false && "ImageTest_Mixed failed!"); - } - } - } - }); -} - -int main(int Argc, const char *Argv[]) { - assert(Argc == 2 && "Invalid number of arguments"); - std::string TestType(Argv[1]); - - sycl::property_list props{ - sycl::property::queue::in_order{}, - sycl::ext::oneapi::property::queue::discard_events{}}; - sycl::queue Q(props); - - auto dev = Q.get_device(); - if (TestType == "image") { - std::cerr << "RunTest_ImageTest" << std::endl; - RunTest_ImageTest(Q); - } else if (TestType == "mixed") { - std::cerr << "RunTest_ImageTest_Mixed" << std::endl; - RunTest_ImageTest_Mixed(Q); - } else { - assert(0 && "Unsupported test type!"); - } - - std::cout << "The test passed." << std::endl; - return 0; -} diff --git a/sycl/test-e2e/DiscardEvents/discard_events_mixed_calls.cpp b/sycl/test-e2e/DiscardEvents/discard_events_mixed_calls.cpp deleted file mode 100644 index 041519a64d900..0000000000000 --- a/sycl/test-e2e/DiscardEvents/discard_events_mixed_calls.cpp +++ /dev/null @@ -1,286 +0,0 @@ -// RUN: %{build} -o %t.out - -// The purpose of all tests is to make sure in-order semantics works correctly -// using discard_events and alternating event and eventless kernel calls in -// different ways. - -// The test checks that eventless kernel calls work correctly after several -// event kernel calls. -// RUN: %{run} %t.out accessor-usm - -// The test checks that event kernel calls work correctly after several -// eventless kernel calls. -// RUN: %{run} %t.out usm-accessor - -// The test checks that alternating event and eventless kernel calls work -// correctly. -// RUN: %{run} %t.out mixed - -// The test checks that urEnqueueMemBufferMap and urEnqueueMemUnmap work -// correctly when we alternate between event and eventless kernel calls. -// RUN: %{run} %t.out map-unmap - -// Note that the tests use buffer functionality and if you have problems with -// the tests, please check if they pass without the discard_events property, if -// they don't pass then it's most likely a general issue unrelated to -// discard_events. -// REQUIRES: aspect-usm_shared_allocations -#include -#include -#include -#include -#include - -using namespace sycl; -static constexpr size_t BUFFER_SIZE = 1024; -static constexpr int MAX_ITER_NUM1 = 10; -static constexpr int MAX_ITER_NUM2 = 10; - -void TestHelper(sycl::queue Q, - const std::function Range, int *Harray, - sycl::buffer Buf)> &Function) { - int *Harray = sycl::malloc_shared(BUFFER_SIZE, Q); - assert(Harray != nullptr); - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - Harray[i] = 0; - } - - sycl::range<1> Range(BUFFER_SIZE); - sycl::buffer Buf(Range); - - Function(Range, Harray, Buf); - - free(Harray, Q); -} - -void IfTrueIncrementUSM(sycl::queue Q, sycl::range<1> Range, int *Harray, - int ValueToCheck) { - Q.submit([&](sycl::handler &CGH) { - CGH.parallel_for(Range, [=](sycl::item<1> itemID) { - size_t i = itemID.get_id(0); - if (Harray[i] == ValueToCheck) { - Harray[i] += 1; - } - }); - }); -} - -void IfTrueIncrementBufferAndUSM(sycl::queue Q, sycl::range<1> Range, - int *Harray, sycl::buffer Buf, - int ValueToCheck) { - Q.submit([&](sycl::handler &CGH) { - auto Acc = Buf.get_access(CGH); - CGH.parallel_for( - Range, [=](sycl::item<1> itemID) { - size_t i = itemID.get_id(0); - if (Harray[i] == ValueToCheck) { - ++Acc[i]; - ++Harray[i]; - } - }); - }); -} - -void RunTest_USM_Accessor(sycl::queue Q) { - TestHelper(Q, [&](sycl::range<1> Range, int *Harray, - sycl::buffer Buf) { - { - sycl::host_accessor HostAcc(Buf); - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - HostAcc[i] = 0; - } - } - - for (int i = 0; i < MAX_ITER_NUM1; ++i) - IfTrueIncrementUSM(Q, Range, Harray, (i)); - - for (int i = 0; i < MAX_ITER_NUM2; ++i) - IfTrueIncrementBufferAndUSM(Q, Range, Harray, Buf, (MAX_ITER_NUM1 + i)); - - Q.wait(); - - // check results - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - int expected = MAX_ITER_NUM1 + MAX_ITER_NUM2; - assert(Harray[i] == expected); - } - { - sycl::host_accessor HostAcc(Buf, sycl::read_only); - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - int expected = MAX_ITER_NUM2; - assert(HostAcc[i] == expected); - } - } - }); -} - -void RunTest_Accessor_USM(sycl::queue Q) { - TestHelper( - Q, [&](sycl::range<1> Range, int *Harray, sycl::buffer Buf) { - { - sycl::host_accessor HostAcc(Buf); - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - HostAcc[i] = 0; - } - } - - for (int i = 0; i < MAX_ITER_NUM1; ++i) - IfTrueIncrementBufferAndUSM(Q, Range, Harray, Buf, (i)); - - for (int i = 0; i < MAX_ITER_NUM2; ++i) - IfTrueIncrementUSM(Q, Range, Harray, (MAX_ITER_NUM1 + i)); - - Q.wait(); - - // check results - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - int expected = MAX_ITER_NUM1 + MAX_ITER_NUM2; - assert(Harray[i] == expected); - } - { - sycl::host_accessor HostAcc(Buf, sycl::read_only); - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - int expected = MAX_ITER_NUM1; - assert(HostAcc[i] == expected); - } - } - }); -} - -void RunTest_Mixed(sycl::queue Q) { - TestHelper( - Q, [&](sycl::range<1> Range, int *Harray, sycl::buffer Buf) { - { - sycl::host_accessor HostAcc(Buf); - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - HostAcc[i] = 0; - } - } - - for (int i = 0; i < MAX_ITER_NUM1; ++i) { - IfTrueIncrementUSM(Q, Range, Harray, (i * 2)); - IfTrueIncrementBufferAndUSM(Q, Range, Harray, Buf, (i * 2 + 1)); - } - - for (int i = 0; i < MAX_ITER_NUM2; ++i) { - IfTrueIncrementBufferAndUSM(Q, Range, Harray, Buf, - (MAX_ITER_NUM1 * 2 + i * 2)); - IfTrueIncrementUSM(Q, Range, Harray, (MAX_ITER_NUM1 * 2 + i * 2 + 1)); - } - - Q.wait(); - - // check results - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - int expected = MAX_ITER_NUM1 * 2 + MAX_ITER_NUM2 * 2; - assert(Harray[i] == expected); - } - { - sycl::host_accessor HostAcc(Buf, sycl::read_only); - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - int expected = MAX_ITER_NUM1 + MAX_ITER_NUM2; - assert(HostAcc[i] == expected); - } - } - }); -} - -void RunTest_MemBufferMapUnMap(sycl::queue Q) { - TestHelper( - Q, [&](sycl::range<1> Range, int *Harray, sycl::buffer Buf) { - Q.submit([&](sycl::handler &CGH) { - auto Acc = Buf.get_access(CGH); - CGH.parallel_for(Range, [=](sycl::item<1> itemID) { - size_t i = itemID.get_id(0); - Harray[i] = i; - Acc[i] = i; - }); - }); - - Q.submit([&](sycl::handler &CGH) { - CGH.parallel_for(Range, [=](sycl::item<1> itemID) { - size_t i = itemID.get_id(0); - if (Harray[i] == i) - Harray[i] += 10; - }); - }); - - { - // waiting for all queue operations in urEnqueueMemBufferMap and then - // checking buffer - sycl::host_accessor HostAcc(Buf); - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - int expected = i; - assert(HostAcc[i] == expected); - } - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - HostAcc[i] += 10; - } - } - - Q.submit([&](sycl::handler &CGH) { - CGH.parallel_for(Range, [=](sycl::item<1> itemID) { - size_t i = itemID.get_id(0); - if (Harray[i] == (i + 10)) - Harray[i] += 100; - }); - }); - - Q.submit([&](sycl::handler &CGH) { - // waiting for all queue operations in urEnqueueMemUnmap and then - // using buffer - auto Acc = Buf.get_access(CGH); - CGH.parallel_for(Range, [=](sycl::item<1> itemID) { - size_t i = itemID.get_id(0); - if (Acc[i] == (i + 10)) - if (Harray[i] == (i + 110)) { - Harray[i] += 1000; - Acc[i] += 100; - } - }); - }); - Q.wait(); - - // check results - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - int expected = i + 1110; - assert(Harray[i] == expected); - } - { - sycl::host_accessor HostAcc(Buf, sycl::read_only); - for (size_t i = 0; i < BUFFER_SIZE; ++i) { - int expected = i + 110; - assert(HostAcc[i] == expected); - } - } - }); -} - -int main(int Argc, const char *Argv[]) { - assert(Argc == 2 && "Invalid number of arguments"); - std::string TestType(Argv[1]); - - sycl::property_list props{ - sycl::property::queue::in_order{}, - sycl::ext::oneapi::property::queue::discard_events{}}; - sycl::queue Q(props); - - if (TestType == "accessor-usm") { - std::cerr << "RunTest_Accessor_USM" << std::endl; - RunTest_Accessor_USM(Q); - } else if (TestType == "usm-accessor") { - std::cerr << "RunTest_USM_Accessor" << std::endl; - RunTest_USM_Accessor(Q); - } else if (TestType == "mixed") { - std::cerr << "RunTest_Mixed" << std::endl; - RunTest_Mixed(Q); - } else if (TestType == "map-unmap") { - std::cerr << "RunTest_MemBufferMapUnMap" << std::endl; - RunTest_MemBufferMapUnMap(Q); - } else { - assert(0 && "Unsupported test type!"); - } - - std::cout << "The test passed." << std::endl; - return 0; -} diff --git a/sycl/test-e2e/DiscardEvents/discard_events_using_assert_ndebug.cpp b/sycl/test-e2e/DiscardEvents/discard_events_using_assert_ndebug.cpp deleted file mode 100644 index cdfbbe1386ed5..0000000000000 --- a/sycl/test-e2e/DiscardEvents/discard_events_using_assert_ndebug.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: %{build} -DNDEBUG -o %t.out -// -// RUN: env SYCL_UR_TRACE=2 %{run} %t.out &> %t.txt ; FileCheck %s --input-file %t.txt -// -// The test checks that the last parameter is `nullptr` for -// urEnqueueKernelLaunch. -// -// CHECK: <--- urEnqueueKernelLaunch -// CHECK: .phEvent = nullptr -// -// CHECK: The test passed. - -#include "discard_events_kernel_using_assert.hpp" diff --git a/sycl/test-e2e/DiscardEvents/discard_events_usm.cpp b/sycl/test-e2e/DiscardEvents/discard_events_usm.cpp deleted file mode 100644 index 8c446fee88365..0000000000000 --- a/sycl/test-e2e/DiscardEvents/discard_events_usm.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// RUN: %{build} -o %t.out -// -// On level_zero Q.fill uses urEnqueueKernelLaunch and not urEnqueueUSMFill -// due to https://github.com/intel/llvm/issues/13787 -// -// RUN: env SYCL_UR_TRACE=2 %{run} %t.out &> %t.txt ; FileCheck %s --input-file %t.txt --check-prefixes=CHECK%if level_zero %{,CHECK-L0%} %else %{,CHECK-OTHER%} -// -// REQUIRES: aspect-usm_shared_allocations -// The test checks that the last parameter is `nullptr` for all UR calls that -// should discard events. -// {{0|0000000000000000}} is required for various output on Linux and Windows. -// NOTE: urEnqueueUSMPrefetch and urEnqueueUSMAdvise in the CUDA and -// HIP backends may return a warning result on Windows with error-code -// 66 (UR_RESULT_ERROR_ADAPTER_SPECIFIC) if USM managed memory is not -// supported or if unsupported advice flags are used for the latter API. -// Since it is a warning it is safe to ignore for this test. -// -// Everything that follows TestQueueOperations() -// CHECK: <--- urEnqueueUSMFill -// CHECK: .phEvent = nullptr -// -// CHECK: <--- urEnqueueUSMMemcpy -// CHECK: .phEvent = nullptr -// -// Level-zero backend doesn't use urEnqueueUSMFill -// CHECK-L0: <--- urEnqueueKernelLaunch -// CHECK-L0: .phEvent = nullptr -// CHECK-OTHER: <--- urEnqueueUSMFill({{.*}} .phEvent = nullptr -// -// ---> urEnqueueUSMMemcpy( -// CHECK: <--- urEnqueueUSMMemcpy -// CHECK: .phEvent = nullptr -// -// CHECK: <--- urEnqueueUSMPrefetch -// CHECK: .phEvent = nullptr -// -// CHECK: <--- urEnqueueUSMAdvise -// CHECK: .phEvent = nullptr -// CHECK: -> {{UR_RESULT_SUCCESS|UR_RESULT_ERROR_ADAPTER_SPECIFIC}} -// -// CHECK: <--- urEnqueueKernelLaunch -// CHECK: .phEvent = nullptr -// -// CHECK: <--- urEnqueueKernelLaunch -// CHECK: .phEvent = nullptr -// -// RegularQueue -// CHECK-NOT: <--- urEnqueueUSMFill({{.*}} .phEvent = nullptr -// CHECK: <--- urEnqueueUSMFill -// CHECK: -> UR_RESULT_SUCCESS -// -// CHECK: <--- urEnqueueEventsWait -// CHECK: .phEvent = nullptr -// -// Everything that follows TestQueueOperationsViaSubmit() -// CHECK: <--- urEnqueueUSMFill -// CHECK: .phEvent = nullptr -// -// CHECK: <--- urEnqueueUSMMemcpy -// CHECK: .phEvent = nullptr -// -// Level-zero backend doesn't use urEnqueueUSMFill -// CHECK-L0: <--- urEnqueueKernelLaunch -// CHECK-L0: .phEvent = nullptr -// CHECK-OTHER: <--- urEnqueueUSMFill({{.*}} .phEvent = nullptr -// -// ---> urEnqueueUSMMemcpy( -// CHECK: <--- urEnqueueUSMMemcpy -// CHECK: .phEvent = nullptr -// -// CHECK: <--- urEnqueueUSMPrefetch -// CHECK: .phEvent = nullptr -// -// CHECK: <--- urEnqueueUSMAdvise -// CHECK: .phEvent = nullptr -// CHECK-SAME: ) -> {{UR_RESULT_SUCCESS|UR_RESULT_ERROR_ADAPTER_SPECIFIC}} -// -// CHECK: <--- urEnqueueKernelLaunch -// CHECK: .phEvent = nullptr -// -// CHECK: <--- urEnqueueKernelLaunch -// CHECK: .phEvent = nullptr -// -// RegularQueue -// CHECK-NOT: <--- urEnqueueUSMFill({{.*}} .phEvent = nullptr -// CHECK: <--- urEnqueueUSMFill -// CHECK: -> UR_RESULT_SUCCESS -// -// CHECK: <--- urEnqueueEventsWait -// CHECK: .phEvent = nullptr -// -// CHECK: The test passed. - -#include "discard_events_test_queue_ops.hpp" -#include -int main(int Argc, const char *Argv[]) { - - sycl::property_list Props{ - sycl::property::queue::in_order{}, - sycl::ext::oneapi::property::queue::discard_events{}}; - sycl::queue Q(Props); - - TestQueueOperations(Q); - - TestQueueOperationsViaSubmit(Q); - - std::cout << "The test passed." << std::endl; - return 0; -} diff --git a/sycl/test-e2e/DiscardEvents/invalid_event.cpp b/sycl/test-e2e/DiscardEvents/invalid_event.cpp deleted file mode 100644 index 4badd247767a8..0000000000000 --- a/sycl/test-e2e/DiscardEvents/invalid_event.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// RUN: %{build} -o %t.out -// RUN: %{run} %t.out - -// The test checks that each queue method call returns a discarded event -// with the status "ext_oneapi_unknown" - -#include -#include -#include -#include -#include - -using namespace sycl; -static constexpr size_t BUFFER_SIZE = 16; - -void QueueAPIsReturnDiscardedEvent(sycl::queue Q) { - sycl::range<1> range(BUFFER_SIZE); - - auto Dev = Q.get_device(); - int *x = sycl::malloc_device(BUFFER_SIZE, Q); - assert(x != nullptr); - int *y = sycl::malloc_device(BUFFER_SIZE, Q); - assert(y != nullptr); - - sycl::event DiscardedEvent; - - DiscardedEvent = Q.memset(x, 0, BUFFER_SIZE * sizeof(int)); - assert( - DiscardedEvent.get_info() == - sycl::info::event_command_status::ext_oneapi_unknown); - - DiscardedEvent = Q.memcpy(y, x, BUFFER_SIZE * sizeof(int)); - assert( - DiscardedEvent.get_info() == - sycl::info::event_command_status::ext_oneapi_unknown); - - DiscardedEvent = Q.fill(y, 1, BUFFER_SIZE); - assert( - DiscardedEvent.get_info() == - sycl::info::event_command_status::ext_oneapi_unknown); - - DiscardedEvent = Q.copy(y, x, BUFFER_SIZE); - assert( - DiscardedEvent.get_info() == - sycl::info::event_command_status::ext_oneapi_unknown); - - DiscardedEvent = Q.prefetch(y, BUFFER_SIZE * sizeof(int)); - assert( - DiscardedEvent.get_info() == - sycl::info::event_command_status::ext_oneapi_unknown); - - DiscardedEvent = Q.mem_advise(y, BUFFER_SIZE * sizeof(int), 0); - assert( - DiscardedEvent.get_info() == - sycl::info::event_command_status::ext_oneapi_unknown); - - DiscardedEvent = Q.single_task([=] {}); - assert( - DiscardedEvent.get_info() == - sycl::info::event_command_status::ext_oneapi_unknown); - - DiscardedEvent = Q.submit([&](sycl::handler &CGH) { - CGH.parallel_for(range, [=](sycl::item<1> itemID) {}); - }); - assert( - DiscardedEvent.get_info() == - sycl::info::event_command_status::ext_oneapi_unknown); - - DiscardedEvent = Q.ext_oneapi_submit_barrier(); - assert( - DiscardedEvent.get_info() == - sycl::info::event_command_status::ext_oneapi_unknown); - - Q.wait(); - free(x, Q); - free(y, Q); -} - -int main(int Argc, const char *Argv[]) { - sycl::property_list Props1{ - sycl::ext::oneapi::property::queue::discard_events{}}; - sycl::queue OOO_Queue(Props1); - QueueAPIsReturnDiscardedEvent(OOO_Queue); - - sycl::property_list Props2{ - sycl::property::queue::in_order{}, - sycl::ext::oneapi::property::queue::discard_events{}}; - sycl::queue Inorder_Queue(Props2); - QueueAPIsReturnDiscardedEvent(Inorder_Queue); - - std::cout << "The test passed." << std::endl; - return 0; -} diff --git a/sycl/test-e2e/DiscardEvents/invalid_event_exceptions.cpp b/sycl/test-e2e/DiscardEvents/invalid_event_exceptions.cpp deleted file mode 100644 index 6da5b087474a9..0000000000000 --- a/sycl/test-e2e/DiscardEvents/invalid_event_exceptions.cpp +++ /dev/null @@ -1,168 +0,0 @@ -// RUN: %{build} -o %t.out -// -// RUN: %{run} %t.out -// -// The test checks 3 things: -// 1. An attempt to construct a queue with both properties(discard_events and -// enable_profiling) throws an exception. -// 2. Checks the APIs for discarded event that should throw an exception that -// they do it. -// 3. An attempt to pass discarded event into depends_on throws an exception. - -#include -#include -#include -#include - -using namespace sycl; - -void DiscardedEventWaitExceptionHelper( - const std::function &FunctionToTry) { - try { - FunctionToTry(); - assert(false && "No exception was thrown."); - } catch (const sycl::exception &e) { - assert(e.code().value() == static_cast(sycl::errc::invalid) && - "sycl::exception code was not the expected sycl::errc::invalid."); - } catch (...) { - assert(false && - "Unexpected exception was thrown in kernel invocation function."); - } -} - -void DependsOnDiscardedEventException(sycl::queue Q) { - auto DiscardedEvent = - Q.submit([&](sycl::handler &CGH) { CGH.single_task([] {}); }); - - Q.submit([&](sycl::handler &CGH) { - try { - CGH.depends_on(DiscardedEvent); - assert(false && "No exception was thrown."); - } catch (const sycl::exception &e) { - assert(e.code().value() == static_cast(sycl::errc::invalid) && - "sycl::exception code was not the expected sycl::errc::invalid."); - } catch (...) { - assert(false && - "Unexpected exception was thrown in kernel invocation function."); - } - CGH.single_task([] {}); - }); - - sycl::event e1, e2; - Q.submit([&](sycl::handler &CGH) { - try { - CGH.depends_on({e1, DiscardedEvent, e2}); - assert(false && "No exception was thrown."); - } catch (const sycl::exception &e) { - assert(e.code().value() == static_cast(sycl::errc::invalid) && - "sycl::exception code was not the expected sycl::errc::invalid."); - } catch (...) { - assert(false && - "Unexpected exception was thrown in kernel invocation function."); - } - CGH.single_task([] {}); - }); - - sycl::queue RegularQ; - RegularQ.submit([&](sycl::handler &CGH) { - try { - CGH.depends_on(DiscardedEvent); - assert(false && "No exception was thrown."); - } catch (const sycl::exception &e) { - assert(e.code().value() == static_cast(sycl::errc::invalid) && - "sycl::exception code was not the expected sycl::errc::invalid."); - } catch (...) { - assert(false && - "Unexpected exception was thrown in kernel invocation function."); - } - CGH.single_task([] {}); - }); - - RegularQ.submit([&](sycl::handler &CGH) { - try { - CGH.depends_on({e1, DiscardedEvent, e2}); - assert(false && "No exception was thrown."); - } catch (const sycl::exception &e) { - assert(e.code().value() == static_cast(sycl::errc::invalid) && - "sycl::exception code was not the expected sycl::errc::invalid."); - } catch (...) { - assert(false && - "Unexpected exception was thrown in kernel invocation function."); - } - CGH.single_task([] {}); - }); -} - -void CheckDiscardedEventAPIException(sycl::queue Q) { - DiscardedEventWaitExceptionHelper([&]() { - auto DiscardedEvent = - Q.submit([&](sycl::handler &CGH) { CGH.single_task([] {}); }); - DiscardedEvent.wait(); - }); - - DiscardedEventWaitExceptionHelper([&]() { - auto DiscardedEvent = - Q.submit([&](sycl::handler &CGH) { CGH.single_task([] {}); }); - sycl::event::wait({DiscardedEvent}); - }); - - DiscardedEventWaitExceptionHelper([&]() { - auto DiscardedEvent = - Q.submit([&](sycl::handler &CGH) { CGH.single_task([] {}); }); - DiscardedEvent.wait_and_throw(); - }); - - DiscardedEventWaitExceptionHelper([&]() { - auto DiscardedEvent = - Q.submit([&](sycl::handler &CGH) { CGH.single_task([] {}); }); - sycl::event::wait_and_throw({DiscardedEvent}); - }); - - DiscardedEventWaitExceptionHelper([&]() { - auto DiscardedEvent = - Q.submit([&](sycl::handler &CGH) { CGH.single_task([] {}); }); - DiscardedEvent.get_wait_list(); - }); -} - -void CreatingEnableProfilingQueueException(sycl::property_list Props) { - try { - sycl::queue Q{Props}; - assert(false && "No exception was thrown."); - } catch (const sycl::exception &e) { - assert(e.code().value() == static_cast(sycl::errc::invalid) && - "sycl::exception code was not the expected sycl::errc::invalid."); - } catch (...) { - assert(false && - "Unexpected exception was thrown in kernel invocation function."); - } -} - -int main(int Argc, const char *Argv[]) { - sycl::property_list Props1{ - sycl::property::queue::enable_profiling{}, - sycl::ext::oneapi::property::queue::discard_events{}}; - CreatingEnableProfilingQueueException(Props1); - - sycl::property_list Props2{ - sycl::ext::oneapi::property::queue::discard_events{}}; - sycl::queue OOO_Queue(Props2); - DependsOnDiscardedEventException(OOO_Queue); - CheckDiscardedEventAPIException(OOO_Queue); - - sycl::property_list Props3{ - sycl::property::queue::in_order{}, - sycl::property::queue::enable_profiling{}, - sycl::ext::oneapi::property::queue::discard_events{}}; - CreatingEnableProfilingQueueException(Props3); - - sycl::property_list Props4{ - sycl::property::queue::in_order{}, - sycl::ext::oneapi::property::queue::discard_events{}}; - sycl::queue Inorder_Queue(Props4); - DependsOnDiscardedEventException(Inorder_Queue); - CheckDiscardedEventAPIException(Inorder_Queue); - - std::cout << "The test passed." << std::endl; - return 0; -} diff --git a/sycl/test/e2e_test_requirements/no-unsupported-without-info.cpp b/sycl/test/e2e_test_requirements/no-unsupported-without-info.cpp index 1bb41b1981349..854402105bf9a 100644 --- a/sycl/test/e2e_test_requirements/no-unsupported-without-info.cpp +++ b/sycl/test/e2e_test_requirements/no-unsupported-without-info.cpp @@ -54,7 +54,7 @@ // tests to match the required format and in that case you should just update // (i.e. reduce) the number and the list below. // -// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 258 +// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 257 // // List of improperly UNSUPPORTED tests. // Remove the CHECK once the test has been properly UNSUPPORTED. @@ -91,6 +91,7 @@ // CHECK-NEXT: Basic/image/image_accessor_range.cpp // CHECK-NEXT: Basic/kernel_info_attr.cpp // CHECK-NEXT: Basic/submit_time.cpp +// CHECK-NEXT: DeprecatedFeatures/DiscardEvents/discard_events_using_assert.cpp // CHECK-NEXT: DeviceImageDependencies/dynamic.cpp // CHECK-NEXT: DeviceImageDependencies/math_device_lib.cpp // CHECK-NEXT: DeviceImageDependencies/objects.cpp @@ -118,8 +119,6 @@ // CHECK-NEXT: DeviceLib/separate_compile_test.cpp // CHECK-NEXT: DeviceLib/std_complex_math_fp64_test.cpp // CHECK-NEXT: DeviceLib/std_complex_math_test.cpp -// CHECK-NEXT: DiscardEvents/discard_events_check_images.cpp -// CHECK-NEXT: DiscardEvents/discard_events_using_assert.cpp // CHECK-NEXT: ESIMD/PerformanceTests/BitonicSortK.cpp // CHECK-NEXT: ESIMD/PerformanceTests/BitonicSortKv2.cpp // CHECK-NEXT: ESIMD/PerformanceTests/Stencil.cpp diff --git a/sycl/test/warnings/warnings_deprecated.cpp b/sycl/test/warnings/warnings_deprecated.cpp index 6fc3e220bc0e3..3dbf0d96ccfc3 100644 --- a/sycl/test/warnings/warnings_deprecated.cpp +++ b/sycl/test/warnings/warnings_deprecated.cpp @@ -7,5 +7,9 @@ int main() { // expected-warning@+1{{'atomic64' is deprecated: use sycl::aspect::atomic64 instead}} sycl::info::device::atomic64 atomic_64; (void)atomic_64; + + // expected-warning@+2{{'discard_events' is deprecated: use sycl_ext_oneapi_enqueue_functions instead}} + sycl::property_list props{ + sycl::ext::oneapi::property::queue::discard_events{}}; return 0; }