- Introduce `CombinedDependenciesJob` for efficient dependency handling and memory management - Add `ScheduleCustom<T>` for user-defined job execution/free logic - Refactor `JobInfo` and `JobDataPool<T>` for safer resource management and custom function support - Improve SPMD extension type constraint formatting - Update SPMD project content path and increment assembly versions - Add unit tests for combined dependencies and custom jobs - Remove `[Timeout]` from tests to prevent spurious failures - Add TODO for future `WideLane` optimizations - Replace legacy .sln with .slnx for better solution structure
27 lines
854 B
C#
27 lines
854 B
C#
using Misaki.HighPerformance.Collections;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace Misaki.HighPerformance.Jobs;
|
|
|
|
internal static class JobDataPool<T>
|
|
{
|
|
private static readonly ConcurrentSlotMap<T> s_slots = new ConcurrentSlotMap<T>(8);
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static int Allocate(ref readonly T data, out int generation)
|
|
{
|
|
return s_slots.Add(data, out generation);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static ref T GetReference(int id, int generation, out bool exists)
|
|
{
|
|
return ref s_slots.GetElementReferenceAt(id, generation, out exists);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static void Free(ref readonly JobInfo jobInfo)
|
|
{
|
|
s_slots.Remove(jobInfo.dataID, jobInfo.dataGeneration);
|
|
}
|
|
} |