21-07-2022, 10:09 PM
I've been attempting to optimize Obi Cloth's scheduler since I noticed that there was idling in between jobs during runtime. One thing that I've done (at least for my use case) was that I changed the ApplyCollisionContraintsJob and BurstColliderCollisionContraintsBatch & BurstColliderFrictionConstraintsBatch jobs from IJob into an IJobFor with parallel scheduling. This helped reduce the Obi's Cloth's overall time with job completion.
While I think this is helpful, I'm not sure if parallelizing the constraints jobs breaks other things as it seems like the jobs don't mutually rely on other elements within the same array it is processing (please see the ProfilerAnalyzer-Results).
The part that I am interested in trying to optimize is the amount of idle in between jobs. I am wondering if there are any tips to try and optimize this and if its possible to schedule and chain a few jobs together to reduce the # of times Obi Cloth calls JobHandle.Complete() on prior input data (for example, when the GenerateContactsJob is scheduled and then DequeueIntoArrayJob is chained after instead of forcing the GenerateContactsJob to complete before we schedule DequeueIntoArrayJob). (Please see the Profiler-Results attachment.)
I'm willing to experiment a bit and see what I can come up with as it requires a bit of refactoring on the jobs, but I'm wondering if there are any suggestions or warning flags I should be aware of. The hardware where I'm profiling Obi Cloth is on: AMD Ryzen 9 5900 HS
And this is done in the Editor (release mode) with Leak Detection off, Burst enabled, Jobs Debugger disabled.
While I think this is helpful, I'm not sure if parallelizing the constraints jobs breaks other things as it seems like the jobs don't mutually rely on other elements within the same array it is processing (please see the ProfilerAnalyzer-Results).
The part that I am interested in trying to optimize is the amount of idle in between jobs. I am wondering if there are any tips to try and optimize this and if its possible to schedule and chain a few jobs together to reduce the # of times Obi Cloth calls JobHandle.Complete() on prior input data (for example, when the GenerateContactsJob is scheduled and then DequeueIntoArrayJob is chained after instead of forcing the GenerateContactsJob to complete before we schedule DequeueIntoArrayJob). (Please see the Profiler-Results attachment.)
I'm willing to experiment a bit and see what I can come up with as it requires a bit of refactoring on the jobs, but I'm wondering if there are any suggestions or warning flags I should be aware of. The hardware where I'm profiling Obi Cloth is on: AMD Ryzen 9 5900 HS
And this is done in the Editor (release mode) with Leak Detection off, Burst enabled, Jobs Debugger disabled.