Fixed regression with ref taken only once while it may move since..
This commit is contained in:
1 parent
5bfc9b1c30
commit
05077f7e90
1 file changed
+3
-4
@@ -386,7 +386,7 @@ public sealed class MersenneNumberDivisorByDivisorGpuTester : IMersenneNumberDiv
|
|||||||
|
|
||||||
int batchSize, computeCount, i, offset = 0;
|
int batchSize, computeCount, i, offset = 0;
|
||||||
bool useDivisorCycles = owner._useDivisorCycles;
|
bool useDivisorCycles = owner._useDivisorCycles;
|
||||||
ulong exponentSliceRef, residue;
|
ulong residue;
|
||||||
while (offset < primesLength)
|
while (offset < primesLength)
|
||||||
{
|
{
|
||||||
batchSize = Math.Min(gpuBatchSize, primesLength - offset);
|
batchSize = Math.Min(gpuBatchSize, primesLength - offset);
|
||||||
@@ -426,12 +426,11 @@ public sealed class MersenneNumberDivisorByDivisorGpuTester : IMersenneNumberDiv
|
|||||||
exponentSlice = hostSpan[..computeCount];
|
exponentSlice = hostSpan[..computeCount];
|
||||||
exponentView = exponentsView.SubView(0, computeCount);
|
exponentView = exponentsView.SubView(0, computeCount);
|
||||||
|
|
||||||
exponentSliceRef = MemoryMarshal.GetReference(exponentSlice);
|
exponentView.CopyFromCPU(ref MemoryMarshal.GetReference(exponentSlice), computeCount);
|
||||||
exponentView.CopyFromCPU(ref exponentSliceRef, computeCount);
|
|
||||||
resultView = resultsView.SubView(0, computeCount);
|
resultView = resultsView.SubView(0, computeCount);
|
||||||
kernel(computeCount, divisorData, exponentView, resultView);
|
kernel(computeCount, divisorData, exponentView, resultView);
|
||||||
accelerator.Synchronize();
|
accelerator.Synchronize();
|
||||||
resultView.CopyToCPU(ref exponentSliceRef, computeCount);
|
resultView.CopyToCPU(ref MemoryMarshal.GetReference(exponentSlice), computeCount);
|
||||||
|
|
||||||
for (i = 0; i < computeCount; i++)
|
for (i = 0; i < computeCount; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user