Skip to content

[MonoVM] Fix assert on startup with abcrem optimization enabled#108469

Merged
lambdageek merged 3 commits into
dotnet:mainfrom
filipnavara:monovm-fix-abcrem
Nov 2, 2024
Merged

[MonoVM] Fix assert on startup with abcrem optimization enabled#108469
lambdageek merged 3 commits into
dotnet:mainfrom
filipnavara:monovm-fix-abcrem

Conversation

@filipnavara

@filipnavara filipnavara commented Oct 2, 2024

Copy link
Copy Markdown
Member

Match the logic in mini_emit_sext_index_reg and OP_BOUNDS_CHECK decomposition. This was already done for LLVM but not for any other target. Instead there was an assert which was hit early on startup when the optimization was enabled (tested on ARM64).

The optimization is not enabled by default but that's separate issue. There are potentially some performance wins to have. For example, the Burgers benchmarks in dotnet/performance shows this:

Default:

| Method    | Mean       | Error   | StdDev  | Median     | Min        | Max        | Gen0       | Gen1       | Gen2       | Allocated    |
|---------- |-----------:|--------:|--------:|-----------:|-----------:|-----------:|-----------:|-----------:|-----------:|-------------:|
| Burgers_3 |   487.9 ms | 2.33 ms | 2.06 ms |   488.2 ms |   483.5 ms |   490.7 ms |          - |          - |          - |    156.76 KB |
| Burgers_0 | 1,266.8 ms | 3.19 ms | 2.83 ms | 1,265.5 ms | 1,264.5 ms | 1,273.6 ms | 47000.0000 | 47000.0000 | 47000.0000 | 781750.05 KB |
| Burgers_1 | 1,180.1 ms | 2.98 ms | 2.49 ms | 1,180.4 ms | 1,176.5 ms | 1,185.3 ms |          - |          - |          - |    156.74 KB |
| Burgers_2 |   286.9 ms | 0.17 ms | 0.15 ms |   286.9 ms |   286.6 ms |   287.0 ms |          - |          - |          - |    156.74 KB |

With -O=abcrem:

| Method    | Mean       | Error   | StdDev  | Median     | Min        | Max        | Gen0       | Gen1       | Gen2       | Allocated    |
|---------- |-----------:|--------:|--------:|-----------:|-----------:|-----------:|-----------:|-----------:|-----------:|-------------:|
| Burgers_3 |   395.5 ms | 1.25 ms | 1.11 ms |   395.6 ms |   394.0 ms |   397.8 ms |          - |          - |          - |    156.76 KB |
| Burgers_0 | 1,167.8 ms | 5.45 ms | 4.83 ms | 1,167.5 ms | 1,161.5 ms | 1,176.8 ms | 47000.0000 | 47000.0000 | 47000.0000 | 781750.05 KB |
| Burgers_1 | 1,104.2 ms | 2.82 ms | 2.64 ms | 1,102.9 ms | 1,100.4 ms | 1,108.5 ms |          - |          - |          - |    156.74 KB |
| Burgers_2 |   192.2 ms | 0.36 ms | 0.30 ms |   192.2 ms |   191.8 ms |   192.8 ms |          - |          - |          - |    156.74 KB |

@ghost ghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Oct 2, 2024
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Oct 2, 2024

@steveisok steveisok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok w/ it assuming the assert is no longer necessary for what we ship.

@filipnavara

Copy link
Copy Markdown
Member Author

It just moves the need_sext handling one level up from the LLVM code branch so it applies to all targets, so we don't need the assert anymore. It's currently not used in any shipping code AFAIK.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community-contribution Indicates that the PR has been added by a community member needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants