Skip to content

Use std::optional/string_view #20213

Open
cyyever wants to merge 3 commits into
pytorch:mainfrom
cyyever:std_opt
Open

Use std::optional/string_view #20213
cyyever wants to merge 3 commits into
pytorch:mainfrom
cyyever:std_opt

Conversation

@cyyever

@cyyever cyyever commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR changes callers to use std::optional/string_view.

Test plan

Check whether the system can build.

@pytorch-bot

pytorch-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⚠️ 12 Awaiting Approval

As of commit f9616a7 with merge base b47e588 (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

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 Jun 11, 2026
@cyyever

cyyever commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot Bot added the release notes: none Do not include this in the release notes label Jun 11, 2026
@rascani

rascani commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Thanks for making this change!

Does this remove all uses of torch::executor::optional and executorch::runtime::etensor::optional? If so, then it would probably be good to remove those type aliases to ensure new usages don't get re-introduced.

There are a few clang-format errors coming from lintrunner that need to be cleaned up.

@cyyever

cyyever commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

@rascani I added more cleanup and fixed the linters.

cyyever added 2 commits June 12, 2026 09:00
Migrate the remaining executorch::aten::optional callers (mostly the
Cadence operators) to std::optional, then delete the deprecated
torch::executor and executorch::runtime::etensor optional/nullopt
aliases so they can't be reintroduced. portable_type/optional.h held
only those aliases and is removed; exec_aten.h now includes <optional>
directly. optional_test.cpp covered only the alias (now plain
std::optional) and is dropped along with its build targets.

The substantive changes are in runtime/core/exec_aten/exec_aten.h and
the removal of runtime/core/portable_type/optional.h; everything under
backends/cadence and kernels/ is the mechanical caller migration.
…_view

Migrate the remaining executorch::aten::string_view callers (the data-map
APIs and op_linalg_svd) to std::string_view, then delete the deprecated
torch::executor and executorch::runtime::etensor string_view aliases.
portable_type/string_view.h held only those aliases and is removed;
exec_aten.h and scalar_type_util.h now include <string_view> directly.

This parallels the optional cleanup in the previous commit. The data-map
header signatures (NamedDataMap and its overrides) move together since
the underlying type is unchanged.
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. release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants