Skip to content
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

[oneDPL] Added "in order" queue support #1260

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MikeDvorskiy
Copy link
Contributor

@MikeDvorskiy MikeDvorskiy commented Nov 2, 2023

[oneDPL] Added "in order" queue support.

We introduce __dpl_sycl::__event and __dpl_sycl::sumbit(..) wrappers.

  1. For out_of_order queue the mentioned wrappers work as sycl::event and sycl::queue::submit, set sycl dependencies and return sycl event.
  2. For in_order queue __dpl_sycl::sumbit doesn't set sycl dependencies and dosn't return sycl event. To provide a sync oneDPL call __dpl_sycl::__event calls sycl::queue::wait.


public:
__event(sycl::event __e): __m_event(__e) {}
__event() {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__event() = default;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's a advantages of that in given case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@MikeDvorskiy MikeDvorskiy Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"doesn't change triviality state of class." - yes...
But, do we really need it? or it can be useful in the Future? I'm just asking...
BTW, the same details in English: https://stackoverflow.com/questions/20828907/the-new-syntax-default-in-c11

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This general idea look like as applied in all cases.

@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/in_order_queue_support branch 2 times, most recently from d58f8d6 to 9099000 Compare November 3, 2023 14:18
Comment on lines +603 to +606
//#if !ONEDPL_ALLOW_DEFERRED_WAITING
//__my_event.wait_and_throw();
//#endif
__my_event.wait();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional? If so, what has changed here and why keep the old commented code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes... (I forgot remove the old code)

__m_event.wait_and_throw();
}

bool has_event() const { return !__in_order; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a problem if the default constructor was called to create this __event? __in_order is false, but only a default constructed event exists.

I suppose in the way it is used currently, this isnt a problem. However, the naming of this function may be misleading. Maybe we would just be better off to assert(!__in_order); directly in the conversion function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I've redesigned that code a little bit.

#if _ONEDPL_COMPILE_KERNEL
, typename _Kernel
#endif
>
sycl::event
auto
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may be better for code maintainability to use __dpl_sycl::__event as the return type rather than auto. (same for other similar functions in thie PR)

For the declarations, I don't mind the use of auto, but for returns of large functions, this seems like unnecessary obfuscation when the type is known and has a simple name.

}

bool has_event() const { return !__in_order; }
operator sycl::event() const
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be safer to make this an explicit function call like get_sycl_event() rather than a conversion function?

I'm worried we might get ourselves into a bit of trouble with a conversion function since this is not always interchangeable with a sycl::event (as evidenced by the assert).

Is this only used in the __future implementation within this PR currently?

@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/in_order_queue_support branch 3 times, most recently from ac4e89c to f1b733d Compare November 7, 2023 15:50
…encies as __dpl_sycl::__event or sycl::event or std:vector<sycl::event>
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/in_order_queue_support branch from f1b733d to d39c402 Compare November 7, 2023 17:01
@MikeDvorskiy MikeDvorskiy marked this pull request as draft November 8, 2023 14:36
auto
__submit(sycl::queue __queue, _Body __body)
{
return __submit_impl(__queue, __body, true, NULL, NULL);
Copy link
Contributor

@SergeyKopienko SergeyKopienko Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to use nullptr keyword here and below.

@akukanov akukanov added the follow through PRs/issues that should be completed/resolved label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
follow through PRs/issues that should be completed/resolved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants