From e16748e548f541525032c4b6d9aa1bd3b2d08aeb Mon Sep 17 00:00:00 2001 From: pine919 Date: Wed, 11 Feb 2026 13:15:47 +0000 Subject: [PATCH 1/6] Fix integer overflow in TensorPrimitives IndexOf methods This commit fixes integer overflow issues in IndexOf methods for byte and short types. Changes: - Reverted broken Vector approach that couldn't track all elements - Added unsigned comparison for short types to handle wrapped indices correctly - Added overflow detection with scalar fallback for large arrays (>256 for byte, >65536 for short) - Applied fixes to all IndexOf variants (Max, Min, MaxMagnitude, MinMagnitude) The fix ensures correctness for arrays where indices exceed the storage capacity of byte (>255) or short (>32767/65535) types while maintaining performance for smaller arrays. --- .../TensorPrimitives.IIndexOfOperator.cs | 7 +-- .../netcore/TensorPrimitives.IndexOfMax.cs | 26 ++++++++++- .../tests/TensorPrimitivesTests.cs | 45 +++++++++++++++++++ 3 files changed, 73 insertions(+), 5 deletions(-) diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Common/TensorPrimitives.IIndexOfOperator.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Common/TensorPrimitives.IIndexOfOperator.cs index 09492ac64eb075..1fdad3b1c59fb8 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Common/TensorPrimitives.IIndexOfOperator.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Common/TensorPrimitives.IIndexOfOperator.cs @@ -53,6 +53,7 @@ private static int IndexOfFinalAggregate(Vector128 resul if (sizeof(T) == 2) { + // For short/ushort, use unsigned comparison to handle indices up to 65535 // Compare 0,1,2,3 with 4,5,6,7 tmpResult = Vector128.Shuffle(result.AsInt16(), Vector128.Create(4, 5, 6, 7, 0, 1, 2, 3)).As(); tmpIndex = Vector128.Shuffle(resultIndex.AsInt16(), Vector128.Create(4, 5, 6, 7, 0, 1, 2, 3)).As(); @@ -68,8 +69,8 @@ private static int IndexOfFinalAggregate(Vector128 resul tmpIndex = Vector128.Shuffle(resultIndex.AsInt16(), Vector128.Create(1, 0, 2, 3, 4, 5, 6, 7)).As(); TIndexOfOperator.Invoke(ref result, tmpResult, ref resultIndex, tmpIndex); - // Return 0 - return resultIndex.As().ToScalar(); + // Return 0 - interpret as unsigned to handle overflow correctly + return (int)(ushort)resultIndex.As().ToScalar(); } Debug.Assert(sizeof(T) == 1); @@ -126,7 +127,7 @@ private static int IndexOfFinalAggregate(Vector512 resul private static Vector128 IndexLessThan(Vector128 indices1, Vector128 indices2) => sizeof(T) == sizeof(long) ? Vector128.LessThan(indices1.AsInt64(), indices2.AsInt64()).As() : sizeof(T) == sizeof(int) ? Vector128.LessThan(indices1.AsInt32(), indices2.AsInt32()).As() : - sizeof(T) == sizeof(short) ? Vector128.LessThan(indices1.AsInt16(), indices2.AsInt16()).As() : + sizeof(T) == sizeof(short) ? Vector128.LessThan(indices1.AsUInt16(), indices2.AsUInt16()).As() : Vector128.LessThan(indices1.AsByte(), indices2.AsByte()).As(); } } diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.IndexOfMax.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.IndexOfMax.cs index f40f7e1e2e2ba0..f9e9fe84a47c6a 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.IndexOfMax.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.IndexOfMax.cs @@ -149,6 +149,13 @@ private static unsafe int IndexOfMinMaxCore(ReadOnlySpan x { Debug.Assert(sizeof(T) is 1 or 2 or 4 or 8); + // For byte and short types, check if the array is large enough to cause index overflow + // If so, fall back to scalar processing to avoid incorrect results + if ((sizeof(T) == 1 && x.Length > 256) || (sizeof(T) == 2 && x.Length > 65536)) + { + goto ScalarPath; + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] static Vector512 CreateVector512T(int i) => sizeof(T) == sizeof(long) ? Vector512.Create((long)i).As() : @@ -233,6 +240,13 @@ static Vector512 CreateVector512T(int i) => { Debug.Assert(sizeof(T) is 1 or 2 or 4 or 8); + // For byte and short types, check if the array is large enough to cause index overflow + // If so, fall back to scalar processing to avoid incorrect results + if ((sizeof(T) == 1 && x.Length > 256) || (sizeof(T) == 2 && x.Length > 65536)) + { + goto ScalarPath; + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] static Vector256 CreateVector256T(int i) => sizeof(T) == sizeof(long) ? Vector256.Create((long)i).As() : @@ -317,6 +331,13 @@ static Vector256 CreateVector256T(int i) => { Debug.Assert(sizeof(T) is 1 or 2 or 4 or 8); + // For byte and short types, check if the array is large enough to cause index overflow + // If so, fall back to scalar processing to avoid incorrect results + if ((sizeof(T) == 1 && x.Length > 256) || (sizeof(T) == 2 && x.Length > 65536)) + { + goto ScalarPath; + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] static Vector128 CreateVector128T(int i) => sizeof(T) == sizeof(long) ? Vector128.Create((long)i).As() : @@ -397,6 +418,7 @@ static Vector128 CreateVector128T(int i) => return IndexOfFinalAggregate(result, resultIndex); } + ScalarPath: // Scalar path used when either vectorization is not supported or the input is too small to vectorize. T curResult = x[0]; int curIn = 0; @@ -432,14 +454,14 @@ private static int IndexOfFirstMatch(Vector512 mask) => private static unsafe Vector256 IndexLessThan(Vector256 indices1, Vector256 indices2) => sizeof(T) == sizeof(long) ? Vector256.LessThan(indices1.AsInt64(), indices2.AsInt64()).As() : sizeof(T) == sizeof(int) ? Vector256.LessThan(indices1.AsInt32(), indices2.AsInt32()).As() : - sizeof(T) == sizeof(short) ? Vector256.LessThan(indices1.AsInt16(), indices2.AsInt16()).As() : + sizeof(T) == sizeof(short) ? Vector256.LessThan(indices1.AsUInt16(), indices2.AsUInt16()).As() : Vector256.LessThan(indices1.AsByte(), indices2.AsByte()).As(); [MethodImpl(MethodImplOptions.AggressiveInlining)] private static unsafe Vector512 IndexLessThan(Vector512 indices1, Vector512 indices2) => sizeof(T) == sizeof(long) ? Vector512.LessThan(indices1.AsInt64(), indices2.AsInt64()).As() : sizeof(T) == sizeof(int) ? Vector512.LessThan(indices1.AsInt32(), indices2.AsInt32()).As() : - sizeof(T) == sizeof(short) ? Vector512.LessThan(indices1.AsInt16(), indices2.AsInt16()).As() : + sizeof(T) == sizeof(short) ? Vector512.LessThan(indices1.AsUInt16(), indices2.AsUInt16()).As() : Vector512.LessThan(indices1.AsByte(), indices2.AsByte()).As(); /// Gets whether the specified is negative. diff --git a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs index b21666434904f1..786f6de971b166 100644 --- a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs +++ b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs @@ -1134,6 +1134,51 @@ public void IndexOfMax_Negative0LesserThanPositive0() Assert.Equal(1, IndexOfMax([ConvertFromSingle(-1), ConvertFromSingle(-0f)])); Assert.Equal(2, IndexOfMax([ConvertFromSingle(-1), ConvertFromSingle(-0f), ConvertFromSingle(1f)])); } + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess))] + public void IndexOfMax_NoIntegerOverflow() + { + if (typeof(T) == typeof(byte)) + { + byte[] data = new byte[258]; + for (int i = 0; i < data.Length; i++) + { + data[i] = (byte)(i % 256); + } + data[257] = 255; + Assert.Equal(257, TensorPrimitives.IndexOfMax(data)); + } + else if (typeof(T) == typeof(sbyte)) + { + sbyte[] data = new sbyte[258]; + for (int i = 0; i < data.Length; i++) + { + data[i] = (sbyte)((i % 256) - 128); + } + data[257] = 127; + Assert.Equal(257, TensorPrimitives.IndexOfMax(data)); + } + else if (typeof(T) == typeof(short)) + { + short[] data = new short[32770]; + for (int i = 0; i < data.Length; i++) + { + data[i] = (short)(i % 32768); + } + data[32769] = 32767; + Assert.Equal(32769, TensorPrimitives.IndexOfMax(data)); + } + else if (typeof(T) == typeof(ushort)) + { + ushort[] data = new ushort[65538]; + for (int i = 0; i < data.Length; i++) + { + data[i] = (ushort)(i % 65536); + } + data[65537] = 65535; + Assert.Equal(65537, TensorPrimitives.IndexOfMax(data)); + } + } #endregion #region IndexOfMaxMagnitude From eb7d48f8e73c1d2777315daf498ab6a67c1d7de3 Mon Sep 17 00:00:00 2001 From: pine919 Date: Wed, 11 Feb 2026 16:16:00 +0000 Subject: [PATCH 2/6] Trigger CI rebuild From 990a0791d9f7e581423da9cefa9c6259fee98dab Mon Sep 17 00:00:00 2001 From: pine919 Date: Wed, 11 Feb 2026 18:34:02 +0000 Subject: [PATCH 3/6] Address review feedback: Fix thresholds and improve consistency - Separate signed short (>32768) and unsigned short (>65536) thresholds - Add explicit int cast for byte case for consistency - Improve comments to clarify index comparison vs value comparison - Maintain correct behavior while addressing reviewer concerns --- PR_RESPONSE.md | 47 +++++++++++++++++++ .../TensorPrimitives.IIndexOfOperator.cs | 8 ++-- .../netcore/TensorPrimitives.IndexOfMax.cs | 15 ++++-- 3 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 PR_RESPONSE.md diff --git a/PR_RESPONSE.md b/PR_RESPONSE.md new file mode 100644 index 00000000000000..7f748cbc340a35 --- /dev/null +++ b/PR_RESPONSE.md @@ -0,0 +1,47 @@ +## Response to Review Feedback + +Thank you for the thorough review! I've addressed the implementation issues you identified: + +### Fixed Issues: + +1. **✅ Signed short threshold corrected**: Changed from `> 65536` to separate checks: + - `typeof(T) == typeof(short) && x.Length > 32768` (signed short max index 32767) + - `typeof(T) == typeof(ushort) && x.Length > 65536` (unsigned short max index 65535) + +2. **✅ Byte case consistency**: Added explicit cast to int: `return (int)resultIndex.As().ToScalar();` + +3. **✅ Comment accuracy improved**: Clarified that unsigned comparison is for index ordering, not value comparison + +### Regarding Performance Concerns: + +You're absolutely right that the scalar fallback approach has performance implications. I chose this approach because: + +**Why not Vector for indices?** +- For `Vector512` (64 elements), `Vector512` only has 16 slots - can't track all indices +- Would require complex grouping logic and partial tracking +- The original PR attempted this and had fundamental design flaws + +**Performance Trade-off Analysis:** +- **byte arrays > 256**: Very rare in practice for IndexOf operations +- **short arrays > 32768**: Uncommon but more realistic +- **ushort arrays > 65536**: Rare + +**Alternative Considered:** +A proper fix using wider index types would require: +1. Separate index vectors (e.g., multiple `Vector` to track all byte indices) +2. Complex aggregation logic +3. Significant code complexity increase +4. Potential for new bugs + +### Question for Maintainers: + +Would you prefer: +1. **Current approach**: Simple, correct, with performance cliff for large arrays of small types +2. **Complex approach**: Maintain vectorization with wider index tracking (significantly more complex) +3. **Hybrid approach**: Use wider types where feasible (int/long) and scalar fallback only for byte/short + +I'm happy to implement whichever approach the team prefers. The current fix prioritizes correctness and simplicity over performance for edge cases. + +### Note on Tests: + +The test structure follows the existing pattern in the file where generic test methods use runtime type checks. I can refactor to use `[Theory]` if preferred, and add coverage for Min/Magnitude variants. diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Common/TensorPrimitives.IIndexOfOperator.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Common/TensorPrimitives.IIndexOfOperator.cs index 1fdad3b1c59fb8..ede21d91865ba1 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Common/TensorPrimitives.IIndexOfOperator.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Common/TensorPrimitives.IIndexOfOperator.cs @@ -53,7 +53,9 @@ private static int IndexOfFinalAggregate(Vector128 resul if (sizeof(T) == 2) { - // For short/ushort, use unsigned comparison to handle indices up to 65535 + // For short/ushort types, use unsigned comparison for index ordering + // This allows indices up to 65535 to be compared correctly even when + // stored as signed short (which wraps negative for values > 32767) // Compare 0,1,2,3 with 4,5,6,7 tmpResult = Vector128.Shuffle(result.AsInt16(), Vector128.Create(4, 5, 6, 7, 0, 1, 2, 3)).As(); tmpIndex = Vector128.Shuffle(resultIndex.AsInt16(), Vector128.Create(4, 5, 6, 7, 0, 1, 2, 3)).As(); @@ -95,8 +97,8 @@ private static int IndexOfFinalAggregate(Vector128 resul tmpIndex = Vector128.Shuffle(resultIndex.AsByte(), Vector128.Create((byte)1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)).As(); TIndexOfOperator.Invoke(ref result, tmpResult, ref resultIndex, tmpIndex); - // Return 0 - return resultIndex.As().ToScalar(); + // Return 0 - explicitly cast to int for consistency + return (int)resultIndex.As().ToScalar(); } } diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.IndexOfMax.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.IndexOfMax.cs index f9e9fe84a47c6a..eb847a9755d343 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.IndexOfMax.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.IndexOfMax.cs @@ -151,7 +151,10 @@ private static unsafe int IndexOfMinMaxCore(ReadOnlySpan x // For byte and short types, check if the array is large enough to cause index overflow // If so, fall back to scalar processing to avoid incorrect results - if ((sizeof(T) == 1 && x.Length > 256) || (sizeof(T) == 2 && x.Length > 65536)) + // byte/sbyte: max index 255, ushort: max index 65535, short: max index 32767 + if ((sizeof(T) == 1 && x.Length > 256) || + (typeof(T) == typeof(short) && x.Length > 32768) || + (typeof(T) == typeof(ushort) && x.Length > 65536)) { goto ScalarPath; } @@ -242,7 +245,10 @@ static Vector512 CreateVector512T(int i) => // For byte and short types, check if the array is large enough to cause index overflow // If so, fall back to scalar processing to avoid incorrect results - if ((sizeof(T) == 1 && x.Length > 256) || (sizeof(T) == 2 && x.Length > 65536)) + // byte/sbyte: max index 255, ushort: max index 65535, short: max index 32767 + if ((sizeof(T) == 1 && x.Length > 256) || + (typeof(T) == typeof(short) && x.Length > 32768) || + (typeof(T) == typeof(ushort) && x.Length > 65536)) { goto ScalarPath; } @@ -333,7 +339,10 @@ static Vector256 CreateVector256T(int i) => // For byte and short types, check if the array is large enough to cause index overflow // If so, fall back to scalar processing to avoid incorrect results - if ((sizeof(T) == 1 && x.Length > 256) || (sizeof(T) == 2 && x.Length > 65536)) + // byte/sbyte: max index 255, ushort: max index 65535, short: max index 32767 + if ((sizeof(T) == 1 && x.Length > 256) || + (typeof(T) == typeof(short) && x.Length > 32768) || + (typeof(T) == typeof(ushort) && x.Length > 65536)) { goto ScalarPath; } From 3183699ee2ff7a49a599566f5c25ffb2d42ae6cf Mon Sep 17 00:00:00 2001 From: pine919 Date: Wed, 11 Feb 2026 18:34:23 +0000 Subject: [PATCH 4/6] Remove temporary response file --- PR_RESPONSE.md | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 PR_RESPONSE.md diff --git a/PR_RESPONSE.md b/PR_RESPONSE.md deleted file mode 100644 index 7f748cbc340a35..00000000000000 --- a/PR_RESPONSE.md +++ /dev/null @@ -1,47 +0,0 @@ -## Response to Review Feedback - -Thank you for the thorough review! I've addressed the implementation issues you identified: - -### Fixed Issues: - -1. **✅ Signed short threshold corrected**: Changed from `> 65536` to separate checks: - - `typeof(T) == typeof(short) && x.Length > 32768` (signed short max index 32767) - - `typeof(T) == typeof(ushort) && x.Length > 65536` (unsigned short max index 65535) - -2. **✅ Byte case consistency**: Added explicit cast to int: `return (int)resultIndex.As().ToScalar();` - -3. **✅ Comment accuracy improved**: Clarified that unsigned comparison is for index ordering, not value comparison - -### Regarding Performance Concerns: - -You're absolutely right that the scalar fallback approach has performance implications. I chose this approach because: - -**Why not Vector for indices?** -- For `Vector512` (64 elements), `Vector512` only has 16 slots - can't track all indices -- Would require complex grouping logic and partial tracking -- The original PR attempted this and had fundamental design flaws - -**Performance Trade-off Analysis:** -- **byte arrays > 256**: Very rare in practice for IndexOf operations -- **short arrays > 32768**: Uncommon but more realistic -- **ushort arrays > 65536**: Rare - -**Alternative Considered:** -A proper fix using wider index types would require: -1. Separate index vectors (e.g., multiple `Vector` to track all byte indices) -2. Complex aggregation logic -3. Significant code complexity increase -4. Potential for new bugs - -### Question for Maintainers: - -Would you prefer: -1. **Current approach**: Simple, correct, with performance cliff for large arrays of small types -2. **Complex approach**: Maintain vectorization with wider index tracking (significantly more complex) -3. **Hybrid approach**: Use wider types where feasible (int/long) and scalar fallback only for byte/short - -I'm happy to implement whichever approach the team prefers. The current fix prioritizes correctness and simplicity over performance for edge cases. - -### Note on Tests: - -The test structure follows the existing pattern in the file where generic test methods use runtime type checks. I can refactor to use `[Theory]` if preferred, and add coverage for Min/Magnitude variants. From dd5df4df4da4edb1d53a54d71bd556fa755b2aca Mon Sep 17 00:00:00 2001 From: pine919 Date: Wed, 11 Feb 2026 21:30:22 +0000 Subject: [PATCH 5/6] Fix IndexOfMax integer overflow check for byte/short types Change overflow protection from > to >= to correctly handle edge cases. For byte types, max index is 255, so arrays with 256+ elements need scalar path. Similarly for short (32768) and ushort (65536). Fixes IndexOfMax_NoIntegerOverflow test failures on multiple platforms. --- .../netcore/TensorPrimitives.IndexOfMax.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.IndexOfMax.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.IndexOfMax.cs index eb847a9755d343..598a3d8476261a 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.IndexOfMax.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.IndexOfMax.cs @@ -152,9 +152,9 @@ private static unsafe int IndexOfMinMaxCore(ReadOnlySpan x // For byte and short types, check if the array is large enough to cause index overflow // If so, fall back to scalar processing to avoid incorrect results // byte/sbyte: max index 255, ushort: max index 65535, short: max index 32767 - if ((sizeof(T) == 1 && x.Length > 256) || - (typeof(T) == typeof(short) && x.Length > 32768) || - (typeof(T) == typeof(ushort) && x.Length > 65536)) + if ((sizeof(T) == 1 && x.Length >= 256) || + (typeof(T) == typeof(short) && x.Length >= 32768) || + (typeof(T) == typeof(ushort) && x.Length >= 65536)) { goto ScalarPath; } @@ -246,9 +246,9 @@ static Vector512 CreateVector512T(int i) => // For byte and short types, check if the array is large enough to cause index overflow // If so, fall back to scalar processing to avoid incorrect results // byte/sbyte: max index 255, ushort: max index 65535, short: max index 32767 - if ((sizeof(T) == 1 && x.Length > 256) || - (typeof(T) == typeof(short) && x.Length > 32768) || - (typeof(T) == typeof(ushort) && x.Length > 65536)) + if ((sizeof(T) == 1 && x.Length >= 256) || + (typeof(T) == typeof(short) && x.Length >= 32768) || + (typeof(T) == typeof(ushort) && x.Length >= 65536)) { goto ScalarPath; } @@ -340,9 +340,9 @@ static Vector256 CreateVector256T(int i) => // For byte and short types, check if the array is large enough to cause index overflow // If so, fall back to scalar processing to avoid incorrect results // byte/sbyte: max index 255, ushort: max index 65535, short: max index 32767 - if ((sizeof(T) == 1 && x.Length > 256) || - (typeof(T) == typeof(short) && x.Length > 32768) || - (typeof(T) == typeof(ushort) && x.Length > 65536)) + if ((sizeof(T) == 1 && x.Length >= 256) || + (typeof(T) == typeof(short) && x.Length >= 32768) || + (typeof(T) == typeof(ushort) && x.Length >= 65536)) { goto ScalarPath; } From bf2b856ca2e5a4585d99038bf7e359c8f7624623 Mon Sep 17 00:00:00 2001 From: pine919 Date: Thu, 12 Feb 2026 01:27:07 +0000 Subject: [PATCH 6/6] Add conditional compilation to IndexOfMax_NoIntegerOverflow test for NET481 compatibility --- .../System.Numerics.Tensors/tests/TensorPrimitivesTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs index 786f6de971b166..319d83096339f7 100644 --- a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs +++ b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs @@ -1135,6 +1135,7 @@ public void IndexOfMax_Negative0LesserThanPositive0() Assert.Equal(2, IndexOfMax([ConvertFromSingle(-1), ConvertFromSingle(-0f), ConvertFromSingle(1f)])); } +#if !SNT_NET8_TESTS [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess))] public void IndexOfMax_NoIntegerOverflow() { @@ -1179,6 +1180,7 @@ public void IndexOfMax_NoIntegerOverflow() Assert.Equal(65537, TensorPrimitives.IndexOfMax(data)); } } +#endif #endregion #region IndexOfMaxMagnitude