Skip to content

Commit ca37997

Browse files
committed
Update base for Update on "[ET Device Support] TensorImpl carries device info"
This diff extends `TensorImpl` to carry device information, enabling the runtime tensor to track which device its data resides on (CPU, CUDA, etc.). This is a prerequisite for parsing device info from the schema and allocating device memory. Differential Revision: [D93635655](https://our.internmc.facebook.com/intern/diff/D93635655/) [ghstack-poisoned]
2 parents 1db5a24 + 89b938a commit ca37997

40 files changed

Lines changed: 2682 additions & 2076 deletions

.github/workflows/pull.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
branches:
77
- main
88
- release/*
9+
tags:
10+
- ciflow/trunk/*
911
workflow_dispatch:
1012

1113
concurrency:
@@ -520,6 +522,91 @@ jobs:
520522
exit 1
521523
fi
522524
525+
test-arm-cortex-m-size-test:
526+
name: test-arm-cortex-m-size-test
527+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
528+
permissions:
529+
id-token: write
530+
contents: read
531+
strategy:
532+
matrix:
533+
os: [bare_metal, zephyr-preset]
534+
fail-fast: false
535+
with:
536+
runner: linux.2xlarge
537+
docker-image: ci-image:executorch-ubuntu-22.04-arm-sdk
538+
submodules: 'recursive'
539+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
540+
timeout: 90
541+
script: |
542+
# The generic Linux job chooses to use base env, not the one setup by the image
543+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
544+
conda activate "${CONDA_ENV}"
545+
546+
cxx_flags="-fno-exceptions -fno-rtti -Wall -Werror -Wno-int-in-bool-context -DET_HAVE_PREAD=0"
547+
setup_script_args=""
548+
if [[ ${{ matrix.os}} == "bare_metal" ]]; then
549+
toolchain_prefix=arm-none-eabi-
550+
threshold="111000" # 111 KiB
551+
toolchain_cmake=examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
552+
elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then
553+
setup_script_args="--target-toolchain zephyr"
554+
toolchain_prefix=arm-zephyr-eabi-
555+
threshold="136020" # 136 KiB
556+
toolchain_cmake=examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake
557+
else
558+
echo "Unsupported OS selection: ${{ matrix.os }}"
559+
exit 1
560+
fi
561+
562+
source .ci/scripts/utils.sh
563+
install_executorch "--use-pt-pinned-commit"
564+
.ci/scripts/setup-arm-baremetal-tools.sh ${setup_script_args}
565+
source examples/arm/arm-scratch/setup_path.sh
566+
567+
# User toolchain
568+
${toolchain_prefix}c++ --version
569+
570+
# Setup cmake target to desired toolchain
571+
toolchain_cmake=$(realpath ${toolchain_cmake})
572+
573+
# Build and run size test
574+
if [[ ${{ matrix.os}} == "bare_metal" ]]; then
575+
bash test/build_size_test.sh "-DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} -DEXECUTORCH_BUILD_ARM_BAREMETAL=ON"
576+
elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then
577+
CXXFLAGS=${cxx_flags} cmake --preset zephyr -DCMAKE_BUILD_TYPE=Release -DEXECUTORCH_OPTIMIZE_SIZE=ON -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out .
578+
cmake --build cmake-out -j9 --target install --config Release
579+
CXXFLAGS=${cxx_flags} cmake -DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out/test test
580+
cmake --build cmake-out/test -j9 --config Release
581+
else
582+
echo "Fail unsupported OS selection ${{ matrix.os }}"
583+
exit 1
584+
fi
585+
586+
elf="cmake-out/test/size_test"
587+
588+
# Dump basic info
589+
ls -al ${elf}
590+
${toolchain_prefix}size ${elf}
591+
592+
# Dump symbol
593+
python .github/scripts/run_nm.py -e ${elf}
594+
python .github/scripts/run_nm.py -e ${elf} -f "executorch" -p "${toolchain_prefix}"
595+
python .github/scripts/run_nm.py -e ${elf} -f "executorch_text" -p "${toolchain_prefix}"
596+
597+
# Add basic guard - TODO: refine this!
598+
${toolchain_prefix}strip ${elf}
599+
output=$(ls -la ${elf})
600+
arr=($output)
601+
size=${arr[4]}
602+
echo "size: $size, threshold: $threshold"
603+
if [[ "$size" -le "$threshold" ]]; then
604+
echo "Success $size <= $threshold"
605+
else
606+
echo "Fail $size > $threshold"
607+
exit 1
608+
fi
609+
523610
android:
524611
uses: ./.github/workflows/_android.yml
525612
permissions:

.github/workflows/trunk.yml

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -377,91 +377,6 @@ jobs:
377377
378378
backends/arm/test/test_arm_baremetal.sh "${ARM_TEST}"
379379
380-
test-arm-cortex-m-size-test:
381-
name: test-arm-cortex-m-size-test
382-
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
383-
permissions:
384-
id-token: write
385-
contents: read
386-
strategy:
387-
matrix:
388-
os: [bare_metal, zephyr-preset]
389-
fail-fast: false
390-
with:
391-
runner: linux.2xlarge
392-
docker-image: ci-image:executorch-ubuntu-22.04-arm-sdk
393-
submodules: 'recursive'
394-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
395-
timeout: 90
396-
script: |
397-
# The generic Linux job chooses to use base env, not the one setup by the image
398-
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
399-
conda activate "${CONDA_ENV}"
400-
401-
cxx_flags="-fno-exceptions -fno-rtti -Wall -Werror -Wno-int-in-bool-context -DET_HAVE_PREAD=0"
402-
setup_script_args=""
403-
if [[ ${{ matrix.os}} == "bare_metal" ]]; then
404-
toolchain_prefix=arm-none-eabi-
405-
threshold="111000" # 111 KiB
406-
toolchain_cmake=examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
407-
elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then
408-
setup_script_args="--target-toolchain zephyr"
409-
toolchain_prefix=arm-zephyr-eabi-
410-
threshold="136020" # 136 KiB
411-
toolchain_cmake=examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake
412-
else
413-
echo "Fail unsupport OS selection ${{ matrix.os }}"
414-
exit 1
415-
fi
416-
417-
source .ci/scripts/utils.sh
418-
install_executorch "--use-pt-pinned-commit"
419-
.ci/scripts/setup-arm-baremetal-tools.sh ${setup_script_args}
420-
source examples/arm/arm-scratch/setup_path.sh
421-
422-
# User toolchain
423-
${toolchain_prefix}c++ --version
424-
425-
# Setup cmake target to desired toolchain
426-
toolchain_cmake=$(realpath ${toolchain_cmake})
427-
428-
# Build and run size test
429-
if [[ ${{ matrix.os}} == "bare_metal" ]]; then
430-
bash test/build_size_test.sh "-DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} -DEXECUTORCH_BUILD_ARM_BAREMETAL=ON"
431-
elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then
432-
CXXFLAGS=${cxx_flags} cmake --preset zephyr -DCMAKE_BUILD_TYPE=Release -DEXECUTORCH_OPTIMIZE_SIZE=ON -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out .
433-
cmake --build cmake-out -j9 --target install --config Release
434-
CXXFLAGS=${cxx_flags} cmake -DCMAKE_TOOLCHAIN_FILE=${toolchain_cmake} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out/test test
435-
cmake --build cmake-out/test -j9 --config Release
436-
else
437-
echo "Fail unsupport OS selection ${{ matrix.os }}"
438-
exit 1
439-
fi
440-
441-
elf="cmake-out/test/size_test"
442-
443-
# Dump basic info
444-
ls -al ${elf}
445-
${toolchain_prefix}size ${elf}
446-
447-
# Dump symbol
448-
python .github/scripts/run_nm.py -e ${elf}
449-
python .github/scripts/run_nm.py -e ${elf} -f "executorch" -p "${toolchain_prefix}"
450-
python .github/scripts/run_nm.py -e ${elf} -f "executorch_text" -p "${toolchain_prefix}"
451-
452-
# Add basic guard - TODO: refine this!
453-
${toolchain_prefix}strip ${elf}
454-
output=$(ls -la ${elf})
455-
arr=($output)
456-
size=${arr[4]}
457-
echo "size: $size, threshold: $threshold"
458-
if [[ "$size" -le "$threshold" ]]; then
459-
echo "Success $size <= $threshold"
460-
else
461-
echo "Fail $size > $threshold"
462-
exit 1
463-
fi
464-
465380
test-arm-ootb-linux:
466381
name: test-arm-ootb-linux
467382
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main

0 commit comments

Comments
 (0)