Use std::optional/string_view #20213
Open
cyyever wants to merge 3 commits into
Open
Conversation
🔗 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.
|
Contributor
Author
|
@pytorchbot label "release notes: none" |
Contributor
|
Thanks for making this change! Does this remove all uses of There are a few clang-format errors coming from lintrunner that need to be cleaned up. |
Contributor
Author
|
@rascani I added more cleanup and fixed the linters. |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR changes callers to use std::optional/string_view.
Test plan
Check whether the system can build.