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

[NativeAOT-LLVM] Merge to Sep 24 #2688

Draft
wants to merge 616 commits into
base: feature/NativeAOT-LLVM
Choose a base branch
from

Conversation

yowl
Copy link
Contributor

@yowl yowl commented Sep 17, 2024

No description provided.

elinor-fung and others added 30 commits August 30, 2024 08:35
… (#107038)

* Correct lengths on lunar months 8 and 9 in 2057.

Fixes #107032

* Add test.

* Correct comment.

* Addresses PR feedback.

Local testing undertaken.

---------

Co-authored-by: Tarek Mahmoud Sayed <10833894+tarekgh@users.noreply.github.com>
…07130)

* [LoongArch64] Add 'loongarch64' display in Crossgen2 and ILC cli.
* Add missing 'Architecture.LoongArch64' in libraries tests.
The recently added AVX support in hardware exception handling path on macOS x64
has introduced a problem when running under Rosetta.
When we extract the floating point part of the context of the failing thread,
the thread can have AVX or AVX512 active, or none of these. The code accidentally
leaves CONTEXT_XSTATE set on the context even when no AVX was enabled on the thread.

Rosetta doesn't support AVX, so having CONTEXT_XSTATE set in the context flags
can lead to later call to RtlRestoreContext attempting to set ymm registers using
instructions that Rosetta cannot emulate and the app crashes due to that.

This doesn't happen in .NET 9, since we always clear the CONTEXT_XSTATE before
exception handling stack unwinding. But in .NET 8, this causes stack overflow
under Rosetta, since the attemt to execute the ymm instruction triggers the
hardware exception handling again and again.
This exists as the more used function bbIsHandlerBeg
This breaks the dependency on having dotnet installed when running tests.
…se (#107170)

On macOS with system integrity protection enabled, if a code-signed binary is loaded in a process, modified, and loaded again in another process, the second run will crash with Code Signature Invalid).

Enabling test-only behaviour modifies the binary (re-writes a placeholder value). The nethost tests were enabling/disabling test-only behaviour for the same nethost binary used by all the tests. This change updates the tests to just always enable it before any use of the binary.
- Add a proper constructor for `Compiler` and call it via placement new from
  `jitNativeCode`.
- Remove `compInit`, `fgInit`, `impInit`, `lvaInit` and `optInit`. Move all
  their initialization into the constructor or, when possible, initialize the
  field directly with its declaration.
* add initial AssemblyNameInfo Fuzzer

* fix the first bug that it has discovered
The cache maintains a list of all regexes in the cache, which it uses to be able to randomly access members as part of evicting when the cache is full and an item needs to be replaced. When evicting, it randomly samples a subset of the items, and then removes whichever is found to have the oldest timestamp. That RemoveAt call is O(N), as elements need to be shifted down. But the order of the list doesn't actually matter, so we can make that instead be O(1) by just moving the last element into the removal slot (overwriting the one to be removed) and then shrinking the size of the list.
…undle when AOTing on Helix (#107079)

* Do not treat assembly.pdb/xml files as native files to bundle

* Bundle satellite assemblies as well
…(#106858)

* respect AppContext switch (which is currently enabled for all projects in the root Directory.Build.props file)

* add project reference to all test projects that need working BF (and were being skipped for a while)

* adjust to changes from #104202: EqualityComparer<string>.Default is mapped to StringEqualityComparer, but serialized as GenericEqualityComparer<string>
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
…nking error (#107253)

* Test case for long path issue on Windows.

* Fix - using relative paths to objects located in the project shortens the linking command.
…40902.1 (#107258)

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 9.0.0-prerelease.24420.3 -> To Version 9.0.0-prerelease.24452.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
* Use docker compose workaround from SslStress in HttpStress

* Attempt 2

* Attempt 3

---------

Co-authored-by: Anton Firszov <Anton.Firszov@microsoft.com>
* increase test timeout for fullAOT x64 jobs
BrzVlad and others added 28 commits September 16, 2024 11:12
…ng it with JIT (#107401)

* [mono][mini] Prefer llvmaot compiled method instead of inlining it with JIT

The motivation for this is to fix crashes due to different HW intrinsics support between llvm and JIT. For example, a llvmaot compiled method might check if we have a set of HW intrinsics available and proceed with a code path that will end up calling a method that assumes intrinsics support that is not present in the aot image (because the gsharedvt version is not emitted for example). In this scenario, the called method will end up being compiled with JIT where we would crash due to missing HW intrinsics support.

* [mono][mini] Prefer llvm compiled method only if it uses simd intrinsics

We include a new flag when compiling aot method. When loading aot method, we will include mapping from code to flags so we can look it up later.
Normally we would have caught this oversight immediately, as tests would have failed to compile, but unlike the vast majority of our test suites, System.Collections.Immutable's test suite references the implementation assembly rather than the ref assembly, in order to access internals via InternalsVisibleTo. Grrr.
* introduce ArrayRecord.FlattenedLength

* do not include invalid Type or Assembly names in the exception messages, as it's most likely corrupted/tampered/malicious data and could be used as a vector of attack.

* It is possible to have binary array records have an element type of array without being marked as jagged
Those platforms are using hybrid globalization now and don't need the package anymore.
The RemoteInvokeOptions instance is mutated by RemoveExecutor.Invoke and cannot be shared.
* Remove redundant unsafe from APIs

Fixes: #104845

* Restore incorrectly commented API
* Mark Encoding as nullable in StreamWriter's constructor

* Update reference file

* Align string constructors with Stream

* add explicit test for null as encoding
* Started the Quality Week work of improving the workflow docs.

* Made more progress on the general workflow README doc, as well as the CoreCLR one.

* Rephrased some things to make them roll off the tongue better, and fixed a couple spelling and grammatical mistakes.

* Basically finished the main  workflow README, and the CoreCLR building docs.

* Almost done with the CoreCLR building docs, finished the MacOS requirements one, and got far enough on the Windows requirements one.

* Finished the first pass on the Windows requirements doc.

* Finished the first pass of the Linux Environment Requirements.

* Finished the first pass of the Linux requirements doc.

* Made good progress on the 'Using Docker' new doc.

* Finished the first pass of the Using Docker doc.

* Initial merging of the new docs with the existing documentation.

* Improved the redaction of some sentences, improved some formatting, and fixed a few broken links.

* Forgot to commit a NativeAOT note.

* Removed the cross signs in the tables and added general info about cross-compiling to the general workflow introduction segment.

* Added some redaction improvements, and corrected a few misleading and/or outdated details.

* Linked the Workflow's README to the CoreCLR Building README.

* Added a few additional details, and improved some wording and phrasing to make the docs more friendly and clear as per received feedback.

* Fixed typo in the -DCLR_CMAKE_APPLE_DYSM=TRUE flags.
* fix the operands for TernaryLogicUseFlags

* Add test case

* Revert "fix the operands for TernaryLogicUseFlags"

This reverts commit 5b016430f5a35ef949dc3d4dc227631a926729bd.

* proper fix

* trim test

* wrap test in try-catch

* Revert "wrap test in try-catch"

This reverts commit 33198757cf2112cbf894977fc9455139d0a10b71.

* wrap in Avx512F.IsSupported
* empty slice fix

* PR comments and more testing

* fixing check

* fixing array rent init

* fixes from PR comments
* fixing 0 length issue with constructor

* Update src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>

* comments from PR

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Update ABI doc

* Managed/native varargs are supported on Windows only

Co-authored-by: Jan Kotas <jkotas@microsoft.com>

* Add github issue links

* Update varargs link ref

* Managed varargs are supported on Windows only

---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Initial debugging work for python pipeline

* Use custom performance branch

* Remove template reference

* Move resources to perf.yml

* Ensure runtime repo is checked out to SourcesDirectory

* Try fix python run

* Set python in perf-job.yml

* More fixes

* More fixes

* Set most params in perf-job.yml

* Fix variable declaration

* Fix some bugs in setup parameters

* Ensure Helix Access Token is passed in

* Fix osGroup arg parsing

* Fix ios args and use local commit time

* Fix physical promotion yaml

* Fix project file path

* Ensure internal param is passed

* Ensure project file is passed in

* Try dynamically load performance repo

* Try use condition inside repositories definition

* Try put condition on repositories object

* Try use variables to conditionally create repository

* Fix conditional variable definition

* Just use ADO for performance repo

* Use updated repository name for scenarios jobs

* Use HELIX_WORKITEM_ROOT for performance dir

* Fix paths for android APKs

* Remove accidental submodule

* Use new project file location for arm64 jit job

* Move archive of work item dir to python

* Use github for performance repo checkout on public jobs

* Another attempt at conditional repository definition

* Another attempt at conditional repository

* Use multi repo checkout only for internal runs

* Ensure ios scenarios and wasm jobs are working

* Only copy files from dotnet-runtime directory on internal jobs

* Use branch instead of ref for performance repository clone

* Clone performance repo to correct folder in public jobs
add instru to help with DATAS debugging

+ record heap count change history on blocking GC threads and BGC threads (I'm including a change to get the m_OSThreadId field of the Thread object since we recently discovered an issue where GC indicates a BGC thread was successfully created yet that field is 0. I'm only recording this on the OS we discovered this on. for future releases we should get it properly via a GCToEEInterface method)
+ record BGC thread creation history

record LLC size to help with gen0 min size debugging
The old label was replaced with macos-latest-internal.
* Introduce new event for failed http requests

* remove response code, because it is not applicable

* fix log level from error to information and message

* fix formating

* fix message template and add tests

* minor fixes
* Update dependencies from https://github.com/dotnet/xharness build 20240913.2

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 10.0.0-prerelease.24462.1 -> To Version 10.0.0-prerelease.24463.2

* Update dependencies from https://github.com/dotnet/xharness build 20240916.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 10.0.0-prerelease.24463.2 -> To Version 10.0.0-prerelease.24466.1

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
…s (#107811)

Revise the fix done in #39105 to make the cast from byref to native int via
an explicit cast, rather than retyping the node.

Fixes #107045.
…ported (#107874)

If a regex is created with RegexOptions.Compiled and RegexOptions.IgnoreCase, and it begins with a pattern that's a reasonably small number of alternating strings, it'll now end up using `SearchValues<string>` to find the next possible match location. However, the `SearchValues<string>` instance doesn't end up getting created if the interpreter is being used. If the implementation falls back to the interpreter because compilation isn't supported because dynamic code isn't supported, then it won't use any optimizations to find the next starting location. That's a regression from when it would previously at least use a vectorized search to find one character class from the set of starting strings.

This fixes it to just always create the `SearchValues<string>`. This adds some overhead when using RegexOptions.Compiled, but it's typically just a few percentage points, and only applies in the cases where this `SearchValues<string>` optimization kicks in. At the moment, changing it to have perfect knowledge about whether it can avoid that creation is too invasive. This overhead also doesn't apply to the source generator.
# Conflicts:
#	eng/liveBuilds.targets
#	src/coreclr/inc/jithelpers.h
#	src/coreclr/jit/compiler.cpp
#	src/coreclr/jit/compiler.h
#	src/coreclr/jit/utils.cpp
#	src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
#	src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/ThrowHelpers.cs
#	src/coreclr/runtime.proj
#	src/libraries/System.Net.Http/src/System.Net.Http.csproj
#	src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs
#	src/libraries/System.Private.CoreLib/src/System/Threading/Interlocked.cs
#	src/native/libs/System.IO.Compression.Native/CMakeLists.txt
#	src/native/libs/build-native.proj
#	src/tests/Common/Directory.Build.targets
#	src/tests/nativeaot/CustomMain/CustomMain.csproj
#	src/tests/nativeaot/SmokeTests/DynamicGenerics/DynamicGenerics.csproj
#	src/tests/nativeaot/SmokeTests/Exceptions/Exceptions.csproj
#	src/tests/nativeaot/SmokeTests/FrameworkStrings/Baseline.csproj
#	src/tests/nativeaot/SmokeTests/FrameworkStrings/UseSystemResourceKeys.csproj
#	src/tests/nativeaot/SmokeTests/PInvoke/PInvoke.csproj
#	src/tests/nativeaot/SmokeTests/Preinitialization/Preinitialization.csproj
#	src/tests/nativeaot/SmokeTests/Reflection/Reflection.csproj
#	src/tests/nativeaot/SmokeTests/Reflection/Reflection_FromUsage.csproj
#	src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibrary.csproj
#	src/tests/nativeaot/SmokeTests/StackTraceMetadata/StackTraceMetadata.csproj
#	src/tests/nativeaot/SmokeTests/StackTraceMetadata/StackTraceMetadata_Stripped.csproj
#	src/tests/nativeaot/SmokeTests/TrimmingBehaviors/TrimmingBehaviors.csproj
#	src/tests/nativeaot/SmokeTests/UnitTests/UnitTests.csproj
remove deleted helpes
builds the windows target
@SingleAccretion
Copy link

remove ThrowMisalign

This helper is NAOT-LLVM specific and should be kept (it is used for atomics).

@yowl
Copy link
Contributor Author

yowl commented Sep 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.