From d4ce3a90e14ee3e0d40d95c126fb82b6dd9cb4eb Mon Sep 17 00:00:00 2001 From: Sewer56 Date: Sat, 11 Oct 2025 02:52:05 +0100 Subject: [PATCH 1/3] Updated: Runner to latest macOS --- .github/workflows/build-and-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 89aae1c..45b31fa 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -19,7 +19,7 @@ jobs: os: - windows-latest - ubuntu-latest - - macos-13 + - macos-15-intel targetFramework: - net8.0 - net7.0 From 63b584b47928ac8335a7a14d6a365b0a4ec14888 Mon Sep 17 00:00:00 2001 From: Sewer56 Date: Sat, 11 Oct 2025 02:51:17 +0100 Subject: [PATCH 2/3] Fix bug with GetHashCodeUnstable and GetHashCodeUnstableLower When using tiered compilation, the method can switch from use of e.g. UnstableHashNonVectorLower and UnstableHashVec256Lower . However, these algorithms produce different results. Therefore, we force compilation of final Jit Tier (Tier 2) by forcing the AggressiveOptimization flag --- .../Internals/Algorithms/UnstableStringHash.cs | 8 ++++---- .../Internals/Algorithms/UnstableStringHashLower.cs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Reloaded.Memory/Internals/Algorithms/UnstableStringHash.cs b/src/Reloaded.Memory/Internals/Algorithms/UnstableStringHash.cs index fdb10ce..edbf906 100644 --- a/src/Reloaded.Memory/Internals/Algorithms/UnstableStringHash.cs +++ b/src/Reloaded.Memory/Internals/Algorithms/UnstableStringHash.cs @@ -26,7 +26,11 @@ internal static class UnstableStringHash /// [ExcludeFromCodeCoverage] // "Cannot be accurately measured without multiple architectures. Known good impl." This is still tested tho. [SuppressMessage("ReSharper", "InconsistentNaming")] +#if NET5_0_OR_GREATER + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] +#else [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif internal static unsafe nuint GetHashCodeUnstable(this ReadOnlySpan text) { #if NET7_0_OR_GREATER @@ -51,9 +55,7 @@ internal static unsafe nuint GetHashCodeUnstable(this ReadOnlySpan text) } #if NET7_0_OR_GREATER -#if NET8_0 // Bug in .NET 8 seems to cause this to not re-jit to tier1 till like 200k calls on Linux x64 [MethodImpl(MethodImplOptions.AggressiveOptimization)] -#endif internal static unsafe UIntPtr UnstableHashVec128(this ReadOnlySpan text) { fixed (char* src = &text.GetPinnableReference()) @@ -118,9 +120,7 @@ internal static unsafe UIntPtr UnstableHashVec128(this ReadOnlySpan text) } } -#if NET8_0 // Bug in .NET 8 seems to cause this to not re-jit to tier1 till like 200k calls on Linux x64 [MethodImpl(MethodImplOptions.AggressiveOptimization)] -#endif internal static unsafe UIntPtr UnstableHashVec256(this ReadOnlySpan text) { fixed (char* src = &text.GetPinnableReference()) diff --git a/src/Reloaded.Memory/Internals/Algorithms/UnstableStringHashLower.cs b/src/Reloaded.Memory/Internals/Algorithms/UnstableStringHashLower.cs index 2809629..27ed825 100644 --- a/src/Reloaded.Memory/Internals/Algorithms/UnstableStringHashLower.cs +++ b/src/Reloaded.Memory/Internals/Algorithms/UnstableStringHashLower.cs @@ -30,7 +30,11 @@ internal static class UnstableStringHashLower /// [ExcludeFromCodeCoverage] // "Cannot be accurately measured without multiple architectures. Known good impl." This is still tested tho. [SuppressMessage("ReSharper", "InconsistentNaming")] +#if NET5_0_OR_GREATER + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] +#else [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif internal static unsafe nuint GetHashCodeUnstableLower(this ReadOnlySpan text) { #if NET7_0_OR_GREATER @@ -99,9 +103,7 @@ internal static unsafe nuint GetHashCodeUnstableLowerSlow(this ReadOnlySpan text) { fixed (char* src = &text.GetPinnableReference()) @@ -222,9 +224,7 @@ internal static unsafe UIntPtr UnstableHashVec128Lower(this ReadOnlySpan t return GetHashCodeUnstableLowerSlow(text); } -#if NET8_0 // Bug in .NET 8 seems to cause this to not re-jit to tier1 till like 200k calls on Linux x64 [MethodImpl(MethodImplOptions.AggressiveOptimization)] -#endif internal static unsafe UIntPtr UnstableHashVec256Lower(this ReadOnlySpan text) { fixed (char* src = &text.GetPinnableReference()) From 5c84e09efb32870161412339958929b52b24e872 Mon Sep 17 00:00:00 2001 From: Sewer56 Date: Sat, 11 Oct 2025 03:21:15 +0100 Subject: [PATCH 3/3] Changed: Unroll job matrix, disable .NET 3.1/5 for ubuntu --- .github/workflows/build-and-publish.yml | 60 ++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 45b31fa..a52c70f 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -16,37 +16,37 @@ jobs: build: strategy: matrix: - os: - - windows-latest - - ubuntu-latest - - macos-15-intel - targetFramework: - - net8.0 - - net7.0 - - net6.0 - - net5.0 - - netcoreapp3.1 - platform: - - x64 include: - - os: windows-latest - targetFramework: net48 - platform: x64 - - os: windows-latest - targetFramework: net48 - platform: x86 - - os: windows-latest - targetFramework: net7.0 - platform: x86 - - os: windows-latest - targetFramework: net6.0 - platform: x86 - - os: windows-latest - targetFramework: net5.0 - platform: x86 - - os: windows-latest - targetFramework: netcoreapp3.1 - platform: x86 + # .NET 8.0 Tests + - { os: windows-latest, targetFramework: net8.0, platform: x64 } + - { os: ubuntu-latest, targetFramework: net8.0, platform: x64 } + - { os: macos-15-intel, targetFramework: net8.0, platform: x64 } + + # .NET 7.0 Tests + - { os: windows-latest, targetFramework: net7.0, platform: x64 } + - { os: ubuntu-latest, targetFramework: net7.0, platform: x64 } + - { os: macos-15-intel, targetFramework: net7.0, platform: x64 } + - { os: windows-latest, targetFramework: net7.0, platform: x86 } + + # .NET 6.0 Tests + - { os: windows-latest, targetFramework: net6.0, platform: x64 } + - { os: ubuntu-latest, targetFramework: net6.0, platform: x64 } + - { os: macos-15-intel, targetFramework: net6.0, platform: x64 } + - { os: windows-latest, targetFramework: net6.0, platform: x86 } + + # .NET 5.0 Tests (no Ubuntu, libSSL issues) + - { os: windows-latest, targetFramework: net5.0, platform: x64 } + - { os: macos-15-intel, targetFramework: net5.0, platform: x64 } + - { os: windows-latest, targetFramework: net5.0, platform: x86 } + + # .NET Core 3.1 Tests (no Ubuntu, libSSL issues) + - { os: windows-latest, targetFramework: netcoreapp3.1, platform: x64 } + - { os: macos-15-intel, targetFramework: netcoreapp3.1, platform: x64 } + - { os: windows-latest, targetFramework: netcoreapp3.1, platform: x86 } + + # .NET Framework 4.8 Tests (Windows only) + - { os: windows-latest, targetFramework: net48, platform: x64 } + - { os: windows-latest, targetFramework: net48, platform: x86 } runs-on: ${{ matrix.os }} steps: