Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[LoongArch64] Fix some bugs to make NativeAOT stable. #114618

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

Merged
merged 10 commits into from
Apr 22, 2025

Conversation

LuckyXu-HF
Copy link
Contributor

[LoongArch64] Fix some bugs to make NativeAOT stable.

* Also checked some riskpoints on LA64 with PR#112736.
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Apr 14, 2025
Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@LuckyXu-HF
Copy link
Contributor Author

LuckyXu-HF commented Apr 14, 2025

cc @shushanhf ,this commit fixed the unstable failure of DynamicGenerics-ThreadLocalStatics and UnitTests-BasicThreading.Run which is mentioned in #104661 (comment) :

The two failed tests are SmokeTests/DynamicGenerics/DynamicGenerics/native/DynamicGenerics and SmokeTests/UnitTests/UnitTests/native/UnitTests, each have a small test failure. ThreadLocalStatics.TLSTesting.ThreadLocalStatics_Test failed in DynamicGenerics and BasicThreading.Run failed in UnitTests. I think they maybe both related to TLS, but LoongArch64 currently lacks TLS support, and is working toward it.

The NativeAOT libs.tests also performed much stably that we got most of testcases passed.

The reason why I didn't test coreclr tests and libraries tests is that it usually reports an unstable error like
EXEC : error : One or more errors occurred. (Code generation failed for method '[S.P.CoreLib]System.Globalization.CalendricalCalculationsHelper.EquationOfTime(float64)') [/home/sunlijun/runtime_test/runtime/src/libraries/Common/tests/Common.Tests.csproj::TargetFramework=net9.0-linux] while compiling the .o file using ilc-published/ilc. It's currently too unstable to test them. We are analyzing and trying to solve it.

And the stability of NativeAOT on LA64 does improved a lot.
Based on this commit the result of NativeAOT testcases about CoreRoot and libs.tests on Alpine-6.12.3-0-lts is linking:

  • NAOT-Release-CoreRoot-Tests: Total: 13296 Passed: 13014 Failed: 1 Skipped: 281 Time: 1127.799s
  • NAOT-Debug-CoreRoot-Tests: Total: 13296 Passed: 13011 Failed: 4 Skipped: 281 Time: 4192.800s
  • NAOT-Release-libs.tests: ActualTestListNum:184 ; Total: 439212 ; Passed: 437106 ; Errors: 0 ; Failed: 7 ; Skipped: 2099; Time: 850.469s
NAOT-Release-CoreRoot:
Time [secs] | Total | Passed | Failed | Skipped | Assembly Execution Summary
============================================================================
      9.714 |   247 |    243 |      0 |       4 | JIT.Regression.Regression_1
      1.172 |    34 |     18 |      0 |      16 | baseservices.baseservices
      1.086 |    85 |     84 |      0 |       1 | JIT.Methodical.Methodical_ro
      0.522 |    17 |     17 |      0 |       0 | JIT.JIT_r
      0.021 |     3 |      0 |      0 |       3 | JIT.JIT_do
     64.922 |   105 |     97 |      0 |       8 | GC.GC
      1.733 |    53 |     53 |      0 |       0 | CoreMangLib.CoreMangLib
      0.163 |    47 |     47 |      0 |       0 | JIT.Regression.Regression_5
      1.726 |   278 |    256 |      0 |      22 | JIT.Methodical.Methodical_r1
      0.241 |   199 |    199 |      0 |       0 | JIT.Directed.Directed_2
      1.039 |   216 |    216 |      0 |       0 | JIT.Generics.JIT.Generics
      3.338 |   229 |    220 |      0 |       9 | JIT.Directed.Directed_3
      2.109 |   275 |    254 |      0 |      21 | JIT.Methodical.Methodical_d1
      4.740 |   344 |    338 |      0 |       6 | JIT.Regression.Regression_3
      0.041 |     0 |      0 |      0 |       0 | managed.Managed
     52.355 |    82 |     80 |      0 |       2 | baseservices.threading.threading_group1
     22.459 |   231 |    231 |      0 |       0 | JIT.jit64.jit64_5
      0.587 |   210 |    205 |      0 |       5 | JIT.Methodical.Methodical_r2
    200.726 |    99 |     96 |      0 |       3 | JIT.Performance.JIT.performance
      8.756 |   433 |    431 |      0 |       2 | JIT.Regression.Regression_6
      0.407 |    17 |     17 |      0 |       0 | JIT.JIT_ro
      0.120 |     2 |      2 |      0 |       0 | Exceptions.Exceptions
      2.159 |   116 |    116 |      0 |       0 | JIT.SIMD.JIT.SIMD
     17.634 |    19 |     18 |      1 |       0 | nativeaot.nativeaot
     53.677 |    88 |     88 |      0 |       0 | baseservices.threading.threading_group2
      1.649 |   131 |    131 |      0 |       0 | JIT.Regression.Regression_4
     11.525 |    73 |     72 |      0 |       1 | Regressions.Regressions
     56.242 |   317 |    280 |      0 |      37 | Loader.Loader
     74.649 |    51 |     51 |      0 |       0 | GC.Scenarios.GC-scenarios1
      0.122 |   160 |    160 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_do
      0.177 |    54 |     51 |      0 |       3 | JIT.Methodical.Methodical_others
      5.320 |  2584 |   2584 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_General_r
      1.813 |    66 |     56 |      0 |      10 | Loader.classloader.regressions.LoaderClassloaderRegressions
      0.392 |   227 |    227 |      0 |       0 | JIT.Regression.Regression_7
      0.228 |   112 |    112 |      0 |       0 | JIT.jit64.jit64_1
      1.032 |    85 |     84 |      0 |       1 | JIT.Methodical.Methodical_do
      0.523 |   207 |    202 |      0 |       5 | JIT.Methodical.Methodical_d2
     43.122 |   373 |    370 |      0 |       3 | JIT.opt.JIT.opt
     29.302 |    12 |     11 |      0 |       1 | JIT.JIT_others
      3.360 |  2551 |   2551 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_General_ro
      0.177 |   343 |    343 |      0 |       0 | JIT.jit64.jit64_4
     87.793 |   142 |    137 |      0 |       5 | JIT.jit64.jit64_3
     18.948 |   620 |    615 |      0 |       5 | JIT.Regression.Regression_2
      0.034 |     2 |      0 |      0 |       2 | JIT.JIT_d
      1.005 |   220 |    128 |      0 |      92 | Interop.Interop
    222.272 |    45 |     43 |      0 |       2 | GC.Features.GC-features
    109.749 |    35 |     32 |      0 |       3 | tracing.tracing
      0.795 |   189 |    189 |      0 |       0 | Loader.classloader.generics.LoaderClassloaderGenerics
      4.579 |   153 |    149 |      0 |       4 | baseservices.exceptions.baseservices-exceptions
      0.404 |   214 |    214 |      0 |       0 | JIT.Directed.Directed_1
      0.189 |   404 |    404 |      0 |       0 | JIT.IL_Conformance.IL_Conformance
      0.146 |   160 |    160 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_d
      0.416 |    16 |     11 |      0 |       5 | reflection.reflection
      0.198 |   161 |    161 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_r
      0.188 |   160 |    160 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_ro
----------------------------------------------------------------------------
   1127.799 | 13296 |  13014 |      1 |     281 | (total)


Creating repro files at: /home/xuliangyu/runtime/artifacts/log/repro
Skipping repro for merged test: OutOfProcessTest::nativeaot/SmokeTests/DwarfDump/DwarfDump/DwarfDump.cmd (nativeaot/SmokeTests/DwarfDump/DwarfDump/DwarfDump.cmd) (nativeaot.nativeaot)
Repro files written.
NAOT-Debug-CoreRoot:
Time [secs] | Total | Passed | Failed | Skipped | Assembly Execution Summary
============================================================================
     10.709 |   247 |    243 |      0 |       4 | JIT.Regression.Regression_1
      3.865 |    34 |     18 |      0 |      16 | baseservices.baseservices
      4.473 |    85 |     84 |      0 |       1 | JIT.Methodical.Methodical_ro
      0.692 |    17 |     17 |      0 |       0 | JIT.JIT_r
      0.033 |     3 |      0 |      0 |       3 | JIT.JIT_do
    209.115 |   105 |     96 |      1 |       8 | GC.GC
      3.557 |    53 |     53 |      0 |       0 | CoreMangLib.CoreMangLib
      0.405 |    47 |     47 |      0 |       0 | JIT.Regression.Regression_5
      6.285 |   278 |    256 |      0 |      22 | JIT.Methodical.Methodical_r1
      0.704 |   199 |    199 |      0 |       0 | JIT.Directed.Directed_2
      4.220 |   216 |    216 |      0 |       0 | JIT.Generics.JIT.Generics
      5.801 |   229 |    218 |      2 |       9 | JIT.Directed.Directed_3
      6.402 |   275 |    254 |      0 |      21 | JIT.Methodical.Methodical_d1
   1648.091 |   344 |    338 |      0 |       6 | JIT.Regression.Regression_3
      0.052 |     0 |      0 |      0 |       0 | managed.Managed
     66.171 |    82 |     80 |      0 |       2 | baseservices.threading.threading_group1
     26.450 |   231 |    231 |      0 |       0 | JIT.jit64.jit64_5
      2.657 |   210 |    205 |      0 |       5 | JIT.Methodical.Methodical_r2
    135.410 |    99 |     96 |      0 |       3 | JIT.Performance.JIT.performance
     22.739 |   433 |    431 |      0 |       2 | JIT.Regression.Regression_6
      0.586 |    17 |     17 |      0 |       0 | JIT.JIT_ro
      0.174 |     2 |      2 |      0 |       0 | Exceptions.Exceptions
    919.890 |   116 |    116 |      0 |       0 | JIT.SIMD.JIT.SIMD
     38.964 |    19 |     18 |      1 |       0 | nativeaot.nativeaot
     54.760 |    88 |     88 |      0 |       0 | baseservices.threading.threading_group2
      2.493 |   131 |    131 |      0 |       0 | JIT.Regression.Regression_4
     43.128 |    73 |     72 |      0 |       1 | Regressions.Regressions
     69.195 |   317 |    280 |      0 |      37 | Loader.Loader
    232.524 |    51 |     51 |      0 |       0 | GC.Scenarios.GC-scenarios1
      0.267 |   160 |    160 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_do
      0.599 |    54 |     51 |      0 |       3 | JIT.Methodical.Methodical_others
     14.678 |  2584 |   2584 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_General_r
      2.470 |    66 |     56 |      0 |      10 | Loader.classloader.regressions.LoaderClassloaderRegressions
      0.618 |   227 |    227 |      0 |       0 | JIT.Regression.Regression_7
      0.513 |   112 |    112 |      0 |       0 | JIT.jit64.jit64_1
      4.016 |    85 |     84 |      0 |       1 | JIT.Methodical.Methodical_do
      2.613 |   207 |    202 |      0 |       5 | JIT.Methodical.Methodical_d2
     55.498 |   373 |    370 |      0 |       3 | JIT.opt.JIT.opt
     31.006 |    12 |     11 |      0 |       1 | JIT.JIT_others
     11.955 |  2551 |   2551 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_General_ro
      0.518 |   343 |    343 |      0 |       0 | JIT.jit64.jit64_4
    117.946 |   142 |    137 |      0 |       5 | JIT.jit64.jit64_3
     18.948 |   620 |    615 |      0 |       5 | JIT.Regression.Regression_2
      0.038 |     2 |      0 |      0 |       2 | JIT.JIT_d
      2.383 |   220 |    128 |      0 |      92 | Interop.Interop
    278.227 |    45 |     43 |      0 |       2 | GC.Features.GC-features
    115.726 |    35 |     32 |      0 |       3 | tracing.tracing
      1.145 |   189 |    189 |      0 |       0 | Loader.classloader.generics.LoaderClassloaderGenerics
     11.445 |   153 |    149 |      0 |       4 | baseservices.exceptions.baseservices-exceptions
      0.896 |   214 |    214 |      0 |       0 | JIT.Directed.Directed_1
      0.446 |   404 |    404 |      0 |       0 | JIT.IL_Conformance.IL_Conformance
      0.270 |   160 |    160 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_d
      0.553 |    16 |     11 |      0 |       5 | reflection.reflection
      0.218 |   161 |    161 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_r
      0.262 |   160 |    160 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests_ro
----------------------------------------------------------------------------
   4192.800 | 13296 |  13011 |      4 |     281 | (total)


Creating repro files at: /home/xuliangyu/runtime/artifacts/log/repro
Skipping repro for merged test: OutOfProcessTest::GC/API/WeakReference/IsAlive/IsAlive.cmd (GC/API/WeakReference/IsAlive/IsAlive.cmd) (GC.GC)
Skipping repro for merged test: OutOfProcessTest::JIT/Directed/forceinlining/AttributeConflict/AttributeConflict.cmd (JIT/Directed/forceinlining/AttributeConflict/AttributeConflict.cmd) (JIT.Directed.Directed_3)
Skipping repro for merged test: OutOfProcessTest::JIT/Directed/forceinlining/PositiveCases/PositiveCases.cmd (JIT/Directed/forceinlining/PositiveCases/PositiveCases.cmd) (JIT.Directed.Directed_3)
Skipping repro for merged test: OutOfProcessTest::nativeaot/SmokeTests/DwarfDump/DwarfDump/DwarfDump.cmd (nativeaot/SmokeTests/DwarfDump/DwarfDump/DwarfDump.cmd) (nativeaot.nativeaot)
Repro files written.

@LuckyXu-HF
Copy link
Contributor Author

Hi @shushanhf @jkotas , could you please review this PR? Thanks.

…T_APPLE) && defined(TARGET_ARM64)) || defined(TARGET_ARM)'.

update src/coreclr/nativeaot/Runtime/loongarch64/WriteBarriers.S
@jkotas jkotas requested a review from shushanhf April 15, 2025 04:16
Copy link
Contributor

@shushanhf shushanhf left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks

Copy link
Contributor

@shushanhf shushanhf left a comment

Choose a reason for hiding this comment

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

LGTM
thanks

…_LIMITED_CONTEXT{} and adjust the stack layout of `ALLOC_THROW_FRAME`.
@LuckyXu-HF
Copy link
Contributor Author

Surprise! I have seen the preliminary CI environment of LA64: https://github.com/dotnet/runtime/pull/114618/checks?check_run_id=40920835505
We can provide the relevant nupkgs for these errors.

@am11
Copy link
Member

am11 commented Apr 22, 2025

It is because of this change just merged https://github.com/dotnet/runtime/pull/114666/files#diff-ae8d8c9d8a8cabb2a2bf979f26fcb73fef62fd67f4a72b558a1c2aa07c099527. We can't currently build host tests for community platforms as it requires apphost from packages.

@am11
Copy link
Member

am11 commented Apr 22, 2025

For some reason, it didn't fail on that PR.. touching src/installer should'd triggered the build. You can revert that file here.

Copy link
Member

@am11 am11 left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thank you!

@jkotas
Copy link
Member

jkotas commented Apr 22, 2025

/ba-g infrastructure timeouts

@jkotas jkotas merged commit f23657a into dotnet:main Apr 22, 2025
114 of 121 checks passed
@LuckyXu-HF LuckyXu-HF deleted the main-LA64-NAOT branch April 23, 2025 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-loongarch64 area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants