Skip to content

Commit 1e4a9a5

Browse files
zonglinpengfacebook-github-bot
authored andcommitted
fix and link
Differential Revision: D75700041
1 parent bc01fc2 commit 1e4a9a5

File tree

14 files changed

+157
-145
lines changed

14 files changed

+157
-145
lines changed

backends/cadence/hifi/kernels/kernels.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#pragma once
1010
#include <executorch/runtime/kernel/kernel_includes.h>
11-
#include <inttypes.h>
1211
#include <stddef.h>
1312
#include <xa_type_def.h>
1413
/* For NNLIB APIs */

backends/cadence/hifi/operators/op_bitwise_and.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
#include <executorch/kernels/portable/cpu/util/broadcast_util.h>
1414
#include <executorch/kernels/portable/cpu/util/functional_util.h>
1515
#include <executorch/runtime/kernel/kernel_includes.h>
16-
#include <functional>
1716

1817
using exec_aten::Scalar;
1918
using exec_aten::ScalarType;
2019
using exec_aten::Tensor;
21-
using executorch::runtime::canCast;
2220
using executorch::runtime::can_cast;
21+
using executorch::runtime::canCast;
2322
using executorch::runtime::CppTypeToScalarType;
2423
using executorch::runtime::KernelRuntimeContext;
2524
using executorch::runtime::promoteTypes;
@@ -74,8 +73,10 @@ Tensor& bitwise_and_Tensor_out(
7473

7574
if (optimized) {
7675
if (broadcast) {
77-
WORD8* __restrict__ ptr1 = (WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
78-
WORD8* __restrict__ ptr2 = (WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
76+
WORD8* __restrict__ ptr1 =
77+
(WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
78+
WORD8* __restrict__ ptr2 =
79+
(WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
7980

8081
const WORD8* __restrict__ pin1 =
8182
(const WORD8* __restrict__)a.const_data_ptr<bool>();
@@ -105,7 +106,8 @@ Tensor& bitwise_and_Tensor_out(
105106

106107
xa_nn_elm_logicaland_boolxbool_bool(p_out, p_inp1, p_inp2, num_elm);
107108
} else if (a_is_broadcasted && !b_is_broadcasted) {
108-
WORD8* __restrict__ ptr1 = (WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
109+
WORD8* __restrict__ ptr1 =
110+
(WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
109111

110112
const WORD8* __restrict__ pin1 =
111113
(const WORD8* __restrict__)a.const_data_ptr<bool>();
@@ -129,7 +131,8 @@ Tensor& bitwise_and_Tensor_out(
129131

130132
xa_nn_elm_logicaland_boolxbool_bool(p_out, p_inp1, p_inp2, num_elm);
131133
} else if (!a_is_broadcasted && b_is_broadcasted) {
132-
WORD8* __restrict__ ptr1 = (WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
134+
WORD8* __restrict__ ptr1 =
135+
(WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
133136

134137
const WORD8* __restrict__ p_inp1 =
135138
(const WORD8* __restrict__)a.const_data_ptr<bool>();
@@ -166,7 +169,8 @@ Tensor& bitwise_and_Tensor_out(
166169
return out;
167170
}
168171

169-
return torch::executor::native::internal::bitwise_tensor_out<op_name>(ctx, a, b, out);
172+
return torch::executor::native::internal::bitwise_tensor_out<op_name>(
173+
ctx, a, b, out);
170174
}
171175

172176
Tensor& bitwise_and_Scalar_out(
@@ -183,4 +187,4 @@ Tensor& bitwise_and_Scalar_out(
183187
} // namespace native
184188
} // namespace HiFi
185189
} // namespace impl
186-
} // namespace cadence
190+
} // namespace cadence

backends/cadence/hifi/operators/op_bitwise_or.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
#include <executorch/kernels/portable/cpu/util/broadcast_util.h>
1414
#include <executorch/kernels/portable/cpu/util/functional_util.h>
1515
#include <executorch/runtime/kernel/kernel_includes.h>
16-
#include <functional>
1716

1817
using exec_aten::Scalar;
1918
using exec_aten::ScalarType;
2019
using exec_aten::Tensor;
21-
using executorch::runtime::canCast;
2220
using executorch::runtime::can_cast;
21+
using executorch::runtime::canCast;
2322
using executorch::runtime::CppTypeToScalarType;
2423
using executorch::runtime::KernelRuntimeContext;
2524
using executorch::runtime::promoteTypes;
@@ -74,8 +73,10 @@ Tensor& bitwise_or_Tensor_out(
7473

7574
if (optimized) {
7675
if (broadcast) {
77-
WORD8* __restrict__ ptr1 = (WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
78-
WORD8* __restrict__ ptr2 = (WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
76+
WORD8* __restrict__ ptr1 =
77+
(WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
78+
WORD8* __restrict__ ptr2 =
79+
(WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
7980

8081
const WORD8* __restrict__ pin1 =
8182
(const WORD8* __restrict__)a.const_data_ptr<bool>();
@@ -105,7 +106,8 @@ Tensor& bitwise_or_Tensor_out(
105106

106107
xa_nn_elm_logicalor_boolxbool_bool(p_out, p_inp1, p_inp2, num_elm);
107108
} else if (a_is_broadcasted && !b_is_broadcasted) {
108-
WORD8* __restrict__ ptr1 = (WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
109+
WORD8* __restrict__ ptr1 =
110+
(WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
109111

110112
const WORD8* __restrict__ pin1 =
111113
(const WORD8* __restrict__)a.const_data_ptr<bool>();
@@ -129,7 +131,8 @@ Tensor& bitwise_or_Tensor_out(
129131

130132
xa_nn_elm_logicalor_boolxbool_bool(p_out, p_inp1, p_inp2, num_elm);
131133
} else if (!a_is_broadcasted && b_is_broadcasted) {
132-
WORD8* __restrict__ ptr1 = (WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
134+
WORD8* __restrict__ ptr1 =
135+
(WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
133136

134137
const WORD8* __restrict__ p_inp1 =
135138
(const WORD8* __restrict__)a.const_data_ptr<bool>();
@@ -166,7 +169,8 @@ Tensor& bitwise_or_Tensor_out(
166169
return out;
167170
}
168171

169-
return torch::executor::native::internal::bitwise_tensor_out<op_name>(ctx, a, b, out);
172+
return torch::executor::native::internal::bitwise_tensor_out<op_name>(
173+
ctx, a, b, out);
170174
}
171175

172176
Tensor& bitwise_or_Scalar_out(
@@ -183,4 +187,4 @@ Tensor& bitwise_or_Scalar_out(
183187
} // namespace native
184188
} // namespace HiFi
185189
} // namespace impl
186-
} // namespace cadence
190+
} // namespace cadence

backends/cadence/hifi/operators/op_bitwise_xor.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
#include <executorch/kernels/portable/cpu/util/broadcast_util.h>
1414
#include <executorch/kernels/portable/cpu/util/functional_util.h>
1515
#include <executorch/runtime/kernel/kernel_includes.h>
16-
#include <functional>
1716

1817
using exec_aten::Scalar;
1918
using exec_aten::ScalarType;
2019
using exec_aten::Tensor;
21-
using executorch::runtime::canCast;
2220
using executorch::runtime::can_cast;
21+
using executorch::runtime::canCast;
2322
using executorch::runtime::CppTypeToScalarType;
2423
using executorch::runtime::KernelRuntimeContext;
2524
using executorch::runtime::promoteTypes;
@@ -74,8 +73,10 @@ Tensor& bitwise_xor_Tensor_out(
7473

7574
if (optimized) {
7675
if (broadcast) {
77-
WORD8* __restrict__ ptr1 = (WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
78-
WORD8* __restrict__ ptr2 = (WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
76+
WORD8* __restrict__ ptr1 =
77+
(WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
78+
WORD8* __restrict__ ptr2 =
79+
(WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
7980

8081
const WORD8* __restrict__ pin1 =
8182
(const WORD8* __restrict__)a.const_data_ptr<bool>();
@@ -105,7 +106,8 @@ Tensor& bitwise_xor_Tensor_out(
105106

106107
xa_nn_elm_logicalxor_boolxbool_bool(p_out, p_inp1, p_inp2, num_elm);
107108
} else if (a_is_broadcasted && !b_is_broadcasted) {
108-
WORD8* __restrict__ ptr1 = (WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
109+
WORD8* __restrict__ ptr1 =
110+
(WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
109111

110112
const WORD8* __restrict__ pin1 =
111113
(const WORD8* __restrict__)a.const_data_ptr<bool>();
@@ -129,7 +131,8 @@ Tensor& bitwise_xor_Tensor_out(
129131

130132
xa_nn_elm_logicalxor_boolxbool_bool(p_out, p_inp1, p_inp2, num_elm);
131133
} else if (!a_is_broadcasted && b_is_broadcasted) {
132-
WORD8* __restrict__ ptr1 = (WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
134+
WORD8* __restrict__ ptr1 =
135+
(WORD8* __restrict__)kernels::allocate_temp_memory(ctx, num_elm);
133136

134137
const WORD8* __restrict__ p_inp1 =
135138
(const WORD8* __restrict__)a.const_data_ptr<bool>();
@@ -166,7 +169,8 @@ Tensor& bitwise_xor_Tensor_out(
166169
return out;
167170
}
168171

169-
return torch::executor::native::internal::bitwise_tensor_out<op_name>(ctx, a, b, out);
172+
return torch::executor::native::internal::bitwise_tensor_out<op_name>(
173+
ctx, a, b, out);
170174
}
171175

172176
Tensor& bitwise_xor_Scalar_out(
@@ -183,4 +187,4 @@ Tensor& bitwise_xor_Scalar_out(
183187
} // namespace native
184188
} // namespace HiFi
185189
} // namespace impl
186-
} // namespace cadence
190+
} // namespace cadence

backends/cadence/hifi/operators/op_embedding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
using exec_aten::ScalarType;
2222
using exec_aten::Tensor;
23-
using executorch::runtime::tensors_have_same_dim_order;
2423
using executorch::runtime::tensor_is_default_dim_order;
24+
using executorch::runtime::tensors_have_same_dim_order;
2525
using torch::executor::check_embedding_args;
2626
using torch::executor::Error;
2727
using torch::executor::KernelRuntimeContext;

0 commit comments

Comments
 (0)