[GSoC 2022] nasm/simd support for libjpeg-turbo#22372
Conversation
|
LGTM ( i tested only on Windows ) you can see build logs with nasm is available and nasm is unavailable result output of test code is like below SIMD Support: YES SIMD Support: NO |
c354162 to
6aa3e9f
Compare
|
FYI: perf tests can report status and performance statistics with to xml with flag --gtest_output=xml:report_file_name.xml. The xml reports could be compared with summary.py script: https://github.com/opencv/opencv/blob/4.x/modules/ts/misc/summary.py |
|
I have changed some parts of the CMakeLists take into account your comments. But i am thinking that is not what you want exactly. Can you give me more info about that and if possible, could you look at last workflow errors? In the macOS ARM build, 3 tests are failed. I did not understand why this is the case because these pass in my computer. @asmorkalov |
0e25aa1 to
427e392
Compare
|
Geometric mean (ms)
|
7e69a7b to
e7b457e
Compare
|
@ocpalo, we really need to finalize this PR by the end of GSoC. Please, be more active |
|
So far, we have verified in the following OS and architecture.
Performance comparision between SIMD enabled vs not. Ubuntu x64 Geometric mean (ms)
|
|
@asmorkalov Hi, Vadim informed me in the last meeting about CPU type and optimization baseline. I have a few comments about this. Let me know what you think so I can do the changes according to your comments. In the My second question is, as you said before some CPU's does not support SIMD instructions. Since we provide this SIMD extension as optional(enabled by default), the user can disable this extension. Should I worry about this? I think it will make CMakeLists complicated. |
f38c4fa to
d199ddf
Compare
|
Hello @ocpalo Thanks for the great job! I reviewed CMakeLists in libjpeg-turbo repos and tested previous version of the patch. Findings:
So What I propose to do:
|
|
@asmorkalov Thanks for the feedback!
I am trying to solve how to catch if old systems does not support AVX2 assembly support at compile time. |
|
|
||
| # No SIMD | ||
| set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c) | ||
| if(MSVC) |
There was a problem hiding this comment.
MSVC
MSVC_IDE
Looks like there is some mess in using of these variables.
There was a problem hiding this comment.
I borrowed these lines from the upstream. Same as MSVC_IDE parts.
f12313a to
9a0283c
Compare
|
CMake emits warning when libjpeg-turbo SIMD Extension is enabled but could not activated due to no support. Hence this seems like workflow fails. Should I change it Also, I was planning to add the following lines to the CMake to see if SIMD extension is supported on compile time. But could not be sure if this is right or not. if(X86_64)
if(NOT "${CPU_BASELINE_FINAL}" MATCHES "SSE2|AVX2" OR NOT "${CPU_DISPATCH}" MATCHES "SSE2|AVX2")
set(WITH_SIMD 0)
endif()
endif()
if(X86)
if(NOT "${CPU_BASELINE_FINAL}" MATCHES "MMX|AVX2|SSE2" OR NOT "${CPU_DISPATCH}" MATCHES "MMX|AVX2|SSE2")
set(WITH_SIMD 0)
endif()
endif()If someone confirm, i will push it. |
|
Only "CPU_BASELINE_FINAL" should be used. Also take a look on other 3rdparty file hows to do this right.
I believe |
|
If ENABLE_LIBJPEG_TURBO_SIMD "Include SIMD extensions for libjpeg-turbo, if available for this platform" (NOT CV_DISABLE_OPTIMIZATION)SIMD extension is controlled via ENABLE_LIBJPEG_TURBO_SIMD flag. And this flags value is |
9a0283c to
d717de5
Compare
asmorkalov
left a comment
There was a problem hiding this comment.
Looks good to me except debug messages in CMake.
| endif() | ||
|
|
||
| if(WITH_SIMD) | ||
| message(STATUS "SIMD extensions: ${CPU_TYPE} (WITH_SIMD = ${WITH_SIMD})") |
There was a problem hiding this comment.
I think this message is redundant. SIMD status is reported form simd/CmakeLists.txt. In particular on armv6 I see:
SIMD extensions: arm (WITH_SIMD = 1)
There was a problem hiding this comment.
Actually this line reports this. There is no message reported on simd/CMakeLists.txt except failures and it reports NEON or partial NEON support. I believe it is good have for other type CPU's.
|
Thanks, I appreciate for the support and the help! |

Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.
Related with #22344