Skip to content

Conversation

@vvchernov
Copy link
Contributor

During developing #11003 #11391 It was observed that DLTensor should satisfy some conditions (data contiguous and alignment) for correct construction of NDArray based on it to avoid problems with memory using.
Further analysis of NDArray class methods showed the same problem in other public method. There is fix of it.

@tkonolige could you check it?

@vvchernov vvchernov force-pushed the vc/dltensor_conditions_in_vm branch from 2d0b447 to f0da140 Compare May 28, 2022 14:08
Copy link
Contributor

@tkonolige tkonolige left a comment

Choose a reason for hiding this comment

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

Thanks @vvchernov!

// fill up content.
data->manager_ctx = tensor;
ICHECK(::tvm::runtime::IsContiguous(tensor->dl_tensor))
<< "DLManagedTensor is not contiguous. It does not support for now";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<< "DLManagedTensor is not contiguous. It does not support for now";
<< "DLManagedTensor must be contiguous.";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will redo it. But I based on similar description in other ICHECK. I think TVM design assumes contiguous tensors only and what we can potentially support in the future it is copying from incontiguous to contiguous ones.

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I think saying something will be supported in the future doesn't really add any useful information. But, if you do want to say that "Only contiguous DLManagedTensors are currently supported." would be a better message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @tkonolige! Please see again

Copy link
Contributor

Choose a reason for hiding this comment

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

How about "DLTensor is not contiguous. Copying from non-contiguous data is currently not supported."

Copy link
Contributor Author

@vvchernov vvchernov May 31, 2022

Choose a reason for hiding this comment

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

Ok, done. It still is not clear for me descriptions from 65 and 83 lines (initial code). Looks like idea is related to non-contiguous data copying, but I'm not sure

Copy link
Contributor

Choose a reason for hiding this comment

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

The wording on those lines is a little awkward but I believe they mean that ArrayCopyFromBytes and ArrayCopyToBytes only support contiguous data.

@vvchernov vvchernov force-pushed the vc/dltensor_conditions_in_vm branch from 760512b to 2e69b94 Compare May 31, 2022 19:37
@vvchernov
Copy link
Contributor Author

Hello @tkonolige could you approve it? if not we can ask Thierry

@tkonolige
Copy link
Contributor

I've approved it. But you'll also need a committer to approve it. @tmoreau89

Copy link
Contributor

@tmoreau89 tmoreau89 left a comment

Choose a reason for hiding this comment

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

Thanks @tkonolige for the review, LGTM

@tmoreau89 tmoreau89 merged commit 24b93f5 into apache:main Jun 1, 2022
@tmoreau89
Copy link
Contributor

Thanks @vvchernov and @tkonolige - the PR has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants