Skip to content

[WIP] Add writeable to flags#8118

Open
asi1024 wants to merge 7 commits intocupy:mainfrom
asi1024:writeable
Open

[WIP] Add writeable to flags#8118
asi1024 wants to merge 7 commits intocupy:mainfrom
asi1024:writeable

Conversation

@asi1024
Copy link
Copy Markdown
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
Copy Markdown
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.

@mergify
Copy link
Copy Markdown
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