Add RISC-V smoke test on QEMU#19399
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19399
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
Implements Phase 1 of the RISC-V Support RFC (pytorch#18991): cross-compile executor_runner for riscv64-linux-gnu, run a small BundledProgram under qemu-user-static on a stock x86_64 GitHub runner, and assert the standard "Test_result: PASS" marker that the portable executor_runner already emits via the bundled-IO comparison path (examples/portable/executor_runner/executor_runner.cpp:646). The riscv64-linux preset mirrors arm-ethosu-linux: same Linux cross-compile shape, same standard executor_runner, same filesystem .pte, same option set with EXECUTORCH_ENABLE_BUNDLE_IO added so the runner self-checks. Single deviation is glibc-via-apt instead of musl to avoid the MUSL_TOOLCHAIN_ROOT tarball setup. The reusable _test_riscv.yml workflow is wired into pull.yml on every PR.
The error we would get on CI is: ``` /usr/bin/riscv64-linux-gnu-gcc --sysroot=/usr/riscv64-linux-gnu -o CMakeFiles/cmTC_eb936.dir/testCCompiler.c.o -c /pytorch/executorch/cmake-out/CMakeFiles/CMakeScratch/TryCompile-o3upsB/testCCompiler.c Linking C executable cmTC_eb936 /opt/conda/envs/py_3.10/lib/python3.10/site-packages/cmake/data/bin/cmake -E cmake_link_script CMakeFiles/cmTC_eb936.dir/link.txt --verbose=1 /usr/lib/gcc-cross/riscv64-linux-gnu/11/../../../../riscv64-linux-gnu/bin/ld: cannot find /usr/riscv64-linux-gnu/lib/libc.so.6 inside /usr/riscv64-linux-gnu /usr/lib/gcc-cross/riscv64-linux-gnu/11/../../../../riscv64-linux-gnu/bin/ld: cannot find /usr/riscv64-linux-gnu/lib/libc_nonshared.a inside /usr/riscv64-linux-gnu /usr/lib/gcc-cross/riscv64-linux-gnu/11/../../../../riscv64-linux-gnu/bin/ld: cannot find /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 inside /usr/riscv64-linux-gnu collect2: error: ld returned 1 exit status ```
It is to not mark it as viable/strict to a release and pull request, until we can prove point its stability
It didn't need to be that complicated
|
Thanks, I just re-triggered CI. |
| examples/riscv/setup.sh # apt: gcc-riscv64-linux-gnu, qemu-user-static | ||
| examples/riscv/run.sh # export, cross-compile, run under qemu-user |
| """AOT export for the RISC-V Phase 1.0 smoke test. | ||
|
|
||
| Exports a trivial ``torch.add`` module to a BundledProgram (.bpte) that the | ||
| portable executor_runner can load on a riscv64 target and verify against the |
There was a problem hiding this comment.
Nit, perhaps we should plan to add riscv32 support in the future, even if we don't add it now, and not assume march too tightly. I am thinking about embedded uscases.
There was a problem hiding this comment.
Absolutely. I don’t have direct input on customers asking for it, but the current scripts can easily be extended to test on qemu-static-riscv32.
|
I've got changes for enabling XNNPACK, mobilenetv2 and mobilebert at riseproject-dev/executorch@riscv-testing...riseproject-dev:executorch:riscv-testing-mobilenetv2 once this PR is merged. It's all incremental, other than needing to add the |
|
I just submitted #19521 to add a |
|
@luhenry - Can you fix up the lints? I think that is the last merge blocker. |
Summary
Implements Phase 1 of the RISC-V Support RFC: cross-compile
executor_runnerforriscv64-linux-gnu, run a small BundledProgram underqemu-user-staticon a x86_64 runner, and assert the standard "Test_result: PASS" marker that the portable executor_runner already emits via the bundled-IO comparison path (examples/portable/executor_runner/executor_runner.cpp:6461).The
riscv64-linuxpreset mirrorsarm-ethosu-linux. The only deviation is glibc instead of musl to avoid theMUSL_TOOLCHAIN_ROOTtarball setup.The reusable
_test_riscv.ymlworkflow is is triggered viapull.ymlon every pull request.Test plan
Ran locally, and integration to CI for automated testing.
cc @GregoryComer @digantdesai @cbilgin @psiddh @AdrianLundell @rascani @mergennachin