Open wangyoucao577 opened 2 years ago
Hi,
Clang-cl was never tested so not unexpected with bugs there.
I think you are correct regarding the file properties settings for MSVC is not set correctly, but need some more time refresh my memory. For runtime detection it should for sure only be applied on the corresponding files.
So in summary:
Feel free to file PR, filing it on gitlab will make things easier to merge.
So regarding SSE4.1 there is no auto-vectorization for MSVC, so there is no compiler flag needed for SSE4.1 source.
See (https://stackoverflow.com/a/64057905)
Regarding AVX in Opus there is no AVX optimizations currently, so either it's PRESUME_AVX which enabled it in all build or MAY_HAVE which is essentially no-op.
I am working on rewriting the intrinsic logic in cmake so will try to make more comments.
I've sent email to webmaster@xiph.org to apply for gitlab forking permission for several days, but didn't get response so far. Could you please take a look so that I can fork and create PR on gitlab? Thanks!
Hiya, saw the mail, just behind.
No need to ask permission to fork! Once you have a PR, I'll be happy to look.
Sorry.. but the fork
button is grey, so I can't fork it.
So regarding SSE4.1 there is no auto-vectorization for MSVC, so there is no compiler flag needed for SSE4.1 source.
See (https://stackoverflow.com/a/64057905)
Regarding AVX in Opus there is no AVX optimizations currently, so either it's PRESUME_AVX which enabled it in all build or MAY_HAVE which is essentially no-op.
I am working on rewriting the intrinsic logic in cmake so will try to make more comments.
Yes, MSVC doesn't have flags for SSE4.1, but MSVC compatible clang-cl does have.
https://github.com/xiph/opus/pull/257
I've made PR here since I still can't fork/branch on gitlab. Please help review. If it's good to you, I can move it to gitlab once I have permission to do. Thanks!
I'm also having compilations errors with opus + clang-cl. install-x64-windows-bitwig-rel-out.log
Hi,
I'm trying to disable
AVX
on windows compilation to compatible with old CPUs that noAVX
instructions support. I usesclang-cl
compiler(clang 12) that installed in latest Visual Studio 2022, but the build is failed. Here's the reproduction and error logs.After some investigation, I found the problem is that
clang-cl
also enablesMSVC
flag in cmake, so the checking support for SSE4.1 usescheck_flag(SSE4_1 /arch:SSE2) # SSE2 and above
(https://github.com/xiph/opus/blob/c9d5bea13e3cb7381bfa897a45d8bab4e7b767a7/cmake/OpusFunctions.cmake#L99), which is not good enough.MSVC doesn't support to enable SSE4.1 seperately. It can only be enabled it by at least
/arch:AVX
, otherwise disabled. See https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86?view=msvc-170. But clang supports more flexible options-msse4.1
. So in this case, I'll recommend to useif (MSVC AND CMAKE_C_COMPILER_ID STREQUAL "MSVC")
to decide whether use/arch:xx
or-mxx
.I have tested it in my situation and it works well. Any idea? If it's ok, I can file a PR for this. Any idea?
One more question, from the compliation I saw the
/arch:AVX
or-mavx
have been added to all files, which will make runtime detection no useful. Any reason to do that? Is it possible to moveAVX
optimization codes to seperate files so that we can only compile them withAVX
, and don't run them when runtime detection found noAVX
support?Thanks!