find solution to combinition of predictor and queue
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="AssemblyInfo"
|
// file="AssemblyInfo"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload
|
// AuthorGroup: Nitload Space
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -25,7 +25,13 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
global using StgSharp.Internal;
|
||||||
|
global using StgSharp.Mathematics.Internal;
|
||||||
|
global using System;
|
||||||
|
global using System.Numerics;
|
||||||
|
|
||||||
|
global using System.Threading;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("StgSharpDebug")]
|
[assembly: InternalsVisibleTo("StgSharp.Graphics")]
|
||||||
|
[assembly: InternalsVisibleTo("StgSharpDebug")]
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="PlainInstancingBuffer"
|
// file="PlainInstancingBuffer"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload
|
// AuthorGroup: Nitload Space
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -27,8 +27,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Graphics;
|
using StgSharp.Mathematics.Graphics;
|
||||||
using StgSharp.Mathematics.Numeric;
|
using StgSharp.Mathematics.Numeric.Graphics;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -66,35 +65,15 @@ namespace StgSharp.Geometries
|
|||||||
mutex = new Mutex();
|
mutex = new Mutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IInstancing> InstanceList
|
public List<IInstancing> InstanceList => instanceList;
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get => instanceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Vec4> CoordAndRotationList
|
public List<Vec4> CoordAndRotationList => coordList;
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get => coordList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<float> ScalingList
|
public List<float> ScalingList => scalingList;
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get => scalingList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Span<Vec4> CoordAndRotationSpan
|
public Span<Vec4> CoordAndRotationSpan => CollectionsMarshal.AsSpan(coordList);
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get => CollectionsMarshal.AsSpan(coordList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Span<float> ScalingSpan
|
public Span<float> ScalingSpan => CollectionsMarshal.AsSpan(scalingList);
|
||||||
{
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
get => CollectionsMarshal.AsSpan(scalingList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int CreateInstanceID()
|
public int CreateInstanceID()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="IntrinsicContext"
|
// file="IntrinsicContext"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload
|
// AuthorGroup: Nitload Space
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
using StgSharp.Mathematics.Numeric.Runtime;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@@ -67,9 +68,7 @@ namespace StgSharp.Mathematics.Internal
|
|||||||
|
|
||||||
[FieldOffset(0)] public readonly ushort Size;
|
[FieldOffset(0)] public readonly ushort Size;
|
||||||
|
|
||||||
private MatrixElementType(
|
private MatrixElementType(int mask)
|
||||||
int mask
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out this);
|
Unsafe.SkipInit(out this);
|
||||||
Unsafe.SkipInit(out Size);
|
Unsafe.SkipInit(out Size);
|
||||||
@@ -106,19 +105,14 @@ namespace StgSharp.Mathematics.Internal
|
|||||||
private nint handle; //f32_panel_mul
|
private nint handle; //f32_panel_mul
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public readonly void Call(
|
public readonly void Call(MatrixIntrinsicHandle index, MatrixParallelTask* task)
|
||||||
MatrixIntrinsicHandle index,
|
|
||||||
MatrixParallelTask* task
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
nint ptr = this[(int)index];
|
nint ptr = this[(int)index];
|
||||||
((delegate* unmanaged[Cdecl]<MatrixParallelTask*, void>)ptr)(task);
|
((delegate* unmanaged[Cdecl]<MatrixParallelTask*, void>)ptr)(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public readonly nint Get(
|
public readonly nint Get(MatrixIntrinsicHandle index)
|
||||||
MatrixIntrinsicHandle index
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return this[(int)index];
|
return this[(int)index];
|
||||||
}
|
}
|
||||||
@@ -149,20 +143,15 @@ namespace StgSharp.Mathematics.Internal
|
|||||||
MatrixKernel* left,
|
MatrixKernel* left,
|
||||||
MatrixKernel* right,
|
MatrixKernel* right,
|
||||||
MatrixKernel* ans,
|
MatrixKernel* ans,
|
||||||
ulong scalar
|
ulong scalar)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
nint ptr = this[(int)index];
|
nint ptr = this[(int)index];
|
||||||
((delegate* unmanaged[Cdecl]<MatrixKernel*, MatrixKernel*, MatrixKernel*, ulong, void>)ptr)(left,
|
((delegate* unmanaged[Cdecl]<MatrixKernel*, MatrixKernel*, MatrixKernel*, ulong, void>)ptr)(left, right,
|
||||||
right,
|
ans, scalar);
|
||||||
ans,
|
|
||||||
scalar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public readonly nint Get(
|
public readonly nint Get(MatrixIntrinsicHandle index)
|
||||||
MatrixIntrinsicHandle index
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return this[(int)index];
|
return this[(int)index];
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -1,9 +1,9 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Cordination"
|
// file="Cordination"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload
|
// AuthorGroup: Nitload Space
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
namespace StgSharp.Mathematics.Numeric
|
namespace StgSharp.Mathematics.Numeric.Graphics
|
||||||
{
|
{
|
||||||
public enum CoordinatePlain
|
public enum CoordinatePlain
|
||||||
{
|
{
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixCompute.Sequential"
|
// file="MatrixCompute.Sequential"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload
|
// AuthorGroup: Nitload Space
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -33,18 +33,14 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using unsafe MkProc = delegate* unmanaged[Cdecl]<StgSharp.Mathematics.Internal.MatrixParallelTask*, void>;
|
using unsafe MkProc = delegate* unmanaged[Cdecl]<StgSharp.Mathematics.Numeric.Runtime.MatrixParallelTask*, void>;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Numeric.Linear
|
namespace StgSharp.Mathematics.Numeric.Linear
|
||||||
{
|
{
|
||||||
public static unsafe partial class MatrixCompute
|
public static unsafe partial class MatrixCompute
|
||||||
{
|
{
|
||||||
|
|
||||||
public static void Add(
|
public static void Add(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
|
||||||
Matrix<float> left,
|
|
||||||
Matrix<float> right,
|
|
||||||
Matrix<float> ans
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(left, nameof(left));
|
ArgumentNullException.ThrowIfNull(left, nameof(left));
|
||||||
ArgumentNullException.ThrowIfNull(right, nameof(right));
|
ArgumentNullException.ThrowIfNull(right, nameof(right));
|
||||||
@@ -97,28 +93,17 @@ namespace StgSharp.Mathematics.Numeric.Linear
|
|||||||
private sealed class SequentialPredictor : MatrixPredictor<SequentialPredictor>
|
private sealed class SequentialPredictor : MatrixPredictor<SequentialPredictor>
|
||||||
{
|
{
|
||||||
|
|
||||||
public override bool Predict(
|
public override bool Predict(Span<CacheLinePrediction> node, out int count)
|
||||||
Span<CacheLinePrediction> node,
|
|
||||||
out int count
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Prefetch(
|
public override void Prefetch(nuint origin, ulong policy, Span<byte> cache)
|
||||||
nuint origin,
|
|
||||||
ulong policy,
|
|
||||||
Span<byte> cache
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void WriteBack(
|
public override void WriteBack(nuint origin, ulong policy, ReadOnlySpan<byte> cache)
|
||||||
nuint origin,
|
|
||||||
ulong policy,
|
|
||||||
ReadOnlySpan<byte> cache
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixParallel.Publish"
|
// file="MatrixParallel.Publish"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload
|
// AuthorGroup: Nitload Space
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
using StgSharp.Collections;
|
using StgSharp.Collections;
|
||||||
using StgSharp.HighPerformance.Memory;
|
using StgSharp.HighPerformance.Memory;
|
||||||
using StgSharp.Mathematics;
|
using StgSharp.Mathematics;
|
||||||
using StgSharp.Mathematics.Internal;
|
using StgSharp.Mathematics.Numeric.Runtime;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -48,10 +48,8 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
|
||||||
internal static unsafe MatrixParallelWrap ScheduleTask<TTask>(
|
internal static unsafe MatrixParallelWrap ScheduleTask<TTask>(nuint computeHandle, MatrixParallelTask* package)
|
||||||
nuint computeHandle,
|
where TTask: IPrefetchPredict
|
||||||
MatrixParallelTask* package
|
|
||||||
) where TTask : IPrefetchPredict
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
int primCount = package->PrimCount;
|
int primCount = package->PrimCount;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixParallelQueue"
|
// file="MatrixParallelQueue"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload
|
// AuthorGroup: Nitload Space
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using Microsoft.VisualBasic.FileIO;
|
using Microsoft.VisualBasic.FileIO;
|
||||||
using StgSharp.HighPerformance.Memory;
|
using StgSharp.HighPerformance.Memory;
|
||||||
using StgSharp.Mathematics.Internal;
|
using StgSharp.Mathematics.Numeric.Runtime;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -42,8 +42,6 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
internal unsafe class MatrixParallelQueue
|
internal unsafe class MatrixParallelQueue
|
||||||
{
|
{
|
||||||
|
|
||||||
// TODO 为各种不同的计算策略设计专门的预测器,以适配L4
|
|
||||||
|
|
||||||
private static ConcurrentStack<MatrixParallelQueue> _recycle = [];
|
private static ConcurrentStack<MatrixParallelQueue> _recycle = [];
|
||||||
private MatrixParallelTask* _package;
|
private MatrixParallelTask* _package;
|
||||||
private ulong _cursor;
|
private ulong _cursor;
|
||||||
@@ -53,9 +51,14 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
|
|
||||||
public MatrixParallelTask* Package => _package;
|
public MatrixParallelTask* Package => _package;
|
||||||
|
|
||||||
|
public MatrixElementType ElementType { get; private set; }
|
||||||
|
|
||||||
|
public MatrixIntrinsicHandle Handle { get; private set; }
|
||||||
|
|
||||||
public static MatrixParallelQueue Rent(
|
public static MatrixParallelQueue Rent(
|
||||||
MatrixParallelTask* pack
|
MatrixElementType elementType,
|
||||||
)
|
MatrixIntrinsicHandle handle,
|
||||||
|
MatrixParallelTask* pack)
|
||||||
{
|
{
|
||||||
if (!_recycle.TryPop(out MatrixParallelQueue? queue)) {
|
if (!_recycle.TryPop(out MatrixParallelQueue? queue)) {
|
||||||
queue = new MatrixParallelQueue();
|
queue = new MatrixParallelQueue();
|
||||||
@@ -63,23 +66,21 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
queue._package = pack;
|
queue._package = pack;
|
||||||
queue._maxCount = ((ulong)pack->CommonX) * ((ulong)pack->CommonY);
|
queue._maxCount = ((ulong)pack->CommonX) * ((ulong)pack->CommonY);
|
||||||
queue._cursor = 0;
|
queue._cursor = 0;
|
||||||
|
queue.ElementType = elementType;
|
||||||
|
queue.Handle = handle;
|
||||||
return queue;
|
return queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Return(
|
public static void Return(MatrixParallelQueue queue)
|
||||||
MatrixParallelQueue queue
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
_recycle.Push(queue);
|
_recycle.Push(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public (ulong count, ulong offset) Steal(
|
public bool Steal(MatrixParallelTask* task)
|
||||||
ulong request
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
ulong cursor = Interlocked.Add(ref _cursor, request) - request;
|
// TODO 使用提取的内容填充task
|
||||||
return (Math.Min(request, Math.Max(0, _maxCount - cursor)), cursor);
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-9
@@ -2,8 +2,8 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixParallelTask"
|
// file="MatrixParallelTask"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload
|
// AuthorGroup: Nitload Space
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -30,7 +30,7 @@ using System.Numerics;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace StgSharp.Mathematics.Internal
|
namespace StgSharp.Mathematics.Numeric.Runtime
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
internal unsafe struct MatrixParallelTask
|
internal unsafe struct MatrixParallelTask
|
||||||
@@ -55,13 +55,9 @@ namespace StgSharp.Mathematics.Internal
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void Copy(
|
public static void Copy(MatrixParallelTask* source, MatrixParallelTask* target)
|
||||||
MatrixParallelTask* source,
|
|
||||||
MatrixParallelTask* target
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
Buffer.MemoryCopy(source, target, sizeof(MatrixParallelTask),
|
Buffer.MemoryCopy(source, target, sizeof(MatrixParallelTask), sizeof(MatrixParallelTask));
|
||||||
sizeof(MatrixParallelTask));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixParallelThread"
|
// file="MatrixParallelThread"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload
|
// AuthorGroup: Nitload Space
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
using StgSharp.Internal;
|
using StgSharp.Internal;
|
||||||
using StgSharp.Mathematics.Internal;
|
using StgSharp.Mathematics.Numeric.Runtime;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@@ -53,9 +53,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
private readonly ManualResetEventSlim _resetEvent;
|
private readonly ManualResetEventSlim _resetEvent;
|
||||||
private readonly Thread _managedThread;
|
private readonly Thread _managedThread;
|
||||||
|
|
||||||
internal MatrixParallelThread(
|
internal MatrixParallelThread(int poolId)
|
||||||
int poolId
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
_resetEvent = new ManualResetEventSlim(false);
|
_resetEvent = new ManualResetEventSlim(false);
|
||||||
_managedThread = new Thread(MatrixParallelWorkLoad);
|
_managedThread = new Thread(MatrixParallelWorkLoad);
|
||||||
@@ -97,13 +95,9 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
|
|
||||||
[LibraryImport(Native.LibName, EntryPoint = "sn_set_thread_affinity")]
|
[LibraryImport(Native.LibName, EntryPoint = "sn_set_thread_affinity")]
|
||||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||||
internal static partial void SetThreadAffinity(
|
internal static partial void SetThreadAffinity(int coreId);
|
||||||
int coreId
|
|
||||||
);
|
|
||||||
|
|
||||||
protected virtual void Dispose(
|
protected virtual void Dispose(bool disposing)
|
||||||
bool disposing
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (!_disposed)
|
if (!_disposed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixPredictor"
|
// file="MatrixPredictor"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload
|
// AuthorGroup: Nitload Space
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -34,26 +34,16 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StgSharp.Mathematics.Numeric.Runtime
|
namespace StgSharp.Mathematics.Numeric.Runtime
|
||||||
{
|
{
|
||||||
public abstract class MatrixPredictor<TSelf> : IPrefetchPredict
|
public abstract class MatrixPredictor<TSelf> : IPrefetchPredict where TSelf: MatrixPredictor<TSelf>
|
||||||
where TSelf : MatrixPredictor<TSelf>
|
|
||||||
{
|
{
|
||||||
|
|
||||||
public abstract bool Predict(
|
protected MatrixPredictor() { }
|
||||||
Span<CacheLinePrediction> node,
|
|
||||||
out int count
|
|
||||||
);
|
|
||||||
|
|
||||||
public abstract void Prefetch(
|
public abstract bool Predict(Span<CacheLinePrediction> node, out int count);
|
||||||
nuint origin,
|
|
||||||
ulong policy,
|
|
||||||
Span<byte> cache
|
|
||||||
);
|
|
||||||
|
|
||||||
public abstract void WriteBack(
|
public abstract void Prefetch(nuint origin, ulong policy, Span<byte> cache);
|
||||||
nuint origin,
|
|
||||||
ulong policy,
|
public abstract void WriteBack(nuint origin, ulong policy, ReadOnlySpan<byte> cache);
|
||||||
ReadOnlySpan<byte> cache
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StgSharp.UnserInterface.Service
|
||||||
|
{
|
||||||
|
internal interface IService
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="Global"
|
// file="IState"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload
|
// AuthorGroup: Nitload Space
|
||||||
// Copyright (c) Nitload. All rights reserved.
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -25,12 +25,13 @@
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
global using StgSharp.Internal;
|
using System;
|
||||||
global using StgSharp.Mathematics.Internal;
|
using System.Collections.Generic;
|
||||||
global using System;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
global using System.Numerics;
|
namespace StgSharp.UnserInterface.State
|
||||||
global using System.Threading;
|
{
|
||||||
using System.Runtime.CompilerServices;
|
internal class IState { }
|
||||||
|
}
|
||||||
[assembly: InternalsVisibleTo("StgSharp.Graphics")]
|
|
||||||
@@ -1,7 +1 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk" />
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="View\" />
|
|
||||||
<Folder Include="State\" />
|
|
||||||
<Folder Include="Service\" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StgSharp.UnserInterface.View
|
||||||
|
{
|
||||||
|
internal class PresentorDescription
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user