Skip to content

Use const_data_ptr/mutable_data_ptr instead of deprecated data_ptr#20958

Open
cyyever wants to merge 2 commits into
pytorch:mainfrom
cyyever:use-const-data-ptr
Open

Use const_data_ptr/mutable_data_ptr instead of deprecated data_ptr#20958
cyyever wants to merge 2 commits into
pytorch:mainfrom
cyyever:use-const-data-ptr

Conversation

@cyyever

@cyyever cyyever commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

ExecuTorch Tensor::data_ptr is ET_DEPRECATED. Replace remaining call sites: read-only accesses use const_data_ptr, the rest use mutable_data_ptr (sampler input, CMSIS-NN struct fields, JNI/mmap'd buffers that require non-const pointers).

Left unchanged: backends/aoti/slim (SlimTensor has no const/mutable variants) and at::Tensor::data_ptr() in extension/pybindings (not deprecated; for_blob takes void*).

Authored with Claude Code.

@pytorch-bot

pytorch-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20958

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 1 New Failure, 4 Pending

As of commit bb52040 with merge base 564e655 (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 15, 2026
@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@rascani

rascani commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Thanks @cyyever! This LGTM, just one cleanup on cuda_mutable_state.cpp

Comment thread backends/cuda/runtime/cuda_mutable_state.cpp Outdated
@cyyever
cyyever force-pushed the use-const-data-ptr branch from cbda78d to fb9f428 Compare July 16, 2026 01:27
@nil-is-all nil-is-all added enhancement Not as big of a feature, but technically not a bug. Should be easy to fix module: cleanup Issues/PRs which cleanup code across the repository labels Jul 17, 2026
@nil-is-all

Copy link
Copy Markdown
Contributor

Hi @cyyever, thanks for the PR! Could you review the CUDA build CI test failures and fix them?

@cyyever
cyyever force-pushed the use-const-data-ptr branch from d431ebd to 67ec355 Compare July 20, 2026 23:59
@cyyever
cyyever force-pushed the use-const-data-ptr branch from 67ec355 to bb52040 Compare July 21, 2026 00:01
@cyyever

cyyever commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@nil-is-all Fixed

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. enhancement Not as big of a feature, but technically not a bug. Should be easy to fix module: cleanup Issues/PRs which cleanup code across the repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants