Commit Graph

291 Commits

Author SHA1 Message Date
Steve Robb
7daf944467 GitHub #9202 : Semantic fix
Replaced nullptr_t with TYPE_OF_NULLPTR to prevent error reporting in IDE's utilizing clangd like QT Creator

#rb steve.robb
#jira UE-153483
#preflight 62962084d86c0bf739afa06c

[CL 20436963 by Steve Robb in ue5-main branch]
2022-05-31 10:41:56 -04:00
Devin Doucette
3b9e9b2d33 ParallelFor: Cancel unused tasks and time the wait for tasks to complete
When worker threads are heavily utilized by slow tasks, ParallelFor may execute most of the work on the calling thread before most (or any) of its tasks have executed. Allowing these tasks to execute later is wasteful because each task executed on a background worker pays about 0.3us to lower and then raise thread priority. Canceling the tasks can avoid that cost when paired with an upcoming change to the scheduler, which saves about 40us for each call to ParallelFor in a heavily-utilized pool of 126 worker threads.

#preflight 62587f45010ebc5d4e89d347
#rb Andriy.Tylychko, Arne.Schober

[CL 20392225 by Devin Doucette in ue5-main branch]
2022-05-27 09:18:08 -04:00
Andriy Tylychko
355cb277e8 FTaskPriorityCVar - a console var to configure Tasks System priorities, by analogy with FAutoConsoleTaskPriority for TaskGraph
#preflight 628386e43f6aa88b1a777e76

[CL 20240822 by Andriy Tylychko in ue5-main branch]
2022-05-17 07:43:35 -04:00
Andriy Tylychko
573d2c69a4 fixed task retraction while waiting on named threads. check the new unit test for exact conditions
#rb francis.hurteau
#preflight 627d27784a05ef0394cc3970

[CL 20165251 by Andriy Tylychko in ue5-main branch]
2022-05-12 11:46:49 -04:00
Andriy Tylychko
bcb0d37211 fixed static analysis compilation
#jira UE-151642
#preflight 627bddf31e749933439054a8

[CL 20142511 by Andriy Tylychko in ue5-main branch]
2022-05-11 12:22:14 -04:00
Andriy Tylychko
1d617c8757 fixed a discrepency between declaration of FBaseGraphTask::LifeStage and its usage
#preflight 6274f0a3594b7a20314df456

[CL 20073670 by Andriy Tylychko in ue5-main branch]
2022-05-06 06:12:29 -04:00
Andriy Tylychko
3843ea9667 moved EExtendedTaskPriority from the private to the public Tasks System API. This allows:
1) to use "inline" priority publicly, which is often helpful for perf
2) to use Tasks System with named threads (only if "tasks integration" is enabled - `TASKGRAPH_NEW_FRONTEND`)
#preflight 6271491cfe09c0cfbc3c5b69

[CL 20027004 by Andriy Tylychko in ue5-main branch]
2022-05-03 12:01:34 -04:00
Andriy Tylychko
e491fb8f8b tasks integration: Tasks System integrated into the old TaskGraph API as an intermediary step into transition to the new API. Disabled by default. The only remaining part of the old TaskGraph is named threads implementation that is not directly supported by the new Tasks System.
also includes the fix for parallel animation evaluation to work correctly with task retraction that is globally enabled by these change. animation fix was reviewed by evgenii.babinets

#rb francis.hurteau, danny.couture
#preflight 6268163bdd35c0d6cab2c267

[CL 19924083 by Andriy Tylychko in ue5-main branch]
2022-04-26 13:31:54 -04:00
David Harvey
0c99f08042 use non-inlined GetActiveTasks() in modular builds because ActiveTask can't be dllexport if it is also thread_local.
#rnx
#jira UE-149806
#preflight 6266da5c9337eeaec4fb67cd
#rb Nuno.Leiria

[CL 19918970 by David Harvey in ue5-main branch]
2022-04-26 09:14:06 -04:00
Arne Schober
3e0b418354 M - Symetric Task switching support for the Scheduler. This will allow Tasks to return an optional FTask* which is than used by the Scheduler to directly switch to and execute immediately regardless of it's priority.
#preflight 624e8d394e0a8b95d098807d

[CL 19673315 by Arne Schober in ue5-main branch]
2022-04-07 13:42:10 -04:00
mark lintott
bc9b168688 Add new Unit Tests
#rb Chris.Constantinescu
#preflight 62458f77292f228e09013681

[CL 19571202 by mark lintott in ue5-main branch]
2022-03-31 07:45:37 -04:00
Arne Schober
3eb5affed9 M - LowLevel Task extension for Expediting, and Revival of previously cancelled Tasks.
Where Revival tries to revert any Cancellation as if it never happened. If the canceled Task was already executed by the Scheduler the revival will fail
(the Task will not be relaunched if revival fails). And where Expediting tries to fast track a task if the result is needed immediately on the current Context.
#preflight 6230cb60f41c515c3704cf08
#RB Francis.Hurteau

[CL 19388819 by Arne Schober in ue5-main branch]
2022-03-15 13:43:06 -04:00
danny couture
26909ffc19 Add base class for FAsyncTask to make it easier to interact with while keeping its templated type an implementation detail
#rnx
#rb Francis.Hurteau
#preflight 622f51ea344901ad1929b63f

[CL 19384075 by danny couture in ue5-main branch]
2022-03-15 07:50:05 -04:00
Devin Doucette
006e85ab44 CompressedBuffer: Changed RawHash to FIoHash
- Only the first 20 bytes of the RawHash field in the header will be consumed.
- In a subsequent change, the last 12 bytes of the RawHash field will be set to zero for new compressed buffers.

- Leveraged composite buffers to avoid performing an extra copy of compressed blocks.
- Updated FBlockEncoder::Compress to always use ParallelFor.
- Added ParallelForWithPreWorkWithTaskContext.

#preflight 622ba3869b7ce6ea5d44b7ab
#rb Zousar.Shaker
#rnx

[CL 19360767 by Devin Doucette in ue5-main branch]
2022-03-11 16:21:11 -05:00
danny couture
4114b4b372 Add support for dynamic thread prioritization
- This restore proper prioritization support that was lost with the new task backend while keeping a sane number of threads
  - This helps to prevent latency sensitive tasks from going to efficient cores for Alder Lake
  - This fixes performance problems caused by high prio task getting picked up by background threads and being preempted under high-load, causing FPS hiccups.
  - SetThreadPriority takes ~20us on average on Windows System and is only paid for background work
  - Longer SetThreadPriority can be expected when lowering the priority of a task under heavy load, which might cause the caller to be preempted right away, this is expected.
  - Can be A/B tested from command-line with -TaskGraphUseDynamicPrioritization=1/0

#rb Andriy.Tylychko, Arne.Schober, Stefan.Boberg
#preflight 622786a7e83598518f3745a1

[CL 19314282 by danny couture in ue5-main branch]
2022-03-08 19:24:40 -05:00
junggun lim
73d255a75a Allow TAsyncResult<void> by disabling the const ref constructor for non-referenceable result types
#jira none
#rb Andriy.Tylychko
#preflight 6220c9b037049be5175c5c12

[CL 19260588 by junggun lim in ue5-main branch]
2022-03-03 21:20:46 -05:00
Andriy Tylychko
1433b7643c ParalleFor doesn't go wider than number of cores
#jira FORT-454706
#rb arne.schober, jordan.cristiano
#preflight 621f904d37049be51729b25f

[CL 19222139 by Andriy Tylychko in ue5-main branch]
2022-03-02 10:58:06 -05:00
steve robb
d25907098e FConcurrentLinearAllocator tags' TagNames changed to char to avoid problems with constexpr TCHARs in UTF-8 mode.
#rb arne.schober
#preflight 6217e0773a2dddac5aee5f37

#ROBOMERGE-AUTHOR: steve.robb
#ROBOMERGE-SOURCE: CL 19123651 via CL 19123683 via CL 19123725 via CL 19125752
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19154482 by steve robb in ue5-main branch]
2022-02-25 15:17:28 -05:00
Arne Schober
fab7b5f06b U5 - Adding DebugName, MinNumBatchSize and LLM inheritance to ParallelFor
Also staring to remove some of the legacy TaskBackend Code to reduce the maintenence effort.
#preflight 6206a235c663666c89aa0e96

[CL 18955688 by Arne Schober in ue5-main branch]
2022-02-11 13:14:11 -05:00
andriy tylychko
b1a539ef31 REL - allow to not run the task continuation during cancellation, as it can be beneficial for some implementations to handle it with a manual Launch.
#ushell-cherrypick of 18452559 by arne.schober

#ROBOMERGE-AUTHOR: arne.schober
#ROBOMERGE-SOURCE: CL 18452544 via CL 18452545 via CL 18452554 via CL 18883856 via CL 18883880 via CL 18883884 via CL 18884166 via CL 18884239
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18884913 by andriy tylychko in ue5-main branch]
2022-02-07 09:14:58 -05:00
arne schober
265b427a72 FEM - introduce Parameters to TTaskDelegate in an effort to eventually reduce the size of FTask. This allows us to remove the this capture inside of FTask::Init. As an added benefit the nested Lambdas might also optimize better because of the much smaller body.
[FYI] Andriy.Tylychko, Francis.Hurteau, Mihnea.Balta

#ROBOMERGE-AUTHOR: arne.schober
#ROBOMERGE-SOURCE: CL 18764566 via CL 18764592 via CL 18764599 via CL 18765175 via CL 18765413
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18765421 by arne schober in ue5-main branch]
2022-01-27 18:53:56 -05:00
michael kirzinger
53c9b167aa Support for non-default constructable types in TPromise
[REVIEW] [at]Andriy.Tylychko
#jira OI-3642
#preflight 61f16f68e12e3fcf9b1baa70

#ROBOMERGE-AUTHOR: michael.kirzinger
#ROBOMERGE-SOURCE: CL 18736470 in //UE5/Release-5.0/... via CL 18736478 via CL 18736859
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18736874 by michael kirzinger in ue5-main branch]
2022-01-26 11:57:45 -05:00
arne schober
9b87ad16e4 FEM - remove unique pointer from parallel for for some small improvement of MVP
#ROBOMERGE-AUTHOR: arne.schober
#ROBOMERGE-SOURCE: CL 18719672 via CL 18719675 via CL 18719677 via CL 18720056 via CL 18720138
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18720140 by arne schober in ue5-main branch]
2022-01-25 01:35:50 -05:00
arne schober
8909d9aac8 FEM - The Linear Allocator for oversized TaskDelegates (which we currently don't have any but that could enable more use cases for the future)
#ROBOMERGE-AUTHOR: arne.schober
#ROBOMERGE-SOURCE: CL 18713882 via CL 18713934 via CL 18713942 via CL 18714811 via CL 18715173
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18716923 by arne schober in ue5-main branch]
2022-01-24 18:55:15 -05:00
arne schober
1aaa42445a FEM - missing static
#ROBOMERGE-AUTHOR: arne.schober
#ROBOMERGE-SOURCE: CL 18706010 via CL 18706012 via CL 18706014 via CL 18706159 via CL 18706184 via CL 18706255
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18706278 by arne schober in ue5-main branch]
2022-01-24 02:44:53 -05:00