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

Compile errors coming up... #342

Open
newcapricasean opened this issue Mar 10, 2023 · 10 comments
Open

Compile errors coming up... #342

newcapricasean opened this issue Mar 10, 2023 · 10 comments

Comments

@newcapricasean
Copy link

C26495
C26491
C4244
C6297
C26817
C6385
C26439
C2447
C2548

See these a lot in visual studio 2022. Anyone else getting these errors?

@pinterf
Copy link

pinterf commented Mar 10, 2023

What if you go back a bit to Warning level 3 (though I cannot see some of your error codes even at level 4).

@newcapricasean
Copy link
Author

I'm still rather new at this compiling and hacking of code, so I'm unfamiliar with what you're referring to, with regard to Warning levels... Is that a general term, across all compiling methods, or just with Virtual Studio??? I guess I could also google it...

@newcapricasean
Copy link
Author

Additionally, I would love to compile it with either Virtual Studio 2022, set to AVX2, or even better with MSYS2 UCRT, using -march=znver2 -O3 -mtune=znver2 -O3.

@newcapricasean
Copy link
Author

Well, I got it to compile, rather than run code analysis. It was successful, though it did tell me the following...

[86/148] Building CXX object avs_core\CMakeFiles\AvsCore.dir\convert\intel\convert_bits_avx2.cpp.obj
Z:\Repos\AviSynthPlus-3.7.2\out\build\x64-Debug\cl : Command line warning D9002: ignoring unknown option '-mavx2'
Z:\Repos\AviSynthPlus-3.7.2\out\build\x64-Debug\cl : Command line warning D9002: ignoring unknown option '-mfma'
[87/148] Building CXX object avs_core\CMakeFiles\AvsCore.dir\filters\intel\resample_avx2.cpp.obj
Z:\Repos\AviSynthPlus-3.7.2\out\build\x64-Debug\cl : Command line warning D9002: ignoring unknown option '-mavx2'
Z:\Repos\AviSynthPlus-3.7.2\out\build\x64-Debug\cl : Command line warning D9002: ignoring unknown option '-mfma'

@qyot27
Copy link
Member

qyot27 commented Mar 10, 2023

Command line warning D9002: ignoring unknown option '-mavx2'
Command line warning D9002: ignoring unknown option '-mfma'

How are you launching the build process? Are you launching the MSys2 environment directly, or are you trying to launch it from within the MSVC Command Prompt? Because those are GCC-style configuration flags, and MSVC (which it is trying to use, because build\x64-Debug\cl shows it's trying to use cl and not GCC or Clang) cannot use those.

Even though the build instructions (which are very likely in need of an overhaul) make reference to launching MSys2 from within the MSVC Prompt, that method tends to be really frail or just not work anymore, especially with the march of compiler versions over the years. Either use the MSVC Prompt directly to run the CMake configuration and then use CMake's internal build command (cmake --build . --config [configtype] -j [# of jobs]), or launch one of MSys2's environments directly to avoid touching the MSVC compiler at all.

@newcapricasean
Copy link
Author

newcapricasean commented Mar 10, 2023

Well, I tried MSYS2, first, and didn't succeed. I did succeed in compiling with Visual Studio 2022. I have a question, though, regarding compiling this, an other avisynth filters... Is SSE2 the default, for a reason? Thus far, I've assumed it was because a-one-size-fits-all approach didn't work, and therefore, overriding it to your hardware's capabilities was best. Is using AVX, or AVX2, slower? Additionally, are they less accurate than SSE or SSE2? Thanks, in advance...

Another question... Is compiling with MSYS2 build it better than MSVC 2022?

@newcapricasean
Copy link
Author

When I try to compile with MSYS2 UCRT, the following is the result... I'll include my toolchain file contents, first...

MY TOOLCHAIN FILE<<<
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_SYSTEM_PROCESSOR amd64)

SET(CMAKE_CXX_FLAGS "-march=znver2 -O3 -mtune=znver2 -O3 -pipe")
SET(CMAKE_C_FLAGS "-march=znver2 -O3 -mtune=znver2 -O3 -pipe")
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-march=znver2 -O3 -mtune=znver2 -O3 -pipe")
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-march=znver2 -O3 -mtune=znver2 -O3 -pipe")

SET(CMAKE_C_FLAGS_RELEASE "-march=znver2 -O3 -mtune=znver2 -O3 -pipe")
SET(CMAKE_CXX_FLAGS_RELEASE "-march=znver2 -O3 -mtune=znver2 -O3 -pipe")

MY TOOLCHAIN FILE<<<

newca@NEW_BEGINNINGS UCRT64 ~
$ cd Z:/AviSynthPlus-3.7.2/avisynth-build

newca@NEW_BEGINNINGS UCRT64 /z/AviSynthPlus-3.7.2/avisynth-build
$ #!sh

newca@NEW_BEGINNINGS UCRT64 /z/AviSynthPlus-3.7.2/avisynth-build
$ cmake -DCMAKE_TOOLCHAIN_FILE=build.cmake ../
-- Building for: Ninja
-- The CXX compiler identification is GNU 12.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/MSYS64/ucrt64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detected target processor as: amd64
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- The C compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/MSYS64/ucrt64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: C:/MSYS64/usr/bin/git.exe (found version "2.39.2")
-- Configuring done
-- Generating done
-- Build files have been written to: Z:/AviSynthPlus-3.7.2/avisynth-build

newca@NEW_BEGINNINGS UCRT64 /z/AviSynthPlus-3.7.2/avisynth-build
$ ninja -j 64
[130/148] Building CXX object avs_core/CMakeFiles/AvsCore.dir/filters/AviSource/avi_source.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/AviSource/avi_source.cpp.obj
C:\MSYS64\ucrt64\bin\c++.exe -DAvsCore_EXPORTS -DBUILDING_AVSCORE -IZ:/AviSynthPlus-3.7.2/avs_core/include -IZ:/AviSynthPlus-3.7.2/avisynth-build/avs_core -march=znver2 -O3 -mtune=znver2 -O3 -pipe -msse2 -DINTEL_INTRINSICS -DRELEASE_TARBALL -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/AviSource/avi_source.cpp.obj -MF avs_core\CMakeFiles\AvsCore.dir\filters\AviSource\avi_source.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/AviSource/avi_source.cpp.obj -c Z:/AviSynthPlus-3.7.2/avs_core/filters/AviSource/avi_source.cpp
Z:/AviSynthPlus-3.7.2/avs_core/filters/AviSource/avi_source.cpp:299:1: error: redefinition of 'LRESULT ICDecompressEx(HIC, DWORD, LPBITMAPINFOHEADER, LPVOID, INT, INT, INT, INT, LPBITMAPINFOHEADER, LPVOID, INT, INT, INT, INT)'
299 | ICDecompressEx(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiSrc,LPVOID lpSrc,INT xSrc,INT ySrc,INT dxSrc,INT dySrc,LPBITMAPINFOHEADER lpbiDst,LPVOID lpDst,INT xDst,INT yDst,INT dxDst,INT dyDst)
| ^~~~~~~~~~~~~~
In file included from Z:/AviSynthPlus-3.7.2/avs_core/filters/AviSource/DubSource.h:22,
from Z:/AviSynthPlus-3.7.2/avs_core/filters/AviSource/AudioSource.h:21,
from Z:/AviSynthPlus-3.7.2/avs_core/filters/AviSource/avi_source.cpp:40:
C:/MSYS64/ucrt64/include/vfw.h:414:31: note: 'LRESULT ICDecompressEx(HIC, DWORD, LPBITMAPINFOHEADER, LPVOID, int, int, int, int, LPBITMAPINFOHEADER, LPVOID, int, int, int, int)' previously defined here
414 | __CRT_INLINE LRESULT WINAPI ICDecompressEx(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiSrc,LPVOID lpSrc,int xSrc,int ySrc,int dxSrc,int dySrc,LPBITMAPINFOHEADER lpbiDst,LPVOID lpDst,int xDst,int yDst,int dxDst,int dyDst) {
| ^~~~~~~~~~~~~~
Z:/AviSynthPlus-3.7.2/avs_core/filters/AviSource/avi_source.cpp:319:1: error: redefinition of 'LRESULT ICDecompressExBegin(HIC, DWORD, LPBITMAPINFOHEADER, LPVOID, INT, INT, INT, INT, LPBITMAPINFOHEADER, LPVOID, INT, INT, INT, INT)'
319 | ICDecompressExBegin(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiSrc,LPVOID lpSrc,INT xSrc,INT ySrc,INT dxSrc,INT dySrc,LPBITMAPINFOHEADER lpbiDst,LPVOID lpDst,INT xDst,INT yDst,INT dxDst,INT dyDst)
| ^~~~~~~~~~~~~~~~~~~
C:/MSYS64/ucrt64/include/vfw.h:432:31: note: 'LRESULT ICDecompressExBegin(HIC, DWORD, LPBITMAPINFOHEADER, LPVOID, int, int, int, int, LPBITMAPINFOHEADER, LPVOID, int, int, int, int)' previously defined here
432 | __CRT_INLINE LRESULT WINAPI ICDecompressExBegin(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiSrc,LPVOID lpSrc,int xSrc,int ySrc,int dxSrc,int dySrc,LPBITMAPINFOHEADER lpbiDst,LPVOID lpDst,int xDst,int yDst,int dxDst,int dyDst) {
| ^~~~~~~~~~~~~~~~~~~
[147/148] Building CXX object avs_core/CMakeFiles/AvsCore.dir/filters/exprfilter/exprfilter.cpp.obj
ninja: build stopped: subcommand failed.

@pinterf
Copy link

pinterf commented Mar 11, 2023

Setting the target to avx2 may result in slower code actually. Things which needed sse4 avx avx2 optimization are written manually. Try it yourself. It would depend on which internal filter are you heavily using.

@pinterf
Copy link

pinterf commented Mar 11, 2023

Check the .rst (or at github io) doc as well on how to build them, I admit msys2 part needs polishing but I just updated the build docs for Intel 2023 compiler, for example.

@DTL2020
Copy link

DTL2020 commented Mar 11, 2023

" Is SSE2 the default, for a reason? Thus far, I've assumed it was because a-one-size-fits-all approach didn't work, and therefore, overriding it to your hardware's capabilities was best. Is using AVX, or AVX2, slower? Additionally, are they less accurate than SSE or SSE2? Thanks, in advance..."

Typical minimum target build architecture of 201x and may be newer compilers is x86 or x64 general purpose IA chip +FPU +SSE(2) SIMD coprocessors. So compiler can use FPU and SSE for scalar operations (scalar float SSE may be faster in compare with FPU float) and also registerfile of coprocessors to pass functions agruments or simply store temporal values and so on. 32bit and 64bit chip modes have different avaialble size of SIMD coprocessor registerfile (or may be limitation of instructions addressing in 32 and 64bit modes).

Typically compilers are not any smart to make significantly good SIMD version of C-functions so typically only benefit you can get from targeting to AVX2 or AVX512 architectures build is having more registerfile size for holding some temporals and not disturb cache (it several times slower and writing to cache cause large disturbance on all multiprocessor cache coherency domain because of broadcasting data changes in common memory address space). Also if compiler interesting in such storage and smart enough. Also if you use intel compiler it can optimize for intel chips families directly (need to add command line switches specific to your target intel chip).

So typically builds for >SSE2 and running on >SSE2 architectures can sometime have some performance benefit (may be 1..5%). But because of emitting >SSE2 instructions they can only run on target or higher architecture because typical compilers not make separate versions and autoswitching so user will got invalid opcode crash on lower architecture.

Also if you want to build for very old x86+FPU or x64+FPU (if possible ?) architectures you need to disable SSE too.

qyot27 pushed a commit that referenced this issue Oct 5, 2024
mingwXX/ucrt64 `vfw.h` has already defined these.
Fixes #242 and #342 (comment).
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

4 participants