en ko

Adaptive Performance 1.0

Mobile devices have more physical limitations compared to PC’s and consoles, this means it’s more constrained when rendering complex games by comparison. The Adaptive performance project was started to improve the performance of these games under these stricter constraints on mobile devices.

In the version 1.0 we focused on how to reduce unnecessary power consumption on the device without impacting the games performance, because the battery consumption and the performance management are big parts of the device performance limitations.

To manage these constraints we implemented 3 features.


  • Power Manager
  • Bottleneck Detection & Auto Performance Control
  • Custom Scaler using device thermal feedback

Details of each implementation are as follows.




Power Manager


Power Manager(PM) was implemented to avoid thermal throttling which is suddenly dropping the performance when the device temperature is high and to extend battery time. To achieve these goals, the PM predicts the optimal CPU/GPU levels for the games needs and sets the hardware to those levels.





The graph above shows the structure of the Power Manager system and its workflows. The operation order of the PM is as follows.



  1. Compare and Calculate previous frame information and real time performance status information like device temperature which is retrieved from GameSDK on the device.
  2. Check the current status of the device through the calculated frame information and the performance status information of the device. In this process, it checks based on the information from GameSDK, if the device is achieving Target Framerate and if the game has a CPU or GPU bottleneck.
  3. Find proper power levels that can reduce power consumption without lowering performance. (Auto Performance Controller)
  4. Transmit the appropriate CPU and GPU levels that are found through the Auto Performance Controller to device.


While the game is playing on the device, Power Manager in Adaptive Performance repeats the above order and provides appropriate behavior for changing device situations.




Bottleneck Detection & Auto Performance Control




Bottleneck detection is the process that identifies which component is delaying the overall rendering pipeline of a game. In Adaptive Performance, it finds Bottleneck points using Frame time and CPU/GPU time information. With this information we can narrow down whether it’s the CPU or the GPU that is stopping the game from reaching the target framerate. This is identified by calculating and comparing the CPU and GPU frame time with the overall frame time. In case of GPU time, more accurate information can be obtained through GameSDK and it makes it easier to find bottleneck points.

This way, once you know whether the CPU or GPU is causing the bottleneck, you can take appropriate action for each situation. For example if the GPU is a bottleneck then we can reduce the CPU level which will in turn lower temperature and vice versa if the CPU is the bottleneck you can lower the GPU level reduce the temperature for that component. If the device already has a low temperature, PM can also adjust the device to use the GPU as much as the game needs. In addition. If the CPU and GPU are surpassing the target framerate then we can reduce the CPU and GPU level to lower the power consumption, thereby increasing battery usage time.

Adaptive Performance provides an auto power management system like above. It is called Auto Performance control.





With the Auto Performance Control system, the developer can automatically communicate with the device and optimize the performance of the game according to the device’s status by just turning on the Auto Performance Control system without any additional work.




Configuring CPU/GPU Levels


In Adaptive Performance, when turning on Auto Performance Mode, it will automatically activate Bottleneck Detection and set the proper CPU/GPU setting through the Auto Performance Control system, which is recommended.

The example code below explains how to decrease heat and power consumption using Auto Performance Control. When the developer turns on Auto Performance Control mode (true) and sets the targetFrameRate that they want, the Auto Performance Control system helps to achieve appropriate performance by controlling the power level.




public void EnterMenu()
{
 if (!ap.Active)
     return;

 Application.targetFrameRate = 30;
 // Enable automatic regulation of CPU and GPU level by Adaptive Performance
 var ctrl = ap.DevicePerformanceControl;
 ctrl.AutomaticPerformanceControl = true;
}

public void EnterBenchmark()
{
 var ctrl = ap.DevicePerformanceControl;
 // Set higher CPU and GPU level when benchmarking a level
 ctrl.cpuLevel = ctrl.MaxCpuPerformanceLevel;
 ctrl.gpuLevel = ctrl.MaxGpuPerformanceLevel;
}




It is possible that developers can set the CPU/GPU levels by themselves using Adaptive Performance APIs, but it is NOT recommended.

What they can adjust directly is the abstract level value, not the actual operating frequency number as this may cause unintended battery consumption and performance degradation problems depending on the performance difference each device has. (For example, a certain level value set for device A may be adversely affected in device B for different reasons. )

Therefore, rather than setting the level directly by the developers, it is recommended to use the Auto Performance Control provided by the experienced developers of Unity and Samsung for achieving the best performance in any devices.

Nevertheless, if developers want to manually set CPU, GPU levels,
Set Instance.DevicePerformanceControl.AutomaticPerformanceControl to false, and they can change CPU/GPU level value through Instance.DevicePerformanceControl.cpulevel and Instance.DevicePerformanceControl.gpulevel.

Again, this is NOT the recommended method. Note that even if the user sets the CPU/GPU level, the level value is not guaranteed to be applied or maintained due to device status or policy.




Control Custom Scaler with Device thermal feedback


If game developers want to get not only Auto Performance Control with the Power management service but also an additional performance improvement then they can use the Custom Scaler.

The Adaptive Performance API notifies the temperature information of the current terminal through the warning level and provides more detailed temperature level . Through this, the developer can see the temperature change and throttling control time of the device with the Warning Level signal provided by Adaptive Performance. If the developer controls the quality scaling of the desired part by utilizing this timing information, it can preemptively manage the heat generation before the point of heat generation control of the terminal and allow the battery to be used for a long time.

The below example is an implementation sample that controls global LOD bias as a custom scale factor using temperature information.


using UnityEngine;
using UnityEngine.AdaptivePerformance;

public class AdaptiveLOD : MonoBehaviour
{
    private IAdaptivePerformance ap = null;

    void Start() {
        ap = Holder.Instance;
        if (!ap.Active)
            return;

        QualitySettings.lodBias = 1.0f;
        ap.ThermalStatus.ThermalEvent += OnThermalEvent;
    }
        void OnThermalEvent(ThermalMetrics ev) {
        switch (ev.WarningLevel) {
            case WarningLevel.NoWarning:
                QualitySettings.lodBias = 1;
                break;
            case WarningLevel.ThrottlingImminent:
                if (ev.temperatureLevel > 0.8f)
                    QualitySettings.lodBias = 0.75f;
                else
                    QualitySettings.lodBias = 1.0f;
                break;
            case WarningLevel.Throttling:
                QualitySettings.lodBias = 0.5f;
                break;
        }
    }
}





Adaptive Performance 1.0 Performance Result


Until now, we’ve looked into the key functions of Adaptive Performance 1.0. Below is the Adpative Performance effect result that we got from Unity’s Megacity Demo.



The above blue graph is the case of using Adaptive Performance and its Auto Performance Control system, and the red one is the case of not using Adaptive Performance.The Target FPS in both cases are 30, but you can see the results of maintaining 30 fps for a longer period of time. Adaptive Performance is much more stable.




※ You can find Supported version of Adaptive Performance 1.0 , more detailed user guide and FAQs as follows.


Unity Editor Version Adaptive Performance Package Version
Unity 2018 LTS+ 1.1.9
Unity 2020.1+
Unity 2019 LTS

1.2.0


  • Detailed User Guide from Unity (Click)

  • Unity Adaptive Performance FAQs (Click)