-
Notifications
You must be signed in to change notification settings - Fork 560
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
Cannot compile with O0(debug mode) #389
Comments
This error happens because the code was called in a loop that's usually unrolled by the compiler's optimizer. Your configure line is strange with different flags for c & c++. There's hardly any c++ code in cpuminer-opt and what does exist doesn't need different flags. |
I re-run the configure script as written at the documentation and it compiles successfully. When I'm running it in debug mode I'm still getting the same error after i added the option
The reason for working with debug mode is that I'm receiving this error. Stacktrace output from GDB:
|
That's not a proper build. That's probably why it crashed. Use a proper architecture. |
I'm sorry but even when I'm running This is my new line: |
If the segfault occurs when built with march=native -O3, there is a problem so a lot more info is required. I'll need the full story: Edit: Take a look at #379, looks very similar. What's your CPU? Edit: here's the important part of that issue: |
The comment solved my problem. AFAIU I'm missing the AVX2 optimizations? Edit: The crash is in this line, as same as mentioned at the this #379 (comment). If I'm adding this line at the loop, it's working as expected:
Edit (2): I read al the thread of #379 and it's the same on my computer. |
That's very interesting, it's the very same problem. Are you using v3.21.1, it should be fixed. I froced target to be aligned:
It's ultimately an alignment issue that shouln't happen. The optimizer auto-vectorizes the loop with AVX2 which requires 32 byte data alignment. Preventing auto-vectorization is a workaround that will prevent the fault, as adding a applog call did in your test. However, if it faults with v3.21.1, with enforced 32 bit alignment, I've got a bigger problem. Regarding the compile problem with code that is dependent on compiler loop unrolling, I'll take a look but won't promise anything. Edit: Both issues were when compiling with GCC-11.2, you could try a different compiler to see if it makes a difference, GCC-12 is available for Ubuntu 22.04. |
I investigated the compile error with -O0 and it was not related to loop unrolling but compile time constants. |
Are there anymore test results forthcoming? If not there's no point keeping this open. |
The issue seems to have been abandoned. Compiling with -O0 is a non-issue, the segfault in GBT using AVX2 will remain a mystery for now. |
I'm trying to compile the latest release v.3.21.1 and v3.21 and got the same error
The makefile was created by:
CFLAGS="-O0 -march=native -mtune=native" CXXFLAGS="$CFLAGS -std=c++17 -Wno-ignored-attributes -mavx2 -msse4.2" ./configure --with-curl
OS: Ubuntu 22.04.1
GCC version: gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
The text was updated successfully, but these errors were encountered: