Skip to content

Commit d438f89

Browse files
author
Zonglin Peng
committed
fixed all hifi ops and cmake
1 parent a01571f commit d438f89

File tree

12 files changed

+34
-20
lines changed

12 files changed

+34
-20
lines changed

backends/cadence/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ endif()
2222
include(${EXECUTORCH_ROOT}/build/Utils.cmake)
2323

2424
# Let files say "include <executorch/path/to/header.h>".
25-
set(_common_include_directories ${EXECUTORCH_ROOT}/..)
25+
set(_common_include_directories ${EXECUTORCH_ROOT}/..
26+
${EXECUTORCH_ROOT}/runtime/core/portable_type)
27+
28+
add_compile_definitions(C10_USING_CUSTOM_GENERATED_MACROS)
2629

2730
if(EXECUTORCH_CADENCE_CPU_RUNNER)
2831
include(${EXECUTORCH_ROOT}/build/Codegen.cmake)
@@ -74,10 +77,12 @@ endif()
7477

7578
if(EXECUTORCH_NNLIB_OPT)
7679
set(TARGET_DIR hifi)
77-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_DIR}/third-party/nnlib)
80+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_DIR}/third-party/nnlib
81+
${EXECUTORCH_ROOT}/runtime/core/portable_type/c10)
7882
elseif(EXECUTORCH_FUSION_G3_OPT)
7983
set(TARGET_DIR fusion_g3)
80-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_DIR}/third-party/nnlib)
84+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_DIR}/third-party/nnlib
85+
${EXECUTORCH_ROOT}/runtime/core/portable_type/c10)
8186
else()
8287
set(TARGET_DIR reference)
8388
endif()

backends/cadence/aot/functions_hifi.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,6 @@
219219
- arg_meta: null
220220
kernel_name: cadence::impl::HiFi::quantized_relu_per_tensor_out
221221

222-
- func: cadence::quantized_linear.per_tensor_out(Tensor src, Tensor weight, Tensor bias, SymInt src_zero_point, SymInt weight_zero_point, SymInt out_multiplier, SymInt out_shift, SymInt out_zero_point, Tensor? offset, *, Tensor(a!) out) -> Tensor(a!)
223-
kernels:
224-
- arg_meta: null
225-
kernel_name: cadence::impl::HiFi::quantized_linear_per_tensor_out
226-
227222
- func: cadence::quantized_fully_connected.out(Tensor src, Tensor weight, Tensor bias, int src_zero_point, Tensor weight_zero_point, Tensor out_multiplier, Tensor out_shift, int out_zero_point, Tensor? offset, *, Tensor(a!) out) -> Tensor(a!)
228223
kernels:
229224
- arg_meta: null

backends/cadence/fusion_g3/operators/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ target_link_libraries(aten_ops_cadence PUBLIC executorch)
6464
target_link_libraries(aten_ops_cadence PRIVATE xa_nnlib)
6565

6666
# Let files say "include <executorch/path/to/header.h>".
67-
set(_common_include_directories ${EXECUTORCH_ROOT}/..)
67+
set(_common_include_directories ${EXECUTORCH_ROOT}/..
68+
${EXECUTORCH_ROOT}/runtime/core/portable_type/c10)
6869

6970
target_include_directories(
7071
aten_ops_cadence PUBLIC ${ROOT_DIR}/.. ${CMAKE_BINARY_DIR}

backends/cadence/hifi/kernels/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ add_library(
2525
${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/xa_nn_transpose_32.c
2626
)
2727
# Let files say "include <executorch/path/to/header.h>".
28-
set(_common_include_directories ${EXECUTORCH_ROOT}/..)
28+
set(_common_include_directories ${EXECUTORCH_ROOT}/..
29+
${EXECUTORCH_ROOT}/runtime/core/portable_type/c10)
2930

3031
target_include_directories(
3132
cadence_kernels

backends/cadence/hifi/operators/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ target_link_libraries(aten_ops_cadence PUBLIC executorch)
6767
target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels)
6868

6969
# Let files say "include <executorch/path/to/header.h>".
70-
set(_common_include_directories ${EXECUTORCH_ROOT}/..)
70+
set(_common_include_directories ${EXECUTORCH_ROOT}/..
71+
${EXECUTORCH_ROOT}/runtime/core/portable_type/c10)
7172

7273
target_include_directories(
7374
aten_ops_cadence PUBLIC ${ROOT_DIR}/.. ${CMAKE_BINARY_DIR}
@@ -77,7 +78,7 @@ target_include_directories(
7778
# Custom ops that are needed to run the test model.
7879
add_library(
7980
custom_ops "op_quantized_linear_out.cpp" "op_quantized_layer_norm.cpp"
80-
"op_quantize_per_tensor.cpp" "op_quantized_relu_out.cpp" "op_dequantize_per_tensor.cpp"
81+
"op_quantize_per_tensor.cpp" "op_quantized_relu_out.cpp" "op_dequantize_per_tensor.cpp" "op_quantized_fully_connected_out"
8182
)
8283
target_include_directories(
8384
custom_ops PUBLIC ${ROOT_DIR}/.. ${CMAKE_BINARY_DIR}

backends/cadence/hifi/operators/op_clamp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ Tensor& clamp_tensor_out(
328328
const executorch::aten::optional<Tensor>& min_opt,
329329
const executorch::aten::optional<Tensor>& max_opt,
330330
Tensor& out) {
331-
clamp_Tensor_out(ctx, in, min_opt, max_opt, out);
331+
return clamp_Tensor_out(ctx, in, min_opt, max_opt, out);
332332
}
333333

334334
} // namespace native

backends/cadence/hifi/operators/op_mean.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Tensor& mean_dim_out(
175175
bool keepdim,
176176
optional<ScalarType> dtype,
177177
Tensor& out) {
178-
mean_out(ctx, in, dim_list, keepdim, dtype, out);
178+
return mean_out(ctx, in, dim_list, keepdim, dtype, out);
179179
}
180180

181181
} // namespace native

backends/cadence/hifi/operators/op_quantized_relu_out.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ void quantized_relu_per_tensor_out(
100100
void quantized_relu_out(
101101
KernelRuntimeContext& ctx,
102102
const Tensor& input,
103-
const int64_t in_zero_point,
103+
const Tensor& in_zero_point,
104104
const int64_t out_zero_point,
105-
const int64_t out_multiplier,
106-
const int64_t out_shift,
105+
const Tensor& out_multiplier,
106+
const Tensor& out_shift,
107107
Tensor& output) {
108108
quantized_relu_per_tensor_out(
109109
ctx,

backends/cadence/hifi/operators/op_softmax.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ Tensor& softmax_out(
200200
int64_t dim,
201201
bool half_to_float,
202202
Tensor& out) {
203-
_softmax_out(ctx, in, dim, half_to_float, out);
203+
return _softmax_out(ctx, in, dim, half_to_float, out);
204204
}
205205

206206
} // namespace native

backends/cadence/hifi/operators/op_where.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,15 @@ Tensor& where_self_out(
183183
return out;
184184
}
185185

186+
Tensor& where_out(
187+
RuntimeContext& ctx,
188+
const Tensor& cond,
189+
const Tensor& a,
190+
const Tensor& b,
191+
Tensor& out) {
192+
return where_out(ctx, cond, a, b, out);
193+
}
194+
186195
} // namespace native
187196
} // namespace HiFi
188197
} // namespace impl

backends/cadence/reference/kernels/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
add_library(cadence_kernels kernels.cpp)
99

1010
# Let files say "include <executorch/path/to/header.h>".
11-
set(_common_include_directories ${EXECUTORCH_ROOT}/..)
11+
set(_common_include_directories ${EXECUTORCH_ROOT}/..
12+
${EXECUTORCH_ROOT}/runtime/core/portable_type/c10)
1213

1314
target_include_directories(cadence_kernels PUBLIC .
1415
${_common_include_directories}

backends/cadence/reference/operators/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ target_link_libraries(aten_ops_cadence PUBLIC executorch)
7171
target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels)
7272

7373
# Let files say "include <executorch/path/to/header.h>".
74-
set(_common_include_directories ${EXECUTORCH_ROOT}/..)
74+
set(_common_include_directories ${EXECUTORCH_ROOT}/..
75+
${EXECUTORCH_ROOT}/runtime/core/portable_type/c10)
7576

7677
target_include_directories(
7778
aten_ops_cadence PUBLIC ${ROOT_DIR}/.. ${CMAKE_BINARY_DIR}

0 commit comments

Comments
 (0)