Skip to content

Added submit_keep_args_alive - #1395

Merged
oleksandr-pavlyk merged 13 commits into
masterfrom
async-ref-count-increment
Oct 24, 2023
Merged

Added submit_keep_args_alive#1395
oleksandr-pavlyk merged 13 commits into
masterfrom
async-ref-count-increment

Conversation

@oleksandr-pavlyk

@oleksandr-pavlykoleksandr-pavlyk commented Sep 7, 2023

Copy link
Copy Markdown
Contributor

Added dpctl.SyclQueue._submit_keep_args_alive(args, events) that increments reference count of args object (typically a sequence of arguments an asynchronous task is operating on), ensuring that args object is not garbage collected until after events signal that tasks working on these objects complete their execution.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • If this PR is a work in progress, are you opening the PR as a draft?

@oleksandr-pavlyk
oleksandr-pavlykforce-pushed the async-ref-count-increment branch 2 times, most recently from 3a92246 to 19b628eCompareSeptember 15, 2023 20:40
@github-actions

Copy link
Copy Markdown

@coveralls

coveralls commented Sep 15, 2023

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 85.763% (+0.06%) from 85.701% when pulling 10722d4 on async-ref-count-increment into 1d57614 on master.

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.14.6dev5=py310ha25a700_9 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.14.6dev5=py310ha25a700_10 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.14.6dev5=py310ha25a700_12 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.14.6dev5=py310ha25a700_13 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.14.6dev5=py310ha25a700_15 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.14.6dev5=py310ha25a700_16 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.0rc1=py310ha25a700_14 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@oleksandr-pavlyk
oleksandr-pavlykforce-pushed the async-ref-count-increment branch 2 times, most recently from 4c8ae59 to bb473daCompareSeptember 22, 2023 02:07
@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.0rc1=py310ha25a700_30 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@oleksandr-pavlyk
oleksandr-pavlyk marked this pull request as ready for review September 22, 2023 22:35
@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.0rc2=py310ha25a700_17 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.0rc2=py310ha25a700_24 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.0rc2=py310ha25a700_25 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.0rc3=py310ha25a700_13 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@oleksandr-pavlyk
oleksandr-pavlykforce-pushed the async-ref-count-increment branch from 7f79887 to e303eaaCompareOctober 5, 2023 20:54
oleksandr-pavlyk added a commit to oleksandr-pavlyk/async-pipelining-example that referenced this pull request Oct 5, 2023
This is an adaptation of pipelining technique shared by @mbecker
in https://github.com/IntelPython/numbda_dpex/issues/147
This is built to work with async-ref-count-increment branch
IntelPython/dpctl#1395 which implements
asynchronous memcpy, asynchronous submit and asynchronous
keep_arg_alve task submission.
@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_16 ran successfully.
Passed: 935
Failed: 65
Skipped: 119

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_17 ran successfully.
Passed: 935
Failed: 65
Skipped: 119

@oleksandr-pavlyk
oleksandr-pavlykforce-pushed the async-ref-count-increment branch from f822827 to ed67ac8CompareOctober 6, 2023 01:51
@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_18 ran successfully.
Passed: 935
Failed: 65
Skipped: 119

@oleksandr-pavlyk
oleksandr-pavlykforce-pushed the async-ref-count-increment branch from ed67ac8 to 802ead7CompareOctober 6, 2023 16:22
@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_19 ran successfully.
Passed: 935
Failed: 65
Skipped: 119

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_44 ran successfully.
Passed: 935
Failed: 65
Skipped: 119

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_53 ran successfully.
Passed: 935
Failed: 65
Skipped: 119

Usage:
q = dpctl.SyclQueue()
...
e = q.submit(krn, args, ranges)
ht_e = q._submit_keep_args_alive(args, [e])
....
ht_e.wait()
Instead delegated the task of Python object life-time management
to the user via use of _submit_keep_args_alive method
The SyclQueue.submit has become synchronosing, although
it still returns a SyclEvent (with exectuion_status always complete)
This is the copy operation where one can specify list of events the
copy operation requires before start of its execution.
DPCTLQueue_MemcpyWithEvents(
__dpctl_keep DPCTLSyclQueueRef QRef,
void *dst,
const void *src,
size_t nbytes,
const DPCTLSyclEventRef *depEvents,
size_t nDE
)
Uses this function in tests.
Also extends `dpctl.SyclQueue.memcpy` to allow arguments to be objects
that expose buffer protocol, allowing `dpctl.SyclQueue.memcpy` and
`dpctl.SyclQueue.memcpy_async` to be used to copy from/to USM-allocation
or host buffer.
```
In [9]: timer = dpctl.SyclTimer()
In [10]: with timer(q):
...: y = dpt.linspace(1, 2, num=10**6, sycl_queue=q)
...:
In [11]: timer.dt
Out[11]: (0.0022024469999450957, 0.002116712)
In [12]: with timer(q):
...: x = dpt.linspace(0, 1, num=10**6, sycl_queue=q)
...:
In [13]: timer.dt
Out[13]: (0.004531950999989931, 0.004239664000000001)
```
The object can unpack into a tuple, like before, but it prints
with annotation of what each number means, and provides names
getters.
with timer(q):
code
dur = timer.dt
print(dur) # outputs (host_dt=..., device_dt=...)
dur.host_dt # get host-timer delta
dur.device_dt # get device-timer delta
hdt, ddt = dur # unpack into a tuple
@oleksandr-pavlyk

Copy link
Copy Markdown
ContributorAuthor

I tested numba_dpex test suite with dpctl from this PR, and all tests passed.

@github-actions

Copy link
Copy Markdown

Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_56 ran successfully.
Passed: 935
Failed: 65
Skipped: 119

@oleksandr-pavlyk
oleksandr-pavlyk merged commit 26b9c92 into masterOct 24, 2023
@oleksandr-pavlyk
oleksandr-pavlyk deleted the async-ref-count-increment branch October 24, 2023 00:16
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@oleksandr-pavlyk@coveralls