Skip to content

Commit 3dc9cfc

Browse files
committed
Adding the build test for the neutron backend library.
1 parent 65136c2 commit 3dc9cfc

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

.github/workflows/trunk.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,36 @@ jobs:
271271
exit 1
272272
fi
273273
274+
nxp-build-test:
275+
name: nxp-build-test
276+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
277+
permissions:
278+
id-token: write
279+
contents: read
280+
with:
281+
runner: linux.2xlarge
282+
docker-image: executorch-ubuntu-22.04-arm-sdk
283+
submodules: 'recursive'
284+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
285+
timeout: 90
286+
script: |
287+
# The generic Linux job chooses to use base env, not the one setup by the image
288+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
289+
conda activate "${CONDA_ENV}"
290+
291+
# Build
292+
cmake -DEXECUTORCH_BUILD_NXP_NEUTRON=ON -Bcmake-out .
293+
cmake --build cmake-out --target executorch_delegate_neutron --config Release
294+
295+
# Build check for the neutron backend library
296+
lib_neutron="cmake-out/backends/nxp/libexecutorch_delegate_neutron.a"
297+
if [ -f $lib_neutron ]; then
298+
echo "Neutron backend library built."
299+
else
300+
echo "Neutron backend library not found!"
301+
exit 1
302+
fi
303+
274304
test-coreml-delegate:
275305
name: test-coreml-delegate
276306
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main

backends/nxp/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
set(
77
_common_include_directories
88
${CMAKE_CURRENT_SOURCE_DIR}/../../..
9+
${CMAKE_CURRENT_SOURCE_DIR}/../../runtime/core/portable_type/c10
910
)
11+
add_compile_definitions(C10_USING_CUSTOM_GENERATED_MACROS)
1012

1113
set(_neutron_sources ${CMAKE_CURRENT_SOURCE_DIR}/runtime/NeutronBackend.cpp )
1214

backends/nxp/runtime/NeutronBackend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ class NeutronBackend final : public PyTorchBackendInterface {
236236
// cfg->mcfg.kernels
237237
const uint8_t* transpositionFlags =
238238
static_cast<const uint8_t*>(processed->data());
239-
uint32_t numInputs = transpositionFlags[INPUT_TENSOR_FORMAT_LEN_POS];
240-
uint32_t numOutputs = transpositionFlags[OUTPUT_TENSOR_FORMAT_LEN_POS];
239+
int numInputs = transpositionFlags[INPUT_TENSOR_FORMAT_LEN_POS];
240+
int numOutputs = transpositionFlags[OUTPUT_TENSOR_FORMAT_LEN_POS];
241241
cfg->inputTranspositionFlags =
242242
INPUT_TENSOR_FORMAT_ARRAY_ADDR(transpositionFlags);
243243
cfg->outputTranspositionFlags =

0 commit comments

Comments
 (0)