![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include "AutoRTFM.h"#include "Async/Fundamental/Scheduler.h"#include "Async/Fundamental/Task.h"#include "Async/TaskGraphInterfaces.h"#include "Containers/Array.h"#include "Containers/ArrayView.h"#include "CoreGlobals.h"#include "CoreTypes.h"#include "Experimental/ConcurrentLinearAllocator.h"#include "HAL/Event.h"#include "HAL/LowLevelMemTracker.h"#include "HAL/PlatformMisc.h"#include "HAL/PlatformTime.h"#include "HAL/ThreadSafeCounter.h"#include "Math/UnrealMathUtility.h"#include "Misc/App.h"#include "Misc/AssertionMacros.h"#include "Misc/EnumClassFlags.h"#include "Misc/Fork.h"#include "Misc/MemStack.h"#include "Misc/Timespan.h"#include "ProfilingDebugging/CpuProfilerTrace.h"#include "ProfilingDebugging/TagTrace.h"#include "Stats/Stats.h"#include "Templates/Function.h"#include "Templates/RefCounting.h"#include "Templates/SharedPointer.h"#include "Templates/UnrealTemplate.h"#include <atomic>Go to the source code of this file.
Namespaces | |
| namespace | UE |
| namespace | UE::LLMPrivate |
| namespace | ParallelForImpl |
Enumerations | |
| enum class | EParallelForFlags { None , ForceSingleThread = 1 , Unbalanced = 2 , PumpRenderingThread = 4 , BackgroundPriority = 8 } |
Variables | |
| CORE_API int32 | GParallelForBackgroundYieldingTimeoutMs |
| CORE_API bool | GParallelForDisableOversubscription |
|
strong |
|
inline |
General purpose parallel for that uses the taskgraph for unbalanced tasks Offers better work distribution among threads at the cost of a little bit more synchronization. This should be used for tasks with highly variable computational time.
| DebugName; | ProfilingScope and Debugname |
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| MinBatchSize; | Minimum Size of a Batch (will only launch DivUp(Num, MinBatchSize) Workers |
| Body; | Function to call from multiple threads |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| Body; | Function to call from multiple threads |
| bForceSingleThread; | Mostly used for testing, if true, run single threaded instead. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph for unbalanced tasks Offers better work distribution among threads at the cost of a little bit more synchronization. This should be used for tasks with highly variable computational time.
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| Body; | Function to call from multiple threads |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph
| DebugName; | ProfilingScope and Debugname |
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| MinBatchSize; | Minimum Size of a Batch (will only launch DivUp(Num, MinBatchSize) Workers |
| Body; | Function to call from multiple threads |
| bForceSingleThread; | Mostly used for testing, if true, run single threaded instead. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| Body; | Function to call from multiple threads |
| bForceSingleThread; | Mostly used for testing, if true, run single threaded instead. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph. This variant takes an array of user-defined context objects for each task that may get spawned to do work (one task per context at most), and passes them to the loop body to give it a task-local "workspace" that can be mutated without need for synchronization primitives.
| DebugName; | ProfilingScope and Debugname |
| Contexts; | User-privided array of user-defined task-level context objects |
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| MinBatchSize; | Minimum Size of a Batch (will only launch DivUp(Num, MinBatchSize) Workers |
| Body; | Function to call from multiple threads |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph. This variant takes an array of user-defined context objects for each task that may get spawned to do work (one task per context at most), and passes them to the loop body to give it a task-local "workspace" that can be mutated without need for synchronization primitives.
| Contexts; | User-privided array of user-defined task-level context objects |
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| MinBatchSize; | Minimum Size of a Batch (will only launch DivUp(Num, MinBatchSize) Workers |
| Body; | Function to call from multiple threads |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph
| DebugName; | ProfilingScope and Debugname |
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| MinBatchSize; | Minimum Size of a Batch (will only launch DivUp(Num, MinBatchSize) Workers |
| Body; | Function to call from multiple threads |
| CurrentThreadWorkToDoBeforeHelping; | The work is performed on the main thread before it starts helping with the ParallelFor proper |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| Body; | Function to call from multiple threads |
| CurrentThreadWorkToDoBeforeHelping; | The work is performed on the main thread before it starts helping with the ParallelFor proper |
| bForceSingleThread; | Mostly used for testing, if true, run single threaded instead. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| Body; | Function to call from multiple threads |
| CurrentThreadWorkToDoBeforeHelping; | The work is performed on the main thread before it starts helping with the ParallelFor proper |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph
| DebugName; | ProfilingScope and DebugName |
| Contexts; | User-privided array of user-defined task-level context objects |
| Num; | number of calls of Body; Body(0), Body(1), ..., Body(Num - 1) |
| MinBatchSize; | Minimum Size of a Batch (will only launch DivUp(Num, MinBatchSize) Workers |
| Body; | Function to call from multiple threads |
| CurrentThreadWorkToDoBeforeHelping; | The work is performed on the main thread before it starts helping with the ParallelFor proper |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph
| DebugName; | ProfilingScope and DebugName |
| OutContexts; | Array that will hold the user-defined, task-level context objects (allocated per parallel task) |
| Num; | number of calls of Body; Body(0), Body(1), ..., Body(Num - 1) |
| MinBatchSize; | Minimum Size of a Batch (will only launch DivUp(Num, MinBatchSize) Workers |
| Body; | Function to call from multiple threads |
| CurrentThreadWorkToDoBeforeHelping; | The work is performed on the main thread before it starts helping with the ParallelFor proper |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph
| DebugName; | ProfilingScope and DebugName |
| OutContexts; | Array that will hold the user-defined, task-level context objects (allocated per parallel task) |
| Num; | number of calls of Body; Body(0), Body(1), ..., Body(Num - 1) |
| MinBatchSize; | Minimum Size of a Batch (will only launch DivUp(Num, MinBatchSize) Workers |
| ContextConstructor; | Function to call to initialize each task context allocated for the operation |
| Body; | Function to call from multiple threads |
| CurrentThreadWorkToDoBeforeHelping; | The work is performed on the main thread before it starts helping with the ParallelFor proper |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph. This variant constructs for the caller a user-defined context object for each task that may get spawned to do work, and passes it on to the loop body to give it a task-local "workspace" that can be mutated without need for synchronization primitives. For this variant, the user provides a callable to construct each context element.
| OutContexts; | Array that will hold the user-defined, task-level context objects (allocated per parallel task) |
| DebugName; | ProfilingScope and Debugname |
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| ContextConstructor; | Function to call to initialize each task context allocated for the operation |
| Body; | Function to call from multiple threads |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph. This variant constructs for the caller a user-defined context object for each task that may get spawned to do work, and passes it on to the loop body to give it a task-local "workspace" that can be mutated without need for synchronization primitives. For this variant, the user provides a callable to construct each context element.
| OutContexts; | Array that will hold the user-defined, task-level context objects (allocated per parallel task) |
| DebugName; | ProfilingScope and Debugname |
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| MinBatchSize; | Minimum Size of a Batch (will only launch DivUp(Num, MinBatchSize) Workers |
| ContextConstructor; | Function to call to initialize each task context allocated for the operation |
| Body; | Function to call from multiple threads |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph. This variant constructs for the caller a user-defined context object for each task that may get spawned to do work, and passes it on to the loop body to give it a task-local "workspace" that can be mutated without need for synchronization primitives.
| OutContexts; | Array that will hold the user-defined, task-level context objects (allocated per parallel task) |
| DebugName; | ProfilingScope and Debugname |
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| MinBatchSize; | Minimum Size of a Batch (will only launch DivUp(Num, MinBatchSize) Workers |
| Body; | Function to call from multiple threads |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph. This variant constructs for the caller a user-defined context object for each task that may get spawned to do work, and passes it on to the loop body to give it a task-local "workspace" that can be mutated without need for synchronization primitives. For this variant, the user provides a callable to construct each context element.
| OutContexts; | Array that will hold the user-defined, task-level context objects (allocated per parallel task) |
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| ContextConstructor; | Function to call to initialize each task context allocated for the operation |
| Body; | Function to call from multiple threads |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |
|
inline |
General purpose parallel for that uses the taskgraph. This variant constructs for the caller a user-defined context object for each task that may get spawned to do work, and passes it on to the loop body to give it a task-local "workspace" that can be mutated without need for synchronization primitives.
| OutContexts; | Array that will hold the user-defined, task-level context objects (allocated per parallel task) |
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| Body; | Function to call from multiple threads |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |