Add custom job scheduling and dependency combiners

- 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
This commit is contained in:
2026-05-03 15:17:19 +09:00
parent 997aab299c
commit fe8362e029
16 changed files with 230 additions and 219 deletions

View File

@@ -65,4 +65,31 @@ internal static class JobExecutor
job.Execute(start, end, in ctx);
}
}
public unsafe static void ExecuteCustom<T>(int dataID, int dataGeneration, ref JobRanges jobRanges, ref readonly JobExecutionContext ctx)
{
ref var job = ref JobDataPool<T>.GetReference(dataID, dataGeneration, out var exists);
Debug.Assert(exists, "Job data not found in the pool.");
ref var jobInfo = ref ctx.JobScheduler.GetJobInfoReference(ctx.SelfHandle, out var exist);
Debug.Assert(exist, "Job info not found for the executing job.");
if (jobInfo.pCustomExecutionFunc != null)
{
((delegate*<ref T, ref JobRanges, ref readonly JobExecutionContext, void>)jobInfo.pCustomExecutionFunc)(ref job, ref jobRanges, in ctx);
}
}
public unsafe static void FreeCustom<T>(ref readonly JobInfo jobInfo)
{
ref var job = ref JobDataPool<T>.GetReference(jobInfo.dataID, jobInfo.dataGeneration, out var exists);
Debug.Assert(exists, "Job data not found in the pool.");
if (jobInfo.pCustomFreeFunc != null)
{
((delegate*<ref T, void>)jobInfo.pCustomFreeFunc)(ref job);
}
JobDataPool<T>.Free(in jobInfo);
}
}