Skip to content

[SIMD] optimize the cvtColor kernel #301

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

Closed
huningxin opened this issue Aug 28, 2019 · 6 comments
Closed

[SIMD] optimize the cvtColor kernel #301

huningxin opened this issue Aug 28, 2019 · 6 comments
Assignees
Milestone

Comments

@huningxin
Copy link
Owner

According to #300 (comment), the SIMD cvtColor kernel is times slower than scalar version.

According to my investigation, the root cause is the inefficient pshufb with memory operands are generated by V8 for current implementation.

One solution is to refer to sse implementation that uses punpcklbw and punpckhqdq. I tried but it still fails due to an emscripten issue that leads V8 fails to generate those instructions. Let's see the response from emscripten community.

@huningxin
Copy link
Owner Author

@Wenzhao-Xiang , please move this info to PR for record.

@huningxin
Copy link
Owner Author

Link to WebAssembly/simd#196

@huningxin
Copy link
Owner Author

@lionkunonly , please report the latest perf data you have. Thanks!

@lionkunonly
Copy link
Collaborator

lionkunonly commented Jul 23, 2020

Ubuntu 18.04, Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz, chrome dev 85.0.4183.26, and emscripten 1.39.16.

WASM Scalar (mean time) WASM SIMD (mean time) SIMD speedup
CvtColor (1920x1080,COLOR_RGBA2GRAY) 2.4161 2.8215 0.86X

@lionkunonly
Copy link
Collaborator

@huningxin Hi, Ningxin. I am not sure how to optimize the CvtColor. Do you have more suggestions in detail?

@huningxin
Copy link
Owner Author

As mentioned in #301 (comment), this issue depends on WebAssembly/simd#196 and emscripten-core/emscripten#9340.

Compared to the last year's performance (0.24X), your latest data (0.86X) is 3.5X faster.

It seems WebAssembly community is still working on that. Let's monitor and test if there is new progress.

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

No branches or pull requests

2 participants