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:
@@ -1,3 +1,5 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Misaki.HighPerformance.Jobs;
|
||||
|
||||
/// <summary>
|
||||
@@ -39,6 +41,20 @@ public interface IJobParallel
|
||||
void Execute(int startIndex, int endIndex, ref readonly JobExecutionContext ctx);
|
||||
}
|
||||
|
||||
internal unsafe struct CombinedDependenciesJob : IJob
|
||||
{
|
||||
public JobHandle* dependencies;
|
||||
public int dependencyCount;
|
||||
|
||||
public readonly void Execute(ref readonly JobExecutionContext ctx)
|
||||
{
|
||||
var span = new Span<JobHandle>(dependencies, dependencyCount);
|
||||
ctx.JobScheduler.WaitAll(span);
|
||||
|
||||
NativeMemory.Free(dependencies);
|
||||
}
|
||||
}
|
||||
|
||||
public static class IJobExtensions
|
||||
{
|
||||
public static void Run<T>(this T job, ref readonly JobExecutionContext ctx)
|
||||
|
||||
Reference in New Issue
Block a user