Uh oh!
There was an error while loading. Please reload this page.
Adding Int128 and UInt128 with a base software implementation - #69204
Conversation
ghost
commented
May 11, 2022
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
ghost
commented
May 11, 2022
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsThis does not cover acceleration in the JIT, that will be a separate work item and will be handled in a follow up PR.
|
Uh oh!
There was an error while loading. Please reload this page.
| if ((strcmp(name, g_Int128Name) == 0) || (strcmp(name, g_UInt128Name) == 0)) | ||
| { | ||
| pLayout->m_ManagedLargestAlignmentRequirementOfAllMembers = 16; // sizeof(__int128) |
There was a problem hiding this comment.
This needs equivalent fix in crossgen/NativeAOT and in Mono
There was a problem hiding this comment.
@fanyang-mono could you point me to where Mono handles custom struct packing/alignment?
I tried checking for where that's handled for the vector types, but couldn't find it.
Int128 and UInt128 need to have 16-byte packing when targeting the System V ABI (used by Unix) and the same packing/alignment as Int64/UInt64 otherwise (such as on Windows or 32-bit platforms).
There was a problem hiding this comment.
-- I fixed this up for crossgen/NativeAOT already and added corresponding P/Invoke tests to ensure the data is passed correctly to/from Native.
There was a problem hiding this comment.
It's handled in mono_class_layout_fields () in metadata/class-init.c.
Not sure the mono gc supports 16 byte aligned objects on 32 bit platforms.
There was a problem hiding this comment.
This doesn't impact 32-bit platforms, only 64-bit platforms (and only 64-bit Unix at that).
There was a problem hiding this comment.
@vargaz, looks like its just blocked everywhere not just 32-bit platforms: https://github.com/dotnet/runtime/blob/main/src/mono/mono/metadata/class-init.c#L2058-L2065
It looks like Mono also isn't differentiating "alignment" from "packing" and so the layout of types that include the new Int128, UInt128, or the existing Vector64<T>, Vector128<T>, Vector256<T> types will be incorrect.
This would explain why I couldn't find any logic touching Vector128<T> and ensuring that it has the right packing (and therefore layout) even if the GC couldn't correctly align the overall allocation.
There was a problem hiding this comment.
Yes, it looks like this is not implemented right now in mono.
There was a problem hiding this comment.
I'll log an issue to ensure this is tracked (I don't see an existing issue).
tannergooding
commented
May 12, 2022
Hmmm. Tests were all passing locally but failing in CI, going to need to investigate this more |
tannergooding
commented
May 13, 2022
This should just need the NativeAOT and Mono fixups to ensure |
I also apparently forgot to implement conversions to and from |
deeprobin
left a comment
There was a problem hiding this comment.
Have noted a few minor things.
But looks very good.
Looking forward to Int128 and UInt128 🎉😄.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Azure Pipelines successfully started running 1 pipeline(s). |
Both these runs failed with GC asserts. I do not think we have any issues tracking failures like this. Is it caused by the changes in this PR? |
tannergooding
commented
May 18, 2022
I'll take a look but I find it doubtful that it'd be caused by this PR. It wasn't failing before and the only change since the last run was to update the native layout for
The other ( |
dakersnar
left a comment
There was a problem hiding this comment.
Changes look good, thanks!
jkotas
commented
May 18, 2022
These asserts are generic signs of GC heap corruption. A bug introduced in common parts (e.g. parsing/formatting) can lead to intermittent crash like that. |
I'd speculate there may be another issue with There was a similar issue exposed by making |
tannergooding
commented
May 18, 2022
It could be related to #69501 for example, which @SingleAccretion just opened and impacts structs. |
tannergooding
commented
May 18, 2022
If this one is also related to |
tannergooding
commented
May 18, 2022
I'm not 100% this fixes the issue as its not a reliable repro. But I did hit it in 20 runs with the |
jkotas
commented
May 18, 2022
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jakobbotsch
commented
May 18, 2022
Can you give instructions for how to repro this? If we have a repro for it we need to look at it, it could be manifesting in other places that are way harder to diagnose. |
tannergooding
commented
May 18, 2022
It was just running the |
jkotas
commented
May 18, 2022
The new Int128 PInvoke test is failing on Android in the extra platforms leg. |
tannergooding
commented
May 18, 2022
Looks like it can't resolve the native library: @vargaz is there anything additional required for P/Invoke to work on Android? Does the library have or need some special name that differs from the default for example? |
tannergooding
commented
May 18, 2022
The tvOS and iOS failures look unrelated, they seem to have just failed and look to be doing that in other jobs as well. |
tannergooding
commented
May 18, 2022
Hmmm, it looks like most of the Most are marked "needs triage" as well. |
There are various other Given the breadth of P/Invoke tests disabled for Android, I'd be inclined to log an issue tracking Mono enabling interop here. The alternative would be to just block |
Disabling the interop test on Android should be fine. |
Logged #69531. Noting I grouped this with the other Mono P/Invoke disablement as tvOS and iOS didn't actually run the tests, they hit the more general timeout issue. |
This does not cover acceleration in the JIT, that will be a separate work item and will be handled in a follow up PR.