diff --git a/.lintrunner.toml b/.lintrunner.toml index ae0d134f8c7..2835af1bf92 100644 --- a/.lintrunner.toml +++ b/.lintrunner.toml @@ -220,6 +220,13 @@ exclude_patterns = [ 'extension/**', 'kernels/optimized/**', # Justified include. + 'kernels/portable/cpu/op_bitwise*.cpp', + 'kernels/portable/cpu/op_eq.cpp', + 'kernels/portable/cpu/op_ge.cpp', + 'kernels/portable/cpu/op_gt.cpp', + 'kernels/portable/cpu/op_le.cpp', + 'kernels/portable/cpu/op_lt.cpp', + 'kernels/portable/cpu/op_ne.cpp', 'runtime/kernel/thread_parallel_interface.h', 'scripts/**', 'third-party/**', diff --git a/kernels/portable/cpu/op_bitwise_and.cpp b/kernels/portable/cpu/op_bitwise_and.cpp index f62d0b70dd4..609dcb1e949 100644 --- a/kernels/portable/cpu/op_bitwise_and.cpp +++ b/kernels/portable/cpu/op_bitwise_and.cpp @@ -8,6 +8,8 @@ #include +#include + namespace torch { namespace executor { namespace native { @@ -19,7 +21,7 @@ Tensor& bitwise_and_Tensor_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "bitwise_and.Tensor_out"; - return internal::bitwise_tensor_out(ctx, a, b, out); + return internal::bitwise_tensor_out(ctx, a, b, out); } Tensor& bitwise_and_Scalar_out( @@ -29,7 +31,7 @@ Tensor& bitwise_and_Scalar_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "bitwise_and.Scalar_out"; - return internal::bitwise_scalar_out(ctx, a, b, out); + return internal::bitwise_scalar_out(ctx, a, b, out); } } // namespace native diff --git a/kernels/portable/cpu/op_bitwise_or.cpp b/kernels/portable/cpu/op_bitwise_or.cpp index 8028815fbf9..42cb2a6c3ba 100644 --- a/kernels/portable/cpu/op_bitwise_or.cpp +++ b/kernels/portable/cpu/op_bitwise_or.cpp @@ -8,6 +8,8 @@ #include +#include + namespace torch { namespace executor { namespace native { @@ -19,7 +21,7 @@ Tensor& bitwise_or_Tensor_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "bitwise_or.Tensor_out"; - return internal::bitwise_tensor_out(ctx, a, b, out); + return internal::bitwise_tensor_out(ctx, a, b, out); } Tensor& bitwise_or_Scalar_out( @@ -29,7 +31,7 @@ Tensor& bitwise_or_Scalar_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "bitwise_or.Scalar_out"; - return internal::bitwise_scalar_out(ctx, a, b, out); + return internal::bitwise_scalar_out(ctx, a, b, out); } } // namespace native diff --git a/kernels/portable/cpu/op_bitwise_xor.cpp b/kernels/portable/cpu/op_bitwise_xor.cpp index 85badf95789..5fe4e1708d5 100644 --- a/kernels/portable/cpu/op_bitwise_xor.cpp +++ b/kernels/portable/cpu/op_bitwise_xor.cpp @@ -8,6 +8,8 @@ #include +#include + namespace torch { namespace executor { namespace native { @@ -19,7 +21,7 @@ Tensor& bitwise_xor_Tensor_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "bitwise_xor.Tensor_out"; - return internal::bitwise_tensor_out(ctx, a, b, out); + return internal::bitwise_tensor_out(ctx, a, b, out); } Tensor& bitwise_xor_Scalar_out( @@ -29,7 +31,7 @@ Tensor& bitwise_xor_Scalar_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "bitwise_xor.Scalar_out"; - return internal::bitwise_scalar_out(ctx, a, b, out); + return internal::bitwise_scalar_out(ctx, a, b, out); } } // namespace native diff --git a/kernels/portable/cpu/op_eq.cpp b/kernels/portable/cpu/op_eq.cpp index bddb6181ee0..9e21b82c43c 100644 --- a/kernels/portable/cpu/op_eq.cpp +++ b/kernels/portable/cpu/op_eq.cpp @@ -8,6 +8,8 @@ #include +#include + namespace torch { namespace executor { namespace native { @@ -19,7 +21,8 @@ Tensor& eq_tensor_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "eq.Tensor_out"; - return internal::comparison_tensor_out(ctx, a, b, out); + return internal::comparison_tensor_out( + ctx, a, b, out); } Tensor& eq_scalar_out( @@ -29,7 +32,8 @@ Tensor& eq_scalar_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "eq.Scalar_out"; - return internal::comparison_scalar_out(ctx, a, b, out); + return internal::comparison_scalar_out( + ctx, a, b, out); } } // namespace native diff --git a/kernels/portable/cpu/op_ge.cpp b/kernels/portable/cpu/op_ge.cpp index 8457f91b548..d5e7576b7ae 100644 --- a/kernels/portable/cpu/op_ge.cpp +++ b/kernels/portable/cpu/op_ge.cpp @@ -8,6 +8,8 @@ #include +#include + namespace torch { namespace executor { namespace native { @@ -19,7 +21,8 @@ Tensor& ge_tensor_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "ge.Tensor_out"; - return internal::comparison_tensor_out(ctx, a, b, out); + return internal::comparison_tensor_out( + ctx, a, b, out); } Tensor& ge_scalar_out( @@ -29,7 +32,8 @@ Tensor& ge_scalar_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "ge.Scalar_out"; - return internal::comparison_scalar_out(ctx, a, b, out); + return internal::comparison_scalar_out( + ctx, a, b, out); } } // namespace native diff --git a/kernels/portable/cpu/op_gt.cpp b/kernels/portable/cpu/op_gt.cpp index bb1f6a274cd..cd65a3b68d9 100644 --- a/kernels/portable/cpu/op_gt.cpp +++ b/kernels/portable/cpu/op_gt.cpp @@ -8,6 +8,8 @@ #include +#include + namespace torch { namespace executor { namespace native { @@ -19,7 +21,7 @@ Tensor& gt_tensor_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "gt.Tensor_out"; - return internal::comparison_tensor_out(ctx, a, b, out); + return internal::comparison_tensor_out(ctx, a, b, out); } Tensor& gt_scalar_out( @@ -29,7 +31,7 @@ Tensor& gt_scalar_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "gt.Scalar_out"; - return internal::comparison_scalar_out(ctx, a, b, out); + return internal::comparison_scalar_out(ctx, a, b, out); } } // namespace native diff --git a/kernels/portable/cpu/op_le.cpp b/kernels/portable/cpu/op_le.cpp index e893678fc5e..909de1bfad2 100644 --- a/kernels/portable/cpu/op_le.cpp +++ b/kernels/portable/cpu/op_le.cpp @@ -8,6 +8,8 @@ #include +#include + namespace torch { namespace executor { namespace native { @@ -19,7 +21,8 @@ Tensor& le_tensor_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "le.Tensor_out"; - return internal::comparison_tensor_out(ctx, a, b, out); + return internal::comparison_tensor_out( + ctx, a, b, out); } Tensor& le_scalar_out( @@ -29,7 +32,8 @@ Tensor& le_scalar_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "le.Scalar_out"; - return internal::comparison_scalar_out(ctx, a, b, out); + return internal::comparison_scalar_out( + ctx, a, b, out); } } // namespace native diff --git a/kernels/portable/cpu/op_lt.cpp b/kernels/portable/cpu/op_lt.cpp index 6f1ffb21153..5af89920536 100644 --- a/kernels/portable/cpu/op_lt.cpp +++ b/kernels/portable/cpu/op_lt.cpp @@ -8,6 +8,8 @@ #include +#include + namespace torch { namespace executor { namespace native { @@ -19,7 +21,7 @@ Tensor& lt_tensor_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "lt.Tensor_out"; - return internal::comparison_tensor_out(ctx, a, b, out); + return internal::comparison_tensor_out(ctx, a, b, out); } Tensor& lt_scalar_out( @@ -29,7 +31,7 @@ Tensor& lt_scalar_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "lt.Scalar_out"; - return internal::comparison_scalar_out(ctx, a, b, out); + return internal::comparison_scalar_out(ctx, a, b, out); } } // namespace native diff --git a/kernels/portable/cpu/op_ne.cpp b/kernels/portable/cpu/op_ne.cpp index 5e5a2d38a33..a4b292359df 100644 --- a/kernels/portable/cpu/op_ne.cpp +++ b/kernels/portable/cpu/op_ne.cpp @@ -8,6 +8,8 @@ #include +#include + namespace torch { namespace executor { namespace native { @@ -19,7 +21,8 @@ Tensor& ne_tensor_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "ne.Tensor_out"; - return internal::comparison_tensor_out(ctx, a, b, out); + return internal::comparison_tensor_out( + ctx, a, b, out); } Tensor& ne_scalar_out( @@ -29,7 +32,8 @@ Tensor& ne_scalar_out( Tensor& out) { // @lint-ignore CLANGTIDY facebook-hte-CArray static constexpr const char op_name[] = "ne.Scalar_out"; - return internal::comparison_scalar_out(ctx, a, b, out); + return internal::comparison_scalar_out( + ctx, a, b, out); } } // namespace native diff --git a/kernels/portable/cpu/pattern/bitwise_op.h b/kernels/portable/cpu/pattern/bitwise_op.h index 6e4c111b8f2..b8d8acf3382 100644 --- a/kernels/portable/cpu/pattern/bitwise_op.h +++ b/kernels/portable/cpu/pattern/bitwise_op.h @@ -47,11 +47,13 @@ constexpr bitwise_fn get_bitwise_fn() { template struct BitwiseFnForOp { - static constexpr auto value = get_bitwise_fn(); - static_assert(value != nullptr, "unknown op_name!"); + static constexpr auto get_value() { + return get_bitwise_fn(); + } + static_assert(get_value() != nullptr, "unknown op_name!"); }; -template +template