30
Cristiano Ferreira – Intel Mark Harkness - Unity Using Intel Hardware Metrics to Make Your Unity Game Faster, Faster

Make your unity game faster, faster

Embed Size (px)

Citation preview

Page 1: Make your unity game faster, faster

Cristiano Ferreira – IntelMark Harkness - Unity

Using Intel Hardware Metrics to Make Your Unity Game Faster, Faster

Page 2: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others.

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 indirectly, 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 announced 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.

Page 3: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others.

About Cristiano

Page 4: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others.

About Mark

• Been at Unity for almost 6 years

• Worked in the Developer Relation for almost that whole time

• Currently touring north America helping Unity teams to optimize their projects

Page 5: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others.

Agenda

• What are hardware metrics?

• Why use hardware metrics?

• Important metrics overview

• Sweet demos

Page 6: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 6

What are hardware metrics?

• Values attained directly from hardware counters

• Easily detect:

• Resources oversubscribed

• Potential bottlenecks

• Where compute time is being spent

Page 7: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 7

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

• Integrated graphics are great at what they do, but don’t consume/use the power of the massive dedicated discrete cards in typical gaming rigs

Page 8: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 8

Why Use Hardware Metrics?

Unity hardware metrics - http://hwstats.unity3d.com/index.html

Page 9: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 9

Why Use Hardware Metrics?

Unity hardware metrics - http://hwstats.unity3d.com/index.html

Page 10: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 10

Graphics Performance Analyzer Tools

• System Analyzer

• Frame Analyzer

• Platform Analyzer

Page 11: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 11

Intel® GPA – Workflow

System Analyzer:

Frame Analyzer:

Platform Analyzer: CPU Limited

GPU Limited

Capture frame

Capture trace

?Run with Intel® GPA

In-App Analysis Offline Analysis

Page 12: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others.

System Analyzer – Details – Real Time Metrics

12

• CPU Metrics

• GPU Metrics

• Memory Metrics

• Power Metrics

• Graphics API Metrics

• Other Platform Metrics

*Metric availability depends on platform

Page 13: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 13

Frame Analyzer

Page 14: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 14

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

Page 15: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 15

General Metric Types

• Execution Unit (EU) Active

• Execution Unit (EU) Idle

• Execution Unit (EU) Stall

Page 16: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 16

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

Page 17: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 17

General Metric Types: EU Idle

• The piece of the pipeline doesn’t have any work to do

Page 18: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 18

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

Page 19: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 19

Typical Stressed Areas

1. Pixel Shader

2. Sampler

3. Memory Bandwidth

4. Vertex Shader

Page 20: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 20

Other interesting metrics

• Sampler is Bottleneck %

• Samplers Busy %

• GTI Read Throughput, bytes

• GTI Write Throughput, bytes

Page 21: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 21

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

Page 22: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 22

Vertex Shader

Page 23: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 23

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

Page 24: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 24

Fragment Shader

Page 25: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 25

Find Your Fragment Shader in Unity

Page 26: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 26

Demo!

Page 27: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 27

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

Page 28: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 28

Metrics In Unity Editor

Page 29: Make your unity game faster, faster

Intel Software – Developer Relations DivisionCopyright © 2016, Intel Corporation. All rights reserved. * Other names and brands may be

claimed as the property of others. 29

Conclusion

• Get the free tools!

• https://software.intel.com/en-us/gpa

• Check out accompanying Unity optimization guide

• https://software.intel.com/en-us/android/articles/unity-optimization-guide-for-x86-android-part-1

• Download today’s workload to follow along

• https://github.com/GameTechDev/UnityPerformanceSandbox

• Contact!

• Twitter @Cristiano – [email protected]

Page 30: Make your unity game faster, faster