Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wasi support #5534

Merged
merged 2 commits into from
Jul 2, 2024
Merged

Add wasi support #5534

merged 2 commits into from
Jul 2, 2024

Conversation

quink-black
Copy link
Contributor

WASI is WebAssembly System Interface. Now we can build ncnn with wasi-sdk[1] to create a WebAssembly binary module, and run it with wasmtime on cmdline.

[1] https://github.com/WebAssembly/wasi-sdk
[2] https://github.com/bytecodealliance/wasmtime

@tencent-adm
Copy link
Member

tencent-adm commented Jun 27, 2024

CLA assistant check
All committers have signed the CLA.

@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.65%. Comparing base (4c3deba) to head (a3e9b8d).
Report is 4 commits behind head on master.

Current head a3e9b8d differs from pull request most recent head decc508

Please upload reports for the commit decc508 to get more accurate results.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #5534       +/-   ##
===========================================
- Coverage   94.66%   92.65%    -2.02%     
===========================================
  Files         787      368      -419     
  Lines      248712    91067   -157645     
===========================================
- Hits       235432    84374   -151058     
+ Misses      13280     6693     -6587     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

#include <thread>
#else
#include <unistd.h> // usleep()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I made another mistake.

cmake -B build -DCMAKE_BUILD_TYPE=Release \
	--toolchain ${wasi_sdk}/share/cmake/wasi-sdk.cmake \
	-DNCNN_RUNTIME_CPU=OFF \
	-DNCNN_DISABLE_EXCEPTION=ON \
	-DNCNN_THREADS=OFF

cmake --build build

After build, you can run benchncnn on cmdline with wasmtime:
wasmtime --dir . benchncnn
@nihui nihui merged commit a05c113 into Tencent:master Jul 2, 2024
69 checks passed
@nihui
Copy link
Member

nihui commented Jul 2, 2024

Thanks for your contribution !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants