From 62281c14af6912c607bf78e17b7df1ee2f1fb221 Mon Sep 17 00:00:00 2001 From: jathu Date: Mon, 17 Mar 2025 08:33:25 -0700 Subject: [PATCH] move codegen to tools --- backends/cadence/CMakeLists.txt | 2 +- backends/cadence/fusion_g3/operators/CMakeLists.txt | 2 +- backends/cadence/hifi/operators/CMakeLists.txt | 2 +- backends/cadence/reference/operators/CMakeLists.txt | 2 +- configurations/CMakeLists.txt | 2 +- docs/source/kernel-library-selective-build.md | 2 +- examples/apple/mps/CMakeLists.txt | 2 +- examples/arm/CMakeLists.txt | 2 +- examples/devtools/CMakeLists.txt | 2 +- examples/mediatek/CMakeLists.txt | 2 +- examples/models/llama/runner/CMakeLists.txt | 2 +- examples/models/llava/runner/CMakeLists.txt | 2 +- examples/portable/custom_ops/CMakeLists.txt | 2 +- examples/qualcomm/CMakeLists.txt | 2 +- examples/selective_build/CMakeLists.txt | 2 +- extension/llm/custom_ops/CMakeLists.txt | 2 +- extension/llm/runner/CMakeLists.txt | 2 +- kernels/optimized/CMakeLists.txt | 2 +- kernels/portable/CMakeLists.txt | 2 +- kernels/quantized/CMakeLists.txt | 2 +- {scripts/build => tools/cmake}/Codegen.cmake | 0 21 files changed, 20 insertions(+), 20 deletions(-) rename {scripts/build => tools/cmake}/Codegen.cmake (100%) diff --git a/backends/cadence/CMakeLists.txt b/backends/cadence/CMakeLists.txt index a96d38e5141..0a439ed80e6 100644 --- a/backends/cadence/CMakeLists.txt +++ b/backends/cadence/CMakeLists.txt @@ -28,7 +28,7 @@ set(_common_include_directories ${EXECUTORCH_ROOT}/.. add_compile_definitions(C10_USING_CUSTOM_GENERATED_MACROS) if(EXECUTORCH_CADENCE_CPU_RUNNER) - include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) + include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(NOT PYTHON_EXECUTABLE) resolve_python_executable() diff --git a/backends/cadence/fusion_g3/operators/CMakeLists.txt b/backends/cadence/fusion_g3/operators/CMakeLists.txt index b3dbcae4135..21f684a12bf 100644 --- a/backends/cadence/fusion_g3/operators/CMakeLists.txt +++ b/backends/cadence/fusion_g3/operators/CMakeLists.txt @@ -12,7 +12,7 @@ if(NOT CMAKE_CXX_STANDARD) endif() include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(NOT PYTHON_EXECUTABLE) resolve_python_executable() diff --git a/backends/cadence/hifi/operators/CMakeLists.txt b/backends/cadence/hifi/operators/CMakeLists.txt index 36469dc92e7..4dc57f68d5e 100644 --- a/backends/cadence/hifi/operators/CMakeLists.txt +++ b/backends/cadence/hifi/operators/CMakeLists.txt @@ -12,7 +12,7 @@ if(NOT CMAKE_CXX_STANDARD) endif() include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(NOT PYTHON_EXECUTABLE) resolve_python_executable() diff --git a/backends/cadence/reference/operators/CMakeLists.txt b/backends/cadence/reference/operators/CMakeLists.txt index 7d213a12813..a0698da52a5 100644 --- a/backends/cadence/reference/operators/CMakeLists.txt +++ b/backends/cadence/reference/operators/CMakeLists.txt @@ -12,7 +12,7 @@ if(NOT CMAKE_CXX_STANDARD) endif() include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(NOT PYTHON_EXECUTABLE) resolve_python_executable() diff --git a/configurations/CMakeLists.txt b/configurations/CMakeLists.txt index 5279ffa566c..7ada1439e92 100644 --- a/configurations/CMakeLists.txt +++ b/configurations/CMakeLists.txt @@ -25,7 +25,7 @@ endif() set(_common_compile_options -Wno-deprecated-declarations) include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED) # Merge optimized and portable definitions, taking optimized where available. diff --git a/docs/source/kernel-library-selective-build.md b/docs/source/kernel-library-selective-build.md index fe2d53c8be8..4bbbb8e7f36 100644 --- a/docs/source/kernel-library-selective-build.md +++ b/docs/source/kernel-library-selective-build.md @@ -36,7 +36,7 @@ The basic flow looks like this: ## APIs -We expose a CMake macro `[gen_selected_ops](https://github.com/pytorch/executorch/blob/main/scripts/build/Codegen.cmake#L12)`, to allow users specifying op info: +We expose a CMake macro `[gen_selected_ops](https://github.com/pytorch/executorch/blob/main/tools/cmake/Codegen.cmake#L12)`, to allow users specifying op info: ``` gen_selected_ops( diff --git a/examples/apple/mps/CMakeLists.txt b/examples/apple/mps/CMakeLists.txt index d3bf0fb0321..a4ce62bf0be 100644 --- a/examples/apple/mps/CMakeLists.txt +++ b/examples/apple/mps/CMakeLists.txt @@ -59,7 +59,7 @@ if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$") # portable_ops_lib include(${EXECUTORCH_ROOT}/build/Utils.cmake) - include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) + include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) gen_selected_ops(LIB_NAME "mps_portable_ops_lib" INCLUDE_ALL_OPS "ON") generate_bindings_for_kernels( LIB_NAME "mps_portable_ops_lib" FUNCTIONS_YAML diff --git a/examples/arm/CMakeLists.txt b/examples/arm/CMakeLists.txt index 2f8055ce5e9..51a435794e4 100644 --- a/examples/arm/CMakeLists.txt +++ b/examples/arm/CMakeLists.txt @@ -36,7 +36,7 @@ find_package(executorch CONFIG REQUIRED HINTS ${CMAKE_INSTALL_PREFIX}) target_include_directories(executorch INTERFACE ${_common_include_directories}) include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) # Generate C++ bindings to register kernels into both PyTorch (for AOT) and # Executorch (for runtime). Here select all ops in functions.yaml diff --git a/examples/devtools/CMakeLists.txt b/examples/devtools/CMakeLists.txt index 9319135f8e9..552f551666e 100644 --- a/examples/devtools/CMakeLists.txt +++ b/examples/devtools/CMakeLists.txt @@ -23,7 +23,7 @@ if(NOT EXECUTORCH_ROOT) endif() include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(NOT PYTHON_EXECUTABLE) resolve_python_executable() diff --git a/examples/mediatek/CMakeLists.txt b/examples/mediatek/CMakeLists.txt index d8e2a5bf667..7a6e9cee42b 100644 --- a/examples/mediatek/CMakeLists.txt +++ b/examples/mediatek/CMakeLists.txt @@ -20,7 +20,7 @@ if(NOT EXECUTORCH_ROOT) endif() include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(NOT PYTHON_EXECUTABLE) resolve_python_executable() diff --git a/examples/models/llama/runner/CMakeLists.txt b/examples/models/llama/runner/CMakeLists.txt index 919bc356551..63a4910219f 100644 --- a/examples/models/llama/runner/CMakeLists.txt +++ b/examples/models/llama/runner/CMakeLists.txt @@ -21,7 +21,7 @@ if(NOT EXECUTORCH_ROOT) endif() include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) # # The `__srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE}. diff --git a/examples/models/llava/runner/CMakeLists.txt b/examples/models/llava/runner/CMakeLists.txt index 7bad4a827ae..ca9cb81b66c 100644 --- a/examples/models/llava/runner/CMakeLists.txt +++ b/examples/models/llava/runner/CMakeLists.txt @@ -21,7 +21,7 @@ if(NOT EXECUTORCH_ROOT) endif() include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) # Let files say "include ". set(_common_include_directories ${EXECUTORCH_ROOT}/..) diff --git a/examples/portable/custom_ops/CMakeLists.txt b/examples/portable/custom_ops/CMakeLists.txt index 9d165d342d0..9d2252027ea 100644 --- a/examples/portable/custom_ops/CMakeLists.txt +++ b/examples/portable/custom_ops/CMakeLists.txt @@ -28,7 +28,7 @@ if(NOT EXECUTORCH_ROOT) endif() include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(NOT PYTHON_EXECUTABLE) resolve_python_executable() diff --git a/examples/qualcomm/CMakeLists.txt b/examples/qualcomm/CMakeLists.txt index c8946f63a6b..f7bd89d6d84 100644 --- a/examples/qualcomm/CMakeLists.txt +++ b/examples/qualcomm/CMakeLists.txt @@ -16,7 +16,7 @@ if(NOT EXECUTORCH_ROOT) endif() include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(NOT PYTHON_EXECUTABLE) resolve_python_executable() diff --git a/examples/selective_build/CMakeLists.txt b/examples/selective_build/CMakeLists.txt index 6647f0a62b4..6d155d20928 100644 --- a/examples/selective_build/CMakeLists.txt +++ b/examples/selective_build/CMakeLists.txt @@ -22,7 +22,7 @@ set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..) set(TORCH_ROOT ${EXECUTORCH_ROOT}/third-party/pytorch) include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(NOT PYTHON_EXECUTABLE) resolve_python_executable() diff --git a/extension/llm/custom_ops/CMakeLists.txt b/extension/llm/custom_ops/CMakeLists.txt index 6dec5d136ea..4d9cfab9b76 100644 --- a/extension/llm/custom_ops/CMakeLists.txt +++ b/extension/llm/custom_ops/CMakeLists.txt @@ -23,7 +23,7 @@ endif() set(_common_compile_options -Wno-deprecated-declarations -fPIC) include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) # # The `__srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE}. diff --git a/extension/llm/runner/CMakeLists.txt b/extension/llm/runner/CMakeLists.txt index 7adb980d224..88b91dbf397 100644 --- a/extension/llm/runner/CMakeLists.txt +++ b/extension/llm/runner/CMakeLists.txt @@ -21,7 +21,7 @@ if(NOT EXECUTORCH_ROOT) endif() include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) # # The `__srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE}. diff --git a/kernels/optimized/CMakeLists.txt b/kernels/optimized/CMakeLists.txt index 6ed55c73e28..8d70e03748b 100644 --- a/kernels/optimized/CMakeLists.txt +++ b/kernels/optimized/CMakeLists.txt @@ -34,7 +34,7 @@ list(APPEND _common_compile_options -DET_BUILD_WITH_BLAS) # compiling for avx2 for now punting this to come back include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(NOT PYTHON_EXECUTABLE) resolve_python_executable() diff --git a/kernels/portable/CMakeLists.txt b/kernels/portable/CMakeLists.txt index 5072723296c..1749a872c28 100644 --- a/kernels/portable/CMakeLists.txt +++ b/kernels/portable/CMakeLists.txt @@ -24,7 +24,7 @@ endif() set(_common_compile_options -Wno-deprecated-declarations) include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(NOT PYTHON_EXECUTABLE) resolve_python_executable() diff --git a/kernels/quantized/CMakeLists.txt b/kernels/quantized/CMakeLists.txt index c3c4c161b5f..83f054f3fa0 100644 --- a/kernels/quantized/CMakeLists.txt +++ b/kernels/quantized/CMakeLists.txt @@ -27,7 +27,7 @@ endif() set(_common_compile_options -Wno-deprecated-declarations) include(${EXECUTORCH_ROOT}/build/Utils.cmake) -include(${EXECUTORCH_ROOT}/scripts/build/Codegen.cmake) +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) if(NOT PYTHON_EXECUTABLE) resolve_python_executable() diff --git a/scripts/build/Codegen.cmake b/tools/cmake/Codegen.cmake similarity index 100% rename from scripts/build/Codegen.cmake rename to tools/cmake/Codegen.cmake