Skip to content
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

[LoongArch64-mono] Part-1:Add native code emission module for LoongArch64 #103403

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lawn123
Copy link
Contributor

@lawn123 lawn123 commented Jun 13, 2024

Add a new archecture LoongArch64 for mono.This PR is an native code emission module.
Add Ioongarch64 architecture support to Mono,divided into 5 parts in total,this is Part-1.
Part-2 #103395,Part-3 #103396,Part-4 #103397,Part-5 #103398.
@shushanhf

…ch64

Change-Id: I8e5937729fe5b57ddd4499b6d976c894701de415
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jun 13, 2024
@shushanhf
Copy link
Contributor

shushanhf commented Jun 13, 2024

Hi, @akoeplinger @lambdageek @steveisok

After the mono had supported the LoongArch64 mono/mono#21389 ,
it's time to push the runtime-mono for LoongArch64.

Could you please review these PRs ?
Thanks!

@shushanhf
Copy link
Contributor

Hi, @akoeplinger @lambdageek @steveisok

After the mono had supported the LoongArch64 mono/mono#21389 , it's time to push the runtime-mono for LoongArch64.

Could you please review these PRs ? Thanks!

Hi, @akoeplinger @lambdageek @steveisok
Could you please review these PRs (from Part-1 to Part-5)?
Thanks!

@lawn123
Copy link
Contributor Author

lawn123 commented Jun 26, 2024

Hi, @akoeplinger @lambdageek @steveisok

After the mono had supported the LoongArch64 mono/mono#21389 , it's time to push the runtime-mono for LoongArch64.

Could you please review these PRs ? Thanks!

Hi, @akoeplinger @lambdageek @steveisok
I ran runtime test locally, The results are as following :

Time [secs] | Total | Passed | Failed | Skipped | Assembly Execution Summary
============================================================================
     60.660 |   174 |    169 |      0 |       5 | JIT.opt.JIT.opt
      7.106 |    33 |     31 |      0 |       2 | JIT.Regression.Regression_4
    139.202 |    44 |     42 |      0 |       2 | JIT.jit64.jit64_3
      1.333 |   202 |    201 |      0 |       1 | JIT.Regression.Regression_6
      0.718 |     3 |      3 |      0 |       0 | baseservices.compilerservices.XUnitWrapper.dll
      0.247 |     2 |      2 |      0 |       0 | baseservices.exceptions.XUnitWrapper.dll
      0.523 |     1 |      1 |      0 |       0 | baseservices.invalid_operations.XUnitWrapper.dll
      0.271 |     1 |      1 |      0 |       0 | baseservices.mono.XUnitWrapper.dll
     10.031 |     7 |      7 |      0 |       0 | baseservices.TieredCompilation.XUnitWrapper.dll
      0.627 |     2 |      2 |      0 |       0 | baseservices.varargs.XUnitWrapper.dll
      0.554 |     1 |      1 |      0 |       0 | CoreMangLib.system.XUnitWrapper.dll
      0.524 |     1 |      1 |      0 |       0 | Exceptions.ForeignThread.XUnitWrapper.dll
      0.240 |     1 |      1 |      0 |       0 | Exceptions.UnwindFpBleedTest.XUnitWrapper.dll
     34.621 |    22 |     22 |      0 |       0 | GC.API.XUnitWrapper.dll
      2.423 |     2 |      2 |      0 |       0 | GC.Coverage.XUnitWrapper.dll
    203.108 |    18 |     18 |      0 |       0 | GC.Features.XUnitWrapper.dll
      1.257 |     3 |      3 |      0 |       0 | GC.LargeMemory.XUnitWrapper.dll
     39.302 |     9 |      9 |      0 |       0 | GC.Regressions.XUnitWrapper.dll
     62.314 |    22 |     22 |      0 |       0 | GC.Scenarios.XUnitWrapper.dll
      0.055 |     1 |      1 |      0 |       0 | GC.Stress.XUnitWrapper.dll
      0.709 |     1 |      0 |      1 |       0 | ilasm.PortablePdb.XUnitWrapper.dll
      0.504 |     1 |      0 |      1 |       0 | ilasm.System.XUnitWrapper.dll
      0.551 |     1 |      1 |      0 |       0 | Interop.DllImportSearchPaths.XUnitWrapper.dll
      0.364 |     1 |      1 |      0 |       0 | Interop.ICustomMarshaler.XUnitWrapper.dll
      0.488 |     3 |      3 |      0 |       0 | Interop.MonoAPI.XUnitWrapper.dll
      0.807 |     4 |      4 |      0 |       0 | Interop.NativeLibrary.XUnitWrapper.dll
      0.857 |     7 |      7 |      0 |       0 | Interop.PInvoke.XUnitWrapper.dll
      0.557 |     2 |      2 |      0 |       0 | Interop.StructMarshalling.XUnitWrapper.dll
      0.431 |     1 |      1 |      0 |       0 | Interop.SuppressGCTransition.XUnitWrapper.dll
      0.430 |     1 |      1 |      0 |       0 | Interop.UnmanagedCallConv.XUnitWrapper.dll
      0.511 |     1 |      1 |      0 |       0 | Interop.UnmanagedCallersOnly.XUnitWrapper.dll
      0.414 |     1 |      1 |      0 |       0 | Interop.UnmanagedCallersOnlyBasic.XUnitWrapper.dll
      0.418 |     1 |      1 |      0 |       0 | JIT.CheckProjects.XUnitWrapper.dll
      3.602 |    30 |     30 |      0 |       0 | JIT.Intrinsics.XUnitWrapper.dll
      0.388 |     2 |      2 |      0 |       0 | JIT.Math.XUnitWrapper.dll
      9.242 |     5 |      5 |      0 |       0 | JIT.PGO.XUnitWrapper.dll
      0.414 |     1 |      1 |      0 |       0 | JIT.RyuJIT.XUnitWrapper.dll
     27.173 |   129 |    129 |      0 |       0 | Loader.classloader.XUnitWrapper.dll
      0.590 |     1 |      1 |      0 |       0 | Loader.CustomAttributes.XUnitWrapper.dll
      0.767 |     1 |      1 |      0 |       0 | Loader.StartupHooks.XUnitWrapper.dll
      0.404 |     1 |      1 |      0 |       0 | reflection.DefaultInterfaceMethods.XUnitWrapper.dll
      0.362 |     1 |      1 |      0 |       0 | reflection.GenericAttribute.XUnitWrapper.dll
      0.546 |     1 |      1 |      0 |       0 | reflection.RefEmit.XUnitWrapper.dll
      0.380 |     1 |      1 |      0 |       0 | reflection.regression.XUnitWrapper.dll
      0.256 |     1 |      1 |      0 |       0 | reflection.StaticInterfaceMembers.XUnitWrapper.dll
      2.171 |    22 |     22 |      0 |       0 | Regressions.coreclr.XUnitWrapper.dll
      0.409 |     1 |      1 |      0 |       0 | tracing.eventactivityidcontrol.XUnitWrapper.dll
     11.576 |     8 |      8 |      0 |       0 | tracing.eventcounter.XUnitWrapper.dll
      0.777 |     2 |      2 |      0 |       0 | tracing.eventlistener.XUnitWrapper.dll
     23.551 |    16 |     16 |      0 |       0 | tracing.eventpipe.XUnitWrapper.dll
      0.970 |     1 |      1 |      0 |       0 | tracing.runtimeeventsource.XUnitWrapper.dll
      2.463 |    11 |     11 |      0 |       0 | JIT.Directed.Directed_2
      2.155 |    43 |     43 |      0 |       0 | JIT.Generics.JIT.Generics
      9.894 |     2 |      2 |      0 |       0 | baseservices.threading.threading_group1
      7.818 |    85 |     76 |      0 |       9 | JIT.Directed.Directed_3
      1.969 |   112 |    112 |      0 |       0 | JIT.IL_Conformance.IL_Conformance
      0.982 |     0 |      0 |      0 |       0 | JIT.jit64.jit64_2
      2.056 |     1 |      1 |      0 |       0 | JIT.jit64.jit64_1
      0.723 |     1 |      1 |      0 |       0 | JIT.jit64.jit64_4
      3.870 |    45 |     32 |      0 |      13 | JIT.jit64.jit64_5
     20.299 |   147 |    146 |      0 |       1 | JIT.Methodical.Methodical_d1
      6.863 |    99 |     96 |      0 |       3 | JIT.Methodical.Methodical_d2
     53.116 |  2486 |   2486 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_General_r
     14.938 |   113 |    110 |      0 |       3 | JIT.Methodical.Methodical_do
      7.617 |   103 |     99 |      0 |       4 | JIT.Methodical.Methodical_r2
     18.787 |   163 |    162 |      0 |       1 | JIT.Methodical.Methodical_r1
     20.430 |   147 |    144 |      0 |       3 | JIT.Regression.Regression_1
      0.829 |     4 |      2 |      0 |       2 | JIT.Regression.Regression_5
     19.614 |   223 |    211 |      0 |      12 | JIT.Regression.Regression_3
      9.018 |   102 |     99 |      0 |       3 | JIT.SIMD.JIT.SIMD
    123.569 |   100 |     99 |      0 |       1 | JIT.Performance.JIT.performance
      0.887 |     1 |      1 |      0 |       0 | baseservices.threading.threading_group2
      3.314 |    33 |     33 |      0 |       0 | JIT.CodeGenBringUpTests.JIT.CodeGenBringUpTests
      6.846 |    72 |     69 |      0 |       3 | JIT.Directed.Directed_1
      1.426 |    32 |     28 |      0 |       4 | JIT.Methodical.Methodical_others
     61.483 |  2453 |   2453 |      0 |       0 | JIT.HardwareIntrinsics.HardwareIntrinsics_General_ro
     14.742 |   110 |    108 |      0 |       2 | JIT.Methodical.Methodical_ro
     36.616 |   415 |    409 |      0 |       6 | JIT.Regression.Regression_2
----------------------------------------------------------------------------
   1108.060 |  7901 |   7819 |      2 |      80 | (total)

Creating repro files at: /home/liuan/project/dotnet-runtime-loongarch/artifacts/repro/linux.loongarch64.Debug
Repro files written.

Could you please review these PRs (from Part-1 to Part-5)?
Thanks!

@am11
Copy link
Member

am11 commented Jun 26, 2024

CI didn't ran. Closing/reopening might help.
edit: it worked.

@shushanhf
Copy link
Contributor

Hi, @jkotas
Could you please give us some advices/guidance for these LoongArch64's PRs?
Who can review these mono PRs for supporting LoongArch64?
Thanks very much!

@jkotas
Copy link
Member

jkotas commented Jul 1, 2024

You have the right people cc'ed.

What is your motivation for adding LoongArch64 for Mono? We have been investing a lot more into CoreCLR and we generally prefer to use CoreCLR for new scenarios.

@shushanhf
Copy link
Contributor

You have the right people cc'ed.

What is your motivation for adding LoongArch64 for Mono? We have been investing a lot more into CoreCLR and we generally prefer to use CoreCLR for new scenarios.

As we known, the wasm and some mobile or embedded processors use the mono.
We want to add LA64 for mono to perfect the dotnet system on LA64.

@jkotas
Copy link
Member

jkotas commented Jul 1, 2024

some mobile or embedded processors use the mono.

The same is true for coreclr. We would be interested to work with you to make loongarch port work well on these systems.

@shushanhf
Copy link
Contributor

some mobile or embedded processors use the mono.

The same is true for coreclr. We would be interested to work with you to make loongarch port work well on these systems.

Thanks. Now the coreclr had been tested on many software projects by sdk6.0, sdk7.0 and sdk8.0.
Although the past few years most software developed by dotnet are used the coreclr,
We want to push the LA64 to mono after the runtime merged mono.

@jkotas
Copy link
Member

jkotas commented Jul 1, 2024

My point is why spend time on the Mono LA64 port. It is an extra work for both us and you. It would be better to spend that time on improving CoreCLR LA64 port and make it run in all places you need it to run.

@shushanhf
Copy link
Contributor

My point is why spend time on the Mono LA64 port. It is an extra work for both us and you. It would be better to spend that time on improving CoreCLR LA64 port and make it run in all places you need it to run.

we agree with you that LA64's dotnet should focus on the coreclr, but the runtime supports mono and there must be some points that the coreclr can't replace the mono, we should make the dotnet's runtime supporting LA64 as much as possible.

@jkotas
Copy link
Member

jkotas commented Jul 2, 2024

there must be some points that the coreclr can't replace the mono

It would be useful to understand what these points are for LA64.

@shushanhf
Copy link
Contributor

there must be some points that the coreclr can't replace the mono

It would be useful to understand what these points are for LA64.

In fact, I don't know the mono's orientation within the runtime so clearly except the wasm.

As some software apps use the mono to run on LA64, after we pushed the LA64 to mono, now we push the LA64 to the runtime's mono.

@jkotas
Copy link
Member

jkotas commented Jul 2, 2024

What prevents those apps from running on coreclr?

@shushanhf
Copy link
Contributor

What prevents those apps from running on coreclr?

The mono https://github.com/mono/mono is ok for LA64 and some apps tested ok.
Now I didn't hit the apps using runtime's mono (that doesn't means there is no need).
The runtime supports mono and there must be some points that the coreclr can't replace the mono, for example wasm and MAUI?

I can wait when some apps using the runtime's mono, it's too late to do that.

@jkotas
Copy link
Member

jkotas commented Jul 2, 2024

The dotnet/runtime mono and coreclr runtime have same public API surface and they are 99+% functionally identical. We have ongoing project on unifying the remaining <1%. A lot of the split between coreclr and mono exists for historic reasons only.

I can wait when some apps using the runtime's mono, it's too late to do that

In hypothetical case you encounter apps that won't just run on coreclr, you will likely have to do a bunch of work to make them work anyway, I would rather wait for such apps to show up and then choose the best strategy to make them work once we know what they are.

wasm and MAUI?

MAUI runs on both CoreCLR and Mono, depending on the platform. Wasm is a special architecture and Mono is a better fit for it currently, but it is not relevant here - LA64 is not a special architecture like Wasm,

@shushanhf
Copy link
Contributor

The dotnet/runtime mono and coreclr runtime have same public API surface and they are 99+% functionally identical. We have ongoing project on unifying the remaining <1%. A lot of the split between coreclr and mono exists for historic reasons only.

If the runtime of dotnet will uniform the mono and coreclr in future, maybe there is no need to push these mono PRs to support LA64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-loongarch64 area-VM-meta-mono 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.

4 participants