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

Ensure D2H copies are stream ordered and by default blocking #7938

Merged
merged 3 commits into from
Oct 18, 2023

Conversation

leofang
Copy link
Member

@leofang leofang commented Oct 16, 2023

Close #7820.

As discussed in the linked issue, this PR adds a new, optional argument blocking to control the copy behavior, and make it default to True to avoid data race. A test that can easily expose the data race is added.

Note that during the discussion, it was proposed to name the new argument as async. However, async is a reserved Python keyword (for coroutines), so I changed it to blocking, but I am happy to make changes if requested.

@leofang
Copy link
Member Author

leofang commented Oct 16, 2023

/test mini

@takagi takagi self-assigned this Oct 16, 2023
@takagi takagi added cat:enhancement Improvements to existing features prio:medium labels Oct 16, 2023
@kmaehashi
Copy link
Member

Thank you Leo! blocking sounds good to me 👍

@leofang leofang added the blocking Issue/pull-request is mandatory for the upcoming release label Oct 16, 2023
@leofang
Copy link
Member Author

leofang commented Oct 16, 2023

(btw I tagged this PR with "blocking" since this is a "no-compat" change.)

@kmaehashi kmaehashi added the no-compat Disrupts backward compatibility label Oct 16, 2023
cupy/__init__.py Outdated Show resolved Hide resolved
cupy/_core/core.pyx Outdated Show resolved Hide resolved
@takagi
Copy link
Member

takagi commented Oct 17, 2023

/test mini

@takagi takagi enabled auto-merge October 17, 2023 07:59
Copy link
Member

@takagi takagi left a comment

Choose a reason for hiding this comment

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

LGTM!

@takagi takagi merged commit 3cda362 into cupy:main Oct 18, 2023
47 checks passed
@leofang leofang deleted the sync_cpy branch October 18, 2023 11:42
@leofang
Copy link
Member Author

leofang commented Oct 18, 2023

Thanks all!

@kmaehashi kmaehashi added this to the v13.0.0rc1 milestone Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocking Issue/pull-request is mandatory for the upcoming release cat:enhancement Improvements to existing features no-compat Disrupts backward compatibility prio:medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Outdated (?) documentation on ndarray.get()/asnumpy() synchronization behavior
3 participants