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

Redesign SyclEvent class #391

Closed
9 tasks done
oleksandr-pavlyk opened this issue Apr 16, 2021 · 1 comment
Closed
9 tasks done

Redesign SyclEvent class #391

oleksandr-pavlyk opened this issue Apr 16, 2021 · 1 comment
Assignees

Comments

@oleksandr-pavlyk
Copy link
Contributor

oleksandr-pavlyk commented Apr 16, 2021

dpctl.SyclEvent needs to closely follow SYCL interface.

C-API changes needed

  • In C-API we need DPCTLEvent_Copy.

  • We should either use e.wait_and_throw() in DPCTLEvent_Wait, or introduce DPCTLEvent_WaitAndThrow(ERef).

  • Since sycl::event is a associated with a SYCL backend, we should support DPCTLEvent_GetBackend(ERef).

  • sycl::event::get_wait_list() returning a vector of events, should be exposed via DPCTLEvent_GetWaitList(ERef).

  • sycl::event::get_info<sycl::info::event::command_execution_status>() returning an enum class event_command_status : int { submitted, running, complete} should be exposed via DPCTLEvent_GetCommandExecutionStatus(ERef).

  • sycl::event::get_profiling_info<sycl::info::event_profiling::command_submit>(), sycl::event::get_profiling_info<sycl::info::event_profiling::command_start>() and sycl::event::get_profiling_info<sycl::info::event_profiling::command_end>() returning uint64_t value of device timer corresponding to the logged time of referenced operations. These are blocking operations (i.e. wait on the event), and throw sycl::invalid_object_code if the queue that created the event did not have profiling enabled.

Python API changes needed

  • dpctl.SyclEvent() should create object corresponding to sycl::event().
  • dpctl.SyclEvent( _SyclEvent ) should copy event from _SyclEvent like other constructors do. _SyclEvent is the helper data owner responsible for calling DPCTLEvent_Delete. Do not think __dealloc__ needs to call DPCTLEvent_Wait().
  • dpctl.SyclEvent( event_capsule ) where event_capsule is named "SyclEventRef" and stores pointer to sycl::event object should create a dpctl.SyclEvent carrying a copy of that sycl::event object.
  • dpctl.SyclEvent.execution_status should return either an enum, or a string
  • dpctl.SyclEvent.profiled_info.submit, dpctl.SyclEvent.profiled_info.start, dpctl.SyclEvent.profiled_info.end would return profiling data.
  • dpctl.SyclEvent.get_backend() should return backend enum.
  • I think dpctl.SyclEvent.wait() should call e.wait_and_throw().
  • dpctl.SyclEvent.wait_list() should return a list of dpctl.SyclEvent instances
  • Static method dpctl.SyclEvent.wait( event or a list of events ) should be implement for synchronously wait_and_throw on the given event or list of events.

N.B.: The functionality to combine multiple events into a single event perhaps belongs to dpctl.SyclQueue, where it would submit an empty single_task, and use depends_on the given list of events.

@vlad-perevezentsev vlad-perevezentsev self-assigned this Aug 4, 2021
@oleksandr-pavlyk
Copy link
Contributor Author

In Python one can not have static method wait alongside a regular wait method.

Therefore the static one is called wait_for(events).

Profiling info is queried using event.profiling_info_submit, etc.

Other than noted discrepancies, all of this was implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants