Skip to content

Commit a55990d

Browse files
committed
Arm backend: Allow autogen included ops with bundleio
Signed-off-by: Erik Lundell <[email protected]> Change-Id: Ib7fbdb7190312320d73a937bc285db7140d2bb1a
1 parent 5041fa1 commit a55990d

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

codegen/tools/selective_build.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ const executorch_flatbuffer::Program* _get_program_from_buffer(
193193
const py::bytes& buffer) {
194194
// Access the Python bytes without copying and get raw pointer/size.
195195
const std::string_view sv = buffer.cast<std::string_view>();
196+
#ifdef ET_BUNDLE_IO
196197
void* buf_ptr = const_cast<void*>(static_cast<const void*>(sv.data()));
197198
const size_t buf_len = sv.size();
198-
#ifdef ET_BUNDLE_IO
199199

200200
// If this is a bundled program, extract the inner ExecuTorch program bytes.
201201
if (executorch::bundled_program::is_bundled_program(buf_ptr, buf_len)) {

docs/source/backends-arm-ethos-u.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ You can see how this coupling between the memory mode and runtime application i
268268

269269
The arm_executor_runner supports [bundled-io](https://docs.pytorch.org/executorch/0.4/bundled-io.html) and [ETdump](https://docs.pytorch.org/executorch/stable/etdump.html) debugging tools.
270270

271-
To enable bundled-io, set `EXECUTORCH_BUILD_DEVTOOLS` when building Executorch and `DET_BUNDLE_IO` when building the executor_runner. Currently using bundled-io requires specifying your
272-
non delegated Aten ops manually by setting `EXECUTORCH_SELECT_OPS_LIST`. To enable ETdump, set `EXECUTORCH_BUILD_ARM_ETDUMP` when building Executorch and `DEXECUTORCH_ENABLE_EVENT_TRACER`
271+
To enable bundled-io, set `EXECUTORCH_BUILD_DEVTOOLS` when building Executorch and `DET_BUNDLE_IO` when building the executor_runner. To enable ETdump, set `EXECUTORCH_BUILD_ARM_ETDUMP` when building Executorch and `DEXECUTORCH_ENABLE_EVENT_TRACER`
273272
when building the executor_runner.
274273

275274

examples/arm/executor_runner/CMakeLists.txt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ list(
235235
-Map=arm_executor_runner.map
236236
)
237237

238-
# Prefer to generate kernel bindings from model file if possible, which is when
239-
# 1. Not building for semihosting 2. Not building with bundleio If that is not
240-
# the case, fallback to select_ops_list If the model file does not contain any
241-
# aten ops, a workaround is currently needed to avoid crashing.
238+
# Figure out which ops to include: For semihosting build, use
239+
# (user-set)SELECT_OPS_MODEL variable. For normal build, use
240+
# EXECUTORCH_SELECT_OPS_MODEL to include ops automatically. If the pte contains
241+
# no undelegated ops, use neither.
242242
execute_process(
243243
COMMAND
244244
python "${ET_DIR_PATH}/codegen/tools/gen_oplist.py"
@@ -264,11 +264,6 @@ elseif(${FOUND_OPS_IN_FILE})
264264
message(
265265
"gen_oplist: EXECUTORCH_SELECT_OPS_MODEL=${ET_PTE_FILE_PATH} is used to auto generate ops from"
266266
)
267-
elseif(NOT ${FOUND_OPS_IN_FILE} AND ${ET_BUNDLE_IO})
268-
set(EXECUTORCH_SELECT_OPS_MODEL "")
269-
message(
270-
"gen_oplist: Building with ET_BUNDLE_IO and .bpte is not supported to auto generate ops from will use EXECUTORCH_SELECT_OPS_LIST=${EXECUTORCH_SELECT_OPS_LIST}"
271-
)
272267
else()
273268
set(EXECUTORCH_SELECT_OPS_LIST "")
274269
set(EXECUTORCH_SELECT_OPS_MODEL "")

examples/arm/run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ function help() {
5353
echo " --no_delegate Do not delegate the model (can't override builtin models)"
5454
echo " --no_quantize Do not quantize the model (can't override builtin models)"
5555
echo " --portable_kernels=<OPS> TO BE DEPRECATED: Alias to select_ops_list."
56-
echo " --select_ops_list=<OPS> Comma separated list of portable (non delegated) kernels to include Default: ${select_ops_list}"
57-
echo " NOTE: This is used when select_ops_model is not possible to use, e.g. for semihosting or bundleio."
56+
echo " --select_ops_list=<OPS> Comma separated list of portable (non delagated) kernels to include Default: ${select_ops_list}"
57+
echo " NOTE: This is only used when building for semihosting."
5858
echo " See https://docs.pytorch.org/executorch/stable/kernel-library-selective-build.html for more information."
5959
echo " --target=<TARGET> Target to build and run for Default: ${target}"
6060
echo " --output=<FOLDER> Target build output folder Default: ${output_folder}"

0 commit comments

Comments
 (0)