-
Notifications
You must be signed in to change notification settings - Fork 621
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
DLPack overhaul #5661
DLPack overhaul #5661
Conversation
CI MESSAGE: [19098946]: BUILD STARTED |
dali/pipeline/data/dltensor.h
Outdated
if (dl_type.code < std::size(code_str)) | ||
ss << code_str[dl_type.code]; | ||
else | ||
ss << "<unknown" << dl_type.code + 0 << ">"; |
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.
ss << "<unknown" << dl_type.code + 0 << ">"; | |
ss << "<unknown:" << dl_type.code + 0 << ">"; |
dali/pipeline/data/dltensor.h
Outdated
* | ||
* The text representation looks like: | ||
* <type><bits>[x<lanes>] | ||
* with <lanes>x present only if the number of lanes is > 1 |
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.
* with <lanes>x present only if the number of lanes is > 1 | |
* with x<lanes> present only if the number of lanes is > 1 |
dali/pipeline/data/dltensor.h
Outdated
* +-- ... | ||
* ``` | ||
* | ||
* You can use any payload structure of your choice, but it must privde the storage for DLTensor's |
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.
* You can use any payload structure of your choice, but it must privde the storage for DLTensor's | |
* You can use any payload structure of your choice, but it must provide the storage for DLTensor's |
CI MESSAGE: [19098946]: BUILD PASSED |
- Remove inheritance. - Make more stuff inline. - Make function names consistent. - Add DLPack resources which share tensor ownership - Add reference counting tests. - Add CPU pinned memory support. TODO(michalz): Unify with JAX. Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
ef4502c
to
9529a5a
Compare
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
CI MESSAGE: [19136647]: BUILD STARTED |
CI MESSAGE: [19136647]: BUILD PASSED |
@@ -19,18 +19,18 @@ | |||
|
|||
namespace dali { | |||
|
|||
DLDataType GetDLType(DALIDataType type) { | |||
DLDataType ToDLType(DALIDataType type) { |
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.
Just a side note, the TYPE_SWITCH here seems like an overkill.
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.
Perhaps, but then again it's almost certainly faster than using TypeTable.
dali/pipeline/data/dltensor.h
Outdated
template <typename Backend> | ||
std::vector<DLMTensorPtr> GetSharedDLTensorList(TensorList<Backend> &tensor_list) { | ||
int device_id = tensor_list.device_id(); | ||
bool pinned = tensor_list.is_pinned(); | ||
|
||
std::vector<DLMTensorPtr> dl_tensors{}; | ||
dl_tensors.reserve(tensor_list.num_samples()); | ||
|
||
for (int i = 0; i < tensor_list.num_samples(); ++i) | ||
dl_tensors.push_back(GetDLTensorView(tensor_list[i], pinned, device_id)); |
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.
Looks like a copy-paste for GetDLTensorListView
. It probably should use unsafe_sample_owner
.
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.
Nice catch.
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
CI MESSAGE: [19179834]: BUILD STARTED |
CI MESSAGE: [19179834]: BUILD PASSED |
Category:
New feature (non-breaking change which adds functionality)
Refactoring (Redesign of existing code that doesn't affect functionality)
Description:
This PR reworks the DLPack support in DALI.
New features:
Refactoring:
Additional information:
Affected modules and functionalities:
Key points relevant for the review:
Tests:
Existing tests: ExternalSource, PythonFunction, JAX, dali_test.bin:DL
New tests: buffer sharing (reference counting test).
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A