Skip to content

Commit b9d8461

Browse files
authored
Merge branch 'release/8.0' into darc-release/8.0-303af298-a10b-4c80-8b1f-7ff52ba3641e
2 parents e34e9ff + 11ad607 commit b9d8461

File tree

26 files changed

+17829
-2791
lines changed

26 files changed

+17829
-2791
lines changed

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,9 @@
379379
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
380380
<Sha>4ff28092cdb2006c30869fb35b2fd6b7b11382b1</Sha>
381381
</Dependency>
382-
<Dependency Name="Microsoft.DotNet.ApiCompat.Task" Version="8.0.100-preview.7.23329.3">
382+
<Dependency Name="Microsoft.DotNet.ApiCompat.Task" Version="8.0.100-rtm.23520.8">
383383
<Uri>https://github.com/dotnet/sdk</Uri>
384-
<Sha>d10b02ae5cc670609d920a672985ed4456bdd6b6</Sha>
384+
<Sha>7e33fd449381b337c290a801057fdcd68c4b7220</Sha>
385385
<SourceBuild RepoName="sdk" ManagedOnly="true" />
386386
</Dependency>
387387
<Dependency Name="optimization.windows_nt-arm64.MIBC.Runtime" Version="1.0.0-prerelease.23519.5">

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<PropertyGroup>
8686
<StaticCsVersion>0.2.0</StaticCsVersion>
8787
<!-- SDK dependencies -->
88-
<MicrosoftDotNetApiCompatTaskVersion>8.0.100-preview.7.23329.3</MicrosoftDotNetApiCompatTaskVersion>
88+
<MicrosoftDotNetApiCompatTaskVersion>8.0.100-rtm.23520.8</MicrosoftDotNetApiCompatTaskVersion>
8989
<!-- Arcade dependencies -->
9090
<MicrosoftDotNetBuildTasksFeedVersion>8.0.0-beta.23516.4</MicrosoftDotNetBuildTasksFeedVersion>
9191
<MicrosoftDotNetCodeAnalysisVersion>8.0.0-beta.23516.4</MicrosoftDotNetCodeAnalysisVersion>

src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,10 @@
800800
<DiagnosticId>CP0001</DiagnosticId>
801801
<Target>T:System.Diagnostics.DebugAnnotations</Target>
802802
</Suppression>
803+
<Suppression>
804+
<DiagnosticId>CP0001</DiagnosticId>
805+
<Target>T:System.Diagnostics.DebuggerGuidedStepThroughAttribute</Target>
806+
</Suppression>
803807
<Suppression>
804808
<DiagnosticId>CP0001</DiagnosticId>
805809
<Target>T:System.MDArray</Target>
@@ -864,6 +868,10 @@
864868
<DiagnosticId>CP0001</DiagnosticId>
865869
<Target>T:System.Reflection.RuntimeAssemblyName</Target>
866870
</Suppression>
871+
<Suppression>
872+
<DiagnosticId>CP0001</DiagnosticId>
873+
<Target>T:System.Runtime.CompilerServices.EagerStaticClassConstructionAttribute</Target>
874+
</Suppression>
867875
<Suppression>
868876
<DiagnosticId>CP0001</DiagnosticId>
869877
<Target>T:System.Runtime.CompilerServices.ForceDictionaryLookupsAttribute</Target>

src/coreclr/nativeaot/System.Private.CoreLib/src/System/CrashInfo.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,17 @@ private bool WriteHeader(RhFailFastReason reason, ulong crashingThreadId, string
103103
if (!WriteValue("version"u8, "1.0.0"u8))
104104
return false;
105105

106-
if (!WriteValue("runtime"u8, new ReadOnlySpan<byte>(RuntimeImports.RhGetRuntimeVersion(out int cbLength), cbLength)))
106+
static void Dummy() { }
107+
108+
if (!WriteHexValue("runtime_base"u8, (ulong)RuntimeImports.RhGetOSModuleFromPointer((nint)(void*)(delegate*<void>)&Dummy)))
107109
return false;
108110

109111
if (!WriteIntValue("runtime_type"u8, (int)RuntimeType.NativeAOT))
110112
return false;
111113

114+
if (!WriteValue("runtime_version"u8, new ReadOnlySpan<byte>(RuntimeImports.RhGetRuntimeVersion(out int cbLength), cbLength)))
115+
return false;
116+
112117
CrashReason crashReason = reason switch
113118
{
114119
RhFailFastReason.EnvironmentFailFast => CrashReason.EnvironmentFailFast,

src/libraries/Common/src/Interop/Interop.Locale.iOS.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,8 @@ internal static partial class Globalization
2424

2525
[LibraryImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetLocaleTimeFormatNative", StringMarshalling = StringMarshalling.Utf8)]
2626
internal static partial string GetLocaleTimeFormatNative(string localeName, [MarshalAs(UnmanagedType.Bool)] bool shortFormat);
27+
28+
[LibraryImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetLocalesNative", StringMarshalling = StringMarshalling.Utf16)]
29+
internal static partial int GetLocalesNative([Out] char[]? value, int valueLength);
2730
}
2831
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using Xunit;
5+
6+
namespace System.Globalization.Tests
7+
{
8+
public class CultureInfoGetCultures
9+
{
10+
[Fact]
11+
public void GetSpecificCultures()
12+
{
13+
var specificCultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
14+
Assert.True(specificCultures.Length > 0);
15+
Assert.All(specificCultures, c => Assert.True(c.IsNeutralCulture == false));
16+
}
17+
18+
[Fact]
19+
public void GetAllCultures()
20+
{
21+
var allCultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
22+
Assert.True(allCultures.Length > 0);
23+
}
24+
}
25+
}

src/libraries/System.Globalization/tests/Hybrid/System.Globalization.IOS.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
</PropertyGroup>
77
<ItemGroup>
88
<Compile Include="..\CultureInfo\CultureInfoEnglishName.cs" />
9+
<Compile Include="..\CultureInfo\CultureInfoGetCultures.cs" />
910
<Compile Include="..\CultureInfo\CultureInfoNumberFormat.cs" />
1011
<Compile Include="..\CultureInfo\CultureInfoNames.cs" />
1112
<Compile Include="..\CultureInfo\CultureInfoNativeName.cs" />
Lines changed: 71 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
1-
Microsoft Visual Studio Solution File, Format Version 12.00
1+

2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34205.153
5+
MinimumVisualStudioVersion = 10.0.40219.1
26
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "..\Common\tests\TestUtilities\TestUtilities.csproj", "{9F20CEA1-2216-4432-BBBD-F01E05D17F23}"
37
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Bcl.Numerics", "..\Microsoft.Bcl.Numerics\ref\Microsoft.Bcl.Numerics.csproj", "{D311ABE4-10A9-4BB1-89CE-6358C55501A8}"
9+
EndProject
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Bcl.Numerics", "..\Microsoft.Bcl.Numerics\src\Microsoft.Bcl.Numerics.csproj", "{1578185F-C4FA-4866-936B-E62AAEDD03B7}"
11+
EndProject
412
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Numerics.Tensors", "ref\System.Numerics.Tensors.csproj", "{21CB448A-3882-4337-B416-D1A3E0BCFFC5}"
513
EndProject
614
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Numerics.Tensors", "src\System.Numerics.Tensors.csproj", "{848DD000-3D22-4A25-A9D9-05AFF857A116}"
715
EndProject
816
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Numerics.Tensors.Tests", "tests\System.Numerics.Tensors.Tests.csproj", "{4AF6A02D-82C8-4898-9EDF-01F107C25061}"
917
EndProject
10-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComInterfaceGenerator", "..\System.Runtime.InteropServices\gen\ComInterfaceGenerator\ComInterfaceGenerator.csproj", "{8CA7C982-3EE4-4BCE-9493-7A63556736D3}"
11-
EndProject
1218
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibraryImportGenerator", "..\System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj", "{4588351F-4233-4957-B84C-7F8E22B8888A}"
1319
EndProject
1420
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Interop.SourceGeneration", "..\System.Runtime.InteropServices\gen\Microsoft.Interop.SourceGeneration\Microsoft.Interop.SourceGeneration.csproj", "{DB954E01-898A-4FE2-A3AA-180D041AB08F}"
1521
EndProject
22+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILLink.CodeFixProvider", "..\..\tools\illink\src\ILLink.CodeFix\ILLink.CodeFixProvider.csproj", "{04FC0651-B9D0-448A-A28B-11B1D4A897F4}"
23+
EndProject
24+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILLink.RoslynAnalyzer", "..\..\tools\illink\src\ILLink.RoslynAnalyzer\ILLink.RoslynAnalyzer.csproj", "{683A7D28-CC55-4375-848D-E659075ECEE4}"
25+
EndProject
26+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILLink.Tasks", "..\..\tools\illink\src\ILLink.Tasks\ILLink.Tasks.csproj", "{1CBEAEA8-2CA1-4B07-9930-35A785205852}"
27+
EndProject
28+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.Linker", "..\..\tools\illink\src\linker\Mono.Linker.csproj", "{BA7828B1-7953-47A0-AE5A-E22B501C4BD0}"
29+
EndProject
30+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.Linker", "..\..\tools\illink\src\linker\ref\Mono.Linker.csproj", "{57E57290-3A6A-43F8-8764-D4DC8151F89C}"
31+
EndProject
1632
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{DE94CA7D-BB10-4865-85A6-6B694631247F}"
1733
EndProject
1834
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{6BC42E6D-848C-4533-B715-F116E7DB3610}"
@@ -21,6 +37,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{AB415F5A-75E
2137
EndProject
2238
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "gen", "{083161E5-6049-4D84-9739-9D7797D7117D}"
2339
EndProject
40+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "gen", "{841A2FA4-A95F-4612-A8B9-AD2EF769BC71}"
41+
EndProject
42+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DF0561A1-3AB8-4B51-AFB4-392EE1DD6247}"
43+
EndProject
44+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{7AC4B2C7-A55C-4C4F-9B02-77F5CBFFF4AB}"
45+
EndProject
46+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{F9C2AAB1-C7B0-4E43-BB18-4FB16F6E272B}"
47+
EndProject
2448
Global
2549
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2650
Debug|Any CPU = Debug|Any CPU
@@ -31,6 +55,14 @@ Global
3155
{9F20CEA1-2216-4432-BBBD-F01E05D17F23}.Debug|Any CPU.Build.0 = Debug|Any CPU
3256
{9F20CEA1-2216-4432-BBBD-F01E05D17F23}.Release|Any CPU.ActiveCfg = Release|Any CPU
3357
{9F20CEA1-2216-4432-BBBD-F01E05D17F23}.Release|Any CPU.Build.0 = Release|Any CPU
58+
{D311ABE4-10A9-4BB1-89CE-6358C55501A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
59+
{D311ABE4-10A9-4BB1-89CE-6358C55501A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
60+
{D311ABE4-10A9-4BB1-89CE-6358C55501A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
61+
{D311ABE4-10A9-4BB1-89CE-6358C55501A8}.Release|Any CPU.Build.0 = Release|Any CPU
62+
{1578185F-C4FA-4866-936B-E62AAEDD03B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
63+
{1578185F-C4FA-4866-936B-E62AAEDD03B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
64+
{1578185F-C4FA-4866-936B-E62AAEDD03B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
65+
{1578185F-C4FA-4866-936B-E62AAEDD03B7}.Release|Any CPU.Build.0 = Release|Any CPU
3466
{21CB448A-3882-4337-B416-D1A3E0BCFFC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3567
{21CB448A-3882-4337-B416-D1A3E0BCFFC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
3668
{21CB448A-3882-4337-B416-D1A3E0BCFFC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -43,10 +75,6 @@ Global
4375
{4AF6A02D-82C8-4898-9EDF-01F107C25061}.Debug|Any CPU.Build.0 = Debug|Any CPU
4476
{4AF6A02D-82C8-4898-9EDF-01F107C25061}.Release|Any CPU.ActiveCfg = Release|Any CPU
4577
{4AF6A02D-82C8-4898-9EDF-01F107C25061}.Release|Any CPU.Build.0 = Release|Any CPU
46-
{8CA7C982-3EE4-4BCE-9493-7A63556736D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47-
{8CA7C982-3EE4-4BCE-9493-7A63556736D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
48-
{8CA7C982-3EE4-4BCE-9493-7A63556736D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
49-
{8CA7C982-3EE4-4BCE-9493-7A63556736D3}.Release|Any CPU.Build.0 = Release|Any CPU
5078
{4588351F-4233-4957-B84C-7F8E22B8888A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
5179
{4588351F-4233-4957-B84C-7F8E22B8888A}.Debug|Any CPU.Build.0 = Debug|Any CPU
5280
{4588351F-4233-4957-B84C-7F8E22B8888A}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -55,20 +83,53 @@ Global
5583
{DB954E01-898A-4FE2-A3AA-180D041AB08F}.Debug|Any CPU.Build.0 = Debug|Any CPU
5684
{DB954E01-898A-4FE2-A3AA-180D041AB08F}.Release|Any CPU.ActiveCfg = Release|Any CPU
5785
{DB954E01-898A-4FE2-A3AA-180D041AB08F}.Release|Any CPU.Build.0 = Release|Any CPU
86+
{04FC0651-B9D0-448A-A28B-11B1D4A897F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
87+
{04FC0651-B9D0-448A-A28B-11B1D4A897F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
88+
{04FC0651-B9D0-448A-A28B-11B1D4A897F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
89+
{04FC0651-B9D0-448A-A28B-11B1D4A897F4}.Release|Any CPU.Build.0 = Release|Any CPU
90+
{683A7D28-CC55-4375-848D-E659075ECEE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
91+
{683A7D28-CC55-4375-848D-E659075ECEE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
92+
{683A7D28-CC55-4375-848D-E659075ECEE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
93+
{683A7D28-CC55-4375-848D-E659075ECEE4}.Release|Any CPU.Build.0 = Release|Any CPU
94+
{1CBEAEA8-2CA1-4B07-9930-35A785205852}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
95+
{1CBEAEA8-2CA1-4B07-9930-35A785205852}.Debug|Any CPU.Build.0 = Debug|Any CPU
96+
{1CBEAEA8-2CA1-4B07-9930-35A785205852}.Release|Any CPU.ActiveCfg = Release|Any CPU
97+
{1CBEAEA8-2CA1-4B07-9930-35A785205852}.Release|Any CPU.Build.0 = Release|Any CPU
98+
{BA7828B1-7953-47A0-AE5A-E22B501C4BD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
99+
{BA7828B1-7953-47A0-AE5A-E22B501C4BD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
100+
{BA7828B1-7953-47A0-AE5A-E22B501C4BD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
101+
{BA7828B1-7953-47A0-AE5A-E22B501C4BD0}.Release|Any CPU.Build.0 = Release|Any CPU
102+
{57E57290-3A6A-43F8-8764-D4DC8151F89C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
103+
{57E57290-3A6A-43F8-8764-D4DC8151F89C}.Debug|Any CPU.Build.0 = Debug|Any CPU
104+
{57E57290-3A6A-43F8-8764-D4DC8151F89C}.Release|Any CPU.ActiveCfg = Release|Any CPU
105+
{57E57290-3A6A-43F8-8764-D4DC8151F89C}.Release|Any CPU.Build.0 = Release|Any CPU
58106
EndGlobalSection
59107
GlobalSection(SolutionProperties) = preSolution
60108
HideSolutionNode = FALSE
61109
EndGlobalSection
62110
GlobalSection(NestedProjects) = preSolution
63111
{9F20CEA1-2216-4432-BBBD-F01E05D17F23} = {DE94CA7D-BB10-4865-85A6-6B694631247F}
64-
{4AF6A02D-82C8-4898-9EDF-01F107C25061} = {DE94CA7D-BB10-4865-85A6-6B694631247F}
112+
{D311ABE4-10A9-4BB1-89CE-6358C55501A8} = {6BC42E6D-848C-4533-B715-F116E7DB3610}
113+
{1578185F-C4FA-4866-936B-E62AAEDD03B7} = {AB415F5A-75E5-4E03-8A92-15CEDEC4CD3A}
65114
{21CB448A-3882-4337-B416-D1A3E0BCFFC5} = {6BC42E6D-848C-4533-B715-F116E7DB3610}
66115
{848DD000-3D22-4A25-A9D9-05AFF857A116} = {AB415F5A-75E5-4E03-8A92-15CEDEC4CD3A}
67-
{8CA7C982-3EE4-4BCE-9493-7A63556736D3} = {083161E5-6049-4D84-9739-9D7797D7117D}
116+
{4AF6A02D-82C8-4898-9EDF-01F107C25061} = {DE94CA7D-BB10-4865-85A6-6B694631247F}
68117
{4588351F-4233-4957-B84C-7F8E22B8888A} = {083161E5-6049-4D84-9739-9D7797D7117D}
69118
{DB954E01-898A-4FE2-A3AA-180D041AB08F} = {083161E5-6049-4D84-9739-9D7797D7117D}
119+
{04FC0651-B9D0-448A-A28B-11B1D4A897F4} = {841A2FA4-A95F-4612-A8B9-AD2EF769BC71}
120+
{683A7D28-CC55-4375-848D-E659075ECEE4} = {841A2FA4-A95F-4612-A8B9-AD2EF769BC71}
121+
{1CBEAEA8-2CA1-4B07-9930-35A785205852} = {DF0561A1-3AB8-4B51-AFB4-392EE1DD6247}
122+
{BA7828B1-7953-47A0-AE5A-E22B501C4BD0} = {DF0561A1-3AB8-4B51-AFB4-392EE1DD6247}
123+
{57E57290-3A6A-43F8-8764-D4DC8151F89C} = {7AC4B2C7-A55C-4C4F-9B02-77F5CBFFF4AB}
124+
{841A2FA4-A95F-4612-A8B9-AD2EF769BC71} = {F9C2AAB1-C7B0-4E43-BB18-4FB16F6E272B}
125+
{DF0561A1-3AB8-4B51-AFB4-392EE1DD6247} = {F9C2AAB1-C7B0-4E43-BB18-4FB16F6E272B}
126+
{7AC4B2C7-A55C-4C4F-9B02-77F5CBFFF4AB} = {F9C2AAB1-C7B0-4E43-BB18-4FB16F6E272B}
70127
EndGlobalSection
71128
GlobalSection(ExtensibilityGlobals) = postSolution
72129
SolutionGuid = {10A5F2C3-5230-4916-9D4D-BBDB94851037}
73130
EndGlobalSection
74-
EndGlobal
131+
GlobalSection(SharedMSBuildProjectFiles) = preSolution
132+
..\..\tools\illink\src\ILLink.Shared\ILLink.Shared.projitems*{683a7d28-cc55-4375-848d-e659075ecee4}*SharedItemsImports = 5
133+
..\..\tools\illink\src\ILLink.Shared\ILLink.Shared.projitems*{ba7828b1-7953-47a0-ae5a-e22b501c4bd0}*SharedItemsImports = 5
134+
EndGlobalSection
135+
EndGlobal
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
## About
2+
3+
Provides methods for performing mathematical operations over _tensors_ represented as spans. These methods are accelerated to use SIMD (Single instruction, multiple data) operations supported by the CPU where available.
4+
5+
## Key Features
6+
7+
* Numerical operations on tensors represented as `ReadOnlySpan<float>`
8+
* Element-wise arithmetic: Add, Subtract, Multiply, Divide, Exp, Log, Cosh, Tanh, etc.
9+
* Tensor arithmetic: CosineSimilarity, Distance, Dot, Normalize, Softmax, Sigmoid, etc.
10+
11+
## How to Use
12+
13+
```C#
14+
using System.Numerics.Tensors;
15+
16+
var movies = new[] {
17+
new { Title="The Lion King", Embedding= new [] { 0.10022575f, -0.23998135f } },
18+
new { Title="Inception", Embedding= new [] { 0.10327095f, 0.2563685f } },
19+
new { Title="Toy Story", Embedding= new [] { 0.095857024f, -0.201278f } },
20+
new { Title="Pulp Function", Embedding= new [] { 0.106827796f, 0.21676421f } },
21+
new { Title="Shrek", Embedding= new [] { 0.09568083f, -0.21177962f } }
22+
};
23+
var queryEmbedding = new[] { 0.12217915f, -0.034832448f };
24+
25+
var top3MoviesTensorPrimitives =
26+
movies
27+
.Select(movie =>
28+
(
29+
movie.Title,
30+
Similarity: TensorPrimitives.CosineSimilarity(queryEmbedding, movie.Embedding)
31+
))
32+
.OrderByDescending(movies => movies.Similarity)
33+
.Take(3);
34+
35+
foreach (var movie in top3MoviesTensorPrimitives)
36+
{
37+
Console.WriteLine(movie);
38+
}
39+
```
40+
41+
## Main Types
42+
43+
The main types provided by this library are:
44+
45+
* `System.Numerics.Tensors.TensorPrimitives`
46+
47+
## Additional Documentation
48+
49+
* [API documentation](https://learn.microsoft.com/en-us/dotnet/api/system.numerics.tensors)
50+
51+
## Feedback & Contributing
52+
53+
System.Numerics.Tensors is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime).
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
M:System.Numerics.Tensors.TensorPrimitives.ConvertToHalf(System.ReadOnlySpan{System.Single},System.Span{System.Half})
2+
M:System.Numerics.Tensors.TensorPrimitives.ConvertToSingle(System.ReadOnlySpan{System.Half},System.Span{System.Single})

0 commit comments

Comments
 (0)