Skip to content

Commit 095d4f5

Browse files
committed
Update
[ghstack-poisoned]
2 parents 956f8a5 + d9cd27c commit 095d4f5

File tree

16 files changed

+461
-147
lines changed

16 files changed

+461
-147
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
27e35de6c288bffad1b4d18b393579c1d1a95547
1+
08434df1f2f88c9770e59246caa2ff9c6f613270

build/cmake_deps.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ excludes = [
130130
deps = [
131131
"executorch_core",
132132
"executorch",
133+
"extension_threadpool",
133134
]
134135

135136
[targets.optimized_native_cpu_ops]
@@ -363,6 +364,7 @@ excludes = [
363364
deps = [
364365
"executorch",
365366
"executorch_core",
367+
"extension_threadpool",
366368
"xnnpack_backend",
367369
"portable_kernels",
368370
]
@@ -449,6 +451,7 @@ deps = [
449451
"executorch_core",
450452
"extension_data_loader",
451453
"extension_module",
454+
"extension_threadpool",
452455
"portable_kernels",
453456
"quantized_kernels",
454457
"xnnpack_backend",

build/test_android_ci.sh

Lines changed: 0 additions & 30 deletions
This file was deleted.

examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/MainActivity.java

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,7 @@ protected void onCreate(Bundle savedInstanceState) {
9797
finish();
9898
}
9999

100-
try {
101-
mModule = Module.load("/data/local/tmp/dl3_xnnpack_fp32.pte");
102-
103-
} catch (IOException e) {
104-
Log.e("ImageSegmentation", "Error reading assets", e);
105-
finish();
106-
}
100+
mModule = Module.load("/data/local/tmp/dl3_xnnpack_fp32.pte");
107101

108102
mImageView = findViewById(R.id.imageView);
109103
mImageView.setImageBitmap(mBitmap);
@@ -129,14 +123,8 @@ public void onClick(View v) {
129123
mButtonXnnpack.setOnClickListener(
130124
new View.OnClickListener() {
131125
public void onClick(View v) {
132-
try {
133-
mModule.destroy();
134-
mModule = Module.load("/data/local/tmp/dl3_xnnpack_fp32.pte");
135-
} catch (IOException e) {
136-
Log.e("ImageSegmentation", "Error reading assets", e);
137-
finish();
138-
}
139-
126+
mModule.destroy();
127+
mModule = Module.load("/data/local/tmp/dl3_xnnpack_fp32.pte");
140128
mButtonXnnpack.setEnabled(false);
141129
mProgressBar.setVisibility(ProgressBar.VISIBLE);
142130
mButtonXnnpack.setText(getString(R.string.run_model));
@@ -149,13 +137,8 @@ public void onClick(View v) {
149137
mButtonHtp.setOnClickListener(
150138
new View.OnClickListener() {
151139
public void onClick(View v) {
152-
try {
153-
mModule.destroy();
154-
mModule = Module.load("/data/local/tmp/dlv3_qnn.pte");
155-
} catch (IOException e) {
156-
Log.e("ImageSegmentation", "Error reading assets", e);
157-
finish();
158-
}
140+
mModule.destroy();
141+
mModule = Module.load("/data/local/tmp/dlv3_qnn.pte");
159142
mButtonHtp.setEnabled(false);
160143
mProgressBar.setVisibility(ProgressBar.VISIBLE);
161144
mButtonHtp.setText(getString(R.string.run_model));

extension/data_loader/mman.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
// This file ensures that mman.h compatible functions are defined in the global
10+
// namespace for windows and posix environments.
11+
12+
#pragma once
13+
14+
#include <executorch/runtime/platform/compiler.h>
15+
16+
#ifndef _WIN32
17+
18+
#include <sys/mman.h>
19+
#include <unistd.h>
20+
21+
ET_INLINE size_t get_os_page_size() {
22+
return sysconf(_SC_PAGESIZE);
23+
}
24+
25+
#else
26+
27+
#define NOMINMAX
28+
#include <windows.h>
29+
#undef NOMINMAX
30+
#include <io.h>
31+
32+
#include <executorch/extension/data_loader/mman_windows.h>
33+
34+
ET_INLINE long get_os_page_size() {
35+
SYSTEM_INFO si;
36+
GetSystemInfo(&si);
37+
long pagesize = si.dwAllocationGranularity > si.dwPageSize
38+
? si.dwAllocationGranularity
39+
: si.dwPageSize;
40+
return pagesize;
41+
}
42+
43+
#endif

0 commit comments

Comments
 (0)