Refactor job API: add JobExecutionContext, update tests

Major breaking change: job interfaces now use JobExecutionContext
instead of threadIndex, enabling thread-aware and dynamic job
dispatching. Updated all job system, SPMD, and test code to match.
Collections improved with new methods and clearer enumerators.
Renamed IJobScheduler.WaitComplete to Wait. Incremented project
versions. Includes bug fixes, documentation, and style updates.
This commit is contained in:
2026-03-04 11:43:39 +09:00
parent b9ca71834f
commit 37d548085e
31 changed files with 652 additions and 207 deletions

View File

@@ -0,0 +1,35 @@
using Misaki.HighPerformance.Jobs;
using Misaki.HighPerformance.LowLevel.Collections;
namespace Misaki.HighPerformance.Test.Jobs;
internal struct JobDispatchingJob : IJobParallelFor
{
public UnsafeArray<UnsafeArray<int>> data;
public UnsafeList<JobHandle>.ParallelWriter handles;
private struct InnerJob : IJobParallelFor
{
public UnsafeArray<int> data;
public void Execute(int loopIndex, ref readonly JobExecutionContext ctx)
{
ref var value = ref data[loopIndex];
value *= 2;
}
}
public void Execute(int loopIndex, ref readonly JobExecutionContext ctx)
{
if (loopIndex % 2 == 0)
{
var innerJob = new InnerJob
{
data = data[loopIndex]
};
var handle = ctx.JobScheduler.ScheduleParallelFor(in innerJob, data[loopIndex].Length, 64, ctx.ThreadIndex);
handles.AddNoResize(handle);
}
}
}