Skip to content

Commit 5f96358

Browse files
authored
Merge branch 'main' into update-module-java
2 parents 507f47a + 78fe7ee commit 5f96358

File tree

28 files changed

+75
-85
lines changed

28 files changed

+75
-85
lines changed

CMakeLists.txt

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,33 @@ project(executorch)
4848
# MARK: - Start EXECUTORCH_H12025_BUILD_MIGRATION --------------------------------------------------
4949

5050
include(${PROJECT_SOURCE_DIR}/tools/cmake/common/preset.cmake)
51+
include(${PROJECT_SOURCE_DIR}/tools/cmake/Utils.cmake)
52+
include(CMakeDependentOption)
53+
include(ExternalProject)
5154

5255
if(NOT CMAKE_CXX_STANDARD)
5356
set(CMAKE_CXX_STANDARD 17)
5457
endif()
5558
announce_configured_options(CMAKE_CXX_STANDARD)
5659

60+
if(NOT CMAKE_SYSTEM_PROCESSOR)
61+
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
62+
endif()
63+
announce_configured_options(CMAKE_SYSTEM_PROCESSOR)
64+
5765
if(NOT CMAKE_BUILD_TYPE)
5866
set(CMAKE_BUILD_TYPE Debug)
5967
endif()
6068
announce_configured_options(CMAKE_BUILD_TYPE)
6169

70+
if(NOT PYTHON_EXECUTABLE)
71+
resolve_python_executable()
72+
endif()
73+
announce_configured_options(PYTHON_EXECUTABLE)
74+
6275
announce_configured_options(CMAKE_CXX_COMPILER_ID)
6376
announce_configured_options(CMAKE_TOOLCHAIN_FILE)
6477
announce_configured_options(BUCK2)
65-
announce_configured_options(PYTHON_EXECUTABLE)
6678

6779
load_build_preset()
6880
include(${PROJECT_SOURCE_DIR}/tools/cmake/preset/default.cmake)
@@ -72,10 +84,6 @@ print_configured_options()
7284

7385
# MARK: - End EXECUTORCH_H12025_BUILD_MIGRATION ----------------------------------------------------
7486

75-
include(tools/cmake/Utils.cmake)
76-
include(CMakeDependentOption)
77-
include(ExternalProject)
78-
7987
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
8088

8189
# Setup RPATH.
@@ -251,11 +259,6 @@ if(EXECUTORCH_BUILD_TESTS)
251259
include(CTest)
252260
endif()
253261

254-
if(NOT PYTHON_EXECUTABLE)
255-
resolve_python_executable()
256-
endif()
257-
message(STATUS "Using python executable '${PYTHON_EXECUTABLE}'")
258-
259262
# TODO(dbort): Fix these warnings and remove this flag.
260263
set(_common_compile_options -Wno-deprecated-declarations -fPIC)
261264

backends/apple/mps/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ endif()
1818

1919
include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
2020

21-
if(NOT PYTHON_EXECUTABLE)
22-
resolve_python_executable()
23-
endif()
24-
2521
set(_common_compile_options -Wno-deprecated-declarations)
2622
set(_common_include_directories ${EXECUTORCH_ROOT}/..)
2723

backends/cadence/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ add_compile_definitions(C10_USING_CUSTOM_GENERATED_MACROS)
3030
if(EXECUTORCH_CADENCE_CPU_RUNNER)
3131
include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake)
3232

33-
if(NOT PYTHON_EXECUTABLE)
34-
resolve_python_executable()
35-
endif()
36-
3733
set(_common_compile_options -Wno-deprecated-declarations -fPIC)
3834

3935
# Find prebuilt libraries. executorch package should contain portable_ops_lib,

backends/cadence/fusion_g3/operators/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ endif()
1414
include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
1515
include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake)
1616

17-
if(NOT PYTHON_EXECUTABLE)
18-
resolve_python_executable()
19-
endif()
20-
2117
# ATen compliant ops that are needed to run this model.
2218
set(_aten_ops__srcs
2319
"${EXECUTORCH_ROOT}/kernels/portable/cpu/util/activation_ops_util.cpp"

backends/cadence/hifi/operators/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ endif()
1414
include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
1515
include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake)
1616

17-
if(NOT PYTHON_EXECUTABLE)
18-
resolve_python_executable()
19-
endif()
20-
2117
# ATen compliant ops that are needed to run this model.
2218
set(_aten_ops__srcs
2319
"${EXECUTORCH_ROOT}/backends/cadence/hifi/operators/op_add.cpp"

backends/cadence/reference/operators/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ endif()
1414
include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
1515
include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake)
1616

17-
if(NOT PYTHON_EXECUTABLE)
18-
resolve_python_executable()
19-
endif()
20-
2117
# ATen compliant ops that are needed to run this model.
2218
set(_aten_ops__srcs
2319
"${CMAKE_CURRENT_SOURCE_DIR}/op_add.cpp"

backends/cortex_m/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ endif()
2323
include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
2424
include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake)
2525

26-
if(NOT PYTHON_EXECUTABLE)
27-
resolve_python_executable()
28-
endif()
29-
3026
# Cortex-M ops kernel sources
3127
set(_cortex_m_kernels__srcs
3228
${CMAKE_CURRENT_SOURCE_DIR}/ops/op_quantize_per_tensor.cpp

backends/mediatek/preprocess.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
from executorch.exir.backend.compile_spec_schema import CompileSpec
2121

2222
SKIP_COMPILE_SPEC_KEYS = {"ImportForever"}
23+
REQUIRED_COMPILE_SPEC_KEYS = {"platform-config"}
24+
SUPPORTED_PLATFORM_CONFIGS = {"mt6989", "mt6991"}
2325

2426

2527
def assert_default_dim_order(edge_graph_module: torch.fx.GraphModule) -> None:
@@ -47,6 +49,28 @@ def preprocess(
4749
cls, edge_program: ExportedProgram, module_compile_spec: List[CompileSpec]
4850
) -> PreprocessResult:
4951

52+
# Validate CompileSpec settings
53+
compile_spec_keys = [spec.key for spec in module_compile_spec]
54+
if len(compile_spec_keys) != len(set(compile_spec_keys)):
55+
raise RuntimeError(
56+
"Unsupported duplicated keys in the CompileSpec settings."
57+
)
58+
if not REQUIRED_COMPILE_SPEC_KEYS.issubset(set(compile_spec_keys)):
59+
raise RuntimeError(
60+
"Following keys are required in the CompileSpec settings: {}."
61+
"".format(REQUIRED_COMPILE_SPEC_KEYS)
62+
)
63+
platform = [
64+
spec.value.decode("utf-8")
65+
for spec in module_compile_spec
66+
if spec.key == "platform-config"
67+
][0]
68+
if platform not in SUPPORTED_PLATFORM_CONFIGS:
69+
raise ValueError(
70+
"Unsupported value of platform-config CompileSpec. Given {} but expected to be one "
71+
"of {}.".format(platform, SUPPORTED_PLATFORM_CONFIGS)
72+
)
73+
5074
# Make sure all inputs are contiguous_format or NCHW or default dim order
5175
assert_default_dim_order(edge_program.graph_module)
5276

@@ -64,8 +88,7 @@ def preprocess(
6488
if name_to_node_mappings[name].meta["val"].dtype == torch.float32
6589
]
6690

67-
# This default compile options are only for mt6989 SOC
68-
compile_options = ["--arch=mdla5.1,edpa1.0", "--relax-fp32", "--opt=3"]
91+
compile_options = ["--relax-fp32", "--opt=3"]
6992
for spec in module_compile_spec:
7093
if spec.key in SKIP_COMPILE_SPEC_KEYS:
7194
continue

backends/vulkan/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ if(NOT RUNTIME_PATH)
2424
set(RUNTIME_PATH ${CMAKE_CURRENT_SOURCE_DIR}/runtime)
2525
endif()
2626

27-
if(NOT PYTHON_EXECUTABLE)
28-
set(PYTHON_EXECUTABLE python3)
29-
endif()
30-
3127
# Include this file to access target_link_options_shared_lib This is required to
3228
# provide access to target_link_options_shared_lib which allows libraries to be
3329
# linked with the --whole-archive flag. This is required for libraries that

backends/vulkan/test/op_tests/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ find_library(LIB_TORCH torch HINTS ${TORCH_INSTALL_PREFIX}/lib)
4545
find_library(LIB_TORCH_CPU torch_cpu HINTS ${TORCH_INSTALL_PREFIX}/lib)
4646
find_library(LIB_C10 c10 HINTS ${TORCH_INSTALL_PREFIX}/lib)
4747

48-
if(NOT PYTHON_EXECUTABLE)
49-
set(PYTHON_EXECUTABLE python3)
50-
endif()
51-
5248
# Third party include paths
5349

5450
set(VULKAN_THIRD_PARTY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../third-party)

0 commit comments

Comments
 (0)