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

[WIP] Add writeable to flags #8118

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

[WIP] Add writeable to flags #8118

wants to merge 7 commits into from

Conversation

asi1024
Copy link
Member

@asi1024 asi1024 commented Jan 17, 2024

Close #2616.
Blocked by #8104.

Adds writeable attributes to cupy.ndarray.flags. Please note that using read-only ndarray does not improves performance, since it currently does not automatically generate code with const or __restrict__.

@kmaehashi
Copy link
Member

Thanks! Some high-level comments:

  • We need to decide how the flag is inherited between NumPy/CuPy.
  • Also needs interoperability consideration, e.g. DLPack BUG: DLPack cannot export readonly buffers and raises wrong exception  numpy/numpy#20742.
  • The documentation must state that (1) race condition may happen due to async behavior of CUDA (data may change after changing the writeable flag to False) and (2) flags may be ignored in some scenarios, e.g., when passing the read-only ndarrays to CuPy functions using RawKernel/RawModule.

Copy link
Contributor

mergify bot commented Jan 24, 2024

This pull request is now in conflicts. Could you fix it @asi1024? 🙏

@asi1024 asi1024 changed the title [WIP] Add writeable to flags Add writeable to flags Jan 24, 2024
@asi1024 asi1024 marked this pull request as ready for review January 24, 2024 08:15
@asi1024 asi1024 changed the title Add writeable to flags [WIP] Add writeable to flags Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding writeable to flags
2 participants