From 1c9b820531e7502a071d775d1094201ed5389f66 Mon Sep 17 00:00:00 2001 From: Youmu Liu <105042599+Nitload-NSI@users.noreply.github.com> Date: Fri, 24 Oct 2025 16:20:21 +0800 Subject: [PATCH] Large task publish ok --- .../Numeric/MatrixComputeModel.cs | 11 +- .../Numeric/MatrixParallel.Publish.cs | 344 ++++++++++-------- .../Numeric/MatrixParallelPool.cs | 47 ++- .../Numeric/MatrixParallelTask.cs | 22 +- 4 files changed, 227 insertions(+), 197 deletions(-) diff --git a/StgSharp.Mathematics/Numeric/MatrixComputeModel.cs b/StgSharp.Mathematics/Numeric/MatrixComputeModel.cs index 2e93507a..86075ae0 100644 --- a/StgSharp.Mathematics/Numeric/MatrixComputeModel.cs +++ b/StgSharp.Mathematics/Numeric/MatrixComputeModel.cs @@ -42,21 +42,22 @@ namespace StgSharp.Mathematics.Numeric nint l = p->Left, r = p->Right, a = p->Result; long + // set beginning value to counters for primary offsets lCount = (long)p->LeftPrimOffset * p->LeftPrimStride, rCount = (long)p->RightPrimOffset * p->RightPrimStride, aCount = (long)p->ResultPrimOffset * p->ResultPrimStride, - pCount = p->PrimCount, + pCount = int.Min(p->PrimCount, p->PrimColumnCountInTile + p->PrimTileOffset)/*count of tile may be too much*/, //edge to reset counters lLimit = pCount - p->LeftPrimOffset, rLimit = pCount - p->RightPrimOffset, aLimit = pCount - p->ResultPrimOffset; delegate* unmanaged[Cdecl] op = (delegate* unmanaged[Cdecl])p->ComputeHandle; - for (long i = 0; i < pCount; i++) + for (long i = p->PrimTileOffset; i < pCount; i++) { // update primary counters - // if reachs edge, reset to zero + // if reaches edge, reset to zero lCount = i < lLimit ? lCount + p->LeftPrimOffset : 0; rCount = i < rLimit ? rCount + p->RightPrimOffset : 0; aCount = i < rLimit ? aCount + p->ResultPrimOffset : 0; @@ -69,12 +70,12 @@ namespace StgSharp.Mathematics.Numeric lc = (long)p->LeftSecOffset * p->LeftSecStride, rc = (long)p->RightSecOffset * p->RightSecStride, ac = (long)p->ResultSecOffset * p->ResultSecStride, - sCount = p->SecCount; + sCount = int.Min(p->SecCount, p->SecColumnCountInTile + p->SecTileOffset); long ll = sCount - p->LeftSecOffset, rl = sCount - p->RightSecOffset, al = sCount - p->ResultSecOffset; - for (int j = 0; j < sCount; j++) + for (int j = p->SecTileOffset; j < sCount; j++) { lc = j < ll ? lc + p->LeftSecOffset : 0; rc = j < rl ? rc + p->RightSecOffset : 0; diff --git a/StgSharp.Mathematics/Numeric/MatrixParallel.Publish.cs b/StgSharp.Mathematics/Numeric/MatrixParallel.Publish.cs index d7216bb4..66000df8 100644 --- a/StgSharp.Mathematics/Numeric/MatrixParallel.Publish.cs +++ b/StgSharp.Mathematics/Numeric/MatrixParallel.Publish.cs @@ -41,9 +41,9 @@ namespace StgSharp.Mathematics.Numeric { public static unsafe void PublicTask( - MatrixSegmentEnumeration source, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation) + MatrixSegmentEnumeration source, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation) where T: unmanaged, INumber { MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask(); @@ -67,10 +67,10 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration left, - MatrixSegmentEnumeration right, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation) + MatrixSegmentEnumeration left, + MatrixSegmentEnumeration right, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation) where T: unmanaged, INumber { MatrixParallelTaskPackage* package = MatrixParallelFactory.CreateBaseTask(); @@ -100,10 +100,10 @@ namespace StgSharp.Mathematics.Numeric // Unary with 1..8 scalars (each scalar is independent generic type) public static unsafe void PublicTask( - MatrixSegmentEnumeration source, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0) + MatrixSegmentEnumeration source, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0) where T: unmanaged, INumber where TScalar0: unmanaged, INumber { @@ -131,11 +131,11 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration source, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1) + MatrixSegmentEnumeration source, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -166,11 +166,11 @@ namespace StgSharp.Mathematics.Numeric // Binary with 1..8 scalars (each scalar is independent generic type) public static unsafe void PublicTask( - MatrixSegmentEnumeration left, - MatrixSegmentEnumeration right, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0) + MatrixSegmentEnumeration left, + MatrixSegmentEnumeration right, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0) where T: unmanaged, INumber where TScalar0: unmanaged, INumber { @@ -203,12 +203,12 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration source, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1, - TScalar2 s2) + MatrixSegmentEnumeration source, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1, + TScalar2 s2) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -240,12 +240,12 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration left, - MatrixSegmentEnumeration right, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1) + MatrixSegmentEnumeration left, + MatrixSegmentEnumeration right, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -280,13 +280,13 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration source, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1, - TScalar2 s2, - TScalar3 s3) + MatrixSegmentEnumeration source, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1, + TScalar2 s2, + TScalar3 s3) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -320,13 +320,13 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration left, - MatrixSegmentEnumeration right, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1, - TScalar2 s2) + MatrixSegmentEnumeration left, + MatrixSegmentEnumeration right, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1, + TScalar2 s2) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -363,14 +363,14 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration source, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1, - TScalar2 s2, - TScalar3 s3, - TScalar4 s4) + MatrixSegmentEnumeration source, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1, + TScalar2 s2, + TScalar3 s3, + TScalar4 s4) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -406,14 +406,14 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration left, - MatrixSegmentEnumeration right, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1, - TScalar2 s2, - TScalar3 s3) + MatrixSegmentEnumeration left, + MatrixSegmentEnumeration right, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1, + TScalar2 s2, + TScalar3 s3) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -452,15 +452,15 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration source, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1, - TScalar2 s2, - TScalar3 s3, - TScalar4 s4, - TScalar5 s5) + MatrixSegmentEnumeration source, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1, + TScalar2 s2, + TScalar3 s3, + TScalar4 s4, + TScalar5 s5) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -498,15 +498,15 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration left, - MatrixSegmentEnumeration right, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1, - TScalar2 s2, - TScalar3 s3, - TScalar4 s4) + MatrixSegmentEnumeration left, + MatrixSegmentEnumeration right, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1, + TScalar2 s2, + TScalar3 s3, + TScalar4 s4) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -547,16 +547,16 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration source, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1, - TScalar2 s2, - TScalar3 s3, - TScalar4 s4, - TScalar5 s5, - TScalar6 s6) + MatrixSegmentEnumeration source, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1, + TScalar2 s2, + TScalar3 s3, + TScalar4 s4, + TScalar5 s5, + TScalar6 s6) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -596,16 +596,16 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration left, - MatrixSegmentEnumeration right, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1, - TScalar2 s2, - TScalar3 s3, - TScalar4 s4, - TScalar5 s5) + MatrixSegmentEnumeration left, + MatrixSegmentEnumeration right, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1, + TScalar2 s2, + TScalar3 s3, + TScalar4 s4, + TScalar5 s5) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -648,17 +648,17 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration source, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1, - TScalar2 s2, - TScalar3 s3, - TScalar4 s4, - TScalar5 s5, - TScalar6 s6, - TScalar7 s7) + MatrixSegmentEnumeration source, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1, + TScalar2 s2, + TScalar3 s3, + TScalar4 s4, + TScalar5 s5, + TScalar6 s6, + TScalar7 s7) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -700,17 +700,17 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration left, - MatrixSegmentEnumeration right, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1, - TScalar2 s2, - TScalar3 s3, - TScalar4 s4, - TScalar5 s5, - TScalar6 s6) + MatrixSegmentEnumeration left, + MatrixSegmentEnumeration right, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1, + TScalar2 s2, + TScalar3 s3, + TScalar4 s4, + TScalar5 s5, + TScalar6 s6) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -755,18 +755,18 @@ namespace StgSharp.Mathematics.Numeric } public static unsafe void PublicTask( - MatrixSegmentEnumeration left, - MatrixSegmentEnumeration right, - MatrixSegmentEnumeration ans, - delegate**, MatrixKernel*, MatrixKernel*, void> Operation, - TScalar0 s0, - TScalar1 s1, - TScalar2 s2, - TScalar3 s3, - TScalar4 s4, - TScalar5 s5, - TScalar6 s6, - TScalar7 s7) + MatrixSegmentEnumeration left, + MatrixSegmentEnumeration right, + MatrixSegmentEnumeration ans, + delegate**, MatrixKernel*, MatrixKernel*, void> Operation, + TScalar0 s0, + TScalar1 s1, + TScalar2 s2, + TScalar3 s3, + TScalar4 s4, + TScalar5 s5, + TScalar6 s6, + TScalar7 s7) where T: unmanaged, INumber where TScalar0: unmanaged, INumber where TScalar1: unmanaged, INumber @@ -818,44 +818,66 @@ namespace StgSharp.Mathematics.Numeric int primCount = package->PrimCount; int secCount = package->SecCount; int tileWidth = (1024 / secCount) + 1; - int tileCount = (primCount / tileWidth) + 1; + int tileCount = (primCount + tileWidth - 1) / tileWidth; MatrixParallelPool pool = LeadParallel(); - int tilePerThreadLess = tileCount / pool.SpareThreadCount; - int tileToSlice = tileCount % pool.SpareThreadCount; - int slicingPerWrap = tileToSlice / pool.SpareThreadCount; - int extraTiles = tileToSlice % pool.SpareThreadCount; + int threadCount = pool.SpareThreadCount; + int tilePerThreadLess = tileCount / threadCount; // tiles per thread without extra slice + int columnAfterBaseTile = tileCount % threadCount * tileWidth; // tile sliced into columns + int extraColumnPerThread = columnAfterBaseTile / threadCount; + int extraColumnCount = columnAfterBaseTile % threadCount; // columns to be sliced - int total = tileCount; - int begin = 0; - Stack taskBunch = new Stack(pool.SpareThreadCount); - while (tileCount > 0) + int total = primCount; + Stack taskBunch = new Stack(threadCount); + MatrixParallelTaskPackage* current = package; + while (true) { - _ = pool.TryRequestWrap(out MatrixParallelWrap? wrap); - bool hasSlice = tileToSlice > 0; - bool isLargeSlice = extraTiles > 0; + if (!pool.TryRequestWrap(out MatrixParallelWrap? wrap) || wrap is null) + { +#if DEBUG + throw new InvalidOperationException("Someone steal parallel wraps from the pool."); +#endif + } + + bool hasSlice = columnAfterBaseTile > 0; + bool isLargeSlice = extraColumnCount > 0; // count tiles for wrap - // TODO 此处应该是线程数量而不是线程束数量 - // TODO 需要想办法正确同步线程数量信息 - int toSlice = hasSlice ? wrap!.WrapTaskCapacity * slicingPerWrap : 0; - int baseTile = wrap!.WrapTaskCapacity * tilePerThreadLess; - int tileInWrap = baseTile + toSlice + (isLargeSlice ? 1 : 0); - int columnInWrap = tileInWrap * tileWidth; + int wrapWidth = wrap!.WrapTaskCapacity; + int columnFromSlicingCount = (hasSlice ? extraColumnPerThread : 0) * wrapWidth; + int baseColumn = wrapWidth * tilePerThreadLess * tileWidth; + int columnInWrap = baseColumn + columnFromSlicingCount + (isLargeSlice ? 1 : 0); // set tasks - MatrixParallelTaskPackage* task = MatrixParallelFactory.FromExistPackage(package); - wrap.WrapTask = (MatrixParallelTaskPackageNonGeneric*)task; - task->LeftPrimOffset += columnInWrap; - task->PrimCount = columnInWrap; + if (columnInWrap == 0) + { +#if DEBUG + throw new InvalidOperationException("Zero tasks published."); +#endif + } + + // update current task + current->PrimColumnCountInTile = columnInWrap; + current->SecColumnCountInTile = current->SecCount; + current->SecTileBegin = 0; // remove tiles count - extraTiles--; - tileToSlice -= toSlice; - tileCount -= tileInWrap; - begin += tileInWrap; + extraColumnCount--; + columnAfterBaseTile -= columnFromSlicingCount; + total -= columnInWrap; + + // set to wrap and push + wrap.WrapTask = (MatrixParallelTaskPackageNonGeneric*)current; taskBunch.Push(wrap); + + + if (total <= 0) + { + break; + } + current = MatrixParallelFactory.FromExistPackage(current); + current->PrimTileBegin += columnInWrap; } ReleaseParallelLeadership(ref pool); diff --git a/StgSharp.Mathematics/Numeric/MatrixParallelPool.cs b/StgSharp.Mathematics/Numeric/MatrixParallelPool.cs index 95b33973..bcaa6b75 100644 --- a/StgSharp.Mathematics/Numeric/MatrixParallelPool.cs +++ b/StgSharp.Mathematics/Numeric/MatrixParallelPool.cs @@ -1,30 +1,27 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="MatrixParallelPool.cs" +// file="MatrixParallelPool" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// AuthorGroup: Nitload +// Copyright (c) Nitload. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- @@ -33,6 +30,7 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; @@ -99,7 +97,8 @@ namespace StgSharp.Mathematics.Numeric return false; } - public bool TryRequestWrap([NotNull]out MatrixParallelWrap? wrap) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool TryRequestWrap([NotNull] out MatrixParallelWrap? wrap) { if (SpareWrap.TryPop(out wrap)) { diff --git a/StgSharp.Mathematics/Numeric/MatrixParallelTask.cs b/StgSharp.Mathematics/Numeric/MatrixParallelTask.cs index f3983819..19318215 100644 --- a/StgSharp.Mathematics/Numeric/MatrixParallelTask.cs +++ b/StgSharp.Mathematics/Numeric/MatrixParallelTask.cs @@ -114,10 +114,12 @@ namespace StgSharp.Mathematics.Numeric #endregion - #region reserve + #region count offset - public readonly long ReservedLong0; // 8 - public readonly long ReservedLong1; // 8 + public readonly int PrimTileOffset; // 4 + public readonly int SecTileOffset; // 4 + public readonly int PrimColumnCountInTile; // 4 + public readonly int SecColumnCountInTile; // 4 #endregion } @@ -134,7 +136,11 @@ namespace StgSharp.Mathematics.Numeric [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe void Copy(MatrixParallelTaskPackage* source, MatrixParallelTaskPackage* target) { - Buffer.MemoryCopy(source, target, sizeof(MatrixParallelTaskPackage), sizeof(MatrixParallelTaskPackage)); + Buffer.MemoryCopy( + source, + target, + sizeof(MatrixParallelTaskPackage), + sizeof(MatrixParallelTaskPackage)); } #region source @@ -197,10 +203,12 @@ namespace StgSharp.Mathematics.Numeric #endregion - #region reserve + #region count offset - public long ReservedLong0; // 8 - public long ReservedLong1; // 8 + public int PrimTileBegin; // 4 + public int SecTileBegin; // 4 + public int PrimColumnCountInTile; // 4 + public int SecColumnCountInTile; // 4 #endregion }