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

请问paddle lite是否支援webassembly? #10419

Closed
stereomatchingkiss opened this issue Nov 18, 2023 · 7 comments
Closed

请问paddle lite是否支援webassembly? #10419

stereomatchingkiss opened this issue Nov 18, 2023 · 7 comments

Comments

@stereomatchingkiss
Copy link

如题,请问是否有相关教程,告诉我们如何编译成webassembly的库?不需要js的接口,只要c++就够了。

例如不支援thread和simd的
支援thread但不支援simd
支援thread和simd
支援simd但不支援thread

谢谢

@engineer1109
Copy link
Contributor

不支持,有很多native的汇编或依赖intel mkl。不要碰了

@stereomatchingkiss
Copy link
Author

多谢,可以理解这得多麻烦,未来有打算学ncnn,抛弃掉intel mkl,自己实现一个吗?

@engineer1109
Copy link
Contributor

应该有其他成熟的AI框架,支持wasm的。但是估计都是CPU的。
性能应该很烂。勉强用用。
我记得onnxruntime可以,两年前试过

@stereomatchingkiss
Copy link
Author

应该有其他成熟的AI框架,支持wasm的。但是估计都是CPU的。 性能应该很烂。勉强用用。 我记得onnxruntime可以,两年前试过

谢谢,试过ncnn,onnxruntime和opencv dnn,作为demo,性能堪用了
对我来说,网页版最大的好处是跨平台方便,一个极好的demo工具

ncnn的问题是在网页上执行paddleocr v3的时候,推理结果是错误的
opencv dnn则是不支援动态输入
onnxruntime编译成static lib后各种链接冲突
最后还是得用onnxruntime的js版本,碍于wasm的EM_JS写的函数只能在main thread调用,代码写的有点别扭

@engineer1109
Copy link
Contributor

@stereomatchingkiss wasm多线程使用,需要全局开启-s USE_PTHREAD=1 (好像是这个)
第三方库也一样
web的pthread对应的是worker

@stereomatchingkiss
Copy link
Author

@stereomatchingkiss wasm多线程使用,需要全局开启-s USE_PTHREAD=1 (好像是这个) 第三方库也一样 web的pthread对应的是worker

已经开启了,QThread, std::thread的调用都没问题
但是不能在main thread之外呼叫EM_JS实现的函数
emscripten目前规定必须在main thread内呼叫

@hong19860320
Copy link
Collaborator

之前已经支持 Emscripten 的编译,具体可以看下这个 PR #8985

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

No branches or pull requests

3 participants