Fix the seg fault issue (108) due to mavx CFLAG - #150
Conversation
with the following build command: ``` cmake -DCMAKE_C_FLAGS="-mavx" .. make ``` Encode command: ``` ./xeve_app -i <input.y4m> -o <output.evc> ``` Error message: ``` XEVE: eXtra-fast Essential Video Encoder Segmentation fault ``` On passing "-mavx2" as C_Flag (cmake -DCMAKE_C_FLAGS="-mavx" ..), it sets the flag for all files in the project, including the source C files. So, the compiler is creating optimizations which are not handled properly resulting in a segmentation fault. This PR fixes the issue by updating the CmakeLists.txt files.
kpchoi
left a comment
There was a problem hiding this comment.
Did you check why the 'mavx2' option generate segfault exactly?
Theoretically, it should not have problem even though we set 'mavx2' option to c-code.
There could be some buggy code for AVX2 optimization generated by c-compiler?
If we could find the weak code to avx2 optimization, it would be better to change the code itself rather than adding 'mnoavx2' cflag option.
|
Output form gdb: In debug build and under valgrind it works correctly in my case. |
|
@neergil , |
* Shuffle struct member declaration in XEVE_CTX * Reorder instructions to introduce latency within `pintra_init_mt()` and `pinter_init_mt()` functions
|
I don't understand this code fully, because the code change is weird. |
|
We looked into this further and found the root cause: Reordering the struct members only prevents the vectorization at this particular spot, so the problem could reappear with a different compiler or flags. #162 fixes the allocation itself instead. Could you check whether it resolves the issue on your side as well? |
We are able to reproduce the issue #108 with the following build command:
Encode command:
Error message:
On passing "-mavx2" as C_Flag (cmake -DCMAKE_C_FLAGS="-mavx" ..), it sets the flag for all files in the project, including the source C files. So, the compiler is creating optimizations which are not handled properly resulting in a segmentation fault.
This PR fixes the issue by updating the CmakeLists.txt files.