-
Notifications
You must be signed in to change notification settings - Fork 791
[SYCL] Don't return last event in ext_oneapi_submit_barrier
#20159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e108e6c
3e3507a
9620fff
eddffb3
0060d9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,28 +53,13 @@ int main() { | |
| std::cout << "Test 2" << std::endl; | ||
| *Res = 0; | ||
|
|
||
| auto Event1 = Q.submit( | ||
| [&](sycl::handler &CGH) { CGH.host_task([&] { *Res += 1; }); }); | ||
| auto BarrierEvent1 = Q.ext_oneapi_submit_barrier(); | ||
| assert(checkBarrierEvent(Q.get_backend(), Event1, BarrierEvent1, | ||
| false /* host tasks used */)); | ||
| auto Event2 = Q.submit([&](sycl::handler &CGH) { CGH.fill(Res, 10, 1); }); | ||
| Q.submit([&](sycl::handler &CGH) { CGH.host_task([&] { *Res += 1; }); }); | ||
| Q.ext_oneapi_submit_barrier(); | ||
| Q.submit([&](sycl::handler &CGH) { CGH.fill(Res, 10, 1); }); | ||
|
|
||
| Q.wait(); | ||
| assert(*Res == 10); | ||
| } | ||
|
|
||
| { | ||
| // Test cast 3 - empty queue. | ||
| std::cout << "Test 3" << std::endl; | ||
| sycl::queue EmptyQ({sycl::property::queue::in_order{}}); | ||
| auto BarrierEvent = EmptyQ.ext_oneapi_submit_barrier(); | ||
| assert( | ||
| BarrierEvent.get_info<sycl::info::event::command_execution_status>() == | ||
| sycl::info::event_command_status::complete); | ||
| BarrierEvent.wait(); | ||
| } | ||
|
Comment on lines
-67
to
-76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this test removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AlexeySachkov Here's my line of reasoning: |
||
|
|
||
| { | ||
| // Test cast 4 - graph. | ||
| sycl::queue GQueue{sycl::property::queue::in_order{}}; | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| //==------------------- ExtOneapiBarrierOpt.cpp ----------------------------==// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include <gtest/gtest.h> | ||
| #include <helpers/ScopedEnvVar.hpp> | ||
| #include <helpers/UrMock.hpp> | ||
| #include <sycl/sycl.hpp> | ||
|
|
||
| using namespace sycl; | ||
|
|
||
| inline thread_local uint32_t NumEventsInWaitList; | ||
|
|
||
| static ur_result_t redefinedEnqueueEventsWaitWithBarrierExt(void *pParams) { | ||
| auto params = | ||
| *static_cast<ur_enqueue_events_wait_with_barrier_ext_params_t *>(pParams); | ||
| NumEventsInWaitList = *(params.pnumEventsInWaitList); | ||
| return UR_RESULT_SUCCESS; | ||
| } | ||
|
|
||
| class ExtOneapiBarrierOptTest : public ::testing::Test { | ||
| public: | ||
| ExtOneapiBarrierOptTest() : Mock{} {} | ||
|
|
||
| protected: | ||
| void SetUp() override { NumEventsInWaitList = 0; } | ||
|
|
||
| protected: | ||
| sycl::unittest::UrMock<> Mock; | ||
| }; | ||
|
|
||
| // Check that ext_oneapi_submit_barrier works fine in the scenarios | ||
| // when provided waitlist consists of only empty events. | ||
| // Tets for https://github.com/intel/llvm/pull/12951 | ||
| TEST(ExtOneapiBarrierOptTest, EmptyEventTest) { | ||
| sycl::queue q1{{sycl::property::queue::in_order()}}; | ||
|
|
||
| mock::getCallbacks().set_after_callback( | ||
| "urEnqueueEventsWaitWithBarrierExt", | ||
| &redefinedEnqueueEventsWaitWithBarrierExt); | ||
|
|
||
| NumEventsInWaitList = 100; | ||
| q1.ext_oneapi_submit_barrier(); | ||
| ASSERT_EQ(0u, NumEventsInWaitList); | ||
|
|
||
| // ext_oneapi_submit_barrier should ignore empty, default constructed events. | ||
| sycl::event E1{}; | ||
| NumEventsInWaitList = 100; | ||
| q1.ext_oneapi_submit_barrier({E1}); | ||
| ASSERT_EQ(0u, NumEventsInWaitList); | ||
|
|
||
| sycl::event E2{}; | ||
| NumEventsInWaitList = 100; | ||
| q1.ext_oneapi_submit_barrier({E1, E2}); | ||
| ASSERT_EQ(0u, NumEventsInWaitList); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xtian-github @gmlueck I'd need approval for excluding
InorderQueue/in_order_ext_oneapi_submit_barrier.cppfrom 6.3 ABI compatibility testing. This test checks whether last event is returned byext_oneapi_submit_barrier()but after this PR, we no longer return last event. Returning last event is not required byext_oneapi_submit_barrierspec, so it is not strictly an ABI break.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is OK, but just checking to make sure I understand ... The spec for
queue::ext_oneapi_submit_barrierdoes require that function to return anevent. However, the test was checking to see if the returned event was the last event (i.e. the event that was returned from the previous submit). This is an implementation detail, not part of the specified API. Therefore, the test being excluded is not really testing the API; it's testing the implementation. Since the implementation changed, we need to change the test also.Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for confirming. I approved.