-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
JIT: Make sure static ctor flag check uses a volatile load #105832
Conversation
Otherwise the hardware is allowed to reorder loads of its static fields to happen before the initialization check.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
The test build hit that msbuild error, I don't seem to be able to restart it for some reason. |
/azp run runtime, runtime-coreclr outerloop |
Azure Pipelines successfully started running 2 pipeline(s). |
This is getting a similar looking failure as in #105441 -- not surprising since the bug is in the 9p6 runtime jit. We will need to modify the test script for crossgen2 to run against live runtime. May not be simple if crossgen2 really needs the capabilities of a full runtime host, though I believe it will run ok with corerun as host.
|
I think it should be simple enough for it to be built with live NativeAOT, perhaps @MichalStrehovsky @jkotas know how? |
The shipping crossgen2 binary is built with live built native AOT. Switching crossgen2 tests to use that would require a bunch of yaml and test script changes. It may also require some extra work to mitigate the throughput impact - checked crossgen2 running on release runtime may be a lot faster than checked crossgen2 runtime on checked live-built runtime. |
There is a good chance that the bug does not repro in native AOT version of crossgen2. The act of switching to native AOT can make the bug to go away and we would not be able to tell whether the bug is fixed by running crossgen2. If we are just looking for workarounds, the easiest workaround may be to enable tiered compilation for crossgen2. |
Right... I was definitely hoping for a simple way to validate that this fixes the problem, but looks like that may be hard. I'll see if I can repro the bug on my M1 with a decently high frequency and validate it manually. |
Haven't been able to validate the fix on my M1 -- I haven't seen a repro of the original problem on it. Anyway, the dumps over in #105827 definitely show that the array field is null right after initialization, so it seems very likely for this to be the issue, and for now we can probably take it on faith that it solves the original problem. |
cc @dotnet/jit-contrib |
If you want to use the same nativeAOT-compiled crossgen2 in testing that we ship in nugets, that's a hard fix, #80154 has been trying to do that for a long time. |
Otherwise the hardware is allowed to reorder loads of its static fields to happen before the initialization check.
Fixes #105441 (comment)