FarPlaneTwo

FarPlaneTwo

18.5k Downloads

Segfault in vectorized CubicWorldGen depth noise generation on Windows (AVX and better)

DaMatrix opened this issue ยท 6 comments

commented

Depth noise generation for CubicWorldGen worlds will instantly and consistently cause a segfault, causing the JVM to exit.

The issue is likely caused by commit 8a3d728.

The issue does not occur when switching to Linux, but using an otherwise identical configuration.

I have a hunch the issue might be specific to AVX or AVX2, but more testing is required.

commented

Have noticed this happens on AVX2 as well from this error log below.
hs_err_pid227608.log
GPU: Radeon 5600XT

commented

well, looking at the offset in that log, the segfault is occuring at offset 0xC573. looking at the disassembler output for the AVX2 dll is showing me this:

disassembler output

i could be mistaken, but this looks like it could be a stack overflow somehow. would you mind adding -Xss16M to your JVM args and trying again?

commented

hs_err_pid243492.log
Still a crash to this point.

commented

latest.log
debug.log
Logs as well

commented

progress update: i've confirmed that the issue only occurs on AVX and higher. most likely it's also a problem on AVX512, although i don't have hardware available to test that.

commented

i've confirmed the issue is related to mingw32's inability to align the stack to anything greater than 16 bytes. AVX registers are 32 bytes, so when using aligned loads/stores to store method parameters/return values to the stack, an exception is generated.

i don't really see any way around this other than switching to another compiler. i do intend to revamp the native compilation pipeline at some point, and will hopefully be able to transition to clang in the process, but for now i'll work around this by forcing everything to be inlined when on windows.