From e6a11323013551e880293409a4067d0538b4a50c Mon Sep 17 00:00:00 2001 From: Yuanyuan Chen Date: Thu, 11 Jun 2026 13:55:39 +0800 Subject: [PATCH 1/5] Migrate callers to std::optional/std::string_view --- backends/cadence/hifi/operators/op_mean.cpp | 2 +- .../ops/cmsis_scratch_buffer_context.h | 2 +- backends/cortex_m/ops/op_quantized_conv2d.cpp | 4 +- .../ops/op_quantized_depthwise_conv2d.cpp | 4 +- backends/cortex_m/ops/op_quantized_linear.cpp | 4 +- .../ops/op_quantized_transpose_conv2d.cpp | 4 +- codegen/api/et_cpp.py | 2 +- codegen/api/types/types.py | 2 +- .../make_aten_functor_from_et_functor.h | 6 +- ...make_aten_functor_from_et_functor_test.cpp | 90 +++++++++---------- kernels/portable/cpu/op_native_dropout.cpp | 2 +- runtime/core/exec_aten/exec_aten.h | 3 +- .../core/exec_aten/util/scalar_type_util.h | 2 +- 13 files changed, 58 insertions(+), 69 deletions(-) diff --git a/backends/cadence/hifi/operators/op_mean.cpp b/backends/cadence/hifi/operators/op_mean.cpp index 514813fbe05..ccd54e80698 100644 --- a/backends/cadence/hifi/operators/op_mean.cpp +++ b/backends/cadence/hifi/operators/op_mean.cpp @@ -17,8 +17,8 @@ using executorch::aten::RuntimeContext; using executorch::aten::ScalarType; using executorch::aten::Tensor; using executorch::runtime::ArrayRef; +using std::optional; using torch::executor::Error; -using torch::executor::optional; namespace impl { namespace HiFi { diff --git a/backends/cortex_m/ops/cmsis_scratch_buffer_context.h b/backends/cortex_m/ops/cmsis_scratch_buffer_context.h index 656309abcee..807cf18cebc 100644 --- a/backends/cortex_m/ops/cmsis_scratch_buffer_context.h +++ b/backends/cortex_m/ops/cmsis_scratch_buffer_context.h @@ -49,7 +49,7 @@ class CMSISScratchBufferContext final { Tensor& scratch_buffer, const Tensor& weights, const Tensor& weight_zero_point, - const torch::executor::optional& bias) + const std::optional& bias) : scratch_ptr_(scratch_buffer.mutable_data_ptr()), total_size_(scratch_buffer.size(0)), base_ptr_(reinterpret_cast(scratch_ptr_)), diff --git a/backends/cortex_m/ops/op_quantized_conv2d.cpp b/backends/cortex_m/ops/op_quantized_conv2d.cpp index 3d4f19e10d0..13e8b132410 100644 --- a/backends/cortex_m/ops/op_quantized_conv2d.cpp +++ b/backends/cortex_m/ops/op_quantized_conv2d.cpp @@ -19,7 +19,7 @@ bool validate_conv2d_arguments( KernelRuntimeContext& context, const Tensor& input, const Tensor& weight, - const torch::executor::optional& bias, + const std::optional& bias, const Tensor& output, const Int64ArrayRef& stride, const Int64ArrayRef& padding, @@ -103,7 +103,7 @@ Tensor& quantized_conv2d_out( KernelRuntimeContext& context, const Tensor& input, const Tensor& weight, - const torch::executor::optional& bias, + const std::optional& bias, const Int64ArrayRef stride, const Int64ArrayRef padding, const Int64ArrayRef dilation, diff --git a/backends/cortex_m/ops/op_quantized_depthwise_conv2d.cpp b/backends/cortex_m/ops/op_quantized_depthwise_conv2d.cpp index a8e1fc21ed7..0793606de44 100644 --- a/backends/cortex_m/ops/op_quantized_depthwise_conv2d.cpp +++ b/backends/cortex_m/ops/op_quantized_depthwise_conv2d.cpp @@ -19,7 +19,7 @@ bool validate_depthwise_conv2d_arguments( KernelRuntimeContext& context, const Tensor& input, const Tensor& weight, - const torch::executor::optional& bias, + const std::optional& bias, const Tensor& output, const Int64ArrayRef& stride, const Int64ArrayRef& padding, @@ -140,7 +140,7 @@ Tensor& quantized_depthwise_conv2d_out( KernelRuntimeContext& context, const Tensor& input, const Tensor& weight, - const torch::executor::optional& bias, + const std::optional& bias, const Int64ArrayRef stride, const Int64ArrayRef padding, const Int64ArrayRef dilation, diff --git a/backends/cortex_m/ops/op_quantized_linear.cpp b/backends/cortex_m/ops/op_quantized_linear.cpp index 7448058de8e..c92ec493cd5 100644 --- a/backends/cortex_m/ops/op_quantized_linear.cpp +++ b/backends/cortex_m/ops/op_quantized_linear.cpp @@ -18,8 +18,8 @@ Tensor& quantized_linear_out( KernelRuntimeContext& context, const Tensor& input, const Tensor& weights, - const torch::executor::optional& bias, - const torch::executor::optional& kernel_sum, + const std::optional& bias, + const std::optional& kernel_sum, const int64_t input_offset, const int64_t filter_offset, const int64_t output_offset, diff --git a/backends/cortex_m/ops/op_quantized_transpose_conv2d.cpp b/backends/cortex_m/ops/op_quantized_transpose_conv2d.cpp index e7ecbc7c7b4..04d57d4c693 100644 --- a/backends/cortex_m/ops/op_quantized_transpose_conv2d.cpp +++ b/backends/cortex_m/ops/op_quantized_transpose_conv2d.cpp @@ -21,7 +21,7 @@ bool validate_transpose_conv2d_arguments( KernelRuntimeContext& context, const Tensor& input, const Tensor& weight, - const torch::executor::optional& bias, + const std::optional& bias, const Tensor& output, const Tensor& requantize_multipliers, const Tensor& requantize_shifts) { @@ -88,7 +88,7 @@ Tensor& quantized_transpose_conv2d_out( KernelRuntimeContext& context, const Tensor& input, const Tensor& weight, - const torch::executor::optional& bias, + const std::optional& bias, const Int64ArrayRef stride, const Int64ArrayRef padding, const Int64ArrayRef output_padding, diff --git a/codegen/api/et_cpp.py b/codegen/api/et_cpp.py index 88f1eb83fe0..1a823b98a5b 100644 --- a/codegen/api/et_cpp.py +++ b/codegen/api/et_cpp.py @@ -278,7 +278,7 @@ def default_expr(d: str, t: Type) -> str: if isinstance(t, OptionalType): if d == "None": - return "torch::executor::nullopt" + return "std::nullopt" return default_expr(d, t.elem) diff --git a/codegen/api/types/types.py b/codegen/api/types/types.py index 712d7e5e341..07c7f7e196a 100644 --- a/codegen/api/types/types.py +++ b/codegen/api/types/types.py @@ -59,7 +59,7 @@ class OptionalCType(CType): def cpp_type(self, *, strip_ref: bool = False) -> str: # Do not pass `strip_ref` recursively. - return f"torch::executor::optional<{self.elem.cpp_type()}>" + return f"std::optional<{self.elem.cpp_type()}>" def remove_const_ref(self) -> CType: return OptionalCType(self.elem.remove_const_ref()) diff --git a/extension/aten_util/make_aten_functor_from_et_functor.h b/extension/aten_util/make_aten_functor_from_et_functor.h index 8e1c2bf0143..c7a823c26df 100644 --- a/extension/aten_util/make_aten_functor_from_et_functor.h +++ b/extension/aten_util/make_aten_functor_from_et_functor.h @@ -67,12 +67,12 @@ struct type_map final { // Optional. template -struct type_map> final { +struct type_map> final { using type = std::optional::type>; }; template -struct type_map&> final { +struct type_map&> final { using type = std::optional::type>&; }; @@ -177,7 +177,7 @@ struct type_convert< typename remove_const_ref::type::value_type>> && std::is_same_v< typename remove_const_ref::type, - torch::executor::optional< + std::optional< typename remove_const_ref::type::value_type>>>> final { public: diff --git a/extension/aten_util/test/make_aten_functor_from_et_functor_test.cpp b/extension/aten_util/test/make_aten_functor_from_et_functor_test.cpp index b76596b9963..3abc84897ce 100644 --- a/extension/aten_util/test/make_aten_functor_from_et_functor_test.cpp +++ b/extension/aten_util/test/make_aten_functor_from_et_functor_test.cpp @@ -32,8 +32,8 @@ Tensor& add_1_out(const Tensor& a, Tensor& out) { } Tensor& add_optional_scalar_out( - torch::executor::optional s1, - torch::executor::optional s2, + std::optional s1, + std::optional s2, Tensor& out) { if (s1.has_value()) { out.mutable_data_ptr()[0] += s1.value(); @@ -45,8 +45,8 @@ Tensor& add_optional_scalar_out( } Tensor& add_optional_tensor_out( - torch::executor::optional s1, - torch::executor::optional s2, + std::optional s1, + std::optional s2, Tensor& out) { if (s1.has_value()) { out.mutable_data_ptr()[0] += @@ -78,8 +78,7 @@ Tensor& sum_arrayref_tensor_out( } Tensor& sum_arrayref_optional_tensor_out( - torch::executor::ArrayRef< - torch::executor::optional> a, + torch::executor::ArrayRef> a, Tensor& out) { for (int i = 0; i < a.size(); i++) { if (a[i].has_value()) { @@ -169,20 +168,19 @@ TEST_F(MakeATenFunctorFromETFunctorTest, TestTypeMap_Tuple_TensorRef3x) { TEST_F(MakeATenFunctorFromETFunctorTest, TestTypeMap_Optionals) { // Scalar. EXPECT_TRUE((std::is_same< - type_map>::type, + type_map>::type, std::optional>::value)); // Tensor. + EXPECT_TRUE((std::is_same< + type_map>::type, + std::optional>::value)); + // ArrayRef. EXPECT_TRUE( (std::is_same< - type_map>::type, - std::optional>::value)); - // ArrayRef. - EXPECT_TRUE((std::is_same< - type_map>>::type, - std::optional>>::value)); + type_map>>::type, + std::optional>>::value)); EXPECT_TRUE((std::is_same< - type_map>>::type, std::optional>>::value)); } @@ -198,13 +196,13 @@ TEST_F(MakeATenFunctorFromETFunctorTest, TestTypeMap_ArrayRef) { type_map>::type, c10::ArrayRef>::value)); // Optionals. + EXPECT_TRUE( + (std::is_same< + type_map>>::type, + c10::ArrayRef>>::value)); EXPECT_TRUE((std::is_same< type_map>>::type, - c10::ArrayRef>>::value)); - EXPECT_TRUE((std::is_same< - type_map>>::type, + std::optional>>::type, c10::ArrayRef>>::value)); } @@ -253,17 +251,16 @@ TEST_F(MakeATenFunctorFromETFunctorTest, TestConvert_OptionalScalar) { // Convert optional at to et. auto optional_at_in = std::optional(); auto optional_et = - type_convert, torch::executor::optional>( + type_convert, std::optional>( optional_at_in) .call(); EXPECT_TRUE( - (std::is_same>:: - value)); + (std::is_same>::value)); // Convert optional et to at. - auto optional_et_in = torch::executor::optional(); + auto optional_et_in = std::optional(); auto optional_at_out = - type_convert, std::optional>( + type_convert, std::optional>( optional_et_in) .call(); EXPECT_TRUE( @@ -273,20 +270,19 @@ TEST_F(MakeATenFunctorFromETFunctorTest, TestConvert_OptionalScalar) { TEST_F(MakeATenFunctorFromETFunctorTest, TestConvert_OptionalTensor) { // Convert optional at to et. auto optional_at_in = std::optional(); - auto optional_et = - type_convert< - std::optional, - torch::executor::optional>(optional_at_in) - .call(); + auto optional_et = type_convert< + std::optional, + std::optional>(optional_at_in) + .call(); EXPECT_TRUE((std::is_same< decltype(optional_et), - torch::executor::optional>::value)); + std::optional>::value)); // Convert optional et to at. torch::executor::testing::TensorFactory tf; - auto et_in = torch::executor::optional(tf.ones({3})); + auto et_in = std::optional(tf.ones({3})); auto optional_at_out = type_convert< - torch::executor::optional, + std::optional, std::optional>(optional_et) .call(); EXPECT_TRUE( @@ -519,9 +515,8 @@ TEST_F(MakeATenFunctorFromETFunctorTest, TestConvert_ConstRefOptionals) { const std::optional const_optional_at_in = std::optional(42); auto const_optional_et = - type_convert< - const std::optional, - torch::executor::optional>(const_optional_at_in) + type_convert, std::optional>( + const_optional_at_in) .call(); EXPECT_TRUE(const_optional_et.has_value()); EXPECT_EQ(const_optional_et.value(), 42); @@ -529,7 +524,7 @@ TEST_F(MakeATenFunctorFromETFunctorTest, TestConvert_ConstRefOptionals) { // Test optional scalar reference conversion std::optional optional_at_ref_in = std::optional(24); auto optional_et_from_ref = - type_convert&, torch::executor::optional>( + type_convert&, std::optional>( optional_at_ref_in) .call(); EXPECT_TRUE(optional_et_from_ref.has_value()); @@ -539,9 +534,8 @@ TEST_F(MakeATenFunctorFromETFunctorTest, TestConvert_ConstRefOptionals) { const std::optional const_optional_at_ref_in = std::optional(84); auto const_optional_et_from_ref = - type_convert< - const std::optional&, - torch::executor::optional>(const_optional_at_ref_in) + type_convert&, std::optional>( + const_optional_at_ref_in) .call(); EXPECT_TRUE(const_optional_et_from_ref.has_value()); EXPECT_EQ(const_optional_et_from_ref.value(), 84); @@ -551,8 +545,7 @@ TEST_F(MakeATenFunctorFromETFunctorTest, TestConvert_ConstRefOptionals) { std::optional(torch::tensor({5})); auto const_optional_tensor_converter = type_convert< const std::optional, - torch::executor::optional>( - const_optional_tensor_at_in); + std::optional>(const_optional_tensor_at_in); auto const_optional_tensor_et = const_optional_tensor_converter.call(); EXPECT_TRUE(const_optional_tensor_et.has_value()); EXPECT_EQ(const_optional_tensor_et.value().const_data_ptr()[0], 5); @@ -562,8 +555,7 @@ TEST_F(MakeATenFunctorFromETFunctorTest, TestConvert_ConstRefOptionals) { std::optional(torch::tensor({7})); auto optional_tensor_converter_from_ref = type_convert< std::optional&, - torch::executor::optional>( - optional_tensor_at_ref_in); + std::optional>(optional_tensor_at_ref_in); auto optional_tensor_et_from_ref = optional_tensor_converter_from_ref.call(); EXPECT_TRUE(optional_tensor_et_from_ref.has_value()); EXPECT_EQ( @@ -574,8 +566,7 @@ TEST_F(MakeATenFunctorFromETFunctorTest, TestConvert_ConstRefOptionals) { std::optional(torch::tensor({9})); auto const_optional_tensor_converter_from_ref = type_convert< const std::optional&, - torch::executor::optional>( - const_optional_tensor_at_ref_in); + std::optional>(const_optional_tensor_at_ref_in); auto const_optional_tensor_et_from_ref = const_optional_tensor_converter_from_ref.call(); EXPECT_TRUE(const_optional_tensor_et_from_ref.has_value()); @@ -586,9 +577,8 @@ TEST_F(MakeATenFunctorFromETFunctorTest, TestConvert_ConstRefOptionals) { // Test empty const optional conversions const std::optional empty_const_optional_at_in = std::nullopt; auto empty_const_optional_et = - type_convert< - const std::optional, - torch::executor::optional>(empty_const_optional_at_in) + type_convert, std::optional>( + empty_const_optional_at_in) .call(); EXPECT_FALSE(empty_const_optional_et.has_value()); @@ -597,7 +587,7 @@ TEST_F(MakeATenFunctorFromETFunctorTest, TestConvert_ConstRefOptionals) { auto empty_const_optional_tensor_et = type_convert< const std::optional, - torch::executor::optional>( + std::optional>( empty_const_optional_tensor_at_in) .call(); EXPECT_FALSE(empty_const_optional_tensor_et.has_value()); diff --git a/kernels/portable/cpu/op_native_dropout.cpp b/kernels/portable/cpu/op_native_dropout.cpp index fae7928568d..dc72fb54599 100644 --- a/kernels/portable/cpu/op_native_dropout.cpp +++ b/kernels/portable/cpu/op_native_dropout.cpp @@ -17,7 +17,7 @@ std::tuple native_dropout_out( KernelRuntimeContext& ctx, const Tensor& input, double prob, - torch::executor::optional train, + std::optional train, Tensor& out, Tensor& mask) { std::tuple ret(out, mask); diff --git a/runtime/core/exec_aten/exec_aten.h b/runtime/core/exec_aten/exec_aten.h index f539414aec9..214b4db95c7 100644 --- a/runtime/core/exec_aten/exec_aten.h +++ b/runtime/core/exec_aten/exec_aten.h @@ -183,8 +183,7 @@ using quint2x4 = torch::executor::quint2x4; using IntArrayRef = torch::executor::IntArrayRef; template -using OptionalArrayRef = - torch::executor::optional>; +using OptionalArrayRef = std::optional>; using OptionalIntArrayRef = OptionalArrayRef; using torch::executor::compute_numel; diff --git a/runtime/core/exec_aten/util/scalar_type_util.h b/runtime/core/exec_aten/util/scalar_type_util.h index f48b50a0786..3e8e36b442e 100644 --- a/runtime/core/exec_aten/util/scalar_type_util.h +++ b/runtime/core/exec_aten/util/scalar_type_util.h @@ -51,7 +51,7 @@ using ScalarType = at::ScalarType; namespace executorch { namespace aten { using ScalarType = torch::executor::ScalarType; -using string_view = torch::executor::string_view; +using string_view = std::string_view; } // namespace aten } // namespace executorch #endif // USE_ATEN_LIB From 45ec0d443ab5e20f2cc52b6f401250704fd38151 Mon Sep 17 00:00:00 2001 From: Yuanyuan Chen Date: Fri, 12 Jun 2026 08:58:24 +0800 Subject: [PATCH 2/5] Remove deprecated optional aliases, migrate callers to std::optional 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 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. --- backends/cadence/fused_quant/op_add.cpp | 2 +- backends/cadence/fused_quant/op_add.h | 13 +- backends/cadence/fused_quant/op_bmm.cpp | 2 +- backends/cadence/fused_quant/op_bmm.h | 13 +- backends/cadence/fused_quant/op_hardswish.cpp | 2 +- backends/cadence/fused_quant/op_hardswish.h | 8 +- backends/cadence/fused_quant/op_mul.cpp | 2 +- backends/cadence/fused_quant/op_mul.h | 13 +- backends/cadence/fused_quant/op_relu.cpp | 2 +- backends/cadence/fused_quant/op_relu.h | 8 +- backends/cadence/fused_quant/quant_utils.h | 4 +- .../cadence/fused_quant/tests/test_op_add.cpp | 2 +- .../cadence/fused_quant/tests/test_op_bmm.cpp | 2 +- .../fused_quant/tests/test_op_hardswish.cpp | 2 +- .../cadence/fused_quant/tests/test_op_mul.cpp | 2 +- .../fused_quant/tests/test_op_relu.cpp | 2 +- .../generic/operators/op_avg_pool2d.cpp | 2 +- .../cadence/generic/operators/op_avg_pool2d.h | 5 +- .../generic/operators/op_fully_connected.cpp | 2 +- .../generic/operators/op_fully_connected.h | 2 +- .../generic/operators/op_linalg_svd.cpp | 2 +- .../cadence/generic/operators/op_linalg_svd.h | 2 +- .../operators/op_quantized_conv1d_nlc.cpp | 2 +- .../operators/op_quantized_conv1d_nlc.h | 2 +- .../generic/operators/op_quantized_conv2d.cpp | 4 +- .../generic/operators/op_quantized_conv2d.h | 2 +- .../op_quantized_depthwise_conv1d_nlc.cpp | 2 +- .../operators/op_quantized_embedding_byte.cpp | 2 +- .../operators/op_quantized_embedding_byte.h | 3 +- .../op_quantized_fully_connected.cpp | 2 +- .../operators/op_quantized_fully_connected.h | 8 +- .../operators/op_quantized_layer_norm.cpp | 2 +- .../generic/operators/op_quantized_linear.cpp | 2 +- .../generic/operators/op_quantized_linear.h | 4 +- .../generic/operators/op_quantized_matmul.cpp | 2 +- .../generic/operators/op_quantized_matmul.h | 2 +- .../generic/operators/op_quantized_mul.cpp | 2 +- .../generic/operators/op_quantized_relu.cpp | 2 +- .../generic/operators/op_requantize.cpp | 2 +- .../cadence/generic/operators/op_rope.cpp | 4 +- backends/cadence/generic/operators/op_rope.h | 4 +- .../cadence/generic/operators/op_softmax.cpp | 2 +- .../cadence/generic/operators/op_softmax.h | 2 +- .../operators/op_transposed_convolution.cpp | 2 +- .../operators/op_quantized_conv1d_nlc.cpp | 2 +- .../op_quantized_conv2d_nhwc_out.cpp | 2 +- .../op_quantized_depthwise_conv1d_nlc.cpp | 2 +- .../hifi/operators/op_quantized_matmul_out.h | 2 +- .../hifi/operators/op_softmax_f32_f32.cpp | 4 +- backends/cadence/hifi/operators/operators.h | 6 +- .../operators/op_quantized_conv_out.cpp | 2 +- .../op_quantized_fully_connected_out.cpp | 2 +- .../operators/op_quantized_linear_out.cpp | 4 +- .../operators/op_quantized_matmul_out.cpp | 4 +- .../cadence/vision/operators/op_softmax.cpp | 2 +- backends/cadence/vision/operators/operators.h | 2 +- kernels/portable/cpu/op_index_put.cpp | 3 +- kernels/test/op_native_dropout_test.cpp | 2 +- runtime/core/exec_aten/exec_aten.h | 3 +- runtime/core/portable_type/optional.h | 36 ----- runtime/core/portable_type/targets.bzl | 1 - .../core/portable_type/test/CMakeLists.txt | 1 - .../core/portable_type/test/optional_test.cpp | 142 ------------------ runtime/core/portable_type/test/targets.bzl | 8 - test/utils/OSSTestConfig.json | 1 - 65 files changed, 95 insertions(+), 289 deletions(-) delete mode 100644 runtime/core/portable_type/optional.h delete mode 100644 runtime/core/portable_type/test/optional_test.cpp diff --git a/backends/cadence/fused_quant/op_add.cpp b/backends/cadence/fused_quant/op_add.cpp index 62e58c71c83..1aea2ccfb6c 100644 --- a/backends/cadence/fused_quant/op_add.cpp +++ b/backends/cadence/fused_quant/op_add.cpp @@ -14,10 +14,10 @@ namespace cadence { namespace fused_quant { namespace native { -using executorch::aten::optional; using executorch::aten::ScalarType; using executorch::aten::Tensor; using executorch::runtime::KernelRuntimeContext; +using std::optional; namespace { diff --git a/backends/cadence/fused_quant/op_add.h b/backends/cadence/fused_quant/op_add.h index 9db1e907294..b32710f41de 100644 --- a/backends/cadence/fused_quant/op_add.h +++ b/backends/cadence/fused_quant/op_add.h @@ -19,19 +19,18 @@ executorch::aten::Tensor& add_out( executorch::runtime::KernelRuntimeContext& ctx, const executorch::aten::Tensor& inp, const executorch::aten::Tensor& other, - const executorch::aten::optional& inp_scale, - const executorch::aten::optional& inp_zero_point, + const std::optional& inp_scale, + const std::optional& inp_zero_point, executorch::aten::ScalarType inp_dtype, int64_t inp_quant_min, int64_t inp_quant_max, - const executorch::aten::optional& other_scale, - const executorch::aten::optional& - other_zero_point, + const std::optional& other_scale, + const std::optional& other_zero_point, executorch::aten::ScalarType other_dtype, int64_t other_quant_min, int64_t other_quant_max, - const executorch::aten::optional& out_scale, - const executorch::aten::optional& out_zero_point, + const std::optional& out_scale, + const std::optional& out_zero_point, executorch::aten::ScalarType out_dtype, int64_t out_quant_min, int64_t out_quant_max, diff --git a/backends/cadence/fused_quant/op_bmm.cpp b/backends/cadence/fused_quant/op_bmm.cpp index 7204ab6c88f..8d071b48a33 100644 --- a/backends/cadence/fused_quant/op_bmm.cpp +++ b/backends/cadence/fused_quant/op_bmm.cpp @@ -14,10 +14,10 @@ namespace cadence { namespace fused_quant { namespace native { -using executorch::aten::optional; using executorch::aten::ScalarType; using executorch::aten::Tensor; using executorch::runtime::KernelRuntimeContext; +using std::optional; namespace { diff --git a/backends/cadence/fused_quant/op_bmm.h b/backends/cadence/fused_quant/op_bmm.h index ef9598eac98..c6a4502983f 100644 --- a/backends/cadence/fused_quant/op_bmm.h +++ b/backends/cadence/fused_quant/op_bmm.h @@ -19,19 +19,18 @@ executorch::aten::Tensor& bmm_out( executorch::runtime::KernelRuntimeContext& ctx, const executorch::aten::Tensor& inp, const executorch::aten::Tensor& other, - const executorch::aten::optional& inp_scale, - const executorch::aten::optional& inp_zero_point, + const std::optional& inp_scale, + const std::optional& inp_zero_point, executorch::aten::ScalarType inp_dtype, int64_t inp_quant_min, int64_t inp_quant_max, - const executorch::aten::optional& other_scale, - const executorch::aten::optional& - other_zero_point, + const std::optional& other_scale, + const std::optional& other_zero_point, executorch::aten::ScalarType other_dtype, int64_t other_quant_min, int64_t other_quant_max, - const executorch::aten::optional& out_scale, - const executorch::aten::optional& out_zero_point, + const std::optional& out_scale, + const std::optional& out_zero_point, executorch::aten::ScalarType out_dtype, int64_t out_quant_min, int64_t out_quant_max, diff --git a/backends/cadence/fused_quant/op_hardswish.cpp b/backends/cadence/fused_quant/op_hardswish.cpp index 452ea90a405..4b968cebe6c 100644 --- a/backends/cadence/fused_quant/op_hardswish.cpp +++ b/backends/cadence/fused_quant/op_hardswish.cpp @@ -16,10 +16,10 @@ namespace cadence { namespace fused_quant { namespace native { -using executorch::aten::optional; using executorch::aten::ScalarType; using executorch::aten::Tensor; using executorch::runtime::KernelRuntimeContext; +using std::optional; namespace { diff --git a/backends/cadence/fused_quant/op_hardswish.h b/backends/cadence/fused_quant/op_hardswish.h index ba9e09da23c..de7d88b427b 100644 --- a/backends/cadence/fused_quant/op_hardswish.h +++ b/backends/cadence/fused_quant/op_hardswish.h @@ -18,13 +18,13 @@ namespace native { executorch::aten::Tensor& hardswish_out( executorch::runtime::KernelRuntimeContext& ctx, const executorch::aten::Tensor& inp, - const executorch::aten::optional& inp_scale, - const executorch::aten::optional& inp_zero_point, + const std::optional& inp_scale, + const std::optional& inp_zero_point, executorch::aten::ScalarType inp_dtype, int64_t inp_quant_min, int64_t inp_quant_max, - const executorch::aten::optional& out_scale, - const executorch::aten::optional& out_zero_point, + const std::optional& out_scale, + const std::optional& out_zero_point, executorch::aten::ScalarType out_dtype, int64_t out_quant_min, int64_t out_quant_max, diff --git a/backends/cadence/fused_quant/op_mul.cpp b/backends/cadence/fused_quant/op_mul.cpp index 3d071f7c2da..a2595104ae8 100644 --- a/backends/cadence/fused_quant/op_mul.cpp +++ b/backends/cadence/fused_quant/op_mul.cpp @@ -14,10 +14,10 @@ namespace cadence { namespace fused_quant { namespace native { -using executorch::aten::optional; using executorch::aten::ScalarType; using executorch::aten::Tensor; using executorch::runtime::KernelRuntimeContext; +using std::optional; namespace { diff --git a/backends/cadence/fused_quant/op_mul.h b/backends/cadence/fused_quant/op_mul.h index f7afa016b79..62314c98003 100644 --- a/backends/cadence/fused_quant/op_mul.h +++ b/backends/cadence/fused_quant/op_mul.h @@ -19,19 +19,18 @@ executorch::aten::Tensor& mul_out( executorch::runtime::KernelRuntimeContext& ctx, const executorch::aten::Tensor& inp, const executorch::aten::Tensor& other, - const executorch::aten::optional& inp_scale, - const executorch::aten::optional& inp_zero_point, + const std::optional& inp_scale, + const std::optional& inp_zero_point, executorch::aten::ScalarType inp_dtype, int64_t inp_quant_min, int64_t inp_quant_max, - const executorch::aten::optional& other_scale, - const executorch::aten::optional& - other_zero_point, + const std::optional& other_scale, + const std::optional& other_zero_point, executorch::aten::ScalarType other_dtype, int64_t other_quant_min, int64_t other_quant_max, - const executorch::aten::optional& out_scale, - const executorch::aten::optional& out_zero_point, + const std::optional& out_scale, + const std::optional& out_zero_point, executorch::aten::ScalarType out_dtype, int64_t out_quant_min, int64_t out_quant_max, diff --git a/backends/cadence/fused_quant/op_relu.cpp b/backends/cadence/fused_quant/op_relu.cpp index ebe7933a7b9..e8e58522d2e 100644 --- a/backends/cadence/fused_quant/op_relu.cpp +++ b/backends/cadence/fused_quant/op_relu.cpp @@ -16,10 +16,10 @@ namespace cadence { namespace fused_quant { namespace native { -using executorch::aten::optional; using executorch::aten::ScalarType; using executorch::aten::Tensor; using executorch::runtime::KernelRuntimeContext; +using std::optional; namespace { diff --git a/backends/cadence/fused_quant/op_relu.h b/backends/cadence/fused_quant/op_relu.h index e8527c7633f..522144eacd0 100644 --- a/backends/cadence/fused_quant/op_relu.h +++ b/backends/cadence/fused_quant/op_relu.h @@ -18,13 +18,13 @@ namespace native { executorch::aten::Tensor& relu_out( executorch::runtime::KernelRuntimeContext& ctx, const executorch::aten::Tensor& inp, - const executorch::aten::optional& inp_scale, - const executorch::aten::optional& inp_zero_point, + const std::optional& inp_scale, + const std::optional& inp_zero_point, executorch::aten::ScalarType inp_dtype, int64_t inp_quant_min, int64_t inp_quant_max, - const executorch::aten::optional& out_scale, - const executorch::aten::optional& out_zero_point, + const std::optional& out_scale, + const std::optional& out_zero_point, executorch::aten::ScalarType out_dtype, int64_t out_quant_min, int64_t out_quant_max, diff --git a/backends/cadence/fused_quant/quant_utils.h b/backends/cadence/fused_quant/quant_utils.h index fff669a9e0e..78884bfcceb 100644 --- a/backends/cadence/fused_quant/quant_utils.h +++ b/backends/cadence/fused_quant/quant_utils.h @@ -64,8 +64,8 @@ struct QParams { }; inline QParams extract_qparams( - const executorch::aten::optional& scale_tensor, - const executorch::aten::optional& zp_tensor, + const std::optional& scale_tensor, + const std::optional& zp_tensor, int64_t quant_min, int64_t quant_max, const executorch::aten::Tensor& data_tensor) { diff --git a/backends/cadence/fused_quant/tests/test_op_add.cpp b/backends/cadence/fused_quant/tests/test_op_add.cpp index dca110cf0e1..61124f0b9b2 100644 --- a/backends/cadence/fused_quant/tests/test_op_add.cpp +++ b/backends/cadence/fused_quant/tests/test_op_add.cpp @@ -14,10 +14,10 @@ #include #include -using executorch::aten::optional; using executorch::aten::ScalarType; using executorch::aten::Tensor; using executorch::runtime::testing::TensorFactory; +using std::optional; namespace { diff --git a/backends/cadence/fused_quant/tests/test_op_bmm.cpp b/backends/cadence/fused_quant/tests/test_op_bmm.cpp index 5ede47ea8a9..bae04993a7a 100644 --- a/backends/cadence/fused_quant/tests/test_op_bmm.cpp +++ b/backends/cadence/fused_quant/tests/test_op_bmm.cpp @@ -14,10 +14,10 @@ #include #include -using executorch::aten::optional; using executorch::aten::ScalarType; using executorch::aten::Tensor; using executorch::runtime::testing::TensorFactory; +using std::optional; namespace { diff --git a/backends/cadence/fused_quant/tests/test_op_hardswish.cpp b/backends/cadence/fused_quant/tests/test_op_hardswish.cpp index 502d680d2e3..eb6231161f2 100644 --- a/backends/cadence/fused_quant/tests/test_op_hardswish.cpp +++ b/backends/cadence/fused_quant/tests/test_op_hardswish.cpp @@ -14,10 +14,10 @@ #include #include -using executorch::aten::optional; using executorch::aten::ScalarType; using executorch::aten::Tensor; using executorch::runtime::testing::TensorFactory; +using std::optional; namespace { diff --git a/backends/cadence/fused_quant/tests/test_op_mul.cpp b/backends/cadence/fused_quant/tests/test_op_mul.cpp index 0b9addabc5e..da27c7287c9 100644 --- a/backends/cadence/fused_quant/tests/test_op_mul.cpp +++ b/backends/cadence/fused_quant/tests/test_op_mul.cpp @@ -14,10 +14,10 @@ #include #include -using executorch::aten::optional; using executorch::aten::ScalarType; using executorch::aten::Tensor; using executorch::runtime::testing::TensorFactory; +using std::optional; namespace { diff --git a/backends/cadence/fused_quant/tests/test_op_relu.cpp b/backends/cadence/fused_quant/tests/test_op_relu.cpp index 6b83551fd2b..1096daae202 100644 --- a/backends/cadence/fused_quant/tests/test_op_relu.cpp +++ b/backends/cadence/fused_quant/tests/test_op_relu.cpp @@ -14,10 +14,10 @@ #include #include -using executorch::aten::optional; using executorch::aten::ScalarType; using executorch::aten::Tensor; using executorch::runtime::testing::TensorFactory; +using std::optional; namespace { diff --git a/backends/cadence/generic/operators/op_avg_pool2d.cpp b/backends/cadence/generic/operators/op_avg_pool2d.cpp index b04187db62e..c33f91151fb 100644 --- a/backends/cadence/generic/operators/op_avg_pool2d.cpp +++ b/backends/cadence/generic/operators/op_avg_pool2d.cpp @@ -19,11 +19,11 @@ namespace generic { namespace native { using ::executorch::aten::IntArrayRef; -using ::executorch::aten::optional; using ::executorch::aten::ScalarType; using ::executorch::aten::Tensor; using ::executorch::runtime::getLeadingDims; using ::executorch::runtime::KernelRuntimeContext; +using std::optional; // Compute the avg_pool2d for in_data in NCHW layout. IT is the input datatype, // and AT is the accumulation datatype. 'quantized' is true when the input is diff --git a/backends/cadence/generic/operators/op_avg_pool2d.h b/backends/cadence/generic/operators/op_avg_pool2d.h index 05f1810bb61..85b5d55a84b 100644 --- a/backends/cadence/generic/operators/op_avg_pool2d.h +++ b/backends/cadence/generic/operators/op_avg_pool2d.h @@ -23,9 +23,8 @@ ::executorch::aten::Tensor& avg_pool2d_out( ::executorch::aten::IntArrayRef padding, bool ceil_mode, bool count_include_pad, - ::executorch::aten::optional divisor_override, - const ::executorch::aten::optional<::executorch::aten::Tensor>& - in_zero_point_t, + std::optional divisor_override, + const std::optional<::executorch::aten::Tensor>& in_zero_point_t, bool channel_last, ::executorch::aten::Tensor& out); diff --git a/backends/cadence/generic/operators/op_fully_connected.cpp b/backends/cadence/generic/operators/op_fully_connected.cpp index 36befc52102..b65f8016880 100644 --- a/backends/cadence/generic/operators/op_fully_connected.cpp +++ b/backends/cadence/generic/operators/op_fully_connected.cpp @@ -15,10 +15,10 @@ namespace impl { namespace generic { namespace native { -using ::executorch::aten::optional; using ::executorch::aten::Tensor; using ::executorch::runtime::getLeadingDims; using ::executorch::runtime::KernelRuntimeContext; +using std::optional; void linear( const Tensor& input, diff --git a/backends/cadence/generic/operators/op_fully_connected.h b/backends/cadence/generic/operators/op_fully_connected.h index d23bcbeb70c..7e03f5ef664 100644 --- a/backends/cadence/generic/operators/op_fully_connected.h +++ b/backends/cadence/generic/operators/op_fully_connected.h @@ -15,9 +15,9 @@ namespace impl { namespace generic { namespace native { -using ::executorch::aten::optional; using ::executorch::aten::Tensor; using ::executorch::runtime::KernelRuntimeContext; +using std::optional; Tensor& fully_connected_out( KernelRuntimeContext& ctx, diff --git a/backends/cadence/generic/operators/op_linalg_svd.cpp b/backends/cadence/generic/operators/op_linalg_svd.cpp index 4974b617418..936456167aa 100644 --- a/backends/cadence/generic/operators/op_linalg_svd.cpp +++ b/backends/cadence/generic/operators/op_linalg_svd.cpp @@ -261,7 +261,7 @@ std::tuple linalg_svd_out( const Tensor& A, bool full_matrices, bool compute_uv, - ::executorch::aten::optional<::executorch::aten::string_view> driver, + std::optional<::executorch::aten::string_view> driver, Tensor& U, Tensor& S, Tensor& Vh) { diff --git a/backends/cadence/generic/operators/op_linalg_svd.h b/backends/cadence/generic/operators/op_linalg_svd.h index 7635276c4f5..6ad0aea2786 100644 --- a/backends/cadence/generic/operators/op_linalg_svd.h +++ b/backends/cadence/generic/operators/op_linalg_svd.h @@ -26,7 +26,7 @@ linalg_svd_out( const ::executorch::aten::Tensor& A, bool full_matrices, bool compute_uv, - ::executorch::aten::optional<::executorch::aten::string_view> driver, + std::optional<::executorch::aten::string_view> driver, ::executorch::aten::Tensor& U, ::executorch::aten::Tensor& S, ::executorch::aten::Tensor& Vh); diff --git a/backends/cadence/generic/operators/op_quantized_conv1d_nlc.cpp b/backends/cadence/generic/operators/op_quantized_conv1d_nlc.cpp index 6f42543cfc1..8a427045a83 100644 --- a/backends/cadence/generic/operators/op_quantized_conv1d_nlc.cpp +++ b/backends/cadence/generic/operators/op_quantized_conv1d_nlc.cpp @@ -256,7 +256,7 @@ ::executorch::aten::Tensor& quantized_conv1d_nlc_per_tensor_out( int64_t output_zero_point, __ET_UNUSED int64_t out_multiplier, __ET_UNUSED int64_t out_shift, - __ET_UNUSED const ::executorch::aten::optional& offset, + __ET_UNUSED const std::optional& offset, Tensor& out) { (void)ctx; quantized_conv1d_nlc( diff --git a/backends/cadence/generic/operators/op_quantized_conv1d_nlc.h b/backends/cadence/generic/operators/op_quantized_conv1d_nlc.h index 4f4d2877b27..f1780497f73 100644 --- a/backends/cadence/generic/operators/op_quantized_conv1d_nlc.h +++ b/backends/cadence/generic/operators/op_quantized_conv1d_nlc.h @@ -54,7 +54,7 @@ ::executorch::aten::Tensor& quantized_conv1d_nlc_per_tensor_out( int64_t output_zero_point, int64_t out_multiplier, int64_t out_shift, - const ::executorch::aten::optional& offset, + const std::optional& offset, Tensor& out); } // namespace native diff --git a/backends/cadence/generic/operators/op_quantized_conv2d.cpp b/backends/cadence/generic/operators/op_quantized_conv2d.cpp index 0811267a3b8..f6755f9dda8 100644 --- a/backends/cadence/generic/operators/op_quantized_conv2d.cpp +++ b/backends/cadence/generic/operators/op_quantized_conv2d.cpp @@ -16,11 +16,11 @@ namespace impl { namespace generic { namespace native { -using ::executorch::aten::optional; using ::executorch::aten::ScalarType; using ::executorch::aten::Tensor; using ::executorch::runtime::KernelRuntimeContext; using ::impl::generic::kernels::quantize; +using std::optional; /* This implements a generic 2d conv kernel that operates on raw pointers. * The quantized version handles quantized convolutions for 2D inputs. @@ -936,7 +936,7 @@ Tensor& quantized_conv2d_nhwc_per_tensor_out( int64_t output_zero_point, ET_UNUSED int64_t out_multiplier, ET_UNUSED int64_t out_shift, - ET_UNUSED const ::executorch::aten::optional& offset, + ET_UNUSED const std::optional& offset, Tensor& out) { quantized_conv2d_nhwc( input, diff --git a/backends/cadence/generic/operators/op_quantized_conv2d.h b/backends/cadence/generic/operators/op_quantized_conv2d.h index bb9476e2644..02740d3afec 100644 --- a/backends/cadence/generic/operators/op_quantized_conv2d.h +++ b/backends/cadence/generic/operators/op_quantized_conv2d.h @@ -205,7 +205,7 @@ ::executorch::aten::Tensor& quantized_conv2d_nhwc_per_tensor_out( int64_t output_zero_point, int64_t out_multiplier, int64_t out_shift, - const ::executorch::aten::optional& offset, + const std::optional& offset, Tensor& out); ::executorch::aten::Tensor& quantized_conv2d_depthwise_nhwc_out( diff --git a/backends/cadence/generic/operators/op_quantized_depthwise_conv1d_nlc.cpp b/backends/cadence/generic/operators/op_quantized_depthwise_conv1d_nlc.cpp index a8f98a76ffc..05fb809cd51 100644 --- a/backends/cadence/generic/operators/op_quantized_depthwise_conv1d_nlc.cpp +++ b/backends/cadence/generic/operators/op_quantized_depthwise_conv1d_nlc.cpp @@ -57,7 +57,7 @@ ::executorch::aten::Tensor& quantized_depthwise_conv1d_nlc_per_tensor_out( output_zero_point, out_multiplier, out_shift, - ::executorch::aten::optional(), + std::optional(), out); } diff --git a/backends/cadence/generic/operators/op_quantized_embedding_byte.cpp b/backends/cadence/generic/operators/op_quantized_embedding_byte.cpp index 55ca67648ca..d2e0d6a8bd9 100644 --- a/backends/cadence/generic/operators/op_quantized_embedding_byte.cpp +++ b/backends/cadence/generic/operators/op_quantized_embedding_byte.cpp @@ -19,11 +19,11 @@ namespace generic { namespace native { using ::executorch::aten::IntArrayRef; -using ::executorch::aten::optional; using ::executorch::aten::Scalar; using ::executorch::aten::ScalarType; using ::executorch::aten::Tensor; using ::executorch::runtime::KernelRuntimeContext; +using std::optional; #define ET_FORALL_CADENCE_QUANTIZED_TYPES(_) \ _(uint8_t, Byte) \ diff --git a/backends/cadence/generic/operators/op_quantized_embedding_byte.h b/backends/cadence/generic/operators/op_quantized_embedding_byte.h index a46bebe09df..84fc53620a0 100644 --- a/backends/cadence/generic/operators/op_quantized_embedding_byte.h +++ b/backends/cadence/generic/operators/op_quantized_embedding_byte.h @@ -19,8 +19,7 @@ ::executorch::aten::Tensor& quantized_embedding_byte_out( ::executorch::runtime::KernelRuntimeContext& ctx, const ::executorch::aten::Tensor& weight, const ::executorch::aten::Tensor& weight_scales, - const ::executorch::aten::optional<::executorch::aten::Tensor>& - weight_zero_points, + const std::optional<::executorch::aten::Tensor>& weight_zero_points, const ::executorch::aten::Tensor& indices, bool pruned_weights, ::executorch::aten::Tensor& out); diff --git a/backends/cadence/generic/operators/op_quantized_fully_connected.cpp b/backends/cadence/generic/operators/op_quantized_fully_connected.cpp index 55e29cb7f52..ce74b5b8b7f 100644 --- a/backends/cadence/generic/operators/op_quantized_fully_connected.cpp +++ b/backends/cadence/generic/operators/op_quantized_fully_connected.cpp @@ -16,10 +16,10 @@ namespace impl { namespace generic { namespace native { -using ::executorch::aten::optional; using ::executorch::aten::ScalarType; using ::executorch::aten::Tensor; using ::executorch::runtime::KernelRuntimeContext; +using std::optional; Tensor& quantized_fully_connected_out( ET_UNUSED KernelRuntimeContext& ctx, diff --git a/backends/cadence/generic/operators/op_quantized_fully_connected.h b/backends/cadence/generic/operators/op_quantized_fully_connected.h index a7510fba95f..408fbabe726 100644 --- a/backends/cadence/generic/operators/op_quantized_fully_connected.h +++ b/backends/cadence/generic/operators/op_quantized_fully_connected.h @@ -25,7 +25,7 @@ ::executorch::aten::Tensor& quantized_fully_connected_out( const ::executorch::aten::Tensor& out_multiplier, const ::executorch::aten::Tensor& out_shift, int64_t out_zero_point, - const ::executorch::aten::optional<::executorch::aten::Tensor>& offset, + const std::optional<::executorch::aten::Tensor>& offset, ::executorch::aten::Tensor& out); ::executorch::aten::Tensor& quantized_fully_connected_per_tensor_out( @@ -38,7 +38,7 @@ ::executorch::aten::Tensor& quantized_fully_connected_per_tensor_out( int64_t out_multiplier, int64_t out_shift, int64_t out_zero_point, - const ::executorch::aten::optional<::executorch::aten::Tensor>& offset, + const std::optional<::executorch::aten::Tensor>& offset, ::executorch::aten::Tensor& out); ::executorch::aten::Tensor& @@ -52,7 +52,7 @@ quantized_fully_connected_asym8sxasym8s_asym8s_per_tensor_out( int64_t out_multiplier, int64_t out_shift, int64_t out_zero_point, - const ::executorch::aten::optional<::executorch::aten::Tensor>& offset, + const std::optional<::executorch::aten::Tensor>& offset, ::executorch::aten::Tensor& out); ::executorch::aten::Tensor& @@ -66,7 +66,7 @@ quantized_fully_connected_asym8uxasym8u_asym8u_per_tensor_out( int64_t out_multiplier, int64_t out_shift, int64_t out_zero_point, - const ::executorch::aten::optional<::executorch::aten::Tensor>& offset, + const std::optional<::executorch::aten::Tensor>& offset, ::executorch::aten::Tensor& out); } // namespace native diff --git a/backends/cadence/generic/operators/op_quantized_layer_norm.cpp b/backends/cadence/generic/operators/op_quantized_layer_norm.cpp index e34ed342d22..85825cff94d 100644 --- a/backends/cadence/generic/operators/op_quantized_layer_norm.cpp +++ b/backends/cadence/generic/operators/op_quantized_layer_norm.cpp @@ -24,7 +24,6 @@ namespace generic { namespace native { using ::executorch::aten::IntArrayRef; -using ::executorch::aten::optional; using ::executorch::aten::Scalar; using ::executorch::aten::ScalarType; using ::executorch::aten::Tensor; @@ -32,6 +31,7 @@ using ::executorch::runtime::getLeadingDims; using ::executorch::runtime::KernelRuntimeContext; using ::impl::generic::kernels::dequantize; using ::impl::generic::kernels::quantize; +using std::optional; // Compute quantized layer_norm. The current implementation assumes that the // input is per-tensor quantized. diff --git a/backends/cadence/generic/operators/op_quantized_linear.cpp b/backends/cadence/generic/operators/op_quantized_linear.cpp index 87f990a855b..02ff97de74d 100644 --- a/backends/cadence/generic/operators/op_quantized_linear.cpp +++ b/backends/cadence/generic/operators/op_quantized_linear.cpp @@ -18,11 +18,11 @@ namespace impl { namespace generic { namespace native { -using ::executorch::aten::optional; using ::executorch::aten::ScalarType; using ::executorch::aten::Tensor; using ::executorch::runtime::KernelRuntimeContext; using ::executorch::runtime::toString; +using std::optional; Tensor& quantized_linear_out( ET_UNUSED KernelRuntimeContext& ctx, diff --git a/backends/cadence/generic/operators/op_quantized_linear.h b/backends/cadence/generic/operators/op_quantized_linear.h index b5396cb9701..517357d5bf9 100644 --- a/backends/cadence/generic/operators/op_quantized_linear.h +++ b/backends/cadence/generic/operators/op_quantized_linear.h @@ -25,7 +25,7 @@ ::executorch::aten::Tensor& quantized_linear_out( const ::executorch::aten::Tensor& out_multiplier, const ::executorch::aten::Tensor& out_shift, int64_t out_zero_point, - const ::executorch::aten::optional<::executorch::aten::Tensor>& offset, + const std::optional<::executorch::aten::Tensor>& offset, ::executorch::aten::Tensor& out); ::executorch::aten::Tensor& quantized_linear_per_tensor_out( @@ -38,7 +38,7 @@ ::executorch::aten::Tensor& quantized_linear_per_tensor_out( const int64_t out_multiplier, const int64_t out_shift, const int64_t out_zero_point, - const ::executorch::aten::optional<::executorch::aten::Tensor>& offset, + const std::optional<::executorch::aten::Tensor>& offset, ::executorch::aten::Tensor& out); ::executorch::aten::Tensor& diff --git a/backends/cadence/generic/operators/op_quantized_matmul.cpp b/backends/cadence/generic/operators/op_quantized_matmul.cpp index e3fb0f00fdc..b84c879e65d 100644 --- a/backends/cadence/generic/operators/op_quantized_matmul.cpp +++ b/backends/cadence/generic/operators/op_quantized_matmul.cpp @@ -21,12 +21,12 @@ namespace generic { namespace native { using ::executorch::aten::IntArrayRef; -using ::executorch::aten::optional; using ::executorch::aten::Scalar; using ::executorch::aten::ScalarType; using ::executorch::aten::Tensor; using ::executorch::runtime::KernelRuntimeContext; using ::impl::generic::kernels::quantize; +using std::optional; // The quantized matmul. The quantized matmul accumulates in a wider register, // whose type is TA. diff --git a/backends/cadence/generic/operators/op_quantized_matmul.h b/backends/cadence/generic/operators/op_quantized_matmul.h index 70775380aac..c28862aa11e 100644 --- a/backends/cadence/generic/operators/op_quantized_matmul.h +++ b/backends/cadence/generic/operators/op_quantized_matmul.h @@ -15,9 +15,9 @@ namespace impl { namespace generic { namespace native { -using ::executorch::aten::optional; using ::executorch::aten::Tensor; using ::executorch::runtime::KernelRuntimeContext; +using std::optional; Tensor& quantized_matmul_out( KernelRuntimeContext& ctx, diff --git a/backends/cadence/generic/operators/op_quantized_mul.cpp b/backends/cadence/generic/operators/op_quantized_mul.cpp index 30352ee9d52..359a305b020 100644 --- a/backends/cadence/generic/operators/op_quantized_mul.cpp +++ b/backends/cadence/generic/operators/op_quantized_mul.cpp @@ -21,13 +21,13 @@ namespace generic { namespace native { using ::executorch::aten::IntArrayRef; -using ::executorch::aten::optional; using ::executorch::aten::Scalar; using ::executorch::aten::ScalarType; using ::executorch::aten::Tensor; using ::executorch::runtime::KernelRuntimeContext; using ::impl::generic::kernels::dequantize; using ::impl::generic::kernels::quantize; +using std::optional; DECLARE_POINTWISE_TENSOR_QUANTIZED_BINARY_OP(quantized_mul_, *); diff --git a/backends/cadence/generic/operators/op_quantized_relu.cpp b/backends/cadence/generic/operators/op_quantized_relu.cpp index 9430951f65b..ecb87bd1b90 100644 --- a/backends/cadence/generic/operators/op_quantized_relu.cpp +++ b/backends/cadence/generic/operators/op_quantized_relu.cpp @@ -21,12 +21,12 @@ namespace generic { namespace native { using ::executorch::aten::IntArrayRef; -using ::executorch::aten::optional; using ::executorch::aten::Scalar; using ::executorch::aten::ScalarType; using ::executorch::aten::Tensor; using ::executorch::runtime::KernelRuntimeContext; using ::impl::generic::kernels::quantize; +using std::optional; template void quantized_relu_per_tensor_out_( diff --git a/backends/cadence/generic/operators/op_requantize.cpp b/backends/cadence/generic/operators/op_requantize.cpp index f846a1964a3..b9df6f1f355 100644 --- a/backends/cadence/generic/operators/op_requantize.cpp +++ b/backends/cadence/generic/operators/op_requantize.cpp @@ -19,13 +19,13 @@ namespace generic { namespace native { using ::executorch::aten::IntArrayRef; -using ::executorch::aten::optional; using ::executorch::aten::Scalar; using ::executorch::aten::ScalarType; using ::executorch::aten::Tensor; using ::executorch::runtime::KernelRuntimeContext; using ::impl::generic::kernels::dequantize; using ::impl::generic::kernels::quantize; +using std::optional; // Requantize the int8_t/uint8_t input tensor to a uint8_t/int8_t out tensor. // The scale and zero_point for requantization are in the args. diff --git a/backends/cadence/generic/operators/op_rope.cpp b/backends/cadence/generic/operators/op_rope.cpp index 17ee6d2a684..fcc7d629cf7 100644 --- a/backends/cadence/generic/operators/op_rope.cpp +++ b/backends/cadence/generic/operators/op_rope.cpp @@ -12,8 +12,8 @@ namespace impl { namespace generic { namespace native { -using ::executorch::aten::optional; using ::executorch::aten::Tensor; +using std::optional; Tensor& rope_out( ET_UNUSED ::executorch::runtime::KernelRuntimeContext& ctx, @@ -75,8 +75,8 @@ namespace impl { namespace generic { namespace native { -using ::executorch::aten::optional; using ::executorch::aten::Tensor; +using std::optional; Tensor& rope_rotate_stacked_halves_out( ET_UNUSED ::executorch::runtime::KernelRuntimeContext& ctx, diff --git a/backends/cadence/generic/operators/op_rope.h b/backends/cadence/generic/operators/op_rope.h index 638677bf118..d738cfda6c1 100644 --- a/backends/cadence/generic/operators/op_rope.h +++ b/backends/cadence/generic/operators/op_rope.h @@ -20,7 +20,7 @@ ::executorch::aten::Tensor& rope_out( const ::executorch::aten::Tensor& input, const ::executorch::aten::Tensor& sin_tensor, const ::executorch::aten::Tensor& cos_tensor, - const ::executorch::aten::optional<::executorch::aten::Tensor>& pos, + const std::optional<::executorch::aten::Tensor>& pos, ::executorch::aten::Tensor& out); ::executorch::aten::Tensor& rope_rotate_stacked_halves_out( @@ -28,7 +28,7 @@ ::executorch::aten::Tensor& rope_rotate_stacked_halves_out( const ::executorch::aten::Tensor& input, const ::executorch::aten::Tensor& sin_tensor, const ::executorch::aten::Tensor& cos_tensor, - const ::executorch::aten::optional<::executorch::aten::Tensor>& pos, + const std::optional<::executorch::aten::Tensor>& pos, ::executorch::aten::Tensor& out); } // namespace native diff --git a/backends/cadence/generic/operators/op_softmax.cpp b/backends/cadence/generic/operators/op_softmax.cpp index 97c64a22511..b680d1e2471 100644 --- a/backends/cadence/generic/operators/op_softmax.cpp +++ b/backends/cadence/generic/operators/op_softmax.cpp @@ -125,7 +125,7 @@ Tensor& _softmax_f32_f32_out( __ET_UNUSED KernelRuntimeContext& ctx, const Tensor& X, int64_t dim, - __ET_UNUSED ::executorch::aten::optional half_to_float, + __ET_UNUSED std::optional half_to_float, Tensor& Y) { _softmax_out(ctx, X, dim, false, Y); diff --git a/backends/cadence/generic/operators/op_softmax.h b/backends/cadence/generic/operators/op_softmax.h index ec51b1d00c0..d83703117b0 100644 --- a/backends/cadence/generic/operators/op_softmax.h +++ b/backends/cadence/generic/operators/op_softmax.h @@ -26,7 +26,7 @@ ::executorch::aten::Tensor& _softmax_f32_f32_out( __ET_UNUSED ::executorch::runtime::KernelRuntimeContext& ctx, const ::executorch::aten::Tensor& X, int64_t dim, - __ET_UNUSED ::executorch::aten::optional half_to_float, + __ET_UNUSED std::optional half_to_float, ::executorch::aten::Tensor& Y); } // namespace native diff --git a/backends/cadence/generic/operators/op_transposed_convolution.cpp b/backends/cadence/generic/operators/op_transposed_convolution.cpp index 121b479e65f..b742ec635b2 100644 --- a/backends/cadence/generic/operators/op_transposed_convolution.cpp +++ b/backends/cadence/generic/operators/op_transposed_convolution.cpp @@ -16,12 +16,12 @@ namespace generic { namespace native { using ::executorch::aten::IntArrayRef; -using ::executorch::aten::optional; using ::executorch::aten::Scalar; using ::executorch::aten::ScalarType; using ::executorch::aten::Tensor; using ::executorch::runtime::KernelRuntimeContext; using ::impl::generic::kernels::quantize; +using std::optional; // This implements a generic 2d transposed_conv kernel that operates on raw // pointers. The version handles both quantized and fp32 convolutions. diff --git a/backends/cadence/hifi/operators/op_quantized_conv1d_nlc.cpp b/backends/cadence/hifi/operators/op_quantized_conv1d_nlc.cpp index 5171c2908bc..9d363469f74 100644 --- a/backends/cadence/hifi/operators/op_quantized_conv1d_nlc.cpp +++ b/backends/cadence/hifi/operators/op_quantized_conv1d_nlc.cpp @@ -238,7 +238,7 @@ void quantized_conv1d_nlc_per_tensor_out( int64_t output_zero_point, int64_t out_multiplier, int64_t out_shift, - __ET_UNUSED const ::executorch::aten::optional& offset, + __ET_UNUSED const std::optional& offset, Tensor& out) { // HiFi nnlib kernels only support dilation=1. // Fall back to generic implementation for dilation > 1. diff --git a/backends/cadence/hifi/operators/op_quantized_conv2d_nhwc_out.cpp b/backends/cadence/hifi/operators/op_quantized_conv2d_nhwc_out.cpp index ea3a756f995..86ef244711d 100644 --- a/backends/cadence/hifi/operators/op_quantized_conv2d_nhwc_out.cpp +++ b/backends/cadence/hifi/operators/op_quantized_conv2d_nhwc_out.cpp @@ -17,7 +17,7 @@ using Tensor = executorch::aten::Tensor; using KernelRuntimeContext = torch::executor::KernelRuntimeContext; using ScalarType = executorch::aten::ScalarType; using ::executorch::aten::IntArrayRef; -using ::executorch::aten::optional; +using std::optional; namespace impl { namespace HiFi { diff --git a/backends/cadence/hifi/operators/op_quantized_depthwise_conv1d_nlc.cpp b/backends/cadence/hifi/operators/op_quantized_depthwise_conv1d_nlc.cpp index 4299990b52a..a8e2b42d77d 100644 --- a/backends/cadence/hifi/operators/op_quantized_depthwise_conv1d_nlc.cpp +++ b/backends/cadence/hifi/operators/op_quantized_depthwise_conv1d_nlc.cpp @@ -206,7 +206,7 @@ void quantized_depthwise_conv1d_nlc_per_tensor_out( output_zero_point, out_multiplier, out_shift, - ::executorch::aten::optional(), + std::optional(), out); return; } diff --git a/backends/cadence/hifi/operators/op_quantized_matmul_out.h b/backends/cadence/hifi/operators/op_quantized_matmul_out.h index c53a07b58aa..a567c7f650d 100644 --- a/backends/cadence/hifi/operators/op_quantized_matmul_out.h +++ b/backends/cadence/hifi/operators/op_quantized_matmul_out.h @@ -21,7 +21,7 @@ ::executorch::aten::Tensor& quantized_matmul_out( int64_t X_zero_point, const ::executorch::aten::Tensor& Y, int64_t Y_zero_point, - const ::executorch::aten::optional<::executorch::aten::Tensor>& bias, + const std::optional<::executorch::aten::Tensor>& bias, int64_t out_multiplier, int64_t out_shift, int64_t out_zero_point, diff --git a/backends/cadence/hifi/operators/op_softmax_f32_f32.cpp b/backends/cadence/hifi/operators/op_softmax_f32_f32.cpp index 074ff29b301..907156af1f7 100644 --- a/backends/cadence/hifi/operators/op_softmax_f32_f32.cpp +++ b/backends/cadence/hifi/operators/op_softmax_f32_f32.cpp @@ -22,7 +22,7 @@ inline Tensor& _softmax_f32_f32_out( KernelRuntimeContext& ctx, const Tensor& in, int64_t dim, - ::executorch::aten::optional half_to_float, + std::optional half_to_float, Tensor& out) { constexpr int kNnlibMaxDim = 16; @@ -146,7 +146,7 @@ Tensor& softmax_f32_f32_out( KernelRuntimeContext& ctx, const Tensor& in, int64_t dim, - ::executorch::aten::optional half_to_float, + std::optional half_to_float, Tensor& out) { return _softmax_f32_f32_out(ctx, in, dim, half_to_float, out); } diff --git a/backends/cadence/hifi/operators/operators.h b/backends/cadence/hifi/operators/operators.h index 3ca505d40cb..fa6847f744b 100644 --- a/backends/cadence/hifi/operators/operators.h +++ b/backends/cadence/hifi/operators/operators.h @@ -72,7 +72,7 @@ void quantized_linear_out( const ::executorch::aten::Tensor& out_multiplier, const ::executorch::aten::Tensor& out_shift, int64_t out_zero_point, - const ::executorch::aten::optional<::executorch::aten::Tensor>& offset, + const std::optional<::executorch::aten::Tensor>& offset, ::executorch::aten::Tensor& out); void quantized_linear_per_tensor_out( @@ -85,7 +85,7 @@ void quantized_linear_per_tensor_out( int64_t out_multiplier, int64_t out_shift, int64_t out_zero_point, - const ::executorch::aten::optional<::executorch::aten::Tensor>& offset, + const std::optional<::executorch::aten::Tensor>& offset, ::executorch::aten::Tensor& out); void quantized_conv2d_nhwc_out( @@ -158,7 +158,7 @@ void quantized_conv2d_nhwc_per_tensor_out( int64_t output_zero_point, int64_t out_multiplier, int64_t out_shift, - const ::executorch::aten::optional<::executorch::aten::Tensor>& offset, + const std::optional<::executorch::aten::Tensor>& offset, ::executorch::aten::Tensor& out); ::executorch::aten::Tensor& cat_out( diff --git a/backends/cadence/vision/operators/op_quantized_conv_out.cpp b/backends/cadence/vision/operators/op_quantized_conv_out.cpp index be4b34bff03..aaba9f5696d 100644 --- a/backends/cadence/vision/operators/op_quantized_conv_out.cpp +++ b/backends/cadence/vision/operators/op_quantized_conv_out.cpp @@ -582,7 +582,7 @@ void quantized_conv2d_nhwc_per_tensor_out( int64_t output_zero_point, int64_t out_multiplier, int64_t out_shift, - ET_UNUSED const ::executorch::aten::optional& offset, + ET_UNUSED const std::optional& offset, Tensor& out) { quantized_conv_per_tensor_out( ctx, diff --git a/backends/cadence/vision/operators/op_quantized_fully_connected_out.cpp b/backends/cadence/vision/operators/op_quantized_fully_connected_out.cpp index 29aa8906414..c53f7f7667a 100644 --- a/backends/cadence/vision/operators/op_quantized_fully_connected_out.cpp +++ b/backends/cadence/vision/operators/op_quantized_fully_connected_out.cpp @@ -13,10 +13,10 @@ namespace impl { namespace vision { namespace native { -using ::executorch::aten::optional; using ::executorch::aten::ScalarType; using ::executorch::aten::Tensor; using ::executorch::runtime::KernelRuntimeContext; +using std::optional; void quantized_fully_connected_out( __ET_UNUSED KernelRuntimeContext& ctx, diff --git a/backends/cadence/vision/operators/op_quantized_linear_out.cpp b/backends/cadence/vision/operators/op_quantized_linear_out.cpp index b6b7cdd17bc..7b3daed8ef6 100644 --- a/backends/cadence/vision/operators/op_quantized_linear_out.cpp +++ b/backends/cadence/vision/operators/op_quantized_linear_out.cpp @@ -84,7 +84,7 @@ void quantized_linear_out( const Tensor& out_multiplier, const Tensor& out_shift, int64_t out_zero_point, - __ET_UNUSED const executorch::aten::optional& offset, + __ET_UNUSED const std::optional& offset, Tensor& out) { // TODO: refactor to use switch case as quantized_linear_per_tensor_out if (out.scalar_type() == executorch::aten::ScalarType::Byte) { @@ -127,7 +127,7 @@ void quantized_linear_per_tensor_out( const int64_t out_multiplier, const int64_t out_shift, const int64_t out_zero_point, - __ET_UNUSED const executorch::aten::optional& offset, + __ET_UNUSED const std::optional& offset, Tensor& out) { #define typed_quantized_linear_per_tensor(ctype, dtype) \ case executorch::aten::ScalarType::dtype: { \ diff --git a/backends/cadence/vision/operators/op_quantized_matmul_out.cpp b/backends/cadence/vision/operators/op_quantized_matmul_out.cpp index 54a303288c3..e63ae5bdda1 100644 --- a/backends/cadence/vision/operators/op_quantized_matmul_out.cpp +++ b/backends/cadence/vision/operators/op_quantized_matmul_out.cpp @@ -60,7 +60,7 @@ void inline _typed_quantized_matmul( int64_t X_zero_point, const Tensor& Y, int64_t Y_zero_point, - const executorch::aten::optional& bias, + const std::optional& bias, int64_t out_multiplier, int64_t out_shift, int64_t out_zero_point, @@ -114,7 +114,7 @@ void quantized_matmul_out( int64_t X_zero_point, const Tensor& Y, int64_t Y_zero_point, - const executorch::aten::optional& bias, + const std::optional& bias, int64_t out_multiplier, int64_t out_shift, int64_t out_zero_point, diff --git a/backends/cadence/vision/operators/op_softmax.cpp b/backends/cadence/vision/operators/op_softmax.cpp index 58ca33c6a0b..6b93709b226 100644 --- a/backends/cadence/vision/operators/op_softmax.cpp +++ b/backends/cadence/vision/operators/op_softmax.cpp @@ -50,7 +50,7 @@ Tensor& _softmax_out( // Adjust for negative dim dim = dim < 0 ? dim + executorch::runtime::nonzero_dim(in) : dim; - const executorch::aten::optional& dim_t = dim; + const std::optional& dim_t = dim; const size_t d = ET_NORMALIZE_IX(dim_t.value(), in.dim()); const size_t size = in.size(d); diff --git a/backends/cadence/vision/operators/operators.h b/backends/cadence/vision/operators/operators.h index 8b5db4161eb..1c756c0b237 100644 --- a/backends/cadence/vision/operators/operators.h +++ b/backends/cadence/vision/operators/operators.h @@ -31,7 +31,7 @@ using ::executorch::runtime::getLeadingDims; inline __attribute__((always_inline)) void linear_( const ::executorch::aten::Tensor& input, const ::executorch::aten::Tensor& weight, - const ::executorch::aten::optional<::executorch::aten::Tensor>& bias, + const std::optional<::executorch::aten::Tensor>& bias, ::executorch::aten::Tensor& output) { const float* __restrict__ input_data = input.const_data_ptr(); const float* __restrict__ weight_data = weight.const_data_ptr(); diff --git a/kernels/portable/cpu/op_index_put.cpp b/kernels/portable/cpu/op_index_put.cpp index 812d3e8fab3..519842db598 100644 --- a/kernels/portable/cpu/op_index_put.cpp +++ b/kernels/portable/cpu/op_index_put.cpp @@ -19,8 +19,7 @@ namespace executor { namespace native { using Tensor = executorch::aten::Tensor; -using TensorOptList = - executorch::aten::ArrayRef>; +using TensorOptList = executorch::aten::ArrayRef>; Tensor& index_put_out( KernelRuntimeContext& ctx, diff --git a/kernels/test/op_native_dropout_test.cpp b/kernels/test/op_native_dropout_test.cpp index 931205f54a5..fec00c87862 100644 --- a/kernels/test/op_native_dropout_test.cpp +++ b/kernels/test/op_native_dropout_test.cpp @@ -25,7 +25,7 @@ class OpNativeDropoutTest : public OperatorTest { void op_native_dropout_out( const Tensor& self, double prob, - executorch::aten::optional train, + std::optional train, Tensor& out, Tensor& mask) { torch::executor::aten::native_dropout_outf( diff --git a/runtime/core/exec_aten/exec_aten.h b/runtime/core/exec_aten/exec_aten.h index 214b4db95c7..64d0fba177b 100644 --- a/runtime/core/exec_aten/exec_aten.h +++ b/runtime/core/exec_aten/exec_aten.h @@ -8,6 +8,8 @@ #pragma once +#include + #include // @manual #include // @manual #include // @manual @@ -41,7 +43,6 @@ #include // @manual #include // @manual #include // @manual -#include // @manual #include // @manual #include // @manual #include // @manual diff --git a/runtime/core/portable_type/optional.h b/runtime/core/portable_type/optional.h deleted file mode 100644 index 31ad06fd093..00000000000 --- a/runtime/core/portable_type/optional.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace executorch { -namespace runtime { -namespace etensor { - -// NOLINTNEXTLINE(misc-unused-using-decls) -using std::nullopt; -// NOLINTNEXTLINE(misc-unused-using-decls) -using std::nullopt_t; -// NOLINTNEXTLINE(misc-unused-using-decls) -using std::optional; - -} // namespace etensor -} // namespace runtime -} // namespace executorch - -namespace torch { -namespace executor { -// TODO(T197294990): Remove these deprecated aliases once all users have moved -// to the new `::executorch` namespaces. -using ::executorch::runtime::etensor::nullopt; -using ::executorch::runtime::etensor::nullopt_t; -using ::executorch::runtime::etensor::optional; -} // namespace executor -} // namespace torch diff --git a/runtime/core/portable_type/targets.bzl b/runtime/core/portable_type/targets.bzl index 0a368bd6379..37f1e073962 100644 --- a/runtime/core/portable_type/targets.bzl +++ b/runtime/core/portable_type/targets.bzl @@ -14,7 +14,6 @@ def define_common_targets(): srcs = ["tensor_impl.cpp"], exported_headers = [ "tensor_options.h", - "optional.h", "scalar.h", "tensor.h", "tensor_impl.h", diff --git a/runtime/core/portable_type/test/CMakeLists.txt b/runtime/core/portable_type/test/CMakeLists.txt index b1f57a93ab5..8aa27d4d877 100644 --- a/runtime/core/portable_type/test/CMakeLists.txt +++ b/runtime/core/portable_type/test/CMakeLists.txt @@ -23,7 +23,6 @@ set(_test_srcs bfloat16_test.cpp dont_shadow_complex_test.c half_test.cpp - optional_test.cpp scalar_test.cpp tensor_impl_test.cpp tensor_test.cpp diff --git a/runtime/core/portable_type/test/optional_test.cpp b/runtime/core/portable_type/test/optional_test.cpp deleted file mode 100644 index 60d835d7439..00000000000 --- a/runtime/core/portable_type/test/optional_test.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include - -#include -#include - -using namespace ::testing; -using executorch::runtime::etensor::nullopt; -using executorch::runtime::etensor::optional; - -// Test that optional::value_type matches the template parameter type. -static_assert( - std::is_same::value_type, int32_t>::value, - "Unexpected optional::value_type"); -static_assert( - std::is_same::value_type, std::string>::value, - "Unexpected optional::value_type"); - -TEST(TestOptional, DefaultHasNoValue) { - optional o; - EXPECT_FALSE(o.has_value()); -} - -TEST(TestOptional, NulloptHasNoValue) { - optional o(nullopt); - EXPECT_FALSE(o.has_value()); -} - -TEST(TestOptional, ValueOfEmptyOptionalShouldThrow) { - optional o; - EXPECT_FALSE(o.has_value()); - - EXPECT_THROW({ (void)o.value(); }, std::bad_optional_access); -} - -TEST(TestOptional, IntValue) { - optional o(15); - EXPECT_TRUE(o.has_value()); - EXPECT_EQ(o.value(), 15); -} - -TEST(TestOptional, NonTrivialValueType) { - optional o("hey"); - EXPECT_TRUE(o.has_value()); - EXPECT_EQ(o.value(), "hey"); -} - -TEST(TestOptional, ConstValue) { - const optional o("hey"); - auto s = o.value(); // If this compiles, we're good. - EXPECT_EQ(o.value(), "hey"); -} - -TEST(TestOptional, CopyCtorWithValue) { - optional o1(15); - optional o2(o1); - - EXPECT_TRUE(o2.has_value()); - EXPECT_EQ(o2.value(), 15); -} - -TEST(TestOptional, CopyCtorWithNoValue) { - optional o1; - optional o2(o1); - - EXPECT_FALSE(o2.has_value()); -} - -TEST(TestOptional, CopyAssignTrivial) { - optional o1(1); - optional o2(2); - o1 = o2; - - EXPECT_EQ(o1.value(), 2); -} - -TEST(TestOptional, CopyAssignNonTrivial) { - optional o1("abcde"); - optional o2("foo"); - o1 = o2; - - EXPECT_EQ(o1.value(), "foo"); -} - -TEST(TestOptional, CopyAssignNone) { - optional o1(2); - optional o2; - o1 = o2; - EXPECT_FALSE(o1.has_value()); -} - -TEST(TestOptional, MoveCtorWithNoValue) { - optional o1; - optional o2(std::move(o1)); - - EXPECT_FALSE(o2.has_value()); -} - -TEST(TestOptional, MoveCtorWithValue) { - optional o1(15); - optional o2(std::move(o1)); - - EXPECT_TRUE(o2.has_value()); - EXPECT_EQ(o2.value(), 15); -} - -TEST(TestOptional, MoveCtorNonTrivialType) { - optional o1("abc"); - optional o2(std::move(o1)); - - EXPECT_TRUE(o2.has_value()); - EXPECT_EQ(o2.value(), "abc"); -} - -optional function_returning_optional_of(int32_t value) { - return value; -} - -TEST(TestOptional, ImplicitReturnOfValue) { - auto o = function_returning_optional_of(21); - EXPECT_TRUE(o.has_value()); - EXPECT_EQ(o.value(), 21); -} - -optional function_returning_nullopt() { - return nullopt; -} - -TEST(TestOptional, ImplicitReturnOfNullopt) { - auto o = function_returning_nullopt(); - EXPECT_FALSE(o.has_value()); -} diff --git a/runtime/core/portable_type/test/targets.bzl b/runtime/core/portable_type/test/targets.bzl index a6671d7d400..ce831f89327 100644 --- a/runtime/core/portable_type/test/targets.bzl +++ b/runtime/core/portable_type/test/targets.bzl @@ -15,14 +15,6 @@ def define_common_targets(): ], ) - runtime.cxx_test( - name = "optional_test", - srcs = ["optional_test.cpp"], - deps = [ - "//executorch/runtime/core/portable_type:portable_type", - ], - ) - runtime.cxx_test( name = "tensor_test", srcs = ["tensor_test.cpp"], diff --git a/test/utils/OSSTestConfig.json b/test/utils/OSSTestConfig.json index c0877aac924..d7d0cb08567 100644 --- a/test/utils/OSSTestConfig.json +++ b/test/utils/OSSTestConfig.json @@ -75,7 +75,6 @@ "bfloat16_test.cpp", "dont_shadow_complex_test.c", "half_test.cpp", - "optional_test.cpp", "scalar_test.cpp", "tensor_impl_test.cpp", "tensor_test.cpp" From 412f5b4da65151a50027e7a80bb4f2b15df02002 Mon Sep 17 00:00:00 2001 From: Yuanyuan Chen Date: Fri, 12 Jun 2026 09:20:58 +0800 Subject: [PATCH 3/5] Remove deprecated string_view aliases, migrate callers to std::string_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 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. --- .../generic/operators/op_linalg_svd.cpp | 2 +- .../cadence/generic/operators/op_linalg_svd.h | 2 +- .../flat_tensor/flat_tensor_data_map.cpp | 8 ++--- extension/flat_tensor/flat_tensor_data_map.h | 6 ++-- extension/named_data_map/merged_data_map.cpp | 2 +- extension/named_data_map/merged_data_map.h | 6 ++-- runtime/core/exec_aten/exec_aten.h | 2 +- .../core/exec_aten/util/scalar_type_util.h | 2 +- runtime/core/named_data_map.h | 10 +++---- runtime/core/portable_type/string_view.h | 29 ------------------- runtime/core/portable_type/targets.bzl | 1 - runtime/executor/merged_data_map.h | 7 ++--- runtime/executor/pte_data_map.cpp | 3 +- runtime/executor/pte_data_map.h | 7 ++--- runtime/executor/test/method_meta_test.cpp | 4 +-- 15 files changed, 28 insertions(+), 63 deletions(-) delete mode 100644 runtime/core/portable_type/string_view.h diff --git a/backends/cadence/generic/operators/op_linalg_svd.cpp b/backends/cadence/generic/operators/op_linalg_svd.cpp index 936456167aa..4cb4f6397ea 100644 --- a/backends/cadence/generic/operators/op_linalg_svd.cpp +++ b/backends/cadence/generic/operators/op_linalg_svd.cpp @@ -261,7 +261,7 @@ std::tuple linalg_svd_out( const Tensor& A, bool full_matrices, bool compute_uv, - std::optional<::executorch::aten::string_view> driver, + std::optional driver, Tensor& U, Tensor& S, Tensor& Vh) { diff --git a/backends/cadence/generic/operators/op_linalg_svd.h b/backends/cadence/generic/operators/op_linalg_svd.h index 6ad0aea2786..e8335b7fa0e 100644 --- a/backends/cadence/generic/operators/op_linalg_svd.h +++ b/backends/cadence/generic/operators/op_linalg_svd.h @@ -26,7 +26,7 @@ linalg_svd_out( const ::executorch::aten::Tensor& A, bool full_matrices, bool compute_uv, - std::optional<::executorch::aten::string_view> driver, + std::optional driver, ::executorch::aten::Tensor& U, ::executorch::aten::Tensor& S, ::executorch::aten::Tensor& Vh); diff --git a/extension/flat_tensor/flat_tensor_data_map.cpp b/extension/flat_tensor/flat_tensor_data_map.cpp index 845778f45c2..342e29e63fc 100644 --- a/extension/flat_tensor/flat_tensor_data_map.cpp +++ b/extension/flat_tensor/flat_tensor_data_map.cpp @@ -49,7 +49,7 @@ bool is_aligned(const void* data) { } Result get_named_data( - executorch::aten::string_view key, + std::string_view key, const flatbuffers::Vector< flatbuffers::Offset>* named_data, const flatbuffers::Vector< @@ -127,7 +127,7 @@ Result create_tensor_layout( } // namespace ET_NODISCARD Result FlatTensorDataMap::get_tensor_layout( - executorch::aten::string_view key) const { + std::string_view key) const { Result segment_end_offset = get_segment_end_offset(header_); if (!segment_end_offset.ok()) { return segment_end_offset.error(); @@ -144,7 +144,7 @@ ET_NODISCARD Result FlatTensorDataMap::get_tensor_layout( } ET_NODISCARD Result FlatTensorDataMap::get_data( - executorch::aten::string_view key) const { + std::string_view key) const { Result segment_end_offset = get_segment_end_offset(header_); if (!segment_end_offset.ok()) { return segment_end_offset.error(); @@ -170,7 +170,7 @@ ET_NODISCARD Result FlatTensorDataMap::get_data( } ET_NODISCARD Error FlatTensorDataMap::load_data_into( - ET_UNUSED executorch::aten::string_view key, + ET_UNUSED std::string_view key, ET_UNUSED void* buffer, ET_UNUSED size_t size) const { Result segment_end_offset = get_segment_end_offset(header_); diff --git a/extension/flat_tensor/flat_tensor_data_map.h b/extension/flat_tensor/flat_tensor_data_map.h index 751e312f7ef..7b66eeab470 100644 --- a/extension/flat_tensor/flat_tensor_data_map.h +++ b/extension/flat_tensor/flat_tensor_data_map.h @@ -54,7 +54,7 @@ class FlatTensorDataMap final ET_NODISCARD executorch::runtime::Result< const executorch::ET_RUNTIME_NAMESPACE::TensorLayout> - get_tensor_layout(executorch::aten::string_view key) const override; + get_tensor_layout(std::string_view key) const override; /** * Retrieve read-only data for the specified key. @@ -65,7 +65,7 @@ class FlatTensorDataMap final */ ET_NODISCARD executorch::runtime::Result get_data( - executorch::aten::string_view key) const override; + std::string_view key) const override; /** * Loads the data of the specified tensor into the provided buffer. @@ -78,7 +78,7 @@ class FlatTensorDataMap final * @returns an Error indicating if the load was successful. */ ET_NODISCARD executorch::runtime::Error load_data_into( - executorch::aten::string_view key, + std::string_view key, void* buffer, size_t size) const override; diff --git a/extension/named_data_map/merged_data_map.cpp b/extension/named_data_map/merged_data_map.cpp index 630395e006c..d76f741fbf4 100644 --- a/extension/named_data_map/merged_data_map.cpp +++ b/extension/named_data_map/merged_data_map.cpp @@ -12,13 +12,13 @@ #include #include -using executorch::aten::string_view; using executorch::ET_RUNTIME_NAMESPACE::NamedDataMap; using executorch::ET_RUNTIME_NAMESPACE::TensorLayout; using executorch::runtime::Error; using executorch::runtime::FreeableBuffer; using executorch::runtime::Result; using executorch::runtime::Span; +using std::string_view; namespace executorch::extension { namespace ET_MERGED_DATA_MAP_NAMESPACE { diff --git a/extension/named_data_map/merged_data_map.h b/extension/named_data_map/merged_data_map.h index 42490ec3d58..cc291b4d093 100644 --- a/extension/named_data_map/merged_data_map.h +++ b/extension/named_data_map/merged_data_map.h @@ -48,7 +48,7 @@ class MergedDataMap final ET_NODISCARD executorch::runtime::Result< const executorch::ET_RUNTIME_NAMESPACE::TensorLayout> - get_tensor_layout(executorch::aten::string_view key) const override; + get_tensor_layout(std::string_view key) const override; /** * Retrieve read-only data for the specified key. @@ -59,7 +59,7 @@ class MergedDataMap final */ ET_NODISCARD executorch::runtime::Result get_data( - executorch::aten::string_view key) const override; + std::string_view key) const override; /** * Loads the data of the specified tensor into the provided buffer. @@ -72,7 +72,7 @@ class MergedDataMap final * @returns an Error indicating if the load was successful. */ ET_NODISCARD executorch::runtime::Error load_data_into( - executorch::aten::string_view key, + std::string_view key, void* buffer, size_t size) const override; diff --git a/runtime/core/exec_aten/exec_aten.h b/runtime/core/exec_aten/exec_aten.h index 64d0fba177b..bdac41ba509 100644 --- a/runtime/core/exec_aten/exec_aten.h +++ b/runtime/core/exec_aten/exec_aten.h @@ -9,6 +9,7 @@ #pragma once #include +#include #include // @manual #include // @manual @@ -46,7 +47,6 @@ #include // @manual #include // @manual #include // @manual -#include // @manual #include // @manual #include // @manual diff --git a/runtime/core/exec_aten/util/scalar_type_util.h b/runtime/core/exec_aten/util/scalar_type_util.h index 3e8e36b442e..10b6ed2c6ac 100644 --- a/runtime/core/exec_aten/util/scalar_type_util.h +++ b/runtime/core/exec_aten/util/scalar_type_util.h @@ -47,7 +47,7 @@ using ScalarType = at::ScalarType; } // namespace executorch #else // !USE_ATEN_LIB #include -#include +#include namespace executorch { namespace aten { using ScalarType = torch::executor::ScalarType; diff --git a/runtime/core/named_data_map.h b/runtime/core/named_data_map.h index c6b6aa4bb7b..dbd5b21a66f 100644 --- a/runtime/core/named_data_map.h +++ b/runtime/core/named_data_map.h @@ -31,7 +31,7 @@ class NamedDataMap { * @return Result containing TensorLayout. */ ET_NODISCARD virtual Result get_tensor_layout( - executorch::aten::string_view key) const = 0; + std::string_view key) const = 0; /** * Get data by key. * @@ -39,7 +39,7 @@ class NamedDataMap { * @return Result containing a FreeableBuffer. */ ET_NODISCARD virtual Result get_data( - executorch::aten::string_view key) const = 0; + std::string_view key) const = 0; /** * Loads data corresponding to the key into the provided buffer. @@ -51,10 +51,8 @@ class NamedDataMap { * `size` bytes of memory. * @returns an Error indicating if the load was successful. */ - ET_NODISCARD virtual Error load_data_into( - executorch::aten::string_view key, - void* buffer, - size_t size) const = 0; + ET_NODISCARD virtual Error + load_data_into(std::string_view key, void* buffer, size_t size) const = 0; /** * Get the number of keys in the NamedDataMap. diff --git a/runtime/core/portable_type/string_view.h b/runtime/core/portable_type/string_view.h deleted file mode 100644 index 8e28fa022cc..00000000000 --- a/runtime/core/portable_type/string_view.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace executorch { -namespace runtime { -namespace etensor { - -using std::string_view; - -} // namespace etensor -} // namespace runtime -} // namespace executorch - -namespace torch { -namespace executor { -// TODO(T197294990): Remove these deprecated aliases once all users have moved -// to the new `::executorch` namespaces. -using ::executorch::runtime::etensor::string_view; -} // namespace executor -} // namespace torch diff --git a/runtime/core/portable_type/targets.bzl b/runtime/core/portable_type/targets.bzl index 37f1e073962..bfa2ecd2a30 100644 --- a/runtime/core/portable_type/targets.bzl +++ b/runtime/core/portable_type/targets.bzl @@ -17,7 +17,6 @@ def define_common_targets(): "scalar.h", "tensor.h", "tensor_impl.h", - "string_view.h", "device.h", ], # Only should be depended on by kernel_types:kernel_types, but various suffixes like Android and Static diff --git a/runtime/executor/merged_data_map.h b/runtime/executor/merged_data_map.h index d5ae97057f2..aae92d90a9b 100644 --- a/runtime/executor/merged_data_map.h +++ b/runtime/executor/merged_data_map.h @@ -57,7 +57,7 @@ class MergedDataMap final : public NamedDataMap { */ ET_NODISCARD Result get_tensor_layout( - executorch::aten::string_view key) const override { + std::string_view key) const override { auto layout = first_->get_tensor_layout(key); if (layout.ok()) { return layout.get(); @@ -76,8 +76,7 @@ class MergedDataMap final : public NamedDataMap { * @return error if the key is not present or data cannot be loaded. */ ET_NODISCARD - Result get_data( - executorch::aten::string_view key) const override { + Result get_data(std::string_view key) const override { auto data = first_->get_data(key); if (data.error() != Error::NotFound) { return data; @@ -97,7 +96,7 @@ class MergedDataMap final : public NamedDataMap { * @returns an Error indicating if the load was successful. */ ET_NODISCARD Error load_data_into( - ET_UNUSED executorch::aten::string_view key, + ET_UNUSED std::string_view key, ET_UNUSED void* buffer, ET_UNUSED size_t size) const override { return Error::NotImplemented; diff --git a/runtime/executor/pte_data_map.cpp b/runtime/executor/pte_data_map.cpp index 881bfd5165a..e35745e7689 100644 --- a/runtime/executor/pte_data_map.cpp +++ b/runtime/executor/pte_data_map.cpp @@ -26,8 +26,7 @@ namespace internal { } ET_NODISCARD -Result PteDataMap::get_data( - executorch::aten::string_view key) const { +Result PteDataMap::get_data(std::string_view key) const { for (uint32_t i = 0; i < named_data_->size(); i++) { const auto* named_data_item = named_data_->Get(i); ET_CHECK_OR_RETURN_ERROR( diff --git a/runtime/executor/pte_data_map.h b/runtime/executor/pte_data_map.h index b4b46a6b541..36d33ae3945 100644 --- a/runtime/executor/pte_data_map.h +++ b/runtime/executor/pte_data_map.h @@ -79,7 +79,7 @@ class PteDataMap final : public NamedDataMap { */ ET_NODISCARD Result get_tensor_layout( - ET_UNUSED executorch::aten::string_view key) const override { + ET_UNUSED std::string_view key) const override { return Error::NotImplemented; } @@ -91,14 +91,13 @@ class PteDataMap final : public NamedDataMap { * @return error if the key is not present or data cannot be loaded. */ ET_NODISCARD - Result get_data( - executorch::aten::string_view key) const override; + Result get_data(std::string_view key) const override; /** * The PteDataMap currently does not implement load_into. */ ET_NODISCARD Error load_data_into( - ET_UNUSED executorch::aten::string_view key, + ET_UNUSED std::string_view key, ET_UNUSED void* buffer, ET_UNUSED size_t size) const override { return Error::NotImplemented; diff --git a/runtime/executor/test/method_meta_test.cpp b/runtime/executor/test/method_meta_test.cpp index a1991a0562c..1324a40cf52 100644 --- a/runtime/executor/test/method_meta_test.cpp +++ b/runtime/executor/test/method_meta_test.cpp @@ -38,7 +38,7 @@ class TensorInfoTestFriend final { Span dim_order, executorch::aten::ScalarType scalar_type, const bool is_memory_planned, - executorch::aten::string_view name) { + std::string_view name) { return TensorInfo::create( Span(sizes.data(), sizes.size()), Span(dim_order.data(), dim_order.size()), @@ -236,7 +236,7 @@ TEST_F(MethodMetaTest, TensorInfoSizeOverflow) { Span(dim_order.data(), dim_order.size()), executorch::aten::ScalarType::Float, false, // is_memory_planned - executorch::aten::string_view{nullptr, 0}), + std::string_view{nullptr, 0}), ""); } From 2306d5e819df6e5327dca59935be259b8607b441 Mon Sep 17 00:00:00 2001 From: Yuanyuan Chen Date: Tue, 16 Jun 2026 11:18:11 +0800 Subject: [PATCH 4/5] Deprecate optional/string_view aliases instead of removing them The optional/string_view type aliases and their headers are public API under the API Life Cycle and Deprecation Policy, so they cannot be removed until two minor releases after being deprecated. Restore portable_type/optional.h and string_view.h (and their buck targets), now aliasing the etensor and legacy torch::executor names to std:: behind ET_DEPRECATED. The caller migration to std:: is kept; exec_aten.h and scalar_type_util.h retain the migrated std:: usages while re-including the restored headers so external users still resolve the deprecated names. --- runtime/core/exec_aten/exec_aten.h | 2 + .../core/exec_aten/util/scalar_type_util.h | 2 +- runtime/core/portable_type/optional.h | 37 +++++++++++++++++++ runtime/core/portable_type/string_view.h | 31 ++++++++++++++++ runtime/core/portable_type/targets.bzl | 2 + 5 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 runtime/core/portable_type/optional.h create mode 100644 runtime/core/portable_type/string_view.h diff --git a/runtime/core/exec_aten/exec_aten.h b/runtime/core/exec_aten/exec_aten.h index bdac41ba509..ac4fb9a126e 100644 --- a/runtime/core/exec_aten/exec_aten.h +++ b/runtime/core/exec_aten/exec_aten.h @@ -44,9 +44,11 @@ #include // @manual #include // @manual #include // @manual +#include // @manual #include // @manual #include // @manual #include // @manual +#include // @manual #include // @manual #include // @manual diff --git a/runtime/core/exec_aten/util/scalar_type_util.h b/runtime/core/exec_aten/util/scalar_type_util.h index 10b6ed2c6ac..3e8e36b442e 100644 --- a/runtime/core/exec_aten/util/scalar_type_util.h +++ b/runtime/core/exec_aten/util/scalar_type_util.h @@ -47,7 +47,7 @@ using ScalarType = at::ScalarType; } // namespace executorch #else // !USE_ATEN_LIB #include -#include +#include namespace executorch { namespace aten { using ScalarType = torch::executor::ScalarType; diff --git a/runtime/core/portable_type/optional.h b/runtime/core/portable_type/optional.h new file mode 100644 index 00000000000..deff1f1b2cc --- /dev/null +++ b/runtime/core/portable_type/optional.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include + +#include + +namespace executorch { +namespace runtime { +namespace etensor { + +template +using optional ET_DEPRECATED = std::optional; +using nullopt_t ET_DEPRECATED = std::nullopt_t; +ET_DEPRECATED inline constexpr std::nullopt_t nullopt{std::nullopt}; + +} // namespace etensor +} // namespace runtime +} // namespace executorch + +namespace torch { +namespace executor { +// TODO(T197294990): Remove these deprecated aliases once all users have moved +// to the new `::executorch` namespaces. +template +using optional ET_DEPRECATED = std::optional; +using nullopt_t ET_DEPRECATED = std::nullopt_t; +ET_DEPRECATED inline constexpr std::nullopt_t nullopt{std::nullopt}; +} // namespace executor +} // namespace torch diff --git a/runtime/core/portable_type/string_view.h b/runtime/core/portable_type/string_view.h new file mode 100644 index 00000000000..f1f25f0b881 --- /dev/null +++ b/runtime/core/portable_type/string_view.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include + +#include + +namespace executorch { +namespace runtime { +namespace etensor { + +using string_view ET_DEPRECATED = std::string_view; + +} // namespace etensor +} // namespace runtime +} // namespace executorch + +namespace torch { +namespace executor { +// TODO(T197294990): Remove these deprecated aliases once all users have moved +// to the new `::executorch` namespaces. +using string_view ET_DEPRECATED = std::string_view; +} // namespace executor +} // namespace torch diff --git a/runtime/core/portable_type/targets.bzl b/runtime/core/portable_type/targets.bzl index bfa2ecd2a30..0a368bd6379 100644 --- a/runtime/core/portable_type/targets.bzl +++ b/runtime/core/portable_type/targets.bzl @@ -14,9 +14,11 @@ def define_common_targets(): srcs = ["tensor_impl.cpp"], exported_headers = [ "tensor_options.h", + "optional.h", "scalar.h", "tensor.h", "tensor_impl.h", + "string_view.h", "device.h", ], # Only should be depended on by kernel_types:kernel_types, but various suffixes like Android and Static From d72f5d74d78ccda8af2a39bee156ba5922c7be4d Mon Sep 17 00:00:00 2001 From: cyy Date: Wed, 17 Jun 2026 13:02:43 +0800 Subject: [PATCH 5/5] Apply lintrunner formatting fixes --- codegen/api/et_cpp.py | 1 - codegen/api/types/types.py | 1 - runtime/core/portable_type/test/CMakeLists.txt | 9 ++------- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/codegen/api/et_cpp.py b/codegen/api/et_cpp.py index 1a823b98a5b..a144128368c 100644 --- a/codegen/api/et_cpp.py +++ b/codegen/api/et_cpp.py @@ -40,7 +40,6 @@ tensorT, ) - if TYPE_CHECKING: from collections.abc import Sequence diff --git a/codegen/api/types/types.py b/codegen/api/types/types.py index 07c7f7e196a..dd80daebb33 100644 --- a/codegen/api/types/types.py +++ b/codegen/api/types/types.py @@ -16,7 +16,6 @@ ) from torchgen.model import BaseTy - halfT = BaseCppType("torch::executor", "Half") bfloat16T = BaseCppType("torch::executor", "BFloat16") stringT = BaseCppType("torch::executor", "string_view") diff --git a/runtime/core/portable_type/test/CMakeLists.txt b/runtime/core/portable_type/test/CMakeLists.txt index 8aa27d4d877..15fda045875 100644 --- a/runtime/core/portable_type/test/CMakeLists.txt +++ b/runtime/core/portable_type/test/CMakeLists.txt @@ -19,13 +19,8 @@ set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) include(${EXECUTORCH_ROOT}/tools/cmake/Test.cmake) -set(_test_srcs - bfloat16_test.cpp - dont_shadow_complex_test.c - half_test.cpp - scalar_test.cpp - tensor_impl_test.cpp - tensor_test.cpp +set(_test_srcs bfloat16_test.cpp dont_shadow_complex_test.c half_test.cpp + scalar_test.cpp tensor_impl_test.cpp tensor_test.cpp ) et_cxx_test(runtime_core_portable_type_test SOURCES ${_test_srcs} EXTRA_LIBS)