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

First stab at Microsoft.DotNet.ILCompiler package #64

Merged
merged 3 commits into from
Aug 28, 2020

Conversation

MichalStrehovsky
Copy link
Member

This is based off the crossgen2 package.

We still don't have the BuildIntegration files, but I'm keen to see how spectacularly this is going to fail in the CI.

@MichalStrehovsky MichalStrehovsky added the area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation label Aug 21, 2020
@MichalStrehovsky
Copy link
Member Author

@jkotas This now produces something.

The current problems with this:

  • The runtime.json in the aggregate package refers to packages such as "runtime.win-x64.Microsoft.DotNet.ILCompiler"
    (expected), but the build actually generates "Microsoft.DotNet.ILCompiler.win-x64.5.0.0-dev.nupkg" (unexpected).
  • As a result of that, I can't really test this locally because I can't convince NuGet to consume the runtime specific package.

The package "looks" okay. One of the problems with the non-runtime-specific package is that it has runtime-specific cruft in it, but that is probably only hurting size.

I don't know if this is something the rest of the infra papers over before publishing. I assume RID specific package build publishing works otherwise.

@jkoritzinsky
Copy link
Member

@MichalStrehovsky the results you're seeing are because the infrastructure is producing a framework pack (the .NET Core 3.0+ method of consuming the runtime) instead of a runtime-specific package (the .NET Core 2.x and previous way).

Try setting BuildRuntimePackages to true in the pkgproj instead of setting BuildRidSpecificPacks to true.

That should enable building the RID-specific NuGet packages the way the lineup package expects.

@MichalStrehovsky
Copy link
Member Author

Try setting BuildRuntimePackages to true in the pkgproj instead of setting BuildRidSpecificPacks to true.

Works like charm. Thank you @jkoritzinsky!

dotnet-bot and others added 2 commits August 27, 2020 15:30
CoreRT repo at commit b48a58e6facdda7f50f9256e0d9d6a209473132f.
This is based off the crossgen2 package.
@MichalStrehovsky
Copy link
Member Author

Along with #71 and #72, this produces a workable NuGet package.

I say workable, because it requires passing /subsystem:console /entry:wmainCRTStartup as additional arguments to linker because otherwise we get fatal error LNK1561: entry point must be defined. I haven't yet figured out the magic voodoo that we miss in the Bootstrapper.lib produced in this repo compared to Bootstrapper.lib from the CoreRT repo to make this issue go away.

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.

Nice!

@MichalStrehovsky MichalStrehovsky merged commit 63d5e0f into dotnet:NativeAOT Aug 28, 2020
@MichalStrehovsky MichalStrehovsky deleted the nuget branch August 28, 2020 13:36
scalablecory pushed a commit that referenced this pull request Sep 22, 2020
This PR has a bunch of refactoring for the Azure Pipelines build process. The primary change is to call build.ps1 instead of cmake directly. This removes the dependency on some of the old script files (which are now deleted).
runtimelab-bot pushed a commit that referenced this pull request Feb 8, 2022
# Local heap optimizations on Arm64

1. When not required to zero the allocated space for local heap (for sizes up to 64 bytes) - do not emit zeroing sequence. Instead do stack probing and adjust stack pointer:

```diff
-            stp     xzr, xzr, [sp,#-16]!
-            stp     xzr, xzr, [sp,#-16]!
-            stp     xzr, xzr, [sp,#-16]!
-            stp     xzr, xzr, [sp,#-16]!
+            ldr     wzr, [sp],#-64
```

2. For sizes less than one `PAGE_SIZE` use `ldr wzr, [sp], #-amount` that does probing at `[sp]` and allocates the space at the same time. This saves one instruction for such local heap allocations:

```diff
-            ldr     wzr, [sp]
-            sub     sp, sp, #208
+            ldr     wzr, [sp],#-208
```

Use `ldp tmpReg, xzr, [sp], #-amount` when the offset not encodable by post-index variant of `ldr`:
```diff
-            ldr     wzr, [sp]
-            sub     sp, sp, #512
+            ldp     x0, xzr, [sp],#-512
```

3. Allow non-loop zeroing (i.e. unrolled sequence) for sizes up to 128 bytes (i.e. up to `LCLHEAP_UNROLL_LIMIT`). This frees up two internal integer registers for such cases:

```diff
-            mov     w11, #128
-                                               ;; bbWeight=0.50 PerfScore 0.25
-G_M44913_IG19:        ; gcrefRegs=00F9 {x0 x3 x4 x5 x6 x7}, byrefRegs=0000 {}, byref, isz
             stp     xzr, xzr, [sp,#-16]!
-            subs    x11, x11, #16
-            bne     G_M44913_IG19
+            stp     xzr, xzr, [sp,#-112]!
+            stp     xzr, xzr, [sp,#16]
+            stp     xzr, xzr, [sp,#32]
+            stp     xzr, xzr, [sp,#48]
+            stp     xzr, xzr, [sp,#64]
+            stp     xzr, xzr, [sp,#80]
+            stp     xzr, xzr, [sp,#96]
```

4. Do zeroing in ascending order of the effective address:

```diff
-            mov     w7, #96
-G_M49279_IG13:
             stp     xzr, xzr, [sp,#-16]!
-            subs    x7, x7, #16
-            bne     G_M49279_IG13
+            stp     xzr, xzr, [sp,#-80]!
+            stp     xzr, xzr, [sp,#16]
+            stp     xzr, xzr, [sp,#32]
+            stp     xzr, xzr, [sp,#48]
+            stp     xzr, xzr, [sp,#64]
```

In the example, the zeroing is done at `[initialSp-16], [initialSp-96], [initialSp-80], [initialSp-64], [initialSp-48], [initialSp-32]` addresses. The idea here is to allow a CPU to detect the sequential `memset` to `0` pattern and switch into write streaming mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants