Skip to content

Commit 613b1d6

Browse files
committed
fixed lint issues
Signed-off-by: jiseong.oh <[email protected]>
1 parent ed1112e commit 613b1d6

File tree

13 files changed

+154
-141
lines changed

13 files changed

+154
-141
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,6 @@ if(EXECUTORCH_BUILD_PYBIND)
839839
list(APPEND _dep_libs enn_backend)
840840
endif()
841841

842-
843842
if(EXECUTORCH_BUILD_XNNPACK)
844843
# need to explicitly specify XNNPACK and xnnpack-microkernels-prod here
845844
# otherwise uses XNNPACK and microkernel-prod symbols from libtorch_cpu

backends/samsung/CMakeLists.txt

Lines changed: 128 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -4,145 +4,165 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7-
87
cmake_minimum_required(VERSION 3.15)
98
set(CMAKE_CXX_STANDARD 17)
109
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1110

12-
get_filename_component(EXECUTORCH_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
11+
get_filename_component(
12+
EXECUTORCH_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE
13+
)
1314

1415
if(NOT DEFINED EXYNOS_AI_LITECORE_ROOT)
15-
message(FATAL_ERROR "Please define EXYNOS_AI_LIRECORE_PATH by adding cmake parameter -DEXYNOS_AI_LITECORE_ROOT=<...>")
16+
message(
17+
FATAL_ERROR
18+
"Please define EXYNOS_AI_LIRECORE_PATH by adding cmake parameter -DEXYNOS_AI_LITECORE_ROOT=<...>"
19+
)
1620
endif()
1721
if(CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
18-
message(FATAL_ERROR "IOS is not supported on Exynos.")
22+
message(FATAL_ERROR "IOS is not supported on Exynos.")
1923
endif()
2024

2125
if(NOT FLATC_EXECUTABLE)
22-
set(FLATC_EXECUTABLE flatc)
26+
set(FLATC_EXECUTABLE flatc)
2327
endif()
2428

2529
add_compile_options(-Wall -Werror -fPIC)
2630
if(CMAKE_BUILD_TYPE STREQUAL "Release")
27-
# strip symbols
28-
add_link_options("-s")
29-
# hide dynamic symbols
30-
set(CMAKE_C_VISIBILITY_PRESET hidden)
31-
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
32-
add_definitions(-DNDEBUG)
31+
# strip symbols
32+
add_link_options("-s")
33+
# hide dynamic symbols
34+
set(CMAKE_C_VISIBILITY_PRESET hidden)
35+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
36+
add_definitions(-DNDEBUG)
3337
endif()
3438

3539
include_directories(
36-
${EXECUTORCH_SOURCE_DIR}/..
37-
${EXECUTORCH_SOURCE_DIR}/runtime/core/portable_type/c10
38-
${EXYNOS_AI_LITECORE_ROOT}
40+
${EXECUTORCH_SOURCE_DIR}/..
41+
${EXECUTORCH_SOURCE_DIR}/runtime/core/portable_type/c10
42+
${EXYNOS_AI_LITECORE_ROOT}
3943
)
4044
add_compile_definitions(C10_USING_CUSTOM_GENERATED_MACROS)
4145

4246
if(${ANDROID})
43-
find_library(android_log log)
47+
find_library(android_log log)
4448
endif()
4549

4650
# add logging library
4751
add_library(enn_logging STATIC)
4852

49-
5053
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
51-
add_subdirectory(
52-
${EXECUTORCH_SOURCE_DIR}/third-party/pybind11
53-
${CMAKE_CURRENT_BINARY_DIR}/pybind11
54-
)
55-
add_library(PyEnnWrapperAdaptor MODULE)
56-
57-
find_library(GG_API_LIB NAMES graphgen_api HINTS ${EXYNOS_AI_LITECORE_ROOT}/lib/x86_64-linux)
58-
add_library(graphgen_api SHARED IMPORTED GLOBAL)
59-
set_target_properties(graphgen_api PROPERTIES
60-
INTERFACE_INCLUDE_DIRECTORIES "${EXYNOS_AI_LITECORE_ROOT}/include"
61-
IMPORTED_LOCATION "${GG_API_LIB}"
62-
)
63-
64-
65-
set(_enn_compile_options_schema ${CMAKE_CURRENT_SOURCE_DIR}/serialization/compile_options_def.fbs)
66-
67-
set(_enn_schema_generate_dir "${CMAKE_BINARY_DIR}/schema/include/executorch/backends/samsung")
68-
# Paths to headers generated from the .fbs files.
69-
string(REGEX REPLACE "serialization/([^/]+)[.]fbs$" "\\1_generated.h" generated_header "${fbs_file}")
70-
set(_enn_schema_output "${_enn_schema_generate_dir}/${generated_header}")
71-
72-
# Generate the headers from the .fbs files.
73-
add_custom_command(
74-
OUTPUT ${_enn_schema_output}
75-
COMMAND
76-
${FLATC_EXECUTABLE} --cpp --cpp-std c++11 --scoped-enums -o
77-
"${_enn_schema_generate_dir}"
78-
${_enn_compile_options_schema}
79-
DEPENDS ${_enn_compile_options_schema}
80-
WORKING_DIRECTORY ${EXECUTORCH_SOURCE_DIR}
81-
COMMENT "Generating enn compile options headers"
82-
VERBATIM
83-
)
84-
add_custom_target(enn_compile_options_output ALL DEPENDS ${_enn_schema_output})
85-
86-
set_target_properties(PyEnnWrapperAdaptor PROPERTIES CXX_VISIBILITY_PRESET hidden)
87-
target_link_libraries(PyEnnWrapperAdaptor PRIVATE
88-
pybind11::module
89-
pybind11::lto
90-
graphgen_api
91-
enn_logging
92-
)
93-
target_include_directories(PyEnnWrapperAdaptor BEFORE PRIVATE
94-
${CMAKE_BINARY_DIR}/schema/include
95-
${EXECUTORCH_SOURCE_DIR}/third-party/flatbuffers/include
96-
)
97-
add_dependencies(PyEnnWrapperAdaptor enn_compile_options_output)
98-
pybind11_extension(PyEnnWrapperAdaptor)
99-
100-
# PyGraphWrapperAdaptor
101-
add_library(PyGraphWrapperAdaptor MODULE)
102-
#
103-
find_library(GRAPH_WRAPPER_LIB NAMES graph_wrapper HINTS ${EXYNOS_AI_LITECORE_ROOT}/lib/x86_64-linux)
104-
add_library(graph_wrapper SHARED IMPORTED GLOBAL)
105-
set_target_properties(graph_wrapper PROPERTIES
106-
INTERFACE_INCLUDE_DIRECTORIES "${EXYNOS_AI_LITECORE_ROOT}/include"
107-
IMPORTED_LOCATION "${GRAPH_WRAPPER_LIB}"
108-
)
109-
set_target_properties(PyGraphWrapperAdaptor PROPERTIES CXX_VISIBILITY_PRESET hidden)
110-
target_link_libraries(PyGraphWrapperAdaptor PRIVATE
111-
pybind11::module
112-
pybind11::lto
113-
graph_wrapper
114-
enn_logging
115-
)
116-
pybind11_extension(PyGraphWrapperAdaptor)
117-
118-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/aot)
54+
add_subdirectory(
55+
${EXECUTORCH_SOURCE_DIR}/third-party/pybind11
56+
${CMAKE_CURRENT_BINARY_DIR}/pybind11
57+
)
58+
add_library(PyEnnWrapperAdaptor MODULE)
59+
60+
find_library(
61+
GG_API_LIB
62+
NAMES graphgen_api
63+
HINTS ${EXYNOS_AI_LITECORE_ROOT}/lib/x86_64-linux
64+
)
65+
add_library(graphgen_api SHARED IMPORTED GLOBAL)
66+
set_target_properties(
67+
graphgen_api
68+
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
69+
"${EXYNOS_AI_LITECORE_ROOT}/include" IMPORTED_LOCATION
70+
"${GG_API_LIB}"
71+
)
72+
73+
set(_enn_compile_options_schema
74+
${CMAKE_CURRENT_SOURCE_DIR}/serialization/compile_options_def.fbs
75+
)
76+
77+
set(_enn_schema_generate_dir
78+
"${CMAKE_BINARY_DIR}/schema/include/executorch/backends/samsung"
79+
)
80+
# Paths to headers generated from the .fbs files.
81+
string(REGEX REPLACE "serialization/([^/]+)[.]fbs$" "\\1_generated.h"
82+
generated_header "${fbs_file}"
83+
)
84+
set(_enn_schema_output "${_enn_schema_generate_dir}/${generated_header}")
85+
86+
# Generate the headers from the .fbs files.
87+
add_custom_command(
88+
OUTPUT ${_enn_schema_output}
89+
COMMAND ${FLATC_EXECUTABLE} --cpp --cpp-std c++11 --scoped-enums -o
90+
"${_enn_schema_generate_dir}" ${_enn_compile_options_schema}
91+
DEPENDS ${_enn_compile_options_schema}
92+
WORKING_DIRECTORY ${EXECUTORCH_SOURCE_DIR}
93+
COMMENT "Generating enn compile options headers"
94+
VERBATIM
95+
)
96+
add_custom_target(
97+
enn_compile_options_output ALL DEPENDS ${_enn_schema_output}
98+
)
99+
100+
set_target_properties(
101+
PyEnnWrapperAdaptor PROPERTIES CXX_VISIBILITY_PRESET hidden
102+
)
103+
target_link_libraries(
104+
PyEnnWrapperAdaptor PRIVATE pybind11::module pybind11::lto graphgen_api
105+
enn_logging
106+
)
107+
target_include_directories(
108+
PyEnnWrapperAdaptor BEFORE
109+
PRIVATE ${CMAKE_BINARY_DIR}/schema/include
110+
${EXECUTORCH_SOURCE_DIR}/third-party/flatbuffers/include
111+
)
112+
add_dependencies(PyEnnWrapperAdaptor enn_compile_options_output)
113+
pybind11_extension(PyEnnWrapperAdaptor)
114+
115+
# PyGraphWrapperAdaptor
116+
add_library(PyGraphWrapperAdaptor MODULE)
117+
#
118+
find_library(
119+
GRAPH_WRAPPER_LIB
120+
NAMES graph_wrapper
121+
HINTS ${EXYNOS_AI_LITECORE_ROOT}/lib/x86_64-linux
122+
)
123+
add_library(graph_wrapper SHARED IMPORTED GLOBAL)
124+
set_target_properties(
125+
graph_wrapper
126+
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
127+
"${EXYNOS_AI_LITECORE_ROOT}/include" IMPORTED_LOCATION
128+
"${GRAPH_WRAPPER_LIB}"
129+
)
130+
set_target_properties(
131+
PyGraphWrapperAdaptor PROPERTIES CXX_VISIBILITY_PRESET hidden
132+
)
133+
target_link_libraries(
134+
PyGraphWrapperAdaptor PRIVATE pybind11::module pybind11::lto graph_wrapper
135+
enn_logging
136+
)
137+
pybind11_extension(PyGraphWrapperAdaptor)
138+
139+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/aot)
119140
endif()
120141

121-
122142
if(${ANDROID})
123-
target_link_libraries(enn_logging PRIVATE ${android_log})
124-
add_library(enn_backend STATIC)
125-
target_link_libraries(enn_backend PRIVATE enn_logging)
126-
executorch_target_link_options_shared_lib(enn_backend)
127-
target_compile_options(enn_backend PRIVATE -Wno-deprecated-declarations)
128-
129-
set(__enn_executor_runner_srcs ${EXECUTORCH_SOURCE_DIR}/examples/samsung/executor_runner/enn_executor_runner.cpp)
130-
add_executable(enn_executor_runner ${__enn_executor_runner_srcs})
131-
add_dependencies(enn_executor_runner enn_backend)
132-
target_link_libraries(enn_executor_runner PRIVATE
133-
enn_logging
134-
enn_backend
135-
gflags
136-
executorch
137-
extension_data_loader
138-
portable_ops_lib
139-
)
140-
set_target_properties(enn_executor_runner PROPERTIES CXX_VISIBILITY_PRESET hidden)
141-
install(
142-
TARGETS enn_backend enn_logging
143-
EXPORT ExecuTorchTargets
144-
DESTINATION lib
145-
)
143+
target_link_libraries(enn_logging PRIVATE ${android_log})
144+
add_library(enn_backend STATIC)
145+
target_link_libraries(enn_backend PRIVATE enn_logging)
146+
executorch_target_link_options_shared_lib(enn_backend)
147+
target_compile_options(enn_backend PRIVATE -Wno-deprecated-declarations)
148+
149+
set(__enn_executor_runner_srcs
150+
${EXECUTORCH_SOURCE_DIR}/examples/samsung/executor_runner/enn_executor_runner.cpp
151+
)
152+
add_executable(enn_executor_runner ${__enn_executor_runner_srcs})
153+
add_dependencies(enn_executor_runner enn_backend)
154+
target_link_libraries(
155+
enn_executor_runner PRIVATE enn_logging enn_backend gflags executorch
156+
extension_data_loader portable_ops_lib
157+
)
158+
set_target_properties(
159+
enn_executor_runner PROPERTIES CXX_VISIBILITY_PRESET hidden
160+
)
161+
install(
162+
TARGETS enn_backend enn_logging
163+
EXPORT ExecuTorchTargets
164+
DESTINATION lib
165+
)
146166
endif()
147167

148168
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/runtime)

backends/samsung/aot/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
# LICENSE file in the root directory of this source tree.
66

77
target_sources(
8-
PyEnnWrapperAdaptor PUBLIC PyEnnWrapperAdaptor.cpp
9-
PyEnnWrapperAdaptor.h
8+
PyEnnWrapperAdaptor PUBLIC PyEnnWrapperAdaptor.cpp PyEnnWrapperAdaptor.h
109
)
1110
target_sources(
12-
PyGraphWrapperAdaptor PUBLIC PyGraphWrapperAdaptor.cpp
13-
PyGraphWrapperAdaptor.h wrappers/op_param_wrapper.h
14-
wrappers/op_wrapper.h wrappers/tensor_wrapper.h
11+
PyGraphWrapperAdaptor
12+
PUBLIC PyGraphWrapperAdaptor.cpp PyGraphWrapperAdaptor.h
13+
wrappers/op_param_wrapper.h wrappers/op_wrapper.h
14+
wrappers/tensor_wrapper.h
1515
)

backends/samsung/builders/op_avg_pool2d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ def define_node(
6161

6262
if len(node.args) > 6:
6363
divisor_override = cast(int, node.args[6])
64-
assert divisor_override == kernel_size[0] * kernel_size[1], "Not supported divisor_override which is not equal to pooling region."
64+
assert (
65+
divisor_override == kernel_size[0] * kernel_size[1]
66+
), "Not supported divisor_override which is not equal to pooling region."
6567

6668
output_id = self.define_tensor(node, enn_graph, vals_to_ids)
6769

backends/samsung/builders/op_clamp.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ def define_node(
3737
if len(node.args) > 2 and node.args[2] is not None:
3838
output_max = cast(float, node.args[2])
3939

40-
params = {
41-
"minimum": output_min,
42-
"maximum": output_max
43-
}
40+
params = {"minimum": output_min, "maximum": output_max}
4441
output_id = self.define_tensor(node, enn_graph, vals_to_ids)
4542

46-
enn_graph.define_op(node.name, "CLIP", [input_id], [output_id], params)
43+
enn_graph.define_op(node.name, "CLIP", [input_id], [output_id], params)

backends/samsung/builders/op_conv2d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ def define_node(
8282
conv_type = "DECONV2D" if is_transpose_conv else "CONV2D"
8383
enn_graph.define_op(
8484
node.name, conv_type, all_input_tensors, [output_id], params
85-
)
85+
)

backends/samsung/builders/op_getitem.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class OpGetItemVisitor(NodeVisitor):
1919
"""
2020
do nothing if node is getitem
2121
"""
22+
2223
def __init__(self, *args) -> None:
2324
super().__init__(*args)
2425

backends/samsung/builders/op_hardtanh.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ def define_node(
3131

3232
output_min = cast(float, node.args[1]) if len(node.args) > 1 else -1
3333
output_max = cast(float, node.args[2]) if len(node.args) > 2 else 1
34-
params = {
35-
"minimum": output_min,
36-
"maximum": output_max
37-
}
34+
params = {"minimum": output_min, "maximum": output_max}
3835

3936
output_id = self.define_tensor(node, enn_graph, vals_to_ids)
4037

backends/samsung/builders/op_linear.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ def define_node(
4242
all_input_tensors.append(bias_id)
4343

4444
weight_shape = get_shape(weight_node)
45-
params = {
46-
"in_channels": weight_shape[1],
47-
"out_channels": weight_shape[0]
48-
}
45+
params = {"in_channels": weight_shape[1], "out_channels": weight_shape[0]}
4946

5047
output_id = self.define_tensor(node, enn_graph, vals_to_ids)
5148

backends/samsung/builders/op_mul.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,4 @@ def define_node(
3030

3131
output_id = self.define_tensor(node, enn_graph, vals_to_ids)
3232

33-
enn_graph.define_op(
34-
node.name, "ELTMUL", [input_id_1, input_id_2], [output_id]
35-
)
33+
enn_graph.define_op(node.name, "ELTMUL", [input_id_1, input_id_2], [output_id])

0 commit comments

Comments
 (0)