add multi predictor support to l4, working for ver 5 of mat parallel

This commit is contained in:
Youmu Liu
2026-04-09 18:07:49 +08:00
parent 0bad6bb480
commit f7187ca7fd
19 changed files with 653 additions and 187 deletions
+6 -4
View File
@@ -38,12 +38,14 @@ namespace StgSharp.HighPerformance.Memory
private const int PredictionCount = 2048;
private const int PredictionLeastAhead = 1024;
private static readonly IIntrinsicKernel _intrinsic = IIntrinsicKernel.Instance;
private readonly CacheLineData* _data;
private readonly EvictionArray* _eviction;
private readonly CacheLineHead* _head;
private readonly CacheLinePrediction* _prediction;
private bool _disposed;
private bool _exhausted;
private int _activeCount;
private int _aheadCount;
@@ -84,7 +86,7 @@ namespace StgSharp.HighPerformance.Memory
ptr += stackSize;
}
public IL4Predict PrefetchPredict { get; set; }
// public IL4Predict PrefetchPredict { get; set; }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ContinueOnce(
@@ -121,7 +123,7 @@ namespace StgSharp.HighPerformance.Memory
nuint origin
)
{
if ((_aheadCount < PredictionLeastAhead) && !PrefetchPredict.IsExhausted)
if ((_aheadCount < PredictionLeastAhead) && !_exhausted)
{
if (Interlocked.CompareExchange(ref _prefetching, 1, 0) == 0)
{
@@ -193,7 +195,7 @@ namespace StgSharp.HighPerformance.Memory
_activeCount = ref activeCount;
}
[Obsolete("You should not create a CacheLineHandle outside a L4", true)]
[Obsolete("You should not create a CacheLineHandle instance outside a L4", true)]
public L4CacheLine() { }
public readonly nuint Address => _handle;