Skip to content

Commit 676561d

Browse files
committed
Update base for Update on "[7/n][ET-VK] Support texture2D in etvk.copy_offset"
To use `copy_offset` with 2D textures in AHB experimentation. Differential Revision: [D63905519](https://our.internmc.facebook.com/intern/diff/D63905519/) [ghstack-poisoned]
2 parents 11dc732 + cb12061 commit 676561d

File tree

175 files changed

+2721
-822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+2721
-822
lines changed

.ci/docker/ci_commit_pins/pytorch.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4b2970f7cd3cdd56883cacf116a8693862f89db5
1+
d1b87e26e5c4343f5b56bb1e6f89b479b389bfac

.ci/docker/requirements-ci.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
mpmath==1.3.0
2-
numpy==1.21.3; python_version == '3.10'
2+
numpy==1.22.0; python_version == '3.10'
33
numpy==1.23.2; python_version == '3.11'
44
numpy; python_version >= '3.12'
55
PyYAML==6.0.1

.github/workflows/android-perf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ jobs:
292292
--output-dir benchmark-results \
293293
--repo ${{ github.repository }} \
294294
--head-branch ${{ github.head_ref || github.ref_name }} \
295-
--workflow-name ${{ github.workflow }} \
295+
--workflow-name "${{ github.workflow }}" \
296296
--workflow-run-id ${{ github.run_id }} \
297297
--workflow-run-attempt ${{ github.run_attempt }}
298298
done

.github/workflows/android.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
- install_requirements.sh
1616
- examples/demo-apps/android/**
1717
- extension/android/**
18+
- extension/benchmark/android/**
1819
- extension/module/**
1920
workflow_dispatch:
2021

.github/workflows/apple-perf.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,17 @@ jobs:
235235
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
236236
build/build_apple_frameworks.sh --coreml --custom --mps --optimized --portable --quantized --xnnpack
237237
238-
mkdir -p extension/apple/Benchmark/Frameworks
238+
mkdir -p extension/benchmark/apple/Benchmark/Frameworks
239239
for FRAMEWORK in "${FRAMEWORKS[@]}"; do (
240-
cp -r "cmake-out/${FRAMEWORK}.xcframework" extension/apple/Benchmark/Frameworks/
240+
cp -r "cmake-out/${FRAMEWORK}.xcframework" extension/benchmark/apple/Benchmark/Frameworks/
241241
) done
242242
echo "::endgroup::"
243243
244244
# NB: Although exported models can be copied to this directory and bundled together with the
245245
# app, we don't use this in CI and rely on AWS extra data parameter to make the model and the
246246
# tokenizer available to the benchmark. This decouples the app and the model. We just need to
247247
# create the directory here to pass the build
248-
mkdir -p extension/apple/Benchmark/Models
248+
mkdir -p extension/benchmark/apple/Benchmark/Models
249249
${CONDA_RUN} --no-capture-output \
250250
build/build_apple_llm_demo.sh ${ARTIFACTS_DIR_NAME}
251251

.github/workflows/apple.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818
- build/test_ios_ci.sh
1919
- examples/demo-apps/apple_ios/**
2020
- extension/apple/**
21+
- extension/benchmark/apple/**
2122
- extension/module/**
2223
workflow_dispatch:
2324

@@ -272,14 +273,14 @@ jobs:
272273
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
273274
build/build_apple_frameworks.sh --coreml --custom --mps --optimized --portable --quantized --xnnpack
274275
275-
mkdir -p extension/apple/Benchmark/Frameworks
276+
mkdir -p extension/benchmark/apple/Benchmark/Frameworks
276277
for FRAMEWORK in "${FRAMEWORKS[@]}"; do (
277-
cp -r "cmake-out/${FRAMEWORK}.xcframework" extension/apple/Benchmark/Frameworks/
278+
cp -r "cmake-out/${FRAMEWORK}.xcframework" extension/benchmark/apple/Benchmark/Frameworks/
278279
) done
279280
echo "::endgroup::"
280281
281282
echo "::group::Build ExecuTorch benchmark app"
282-
mkdir -p extension/apple/Benchmark/Models
283+
mkdir -p extension/benchmark/apple/Benchmark/Models
283284
${CONDA_RUN} --no-capture-output \
284285
build/build_apple_llm_demo.sh ${ARTIFACTS_DIR_NAME}
285286
echo "::endgroup::"

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
FILES_NEEDS_FORMAT=$(/opt/google-java-format -n extension/android/src/main/java/org/pytorch/executorch/*.java \
6767
examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/*.java \
6868
examples/demo-apps/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/*.java \
69-
extension/android/benchmark/app/src/main/java/org/pytorch/minibench/*.java)
69+
extension/benchmark/android/benchmark/app/src/main/java/org/pytorch/minibench/*.java)
7070
if [ -n "$FILES_NEEDS_FORMAT" ]; then
7171
echo "Warning: The following files need formatting. Please use google-java-format."
7272
echo "Use a binary from https://github.com/google/google-java-format/releases/"

.github/workflows/upload-android-test-specs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ on:
44
pull_request:
55
paths:
66
- .github/workflows/upload-android-test-specs.yml
7-
- extension/android/benchmark/android-llm-device-farm-test-spec.yml
7+
- extension/benchmark/android/benchmark/android-llm-device-farm-test-spec.yml
88
push:
99
branches:
1010
- main
1111
paths:
1212
- .github/workflows/upload-android-test-specs.yml
13-
- extension/android/benchmark/android-llm-device-farm-test-spec.yml
13+
- extension/benchmark/android/benchmark/android-llm-device-farm-test-spec.yml
1414

1515
concurrency:
1616
# NB: This concurency group needs to be different than the one used in android-perf, otherwise
@@ -32,7 +32,7 @@ jobs:
3232
${{ github.repository }}/${{ github.run_id }}/artifacts
3333
retention-days: 1
3434
if-no-files-found: error
35-
path: extension/android/benchmark/android-llm-device-farm-test-spec.yml
35+
path: extension/benchmark/android/benchmark/android-llm-device-farm-test-spec.yml
3636

3737
validate-android-test-spec:
3838
needs: upload-android-test-spec-for-validation
@@ -77,7 +77,7 @@ jobs:
7777
7878
- name: Upload the spec to S3 ossci-android bucket
7979
shell: bash
80-
working-directory: extension/android/benchmark/
80+
working-directory: extension/benchmark/android/benchmark/
8181
env:
8282
SPEC_FILE: android-llm-device-farm-test-spec.yml
8383
run: |

.github/workflows/upload-apple-test-specs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ on:
44
pull_request:
55
paths:
66
- .github/workflows/upload-apple-test-specs.yml
7-
- examples/demo-apps/apple_ios/default-ios-device-farm-appium-test-spec.yml
7+
- extension/benchmark/apple/Benchmark/default-ios-device-farm-appium-test-spec.yml
88
push:
99
branches:
1010
- main
1111
paths:
1212
- .github/workflows/upload-apple-test-specs.yml
13-
- examples/demo-apps/apple_ios/default-ios-device-farm-appium-test-spec.yml
13+
- extension/benchmark/apple/Benchmark/default-ios-device-farm-appium-test-spec.yml
1414

1515
concurrency:
1616
# NB: This concurency group needs to be different than the one used in apple-perf, otherwise
@@ -32,7 +32,7 @@ jobs:
3232
${{ github.repository }}/${{ github.run_id }}/artifacts
3333
retention-days: 1
3434
if-no-files-found: error
35-
path: examples/demo-apps/apple_ios/default-ios-device-farm-appium-test-spec.yml
35+
path: extension/benchmark/apple/Benchmark/default-ios-device-farm-appium-test-spec.yml
3636

3737
validate-apple-test-spec:
3838
needs: upload-apple-test-spec-for-validation
@@ -78,7 +78,7 @@ jobs:
7878
7979
- name: Upload the spec to S3 ossci-ios bucket
8080
shell: bash
81-
working-directory: examples/demo-apps/apple_ios
81+
working-directory: extension/benchmark/apple/Benchmark/
8282
env:
8383
SPEC_FILE: default-ios-device-farm-appium-test-spec.yml
8484
run: |

backends/arm/runtime/ArmBackendEthosU.cpp

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,31 @@
1515

1616
#include <ethosu_driver.h>
1717

18-
#include "executorch/backends/arm/runtime/VelaBinStream.h"
19-
#include "executorch/runtime/backend/interface.h"
20-
#include "executorch/runtime/core/error.h"
21-
#include "executorch/runtime/core/evalue.h"
22-
#include "executorch/runtime/core/exec_aten/util/dim_order_util.h"
23-
#include "executorch/runtime/core/exec_aten/util/scalar_type_util.h"
18+
#include <executorch/backends/arm/runtime/VelaBinStream.h>
19+
#include <executorch/runtime/backend/interface.h>
20+
#include <executorch/runtime/core/error.h>
21+
#include <executorch/runtime/core/evalue.h>
22+
#include <executorch/runtime/core/exec_aten/util/dim_order_util.h>
23+
#include <executorch/runtime/core/exec_aten/util/scalar_type_util.h>
2424

2525
using namespace std;
2626

27-
namespace torch {
28-
namespace executor {
27+
using executorch::aten::ScalarType;
28+
using executorch::runtime::ArrayRef;
29+
using executorch::runtime::Backend;
30+
using executorch::runtime::BackendExecutionContext;
31+
using executorch::runtime::BackendInitContext;
32+
using executorch::runtime::CompileSpec;
33+
using executorch::runtime::DelegateHandle;
34+
using executorch::runtime::Error;
35+
using executorch::runtime::EValue;
36+
using executorch::runtime::FreeableBuffer;
37+
using executorch::runtime::MemoryAllocator;
38+
using executorch::runtime::Result;
39+
40+
namespace executorch {
41+
namespace backends {
42+
namespace arm {
2943

3044
typedef struct {
3145
FreeableBuffer* processed;
@@ -142,10 +156,10 @@ class ArmBackend final : public ::executorch::runtime::BackendInterface {
142156
Error,
143157
"Input %d expected Integer (4 byte) or Char (1 byte) integer inputs, got ScalarType id %s",
144158
i,
145-
toString(tensor_in.scalar_type()));
159+
executorch::runtime::toString(tensor_in.scalar_type()));
146160
return Error::InvalidProgram;
147161
}
148-
supported = is_contiguous_dim_order(
162+
supported = executorch::runtime::is_contiguous_dim_order(
149163
tensor_in.dim_order().data(), tensor_in.dim());
150164
if (!supported) {
151165
ET_LOG(
@@ -268,7 +282,7 @@ class ArmBackend final : public ::executorch::runtime::BackendInterface {
268282
private:
269283
Error check_requires_permute(
270284
int index,
271-
const exec_aten::Tensor tensor,
285+
const executorch::aten::Tensor tensor,
272286
VelaIO* io,
273287
bool permuted_io_flag,
274288
bool* is_permuted) const {
@@ -343,5 +357,6 @@ Backend backend_id{"ArmBackend", &backend};
343357
static auto registered = register_backend(backend_id);
344358
} // namespace
345359

346-
} // namespace executor
347-
} // namespace torch
360+
} // namespace arm
361+
} // namespace backends
362+
} // namespace executorch

backends/arm/runtime/VelaBinStream.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010
* as that function emits this format and the two need to align.
1111
*/
1212

13+
#include <executorch/backends/arm/runtime/VelaBinStream.h>
14+
1315
#include <cstring>
1416

15-
#include "executorch/backends/arm/runtime/VelaBinStream.h"
16-
#include "executorch/runtime/core/error.h"
17+
#include <executorch/runtime/core/error.h>
18+
19+
namespace executorch {
20+
namespace backends {
21+
namespace arm {
1722

1823
// get next mul of 16 ptr, return n if already aligned
1924
static uintptr_t next_mul_16(uintptr_t n) {
@@ -91,3 +96,7 @@ bool vela_bin_read(const char* data, VelaHandles* handles, int size) {
9196
// We've fallen off the end without finding vela_end_stream
9297
return false;
9398
}
99+
100+
} // namespace arm
101+
} // namespace backends
102+
} // namespace executorch

backends/arm/runtime/VelaBinStream.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
#include <cstddef>
1919
#include <cstdint>
2020

21+
namespace executorch {
22+
namespace backends {
23+
namespace arm {
24+
2125
// Standard block name size
2226
const uint32_t kVelaBlockNameLength = 16;
2327

@@ -67,3 +71,7 @@ bool vela_bin_read(const char* data, VelaHandles* handles, int size);
6771
* on the Ethos-U.
6872
*/
6973
bool vela_bin_validate(const char* data, int size);
74+
75+
} // namespace arm
76+
} // namespace backends
77+
} // namespace executorch

backends/cadence/aot/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ python_library(
2222
deps = [
2323
"fbsource//third-party/pypi/tabulate:tabulate",
2424
"//caffe2:torch",
25+
"//executorch/exir:lib",
2526
"//executorch/exir:memory",
2627
"//executorch/exir/dialects:lib",
2728
"//executorch/exir/dialects/edge:lib",

backends/cadence/aot/compiler.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
from torch.export import export
3737
from torch.export.exported_program import ExportedProgram
3838

39+
from .utils import print_ops_info
40+
3941

4042
# Note: this is not meant as a primary API since it can create inconsistencies
4143
# if the quantizer here is different from the quantizer used to convert. It is
@@ -193,16 +195,17 @@ def export_to_edge(
193195

194196

195197
# Export the model and lower it to an EdgeProgramManager (in edge IR), and
196-
# apply passes specific to Cadence DSP execution.
198+
# apply passes specific to Cadence DSP execution. Return both to print the
199+
# differences.
197200
def export_to_cadence(
198201
model: torch.nn.Module,
199202
inputs: tuple[object, ...],
200203
dump_graphs: bool = False,
201204
) -> EdgeProgramManager:
202-
edge_program_manager = export_to_edge(model, inputs)
205+
edge_prog_manager = export_to_edge(model, inputs)
203206

204207
# Run a couple required passes for quant/dequant ops
205-
cadence_program_manager = edge_program_manager.transform(
208+
cadence_prog_manager = edge_prog_manager.transform(
206209
[
207210
InitializePipeline(),
208211
RemoveZeroSizedCatArgsPass(),
@@ -216,4 +219,10 @@ def export_to_cadence(
216219
]
217220
)
218221

219-
return cadence_program_manager
222+
# Print some information to terminal
223+
print_ops_info(
224+
edge_prog_manager.exported_program().graph_module,
225+
cadence_prog_manager.exported_program().graph_module,
226+
)
227+
228+
return cadence_prog_manager

0 commit comments

Comments
 (0)