matrix parallel start to use two different policy
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.Collections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -56,7 +57,29 @@ namespace StgSharp.HighPerformance.Memory
|
||||
)
|
||||
{
|
||||
count = (count < 0) ? 0 : count;
|
||||
return _intrinsic.ScanEvict((short*)_predictCount, (short*)_mapCount, count, this);
|
||||
int* pPtr = (int*)_predictCount, mPtr = (int*)_mapCount;
|
||||
|
||||
|
||||
int remain = count;
|
||||
ConcurrentFlexibleArray<IL4Predict> predictors = _predictors;
|
||||
predictors.RequestSpanOperation();
|
||||
Span<IL4Predict> pSpan = predictors.AsSpan();
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < CacheLineCount; i++)
|
||||
{
|
||||
if (pPtr[i] > mPtr[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
remain -= TryEvictAt(i, pSpan) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
predictors.ReleaseSpanOperation();
|
||||
}
|
||||
return remain;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -85,7 +108,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
predict.WriteBack(head->Origin, head->Profile, new ReadOnlySpan<byte>((byte*)head->Address, (int)head->Size));
|
||||
RecycleLine(index);
|
||||
(*_mapCount)[index] = 0;
|
||||
(*_predictCount)[index] = short.MaxValue;
|
||||
(*_predictCount)[index] = int.MaxValue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user