pytorch / executorch

On-device AI across mobile, embedded and edge for PyTorch
https://pytorch.org/executorch/
Other
2.24k stars 374 forks source link

arm_executor_runner is not an object file #7104

Closed AIWintermuteAI closed 2 days ago

AIWintermuteAI commented 3 days ago

🐛 Describe the bug

As a result of running ./run.sh --build_only --scratch-dir=build-dir on MacOS

cmake-out % size arm_executor_runner
__TEXT  __DATA  __OBJC  others  dec     hex
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/size: file: arm_executor_runner is not an object file

Using arm-none-eabi-size instead works.

Versions

arm % python collect_env.py Collecting environment information... PyTorch version: 2.6.0.dev20241019 Is debug build: False CUDA used to build PyTorch: None ROCM used to build PyTorch: N/A

OS: macOS 14.6.1 (arm64) GCC version: Could not collect Clang version: 15.0.0 (clang-1500.1.0.2.5) CMake version: version 3.30.5 Libc version: N/A

Python version: 3.10.15 (main, Oct 3 2024, 02:24:49) [Clang 14.0.6 ] (64-bit runtime) Python platform: macOS-14.6.1-arm64-arm-64bit Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True

CPU: Apple M1 Pro

Versions of relevant libraries: [pip3] executorch==0.5.0a0+ffad824 [pip3] numpy==1.21.3 [pip3] torch==2.6.0.dev20241019 [pip3] torchaudio==2.5.0.dev20241019 [pip3] torchsr==1.0.4 [pip3] torchvision==0.20.0.dev20241019 [conda] executorch 0.5.0a0+ffad824 pypi_0 pypi [conda] numpy 1.21.3 pypi_0 pypi [conda] torch 2.6.0.dev20241019 pypi_0 pypi [conda] torchaudio 2.5.0.dev20241019 pypi_0 pypi [conda] torchsr 1.0.4 pypi_0 pypi [conda] torchvision 0.20.0.dev20241019 pypi_0 pypi

AIWintermuteAI commented 3 days ago

It's these few lines https://github.com/pytorch/executorch/blob/d679ad70a7745c60df581d6b110e6f79c389feb9/examples/arm/run.sh#L216

zingo commented 2 days ago

Thanks, good finding! Yes we should fix this :) Do you want to make a patch and get some kudos? If not we can make one, no problem.

AIWintermuteAI commented 2 days ago

@zingo I can make a PR. But I was running this on Mac, which seems to be unsupported (?). Not sure if this issue is platform related, as in theory size on Linux x86 also would not work on ARM binary. But where was the person who wrote this cript running all of this, Linux on ARM machine?

zingo commented 2 days ago

But where was the person who wrote this cript running all of this, Linux on ARM machine?

I wrote this part of the script, and are using Linux on x86 I assume it could be that the size on my machine (and all testing machine used) "by-luck" can handle elf file for Arm as Linux version probably are happy as long as it's an elf file, so I missed that. It would be better to use the one from the embedded compiler e.g. I agree that arm-none-eabi-size is much better :) Sorry for the bug.

Even if MacOS is not supported I would like it to be in the future and fixing stuff along the way is nice. Thanks

Did a test on my maching replacing the 3 size with arm-none-eabi-size and it works perfectly fine in this setup, so it github PR testing is happy with the PR it should be fine :)

AIWintermuteAI commented 2 days ago

Created a PR.