Skip to content

Clarify "event::get_wait_list" for in-order queues #1017

Description

@gmlueck

Specification Version

SYCL 2020 (Revision 11)

Section Number(s)

Section 4.6.6. "Event class"

Issue Description

What do we expect event::get_wait_list to return for an event the comes from a command on an in-order queue? Consider the following code snippet:

queue q{property::queue::in_order{});
event e1 = q.single_task([=]{});
event e2 = q.single_task([=]{});
std::vector<event> evts = e2.get_wait_list();

Do we expect evts to contain e1? The description of get_wait_list says:

Only direct dependencies are returned

However, it's not clear what a "direct dependency" is. There is no explicit event dependency created here. Instead, the dependency is implicit because the queue is in-order.

Once we finish the KHR proposed in #922, users will be able to write code like this:

queue q{property::queue::in_order{});
khr::launch_task(q, [=]{});
event e2 = q.single_task([=]{});
std::vector<event> evts = e2.get_wait_list();

Now, it's even less clear. Do we expect the implementation to synthesize an event that corresponds to the first call to launch_task and then return that event in evts? This would be very hard to do efficiently because the purpose of launch_task is to allow the implementation to optimize the submit path by not creating an event.

In fact, both cases above are hard for DPC++ to do efficiently because of the way we optimize event management for in-order queues. Even this case would require some extra work in our implementation:

queue q{property::queue::in_order{});
event e1 = q.single_task([=]{});
event e2 = q.single_task(e1, [=]{});   // Redundantly list "e1" as a dependency even though queue is in-order
std::vector<event> evts = e2.get_wait_list();

Would we expect evts to contain e1 in this case? If so, we will need to do some extra bookkeeping just to return e1 in this silly case.

From our perspective, it would be ideal to define get_wait_list such that it can return an empty list in all three of the cases I list above.

It's not clear to me what use case is solved by having get_wait_list at all. Do we know if anyone is using it? If so, what are they using it for?

Code Example (Optional)

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions