Repository navigation
Description
Description
We've noticed that our tests crash on the ARM platform (both Linux & MacOS) in release mode. After investigation, I identified one of our optimizations that use intrinsics is causing it. For testing purposes, I forced our code to use a scalar version and tests are running without any crashes.
I also tried to reproduce it on Windows (x64) by disabling AVX/AVX2/removing Vector256 from the code below but it works just fine. I suspect this can be the codegen issue.
Please notice the fact that doesn't appear in Debug mode.
Code that causing the issue:
https://github.com/ravendb/ravendb/blob/bb639435eb6b6148e6d2de03add1240a119f5828/src/Voron/Data/Lookups/Lookup.cs#L791-L800
Reproduction Steps
Run Tryouts project in Release mode from a branch on ARM machine: https://github.com/maciejaszyk/ravendb/tree/ArmRepro
Should happen almost immediately.
Expected behavior
No crashing
Actual behavior
I've seen exit code 139.
Regression?
No response
Known Workarounds
No response
Configuration
.NET SDK:
Version: 7.0.203
Commit: 5b005c19f5
Runtime Environment:
OS Name: Mac OS X
OS Version: 13.3
OS Platform: Darwin
RID: osx.13-arm64
Base Path: /usr/local/share/dotnet/sdk/7.0.203/
Host:
Version: 7.0.12
Architecture: arm64
Commit: 4a824ef
.NET SDKs installed:
6.0.402 [/usr/local/share/dotnet/sdk]
7.0.203 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.12 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.12 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Also reproducible on Linux ARM:
.NET SDK:
Version: 7.0.402
Commit: 791db8e2d8
Runtime Environment:
OS Name: debian
OS Version: 11
OS Platform: Linux
RID: debian.11-arm64
Host:
Version: 7.0.12
Architecture: arm64
Commit: 4a824ef
Other information
No response
Activity
JulieLeeMSFT commentedon Oct 24, 2023
@kunalspathak, PTAL.
kunalspathak commentedon Oct 25, 2023
I was able to reproduce this problem and in checked build, we are hitting this assert.
runtime/src/coreclr/jit/hwintrinsiccodegenarm64.cpp
Line 377 in 35db500
In release, we dereference
lea->Index()although it does not haveindexand we get AV. This was introduced in #67490 where we started having addressing mode for SIMD vector loads/store with unscaled indices. In that, we do not containLEAif(scale | offset) > 0, however, we mark it as contained even ifoffset < 0. We should be still able to handle this situation in codegen, however, in the PR, the only case we added was just with an assumption that we have valid index andoffset == 0(the assert that is hitting in checked builds). We should also handle cases wherelea->HasNoIndex()andoffset == 0andoffset != 0cases iflea->HasIndex(), along with ifoffsetfits in instruction or not. Seeruntime/src/coreclr/jit/emitarm64.cpp
Line 14040 in 08903c0
I think the right fix is to not contain
leaifoffset < 0and thus tweaking the following condition.With that, we no longer mark the
leaas contained and generate 2 instructions forld1instead ofldr, which IMO is ok to have, given that this is a fix in net7.Eventually, we handle it in better way in #80411 and hence don't see this issue in .NET 8 anymore.
@JulieLeeMSFT - do I need to send a PR to
release/7.0branch?arekpalinski commentedon Oct 25, 2023
Please note that this is affecting a new, big feature of our product (https://github.com/ravendb/ravendb) in the latest version. This issue makes it unusable on ARM. So we really need to have it fixed in dotnet 7.0
kunalspathak commentedon Oct 25, 2023
I have submitted #93983, but wondering if upgrading to .NET8 an option for you?
arekpalinski commentedon Oct 27, 2023
This is affecting our users right now so we'd love to have it fixed in .NET7. Eventually we'll do the upgrade to .NET8 for sure but the testing process will take some time on our side before we release on .NET8.