Skip to content

Commit 91252e7

Browse files
authored
Qualcomm AI Engine Direct - Add configurable job number for build script
Differential Revision: D60769103 Pull Request resolved: #4543
1 parent f19f9d9 commit 91252e7

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

backends/qualcomm/scripts/build.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ BUILD_AARCH64="true"
3030
CMAKE_AARCH64="build_android"
3131
CLEAN="true"
3232
BUILD_TYPE="Debug"
33+
BUILD_JOB_NUMBER="16"
3334

3435
if [ -z PYTHON_EXECUTABLE ]; then
3536
PYTHON_EXECUTABLE="python3"
@@ -39,7 +40,7 @@ if [ -z BUCK2 ]; then
3940
BUCK2="buck2"
4041
fi
4142

42-
long_options=skip_x86_64,skip_aarch64,no_clean,release
43+
long_options=skip_x86_64,skip_aarch64,no_clean,release,job_number:
4344

4445
parsed_args=$(getopt -a --options '' --longoptions $long_options --name "$0" -- "$@")
4546
eval set -- "$parsed_args"
@@ -51,6 +52,7 @@ while true ; do
5152
--skip_aarch64) BUILD_AARCH64="false"; shift;;
5253
--no_clean) CLEAN="false"; shift;;
5354
--release) BUILD_TYPE="Release"; shift;;
55+
--job_number) BUILD_JOB_NUMBER="$2"; shift 2;;
5456
--) shift; break;;
5557
esac
5658
done
@@ -82,7 +84,7 @@ if [ "$BUILD_AARCH64" = true ]; then
8284
-DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
8385
-B$BUILD_ROOT
8486

85-
cmake --build $BUILD_ROOT -j16 --target install
87+
cmake --build $BUILD_ROOT -j$BUILD_JOB_NUMBER --target install
8688

8789
EXAMPLE_ROOT=examples/qualcomm
8890
CMAKE_PREFIX_PATH="${BUILD_ROOT}/lib/cmake/ExecuTorch;${BUILD_ROOT}/third-party/gflags;"
@@ -97,7 +99,7 @@ if [ "$BUILD_AARCH64" = true ]; then
9799
-DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
98100
-B$EXAMPLE_ROOT
99101

100-
cmake --build $EXAMPLE_ROOT -j16
102+
cmake --build $EXAMPLE_ROOT -j$BUILD_JOB_NUMBER
101103
fi
102104

103105
if [ "$BUILD_X86_64" = true ]; then
@@ -120,7 +122,7 @@ if [ "$BUILD_X86_64" = true ]; then
120122
-S $PRJ_ROOT \
121123
-B $BUILD_ROOT \
122124

123-
cmake --build $BUILD_ROOT -j16 --target install
125+
cmake --build $BUILD_ROOT -j$BUILD_JOB_NUMBER --target install
124126

125127
rm -f $PRJ_ROOT/backends/qualcomm/python/*
126128
cp -fv $BUILD_ROOT/backends/qualcomm/Py* "$PRJ_ROOT/backends/qualcomm/python"
@@ -135,5 +137,5 @@ if [ "$BUILD_X86_64" = true ]; then
135137
-DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
136138
-B$EXAMPLE_ROOT
137139

138-
cmake --build $EXAMPLE_ROOT -j16
140+
cmake --build $EXAMPLE_ROOT -j$BUILD_JOB_NUMBER
139141
fi

backends/qualcomm/tests/test_qnn_delegate.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def test_qnn_backend_avg_pool2d(self):
8282

8383
def test_qnn_backend_bmm(self):
8484
module = Bmm() # noqa: F405
85+
torch.manual_seed(8)
8586
sample_input = (torch.randn([4, 8, 32]), torch.randn([4, 32, 8]))
8687
self.lower_module_and_test_output(module, sample_input)
8788

@@ -483,6 +484,7 @@ def setUp(self):
483484

484485
def test_qnn_backend_chunk_add(self):
485486
module = ChunkAdd() # noqa: F405
487+
torch.manual_seed(8)
486488
sample_input = (torch.randn(1, 2, 4, 2),)
487489
self.lower_module_and_test_output(module, sample_input)
488490

@@ -533,6 +535,7 @@ def test_qnn_backend_simple_model(self):
533535

534536
def test_qnn_backend_view_permute_matmul(self):
535537
module = ViewPermuteMatMul() # noqa: F405
538+
torch.manual_seed(8)
536539
sample_input = (torch.randn([1, 8, 512]), torch.randn([1, 2, 8, 256]))
537540
self.lower_module_and_test_output(module, sample_input)
538541

@@ -647,6 +650,7 @@ def test_qnn_backend_avg_pool2d(self):
647650

648651
def test_qnn_backend_bmm(self):
649652
module = Bmm() # noqa: F405
653+
torch.manual_seed(8)
650654
sample_input = (torch.randn([4, 8, 32]), torch.randn([4, 32, 8]))
651655
module = self.get_qdq_module(module, sample_input)
652656
self.lower_module_and_test_output(module, sample_input)
@@ -1097,6 +1101,7 @@ def setUp(self):
10971101

10981102
def test_qnn_backend_chunk_add(self):
10991103
module = ChunkAdd() # noqa: F405
1104+
torch.manual_seed(8)
11001105
sample_input = (torch.randn(1, 1, 4, 2),)
11011106
module = self.get_qdq_module(module, sample_input)
11021107
self.lower_module_and_test_output(module, sample_input)
@@ -1157,6 +1162,7 @@ def test_qnn_backend_simple_model(self):
11571162

11581163
def test_qnn_backend_view_permute_matmul(self):
11591164
module = ViewPermuteMatMul() # noqa: F405
1165+
torch.manual_seed(8)
11601166
sample_input = (torch.randn([1, 8, 512]), torch.randn([1, 2, 8, 256]))
11611167
module = self.get_qdq_module(module, sample_input)
11621168
self.lower_module_and_test_output(module, sample_input)
@@ -1995,7 +2001,7 @@ def test_vit(self):
19952001
if "Error" in msg:
19962002
self.fail(msg["Error"])
19972003
else:
1998-
self.assertGreaterEqual(msg["top_1"], 70)
2004+
self.assertGreaterEqual(msg["top_1"], 65)
19992005
self.assertGreaterEqual(msg["top_5"], 90)
20002006

20012007
def test_edsr(self):

0 commit comments

Comments
 (0)