seems tile_fma kernel has index error and indexer of matrix has error as well

This commit is contained in:
Youmu Liu
2026-01-11 16:45:38 +08:00
parent cd8210d9a1
commit b8bf1e9f08
8 changed files with 56 additions and 29 deletions
+2 -1
View File
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Global"
// Project: StgSharp
@@ -33,6 +33,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("StgSharp.Mathematics")]
[assembly: InternalsVisibleTo("StgSharpDebug")]
[assembly: SuppressMessage(
"Design",
+9 -9
View File
@@ -158,12 +158,12 @@ namespace StgSharp.Mathematics.Numeric
)
{
// Caller guarantees: indices in range, layout is dense square.
int k_c = y >> 2;
int k_r = x >> 2;
int c = y & 3;
int r = x & 3;
int k_c = y / 4;
int k_r = x / 4;
int c = y % 4;
int r = x % 4;
ref MatrixKernel<T> kernel = ref _buffer[_boarder.GetIndexOffset(k_c, k_r, in _size)];
ref MatrixKernel<T> kernel = ref _buffer[_boarder.GetIndexOffset(k_r, k_c, in _size)];
return ref kernel[c, r];
}
@@ -183,10 +183,10 @@ namespace StgSharp.Mathematics.Numeric
)
{
// Caller guarantees: indices in range, layout is dense square.
int k_c = y >> 2;
int k_r = x >> 2;
int c = y & 3;
int r = x & 3;
int k_c = y / 4;
int k_r = x / 4;
int c = y % 4;
int r = x % 4;
return ref _buffer[_boarder.GetIndexOffset(k_c, k_r, in _size)];
}
@@ -121,7 +121,7 @@ namespace StgSharp.Mathematics.Numeric
long y = yKernel;
long col = enumerator.KernelColumnLength;
Console.Write($"Attempt to get offset at ({x},{y}), offset is {x * col + y} ");
// Console.Write($"Attempt to get offset at ({x},{y}), offset is {x * col + y} ");
return x * col + y;
}