Using Intel Hardware Metrics to Make Your Unity Game Faster, Faster Cristiano Ferreira - Intel
Legal •
Copyright © 2016 Intel Corporation. All rights reserved.
•
*Other names and brands may be claimed as the property of others.
•
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
•
A "Mission Critical Application" is any application in which failure of the Intel Product could result, directly or indirectl y, in personal injury or death. SHOULD YOU PURCHASE OR USE INTEL'S PRODUCTS FOR ANY SUCH MISSION CRITICAL APPLICATION, YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES, SUBCONTRACTORS AND AFFILIATES, AND THE DIRECTORS, OFFICERS, AND EMPLOYEES OF EACH, HARMLESS AGAINST ALL CLAIMS COSTS, DAMAGES, AND EXPENSES AND REASONABLE ATTORNEYS' FEES ARISING OUT OF, DIRECTLY OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY, PERSONAL INJURY, OR DEATH ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL APPLICATION, WHETHER OR NOT INTEL OR ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN, MANUFACTURE, OR WARNING OF THE INTEL PRODUCT OR ANY OF ITS PARTS.
•
Intel may make changes to specifications and product descriptions at any time, without notice.
•
All products, dates, and figures specified are preliminary based on current expectations, and are subject to change without notice.
•
Intel processors, chipsets, and desktop boards may contain design defects or errors known as errata, which may cause the product to deviate from published specifications. Current characterized errata are available on request.
•
Any code names featured are used internally within Intel to identify products that are in development and not yet publicly an nounced for release. Customers, licensees and other third parties are not authorized by Intel to use code names in advertising, promotion or marketing of any product or services and any such use of Intel's internal code names is at the sole risk of the user.
•
Intel product plans in this presentation do not constitute Intel plan of record product roadmaps. Please contact your Intel representative to obtain Intel’s current plan of record product roadmaps.
•
Performance claims: Software and workloads used in performance tests may have been optimized for performance only on Intel® microprocessors. Performance tests, such as SYSmark and MobileMark, are measured using specific computer systems, components, software, operations and functions. Any change to any of those factors may cause the results to vary. You should consult other information and performance tests to assist you in fully evaluating your contemplated purchases, including the performance of that product when combined with other products . For more information go to http://www.Intel.com/performance
•
Iris™ graphics is available on select systems. Consult your system manufacturer.
•
Intel, Intel Inside, the Intel logo, Intel Core and Iris are trademarks of Intel Corporation in the United States and other countries.
3
Agenda • • • •
What are hardware metrics? Why use hardware metrics? Important metrics overview Optimizations scenarios
4
What are hardware metrics? • Values attained directly from hardware counters • Easily detect: • Resources oversubscribed • Potential bottlenecks • Where compute time is being spent
5
Why Use Hardware Metrics? • Hardware counters don’t lie • Cut out a lot of potential guess work and thought experiments • Make a baseline performance target for each ‘Quality Setting’ in Unity specific to your lowest supported device, or even for all low, mid, high, enthusiast tiers. • Optimize for lowest end hardware
6
Why Use Hardware Metrics?
Unity hardware metrics - http://hwstats.unity3d.com/index.html 7
Why Use Hardware Metrics?
Unity hardware metrics - http://hwstats.unity3d.com/index.html 8
Graphics Performance Analyzer Tools • System Analyzer • Frame Analyzer • Platform Analyzer
9
Intel® GPA – Workflow System Analyzer: Run with Intel® GPA
Frame Analyzer:
Capture frame
GPU Limited CPU Limited
?
Platform Analyzer:
Capture trace
In-App Analysis
Offline Analysis 10
System Analyzer – Details – Real Time Metrics • • • • • •
CPU Metrics GPU Metrics Memory Metrics Power Metrics Graphics API Metrics Other Platform Metrics *Metric availability depends on platform
11
Frame Analyzer
12
Typical Analysis Steps 1. Find biggest opportunities for optimization (long GPU duration) 2. Find out the most stressed parts of the pipeline in those calls 3. Find the corresponding material / settings in Unity to discover how to alleviate the issue
13
General Metric Types • Execution Unit (EU) Active • Execution Unit (EU) Idle • Execution Unit (EU) Stall
14
General Metric Types: EU Active • The piece of the pipeline is active and has work • Usually a good thing, but this will not tell you if all calculations are necessary or as optimized as they should be • Objective is to keep each piece of the pipeline as active as possible without doing unnecessary work
15
General Metric Types: EU Idle • The piece of the pipeline doesn’t have any work to do
16
General Metric Types: EU Stall • An EU becomes stalled when all of its threads are waiting for results from fixed function units • Ex. Pixel shader requests texels from the texture sampler
• Objective is to reduce stall percentage as much as possible
17
Other interesting metrics • Sampler is Bottleneck % • Samplers Busy % • GTI Read Throughput, bytes • GTI Write Throughput, bytes
18
Vertex Shader • Used for vertex transformations and per-vertex calculations for effects • If duration of VS is highest in the pipeline, can save time by: • Simplifying geometry (LOD!) • Simplifying per-vertex compute
19
Vertex Shader
20
Fragment Shader • After your model is projected into 2D space and rasterized, a fragment shader is executed for every pixel that is touched by the input geometry • Main goal typically to calculate the final pixel color • Can also be used for full screen image effects
21
Fragment Shader
22
Find Your Fragment Shader in Unity
23
DEMO!
Typical Analysis Steps 1. Find biggest opportunities for optimization (long GPU duration) 2. Find out the most stressed parts of the pipeline in those calls 3. Find the corresponding material / settings in Unity to discover how to alleviate the issue
25
Demo: Render Queue Ordering
26
Demo: Render Queue Ordering
27
Demo: Render Queue Ordering
28
Demo: Render Queue Ordering
29
Demo: Uncompressed Texture Viewing
30
Demo: Uncompressed Texture Viewing
31
Demo: Uncompressed Texture Viewing
32
Demo: Uncompressed Texture Viewing
33
Demo: Uncompressed Texture Viewing Uncompressed Texture
Compressed Texture
34
Demo: Fully / Semi Transparency
35
Demo: Disable Fully Transparent Objects
36
Demo: Disable Fully Transparent Objects
37
Demo: Forward Passes for Per-Pixel Lights
38
Demo: Forward Passes for Per-Pixel Lights
39
Demo: Forward Passes for Per-Pixel Lights
40
Demo: Forward Passes for Per-Pixel Lights
41
Demo
42
Conclusion • Get the free tools! • https://software.intel.com/en-us/gpa
• Check out accompanying Unity optimization guide • http://intel.ly/1psrRKI
• Download today’s workload to follow along • https://github.com/GameTechDev/UnityPerformanceSandbox
• Tweet me! • Cristiano - @Cristianohh 43