-
Notifications
You must be signed in to change notification settings - Fork 916
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
[REVIEW] Change ways to access ptr
in Buffer
#12587
[REVIEW] Change ways to access ptr
in Buffer
#12587
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small queries.
Co-authored-by: Lawrence Mitchell <[email protected]>
Codecov ReportBase: 86.58% // Head: 85.72% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## branch-23.02 #12587 +/- ##
================================================
- Coverage 86.58% 85.72% -0.86%
================================================
Files 155 155
Lines 24368 24911 +543
================================================
+ Hits 21098 21356 +258
- Misses 3270 3555 +285
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Addressed 👍 This PR should be ready for another round of reviews. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good but I don't think we need the "internal_write"
mode.
Co-authored-by: Mads R. B. Kristensen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting there, thanks! Some more minor things I think.
"shape": (self.size,), | ||
"strides": None, | ||
"typestr": "|u1", | ||
"version": 0, | ||
} | ||
|
||
@property | ||
def _readonly_proxy_cai_obj(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I don't think we should add extra property here given that it's used only in one other function (do we expect more uses for it?)
If not, I think we can just use cuda_array_interface_wrapper
in those places instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is only being used in data_array_view
& mask_array_view
, and one more place for copy-on-write scenarios: https://github.com/rapidsai/cudf/pull/12556/files#diff-e23cdfbd2c7e4be6f1d08ea3cec7e075e42851641068fe318985775f6b9efd99R214.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK -- let's leave as is now, and we can take stock in the merge of copy-on-write
.
Co-authored-by: Ashwin Srinath <[email protected]>
with acquire_spill_lock(): | ||
kernel.forall(len(data))(str_views, output) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should avoid setting this precedent; tests really shouldn't have to worry about spilling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline and removed this lock to keep things consistent where we are explicitly not testing for spilling ability.
Pending reviews have been addressed, dismissing to proceed with merging.
/merge |
This PR adapts to the breaking changes being introduced in: rapidsai/cudf#12587 Authors: - GALI PREM SAGAR (https://github.com/galipremsagar) Approvers: - AJ Schmidt (https://github.com/ajschmidt8) - Mark Harris (https://github.com/harrism) - Lawrence Mitchell (https://github.com/wence-) - Michael Wang (https://github.com/isVoid) URL: #871
This PR adapts to the breaking changes being introduced in: rapidsai/cudf#12587 Authors: - GALI PREM SAGAR (https://github.com/galipremsagar) Approvers: - Lawrence Mitchell (https://github.com/wence-) - AJ Schmidt (https://github.com/ajschmidt8) - Dante Gama Dessavre (https://github.com/dantegd)
Fix test that reads directly from `cudf.Buffer` pointer to new `get_ptr(mode="read")`, in accordance with changes from rapidsai/cudf#12587 .
Fix test that reads directly from `cudf.Buffer` pointer to new `get_ptr(mode="read")`, in accordance with changes from rapidsai/cudf#12587 . Authors: - Peter Andreas Entschev (https://github.com/pentschev) Approvers: - GALI PREM SAGAR (https://github.com/galipremsagar) - Lawrence Mitchell (https://github.com/wence-) URL: #1094
This PR adapts to the breaking changes being introduced in: rapidsai/cudf#12587 Authors: - GALI PREM SAGAR (https://github.com/galipremsagar) Approvers: - Lawrence Mitchell (https://github.com/wence-) - AJ Schmidt (https://github.com/ajschmidt8) - Dante Gama Dessavre (https://github.com/dantegd)
Description
This PR:
With the introduction of
copy-on-write
(#11718), andspilling
, there are different ways eachBuffer
implementation expects the code to behave when a.ptr
is accessed, i.e., in case of COW, aptr
can be accessed for read or write purposes, in case of spilling the ptr can be accessed with a spill lock and the buffer will be spillable after the spill lock goes out of scope during execution. For these reasons we introducedptr
,mutable_ptr
anddata_array_view
,_data_array_view
,mask_array_view
, and_mask_array_view
. With so many ways to access buffer ptr and array views, this has become quite difficult for devs to know when to use what unless you are fully familiar with the implementation details. It will also lead us to a lot of special case handling forBuffer
,SpillableBuffer
, andCopyonWriteBuffer
. For this reason, we have decided to simplify fetching the pointer with aget_ptr(mode="read"/"write")
API, fetching data & mask array views will also become methods that acceptmode
likedata_array_view(mode="read"/"write")
&mask_array_view(mode="read"/"write")
. It is the expectation that when the caller passed "read", they don't tamper with the buffer or the memory it is pointing to. In the case of "write", they are good to mutate the memory it is pointing to.Note that even with
mode="read"/"write"
the caller should still, if appropriate, acquire a spill lock for the duration of the access. If this is not done, and the buffer is aSpillableBuffer
, it will permanently be marked as unspillable.get_ptr()
to replaceptr
property.data_array_view
&mask_array_view
methods withdata_array_view(mode=r/w)
&mask_array_view(mode=r/w)
Checklist