a.PerTrackCompression.ISPC
a.PerTrackCompression.ISPC
#Overview
name: a.PerTrackCompression.ISPC
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to use ISPC optimizations in per track anim encoding
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of a.PerTrackCompression.ISPC is to control whether ISPC (Intel SPMD Program Compiler) optimizations are used in per-track animation encoding within Unreal Engine 5. This setting variable is primarily related to the animation system, specifically focusing on animation compression and decompression.
This setting variable is relied upon by the Animation module within the Engine subsystem. It is referenced in the animation encoding and compression-related files, particularly in the per-track compression implementation.
The value of this variable is set through the Unreal Engine console system. It is defined as a console variable (CVar) using FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands.
The variable interacts with a boolean flag named bAnim_PerTrackCompression_ISPC_Enabled, which directly controls the behavior of the ISPC optimization for per-track animation compression.
Developers must be aware that enabling or disabling this variable will affect the performance and potentially the quality of animation compression and decompression. It’s important to note that not all key decompression code is vectorized, so enabling ISPC optimizations might actually slow down some seldom-used formats due to extra Load-Hit-Store (LHS) stalls.
Best practices when using this variable include:
- Testing the performance impact in your specific use case, as the benefits may vary depending on the animation data and hardware.
- Considering the trade-offs between compression efficiency and decompression speed.
- Using it in conjunction with profiling tools to ensure it’s providing the desired performance improvements.
- Being cautious when modifying it in a shipping product, as it may affect animation behavior and performance.
- Documenting any changes made to this setting, as it can significantly impact the animation system’s behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Animation/AnimEncoding_PerTrackCompression.cpp:25
Scope: file
Source code excerpt:
#include "HAL/IConsoleManager.h"
static bool bAnim_PerTrackCompression_ISPC_Enabled = ANIM_PER_TRACK_COMPRESSION_ISPC_ENABLED_DEFAULT;
static FAutoConsoleVariableRef CVarAnimPerTrackCompressionISPCEnabled(TEXT("a.PerTrackCompression.ISPC"), bAnim_PerTrackCompression_ISPC_Enabled, TEXT("Whether to use ISPC optimizations in per track anim encoding"));
#endif
// This define controls whether scalar or vector code is used to decompress keys. Note that not all key decompression code
// is vectorized yet, so some (seldom used) formats will actually get slower (due to extra LHS stalls) when enabled.
// The code also relies on a flexible permute instruction being available (e.g., PPC vperm)
#define USE_VECTOR_PTC_DECOMPRESSOR 0
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Animation/IspcTestAnimEncodingPerTrackCompression.cpp:10
Scope (from outer to inner):
file
function bool FIspcTestAnimEncodingPerTrackCompressionGetPoseRotations::RunTest
Source code excerpt:
bool FIspcTestAnimEncodingPerTrackCompressionGetPoseRotations::RunTest(const FString& Parameters)
{
const FString CommandName(TEXT("a.PerTrackCompression.ISPC"));
auto FormatCommand = [CommandName](bool State) -> FString {
return FString::Format(TEXT("{0} {1}"), { CommandName, State });
};
const IConsoleVariable* CVarISPCEnabled = IConsoleManager::Get().FindConsoleVariable(*CommandName);
bool InitialState = CVarISPCEnabled->GetBool();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Animation/IspcTestAnimEncodingPerTrackCompression.cpp:112
Scope (from outer to inner):
file
function bool FIspcTestAnimEncodingPerTrackCompressionGetPoseTranslations::RunTest
Source code excerpt:
bool FIspcTestAnimEncodingPerTrackCompressionGetPoseTranslations::RunTest(const FString& Parameters)
{
const FString CommandName(TEXT("a.PerTrackCompression.ISPC"));
auto FormatCommand = [CommandName](bool State) -> FString {
return FString::Format(TEXT("{0} {1}"), { CommandName, State });
};
const IConsoleVariable* CVarISPCEnabled = IConsoleManager::Get().FindConsoleVariable(*CommandName);
bool InitialState = CVarISPCEnabled->GetBool();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Animation/IspcTestAnimEncodingPerTrackCompression.cpp:214
Scope (from outer to inner):
file
function bool FIspcTestAnimEncodingPerTrackCompressionGetPoseScales::RunTest
Source code excerpt:
bool FIspcTestAnimEncodingPerTrackCompressionGetPoseScales::RunTest(const FString& Parameters)
{
const FString CommandName(TEXT("a.PerTrackCompression.ISPC"));
auto FormatCommand = [CommandName](bool State) -> FString {
return FString::Format(TEXT("{0} {1}"), { CommandName, State });
};
const IConsoleVariable* CVarISPCEnabled = IConsoleManager::Get().FindConsoleVariable(*CommandName);
bool InitialState = CVarISPCEnabled->GetBool();