Skip to content

Conversation

@praasz
Copy link
Contributor

@praasz praasz commented Mar 20, 2025

Details:

  • The Tensor::data function member returns const/non-const pointer to data depends if tensor object is constant.
  • Add support to create tensor view for allocated host memory as read only.

Blocked by:

Tickets:

@praasz praasz added this to the 2025.2 milestone Mar 20, 2025
@praasz praasz requested review from a team as code owners March 20, 2025 08:09
@github-actions github-actions bot added category: inference OpenVINO Runtime library - Inference category: Core OpenVINO Core (aka ngraph) category: IE Tests OpenVINO Test: plugins and common category: TEMPLATE OpenVINO Template plugin category: CPP API OpenVINO CPP API bindings category: NPU OpenVINO NPU plugin category: NPUW NPUW plugin labels Mar 20, 2025
Signed-off-by: Raasz, Pawel <[email protected]>
Copy link
Contributor

@ilya-lavrenov ilya-lavrenov left a comment

Choose a reason for hiding this comment

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

Looks like we break source compatibility with this change?

@ilya-lavrenov ilya-lavrenov self-assigned this Mar 20, 2025
Signed-off-by: Raasz, Pawel <[email protected]>
@praasz
Copy link
Contributor Author

praasz commented Mar 20, 2025

Looks like we break source compatibility with this change?

The compilation errors will points where cast of tensor data pointer is done wrong (programing errors: missing const) from this perspective it will break compatibility.

To avoid compile errors with current data() member there is a need to introduce new member or overload data with some tag and mark current data() as deprecated or it will work as new implementation of pointer cast, but still there will be get non-const pointer to const tensors.

praasz added 2 commits March 21, 2025 07:19
github-merge-queue bot pushed a commit to openvinotoolkit/openvino.genai that referenced this pull request Mar 25, 2025
### Description
- Update casting/getting data pointer from tensor when tensor can return
const pointer to data
- Use new version of OpenVINO YTokenizers which also contains similar
update

### Blocking
- openvinotoolkit/openvino#29594

Signed-off-by: Raasz, Pawel <[email protected]>
Copy link
Contributor

@t-jankowski t-jankowski left a comment

Choose a reason for hiding this comment

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

ok for core

@praasz praasz requested review from ilya-lavrenov and olpipi March 31, 2025 05:04
Copy link
Contributor

@ilya-lavrenov ilya-lavrenov left a comment

Choose a reason for hiding this comment

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

I suppose we cannot merge this PR as is, because it breaks source compatibility (we saw it in GenAI, Tokenizers, OMZ and Contrib).

We need to make this change more smoothly

@praasz praasz requested review from a team as code owners April 4, 2025 10:56
@praasz praasz requested review from ilya-lavrenov and removed request for a team April 4, 2025 10:56
@github-actions github-actions bot added category: build OpenVINO cmake script / infra category: samples OpenVINO Runtime Samples labels Apr 4, 2025
praasz added 2 commits April 4, 2025 12:22
Signed-off-by: Raasz, Pawel <[email protected]>
@ilya-lavrenov ilya-lavrenov added this pull request to the merge queue Apr 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 7, 2025
@mlukasze mlukasze added this pull request to the merge queue Apr 8, 2025
Merged via the queue into openvinotoolkit:master with commit d119656 Apr 8, 2025
193 checks passed
@praasz praasz deleted the feature/preserve-constness-in-ov-tensor branch October 27, 2025 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: build OpenVINO cmake script / infra category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings category: CPU OpenVINO CPU plugin category: GPU OpenVINO GPU plugin category: IE Tests OpenVINO Test: plugins and common category: inference OpenVINO Runtime library - Inference category: NPU OpenVINO NPU plugin category: NPUW NPUW plugin category: samples OpenVINO Runtime Samples category: TEMPLATE OpenVINO Template plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants