-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
condition var->opcode == OP_REGOFFSET
not met on Mono-based SDK
#90292
Comments
var->opcode == OP_REGOFFSET
not met on s390x musl-libc
cc @uweigand |
I reproduced this with ppc64le, as well. Should I wait till GA to test out mono on Alpine? |
I think testing this now is good. I am not aware of any reason why mono shouldn't work by design right now. If you are finding bugs that others haven't found, filing/fixing them now is probably easier than waiting until GA, which has a lower tolerance for risk and any extensive musl/mono changes that might be required. |
Perfect, I have a bit of time this week to work on this as cut-off is probably just around the corner for GA. I have not built a bootstrap for preview.6 so I'll get that going and see if anything changes. My last bootstrap (available here) was preview.3 and it spits out even uglier error messages. |
preview.6 is proving difficult to crossbuild. Instead, I've prepared an x86_64 mono-flavored runtime of preview.7 for easier testing. The issue persists, allowing for reproduction on x86_64. |
This problem doesn't occur when building roslyn within source-build, only when building roslyn directly. It is definitely an issue with the restore tool, but fortunately in my case I can workaround the issue as I do not need to build roslyn directly like I had to when bootstrapping dotnet7 and dotnet6. I tried applying the exact same properties as source-build roslyn with no luck. |
assigning to @uweigand and @directhex to discuss in their syncs. Moving to Future milestone. |
Smaller repro (works on Fedora too):
|
The assertion is triggered by
|
Somebody who knows s390x/ppc needs to look into this. |
I'm trying to debug this, but it seems to be very specific to mono, in particular, the gsharedvt area. I suspect that something goes wrong with the gsharedvt metadata when Edit: In particular, I don't see why we are not taking the |
cfg->gsharedvt should not even be true on s390x. |
Thanks, I must have been looking into a completely wrong direction. I wonder what would be the best approach to investigate this further. |
One more finding: the following works
because the result is assigned to an
|
FWIW the reproducer from #90292 (comment) triggers the same issue on the x86_64 Let me summarize what I found so far. Here is the problematic method: https://github.com/dotnet/command-line-api/blob/a045dd54a4c44723c215d992288160eb1401bb7f/src/System.CommandLine/Argument%7BT%7D.cs#L166. Here is the JIT log: https://gist.github.com/iii-i/042ecd6a3c555fdb386994f6059ed378. The problematic basic block is B14. The IL is:
It's converted into:
Note that the method call became
Then
Finally, the attempt to lower
I have a few thoughts on how to fix that, but it all would boil down to a bunch of "if" statements preventing some steps in the chain above from happening, which looks like a hack and would probably prevent some useful optimizations. So I'd like to ask - what would be a proper way to fix this? |
Thanks Ilya for the write-up! I've had another look, and it appears to be that the copy propagation may be the main problem here. Note that in this case we have a transformation of:
into
where As On the other hand, To fix this, I think we should either:
To implement the second option, I think we should simply modify this condition in
by adding a This does in fact fix the crash for me, without disabling any other copy propagation instances (in the small tests I did so far). @vargaz does this look reasonable or am I missing something here? |
Looking into this even further, maybe the actual problem is already the expansion into a
where the generic When allocating the return register, Mono uses the underlying base type (which is a primitive type
If I change this code to handle enum type by using the base type here as well, the problem also goes away. Plus, the generated code is more efficient than the code I got with the local-propagation.c change from the previous comment (just sets a register to 0 instead of storing 0 to a stack slot and reloading from there). For reference, here's the change I'm testing:
I'd still appreciate feedback on whether this (or the above) is the right approach. |
Note that this JIT bug is triggered by code that is present in the .NET 8 version of msbuild starting with preview7. This means that .NET 8 msbuild will crash in many scenarios on Mono-based platforms. (For example, I cannot build the current runtime repository natively on s390x any more, since this now requires preview7 to build). While the title of this issue still refers to musl-libc, this is actually unrelated and happens on glibc-based platforms just the same. This represents a serious regression in .NET 8 and should be fixed before release. |
var->opcode == OP_REGOFFSET
not met on s390x musl-libcvar->opcode == OP_REGOFFSET
not met on Mono-based SDK
Use underlying base type when deciding how to inline a CreateInstance invocation in mini_emit_inst_for_method. Fixes dotnet#90292 (Mono abort causing .NET 8 msbuild regression).
FYI - I've now submitted the patch in my latest comment as PR, to verify it passes CI. |
Do you want that dispatched on PPC/390? |
Ah yes, that would be good. |
Use underlying base type when deciding how to inline a CreateInstance invocation in mini_emit_inst_for_method. Fixes #90292 (Mono abort causing .NET 8 msbuild regression).
Use underlying base type when deciding how to inline a CreateInstance invocation in mini_emit_inst_for_method. Fixes #90292 (Mono abort causing .NET 8 msbuild regression).
Use underlying base type when deciding how to inline a CreateInstance invocation in mini_emit_inst_for_method. Fixes #90292 (Mono abort causing .NET 8 msbuild regression). Co-authored-by: Ulrich Weigand <[email protected]> Co-authored-by: Larry Ewing <[email protected]>
Description
I get the following error when building roslyn with the latest 8.0.0-preview.7 of dotnet on s390x musl-libc system (Alpine Linux):
Reproduction Steps
Build roslyn on Alpine Linux s390x platform using the following bootstrap
Expected behavior
Build should work.
Actual behavior
Build fails
Regression?
I've never been able to build the whole dotnet8 stack using mono-flavored runtime.
Known Workarounds
None
Configuration
Alpine Linux s390x
Other information
I couldn't even get a binlog, so it seems pretty low-level.
The text was updated successfully, but these errors were encountered: