Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy sdk to dev_tools, add dev_tools to visibility config #4416

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/docker/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ RUN rm install_android.sh
ARG ARM_SDK
COPY --chown=ci-user:ci-user ./arm /opt/arm
# Set up ARM SDK if needed
RUN if [ -n "${ARM_SDK}" ]; then git config --global user.email "ossci@example.com"; git config --global user.name "OSS CI"; bash /opt/arm/setup.sh --i-agree-to-the-contained-eula /opt/arm-sdk; chown -R ci-user:ci-user /opt/arm-sdk; fi
RUN if [ -n "${ARM_SDK}" ]; then git config --global user.email "ossci@example.com"; git config --global user.name "OSS CI"; bash /opt/arm/setup.sh --i-agree-to-the-contained-eula /opt/arm-dev_tools; chown -R ci-user:ci-user /opt/arm-dev_tools; fi

USER ci-user
CMD ["bash"]
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED "Build the optimized kernels" OFF)

option(EXECUTORCH_BUILD_KERNELS_QUANTIZED "Build the quantized kernels" OFF)

option(EXECUTORCH_BUILD_SDK "Build the ExecuTorch SDK")
option(EXECUTORCH_BUILD_DEV_TOOLS "Build the ExecuTorch Developer Tools")

option(EXECUTORCH_BUILD_SIZE_TEST "Build the size test" OFF)

Expand Down Expand Up @@ -604,12 +604,12 @@ if(EXECUTORCH_BUILD_GTESTS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/googletest)
endif()

if(EXECUTORCH_BUILD_SDK)
if(EXECUTORCH_BUILD_DEV_TOOLS)
set(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER
ON
CACHE BOOL "EXECUTORCH_BUILD_EXTENSION_DATA_LOADER" FORCE
)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/sdk)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dev_tools)
endif()

if(EXECUTORCH_BUILD_EXTENSION_APPLE)
Expand Down Expand Up @@ -663,8 +663,8 @@ if(EXECUTORCH_BUILD_PYBIND)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/data_loader)
endif()

if(NOT EXECUTORCH_BUILD_SDK)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/sdk)
if(NOT EXECUTORCH_BUILD_DEV_TOOLS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/dev_tools)
endif()

# find pytorch lib, to allow pybind to take at::Tensor as input/output
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Key value propositions of ExecuTorch are:
- **Portability:** Compatibility with a wide variety of computing platforms,
from high-end mobile phones to highly constrained embedded systems and
microcontrollers.
- **Productivity:** Enabling developers to use the same toolchains and SDK from
- **Productivity:** Enabling developers to use the same toolchains from
PyTorch model authoring and conversion, to debugging and deployment to a wide
variety of platforms.
- **Performance:** Providing end users with a seamless and high-performance
Expand Down Expand Up @@ -93,7 +93,7 @@ tools.
├── schema # ExecuTorch PTE file format flatbuffer
schemas.
├── scripts # Utility scripts for size management, dependency management, etc.
├── sdk # Model profiling, debugging, and introspection.
├── dev_tools # Model profiling, debugging, and introspection.
├── shim # Compatibility layer between OSS and Internal builds
├── test # Broad scoped end-to-end tests.
├── third-party # Third-party dependencies.
Expand Down
4 changes: 2 additions & 2 deletions backends/apple/coreml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ target_include_directories(
target_include_directories(coremldelegate PRIVATE ${EXECUTORCH_ROOT}/..)
target_link_libraries(coremldelegate PRIVATE executorch_no_prim_ops)

if(EXECUTORCH_BUILD_SDK)
if(EXECUTORCH_BUILD_DEV_TOOLS)
target_sources(coremldelegate PRIVATE ${SDK_SOURCES} ${PROTOBUF_SOURCES})
target_include_directories(
coremldelegate
Expand Down Expand Up @@ -166,7 +166,7 @@ endif()
target_compile_options(coremldelegate PRIVATE "-fobjc-arc")
target_compile_options(coremldelegate PRIVATE "-fno-exceptions")

if(EXECUTORCH_BUILD_SDK)
if(EXECUTORCH_BUILD_DEV_TOOLS)
target_compile_options(
executorch_no_prim_ops PUBLIC -DET_EVENT_TRACER_ENABLED
)
Expand Down
4 changes: 2 additions & 2 deletions backends/apple/mps/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ runtime.python_test(
"//caffe2:torch",
"//executorch/examples/models:models",
"//executorch/exir/tests:models",
"//executorch/sdk:lib",
"//executorch/sdk/bundled_program/serialize:lib",
"//executorch/dev_tools:lib",
"//executorch/dev_tools/bundled_program/serialize:lib",
"fbsource//third-party/pypi/pytest:pytest",
],
)
6 changes: 3 additions & 3 deletions backends/apple/mps/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,18 @@ python3 -m examples.apple.mps.scripts.mps_example --model_name="mv3" --no-use_fp
```

### Profiling:
1. [Optional] Generate an [ETRecord](./sdk-etrecord.rst) while you're exporting your model.
1. [Optional] Generate an [ETRecord](./dev-tools-etrecord.rst) while you're exporting your model.
```bash
cd executorch
python3 -m examples.apple.mps.scripts.mps_example --model_name="mv3" --generate_etrecord -b
```
2. Run your Program on the ExecuTorch runtime and generate an [ETDump](./sdk-etdump.md).
2. Run your Program on the ExecuTorch runtime and generate an [ETDump](./dev-tools-etdump.md).
```
./cmake-out/examples/apple/mps/mps_executor_runner --model_path mv3_mps_bundled_fp16.pte --bundled_program --dump-outputs
```
3. Create an instance of the Inspector API by passing in the ETDump you have sourced from the runtime along with the optionally generated ETRecord from step 1.
```bash
python3 -m sdk.inspector.inspector_cli --etdump_path etdump.etdp --etrecord_path etrecord.bin
python3 -m dev_tools.inspector.inspector_cli --etdump_path etdump.etdp --etrecord_path etrecord.bin
```

## Deploying and Running on Device
Expand Down
2 changes: 1 addition & 1 deletion backends/apple/mps/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def define_common_targets(is_xplat = False, platforms = []):
"//executorch/exir/backend:backend_lib",
"//executorch/extension/pybindings/...",
"//executorch/runtime/backend/...",
"//executorch/sdk/runners/...",
"//executorch/dev_tools/runners/...",
"//executorch/test/...",
"@EXECUTORCH_CLIENTS",
],
Expand Down
6 changes: 3 additions & 3 deletions backends/apple/mps/test/test_mps_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
from executorch.exir.backend.backend_details import CompileSpec
from executorch.exir.capture._config import ExecutorchBackendConfig
from executorch.exir.tracer import Value
from executorch.sdk import BundledProgram
from executorch.sdk.bundled_program.config import MethodTestCase, MethodTestSuite
from executorch.sdk.bundled_program.serialize import (
from executorch.dev_tools import BundledProgram
from executorch.dev_tools.bundled_program.config import MethodTestCase, MethodTestSuite
from executorch.dev_tools.bundled_program.serialize import (
serialize_from_bundled_program_to_flatbuffer,
)
from torch.export import export, ExportedProgram
Expand Down
2 changes: 1 addition & 1 deletion backends/qualcomm/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if [ "$BUILD_AARCH64" = true ]; then
-DCMAKE_INSTALL_PREFIX=$BUILD_ROOT \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DEXECUTORCH_BUILD_QNN=ON \
-DEXECUTORCH_BUILD_SDK=ON \
-DEXECUTORCH_BUILD_DEV_TOOLS=ON \
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
-DQNN_SDK_ROOT=$QNN_SDK_ROOT \
Expand Down
2 changes: 1 addition & 1 deletion backends/qualcomm/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ cd build_android
cmake .. \
-DCMAKE_INSTALL_PREFIX=$PWD \
-DEXECUTORCH_BUILD_QNN=ON \
-DEXECUTORCH_BUILD_SDK=ON \
-DEXECUTORCH_BUILD_DEV_TOOLS=ON \
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
-DQNN_SDK_ROOT=$QNN_SDK_ROOT \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake \
Expand Down
4 changes: 2 additions & 2 deletions backends/qualcomm/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
from executorch.exir.pass_base import ExportPass
from executorch.exir.passes.memory_planning_pass import MemoryPlanningPass
from executorch.exir.program._program import ExecutorchProgram
from executorch.sdk import generate_etrecord
from executorch.sdk.inspector import Inspector
from executorch.dev_tools import generate_etrecord
from executorch.dev_tools.inspector import Inspector
from torch.ao.quantization.quantize_pt2e import convert_pt2e, prepare_pt2e


Expand Down
6 changes: 3 additions & 3 deletions backends/xnnpack/test/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ runtime.python_test(
deps = [
"//executorch/backends/xnnpack/partition:xnnpack_partitioner",
"//executorch/backends/xnnpack/test/tester:tester",
"//executorch/dev_tools:lib",
"//executorch/dev_tools/bundled_program:config",
"//executorch/dev_tools/bundled_program/serialize:lib",
"//executorch/exir/passes:constant_prop_pass",
"//executorch/sdk:lib",
"//executorch/sdk/bundled_program:config",
"//executorch/sdk/bundled_program/serialize:lib",
"//pytorch/ao:torchao", # @manual
],
external_deps = [
Expand Down
12 changes: 6 additions & 6 deletions backends/xnnpack/test/test_xnnpack_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@

# import the xnnpack backend implementation
from executorch.backends.xnnpack.xnnpack_preprocess import XnnpackBackend
from executorch.dev_tools import BundledProgram

from executorch.dev_tools.bundled_program.config import MethodTestCase, MethodTestSuite
from executorch.dev_tools.bundled_program.serialize import (
serialize_from_bundled_program_to_flatbuffer,
)
from executorch.exir import ExecutorchProgram, ExirExportedProgram
from executorch.exir.backend.backend_api import to_backend, validation_disabled

Expand All @@ -34,12 +40,6 @@
_load_for_executorch_from_buffer,
)
from executorch.extension.pytree import tree_flatten
from executorch.sdk import BundledProgram

from executorch.sdk.bundled_program.config import MethodTestCase, MethodTestSuite
from executorch.sdk.bundled_program.serialize import (
serialize_from_bundled_program_to_flatbuffer,
)

from torch.ao.quantization import ( # @manual
default_per_channel_symmetric_qnnpack_qconfig,
Expand Down
2 changes: 1 addition & 1 deletion build/Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function(executorch_print_configuration_summary)
"${EXECUTORCH_BUILD_KERNELS_QUANTIZED}"
)
message(
STATUS " EXECUTORCH_BUILD_SDK : ${EXECUTORCH_BUILD_SDK}"
STATUS " EXECUTORCH_BUILD_DEV_TOOLS : ${EXECUTORCH_BUILD_DEV_TOOLS}"
)
message(
STATUS
Expand Down
22 changes: 11 additions & 11 deletions sdk/CMakeLists.txt → dev_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ set_property(TARGET flatccrt PROPERTY POSITION_INDEPENDENT_CODE ON)
include(ExternalProject)

# The include directory that will contain the generated schema headers.
set(_program_schema__include_dir "${CMAKE_BINARY_DIR}/sdk/include")
set(_bundled_schema__include_dir "${CMAKE_BINARY_DIR}/sdk/bundled_program")
set(_program_schema__include_dir "${CMAKE_BINARY_DIR}/dev_tools/include")
set(_bundled_schema__include_dir "${CMAKE_BINARY_DIR}/dev_tools/bundled_program")

# TODO(dbort): Only enable this when cross-compiling. It can cause build race
# conditions (libflatcc.a errors) when enabled.
Expand Down Expand Up @@ -110,11 +110,11 @@ set(_etdump_schema__outputs)
foreach(fbs_file ${_etdump_schema_names})
string(REGEX REPLACE "[.]fbs$" "_reader.h" generated "${fbs_file}")
list(APPEND _etdump_schema__outputs
"${_program_schema__include_dir}/executorch/sdk/etdump/${generated}"
"${_program_schema__include_dir}/executorch/dev_tools/etdump/${generated}"
)
string(REGEX REPLACE "[.]fbs$" "_builder.h" generated "${fbs_file}")
list(APPEND _etdump_schema__outputs
"${_program_schema__include_dir}/executorch/sdk/etdump/${generated}"
"${_program_schema__include_dir}/executorch/dev_tools/etdump/${generated}"
)
endforeach()

Expand All @@ -125,7 +125,7 @@ foreach(fbs_file ${_bundled_input_schema_names})
list(
APPEND
_bundled_program_schema__outputs
"${_bundled_schema__include_dir}/executorch/sdk/bundled_program/schema/${generated}"
"${_bundled_schema__include_dir}/executorch/dev_tools/bundled_program/schema/${generated}"
)
endforeach()

Expand All @@ -137,9 +137,9 @@ add_library(
# Ensure the host tool is built before the main project
add_dependencies(etdump_schema flatcc_cli)

file(MAKE_DIRECTORY ${_program_schema__include_dir}/executorch/sdk/etdump)
file(MAKE_DIRECTORY ${_program_schema__include_dir}/executorch/dev_tools/etdump)
file(MAKE_DIRECTORY
${_program_schema__include_dir}/executorch/sdk/bundled_program
${_program_schema__include_dir}/executorch/dev_tools/bundled_program
)

if(EXECUTORCH_SEPARATE_FLATCC_HOST_PROJECT)
Expand Down Expand Up @@ -177,10 +177,10 @@ add_custom_command(
# tree instead of under the binary directory, and there's no way to change
# that behavior.
${_flatcc_source_dir}/bin/flatcc -cwr -o
${_program_schema__include_dir}/executorch/sdk/etdump
${_program_schema__include_dir}/executorch/dev_tools/etdump
${_etdump_schema__srcs}
COMMAND rm -f ${_etdump_schema_cleanup_paths}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/sdk
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/dev_tools
DEPENDS ${_etdump_schema_gen_dep}
COMMENT "Generating etdump headers"
VERBATIM
Expand All @@ -201,9 +201,9 @@ add_custom_command(
OUTPUT ${_bundled_program_schema__outputs}
COMMAND
${FLATC_EXECUTABLE} --cpp --cpp-std c++11 --gen-mutable --scoped-enums -o
"${_bundled_schema__include_dir}/executorch/sdk/bundled_program/schema"
"${_bundled_schema__include_dir}/executorch/dev_tools/bundled_program/schema"
${_bundled_program_schema__srcs}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/sdk
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/dev_tools
DEPENDS ${FLATC_EXECUTABLE} ${_bundled_program_schema__srcs}
COMMENT "Generating bundled_program headers"
VERBATIM
Expand Down
6 changes: 3 additions & 3 deletions sdk/TARGETS → dev_tools/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ python_library(
name = "lib",
srcs = ["__init__.py"],
deps = [
"//executorch/sdk/bundled_program:core",
"//executorch/sdk/etrecord:etrecord",
"//executorch/sdk/inspector:lib",
"//executorch/dev_tools/bundled_program:core",
"//executorch/dev_tools/etrecord:etrecord",
"//executorch/dev_tools/inspector:lib",
],
)
8 changes: 4 additions & 4 deletions sdk/__init__.py → dev_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

import executorch.sdk.inspector as inspector
from executorch.sdk.bundled_program.core import BundledProgram
from executorch.sdk.etrecord import ETRecord, generate_etrecord, parse_etrecord
from executorch.sdk.inspector import Inspector
import executorch.dev_tools.inspector as inspector
from executorch.dev_tools.bundled_program.core import BundledProgram
from executorch.dev_tools.etrecord import ETRecord, generate_etrecord, parse_etrecord
from executorch.dev_tools.inspector import Inspector

__all__ = [
"ETRecord",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ runtime.python_library(
":config",
":version",
"//caffe2:torch",
"//executorch/dev_tools/bundled_program/schema:bundled_program_schema_py",
"//executorch/exir:schema",
"//executorch/exir:tensor",
"//executorch/exir/_serialize:lib",
"//executorch/sdk/bundled_program/schema:bundled_program_schema_py",
],
)

Expand All @@ -46,6 +46,6 @@ runtime.python_library(
"version.py",
],
visibility = [
"//executorch/sdk/...",
"//executorch/dev_tools/...",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/

#include <executorch/sdk/bundled_program/bundled_program.h>
#include <executorch/dev_tools/bundled_program/bundled_program.h>

#include <cmath>
#include <cstddef>
Expand All @@ -16,12 +16,12 @@
#include <ATen/ATen.h>
#endif // USE_ATEN_LIB

#include <executorch/dev_tools/bundled_program/schema/bundled_program_schema_generated.h>
#include <executorch/runtime/core/event_tracer_hooks.h>
#include <executorch/runtime/core/exec_aten/util/dim_order_util.h>
#include <executorch/runtime/core/memory_allocator.h>
#include <executorch/runtime/executor/method.h>
#include <executorch/runtime/platform/log.h>
#include <executorch/sdk/bundled_program/schema/bundled_program_schema_generated.h>

namespace torch {
namespace executor {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
import typing
from typing import Dict, List, Optional, Sequence, Type, Union

import executorch.exir.schema as core_schema
import executorch.dev_tools.bundled_program.schema as bp_schema

import executorch.sdk.bundled_program.schema as bp_schema
import executorch.exir.schema as core_schema

import torch
import torch.fx
from executorch.dev_tools.bundled_program.config import ConfigValue, MethodTestSuite

from executorch.dev_tools.bundled_program.version import BUNDLED_PROGRAM_SCHEMA_VERSION

from executorch.exir import ExecutorchProgram, ExecutorchProgramManager
from executorch.exir._serialize import _serialize_pte_binary
from executorch.exir.tensor import get_scalar_type, scalar_type_enum, TensorSpec
from executorch.sdk.bundled_program.config import ConfigValue, MethodTestSuite

from executorch.sdk.bundled_program.version import BUNDLED_PROGRAM_SCHEMA_VERSION

# pyre-ignore
supported_program_type_table: Dict[Type[core_schema.KernelTypes], ConfigValue] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ runtime.python_library(
"bundled_program_schema.py",
],
visibility = [
"//executorch/sdk/bundled_program/...",
"//executorch/sdk/etrecord/...",
"//executorch/dev_tools/bundled_program/...",
"//executorch/dev_tools/etrecord/...",
],
deps = [
"//executorch/exir:scalar_type",
Expand Down
Loading
Loading