Institutionen För Systemteknik Department of Electrical Engineering

Total Page:16

File Type:pdf, Size:1020Kb

Institutionen För Systemteknik Department of Electrical Engineering Institutionen för systemteknik Department of Electrical Engineering Examensarbete Evaluation of multi-threading in Vulkan av Axel Blackert LiTH-ISY-EX-ET--16/0458--SE 2016-09-12 Linköpings universitet Linköpings universitet SE-581 83 Linköping, Sweden 581 83 Linköping Abstract Today processor development has a lot of focus on parallel performance by providing multiple cores that programs can use. The problem with the current version of OpenGL is that it lacks support for utilizing multiple CPU threads for calling rendering commands. Vulkan is a new low level graphics API that gives more control to the developers and provides tools to properly utilize multiple threads for doing rendering operations in parallel. This should give increased performance in situations where the CPU is limiting the performance of the application and the goal of this report is to evaluate how large these performance gains can be in different scenes. To do this evaluation a test program is written with both Vulkan and OpenGL implementations and by rendering the same scene using different APIs and techniques the performance can be compared. In addition to evaluating the multithreaded rendering performance the new explicit pipelines in Vulkan is also evaluated. Definitions CPU – Central Processing Unit GPU – Graphical Processing Unit API – Application Programming Interface FPS – Frames Per Second GLSL – OpenGL Shading Language 1 CONTENT Introduction ............................................................................................................................................. 1 1.1 Background ............................................................................................................................. 1 1.2 Purpose .................................................................................................................................... 1 1.3 Task ......................................................................................................................................... 1 1.4 Limitations .............................................................................................................................. 1 2 Theory ............................................................................................................................................. 2 2.1 Khronos Group ........................................................................................................................ 2 2.2 Vulkan ..................................................................................................................................... 2 2.3 Driver overhead ...................................................................................................................... 3 2.4 Platform independence ............................................................................................................ 3 2.5 Multithreading ......................................................................................................................... 3 2.5.1 No global state .................................................................................................................... 4 2.5.2 No synchronization in the drivers ....................................................................................... 4 2.5.3 Separation between generation and execution of rendering ................................................ 5 2.6 Rendering pipeline .................................................................................................................. 5 2.7 Instancing ................................................................................................................................ 6 2.8 3rd party libraries ..................................................................................................................... 6 2.8.1 GLM .................................................................................................................................... 6 2.8.2 Assimp ................................................................................................................................ 6 2.8.3 GLEW ................................................................................................................................. 6 2.8.4 TSBK07 utilities ................................................................................................................. 6 2.8.5 Sascha Willems utilities ...................................................................................................... 6 2.9 Previous Work ........................................................................................................................ 7 3 Method ............................................................................................................................................ 8 3.1 The resulting program ............................................................................................................. 8 3.2 Technical Terms ...................................................................................................................... 8 3.2.1 Vertex and fragment shaders ............................................................................................... 8 3.2.2 Shader uniforms .................................................................................................................. 8 3.2.3 Push constants ..................................................................................................................... 8 3.2.4 Command buffer ................................................................................................................. 8 3.2.5 Command pool .................................................................................................................... 8 3.3 Implementation details ............................................................................................................ 8 3.3.1 Rendering interface ............................................................................................................. 9 3.3.2 Creating the renderer ........................................................................................................... 9 3.3.3 Recording performance ..................................................................................................... 10 3.3.4 Vulkan renderer................................................................................................................. 10 3.3.5 OpenGL renderer .............................................................................................................. 10 3.3.6 Shader ............................................................................................................................... 10 3.3.7 Camera .............................................................................................................................. 10 3.3.8 Loading models ................................................................................................................. 11 3.4 Test system ............................................................................................................................ 11 3.5 Testing................................................................................................................................... 11 3.5.1 Multi-threading tests ......................................................................................................... 11 3.5.2 Pipeline management tests ................................................................................................ 12 4 Evaluation ...................................................................................................................................... 13 4.1 Low detail model tests .......................................................................................................... 13 4.1.1 Single threaded Vulkan, low detail model ........................................................................ 14 4.1.2 Four threads with Vulkan, low detail model ..................................................................... 14 4.1.3 Single threaded OpenGL, low res model .......................................................................... 15 4.2 High detail model test ........................................................................................................... 16 4.2.1 Single threaded Vulkan, high res model ........................................................................... 16 4.2.2 Four threaded Vulkan, high res model .............................................................................. 17 4.2.3 Single threaded OpenGL, high detail model ..................................................................... 18 4.3 Instancing .............................................................................................................................. 18 4.4 Pipeline swapping performance ............................................................................................ 18 4.4.1 Changing facing, culling and shader ................................................................................. 18 4.4.2 Changing facing and culling ............................................................................................. 19 5 Conclusion ..................................................................................................................................... 20 5.1 Multithreading ......................................................................................................................
Recommended publications
  • GLSL 4.50 Spec
    The OpenGL® Shading Language Language Version: 4.50 Document Revision: 7 09-May-2017 Editor: John Kessenich, Google Version 1.1 Authors: John Kessenich, Dave Baldwin, Randi Rost Copyright (c) 2008-2017 The Khronos Group Inc. All Rights Reserved. This specification is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. It or any components may not be reproduced, republished, distributed, transmitted, displayed, broadcast, or otherwise exploited in any manner without the express prior written permission of Khronos Group. You may use this specification for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. Khronos Group grants express permission to any current Promoter, Contributor or Adopter member of Khronos to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be reformatted AS LONG AS the contents of the specification are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the Khronos Group website should be included whenever possible with specification distributions.
    [Show full text]
  • GLSL Specification
    The OpenGL® Shading Language Language Version: 4.60 Document Revision: 3 23-Jul-2017 Editor: John Kessenich, Google Version 1.1 Authors: John Kessenich, Dave Baldwin, Randi Rost Copyright (c) 2008-2017 The Khronos Group Inc. All Rights Reserved. This specification is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. It or any components may not be reproduced, republished, distributed, transmitted, displayed, broadcast, or otherwise exploited in any manner without the express prior written permission of Khronos Group. You may use this specification for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. Khronos Group grants express permission to any current Promoter, Contributor or Adopter member of Khronos to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be reformatted AS LONG AS the contents of the specification are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the Khronos Group website should be included whenever possible with specification distributions.
    [Show full text]
  • The Opencl Specification
    The OpenCL Specification Version: 2.0 Document Revision: 22 Khronos OpenCL Working Group Editor: Aaftab Munshi Last Revision Date: 3/18/14 Page 1 1. INTRODUCTION ............................................................................................................... 10 2. GLOSSARY ......................................................................................................................... 12 3. THE OPENCL ARCHITECTURE .................................................................................... 23 3.1 Platform Model ................................................................................................................................ 23 3.2 Execution Model .............................................................................................................................. 25 3.2.1 Execution Model: Mapping work-items onto an NDRange ........................................................................28 3.2.2 Execution Model: Execution of kernel-instances ........................................................................................30 3.2.3 Execution Model: Device-side enqueue ......................................................................................................31 3.2.4 Execution Model: Synchronization .............................................................................................................32 3.2.5 Execution Model: Categories of Kernels ....................................................................................................33 3.3 Memory
    [Show full text]
  • The Openvx™ Specification
    The OpenVX™ Specification Version 1.0.1 Document Revision: r31169 Generated on Wed May 13 2015 08:41:43 Khronos Vision Working Group Editor: Susheel Gautam Editor: Erik Rainey Copyright ©2014 The Khronos Group Inc. i Copyright ©2014 The Khronos Group Inc. All Rights Reserved. This specification is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. It or any components may not be reproduced, republished, distributed, transmitted, displayed, broadcast or otherwise exploited in any manner without the express prior written permission of Khronos Group. You may use this specifica- tion for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. Khronos Group grants express permission to any current Promoter, Contributor or Adopter member of Khronos to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be re-formatted AS LONG AS the contents of the specifi- cation are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the Khronos Group web-site should be included whenever possible with specification distributions.
    [Show full text]
  • Digital Asset Exchange
    DDiiggiittaall AAsssseett EExxcchhaannggee Dr. Rémi Arnaud Sony Computer Entertainment Khronos Group Promoter © Copyright Khronos Group, 2007 - Page 1 •www.khronos.org •Founded in January 2000 by a number of leading media-centric companies, including: 3Dlabs, ATI, Discreet, Evans & Sutherland, Intel, NVIDIA, SGI and Sun Microsystems. (currently more than 100) •Dedicated to the creation of royalty-free open standard APIs to enable the playback of rich media on a wide variety of platforms and devices. •Home of 11 WG, including: OpenGL, OpenGL ES, OpenVG, OpenKODE, OpenSL, COLLADA •New WG introduced at GDC: glFX, Compositing © Copyright Khronos Group, 2007 - Page 2 CCOOLLLLAADDAA aass aa SSCCEE pprroojjeecctt •SCE project, started in August 2003 - Goal: raise the quality and productivity of content development - free the content from proprietary formats and API, bring more tools to game developers, lower the barrier to entry for small tool companies, facilitate middleware integration, bring ‘advanced’ features in the main stream, drastically improve artist productivity. •Common description language - Developers get the content in a standard form - Tools can interchange content - Developers can mix and match tools during development - Many specialized tools can be independently created, and incorporated into developer’s content pipeline •COLLAborative Design Activity, SCE brought to the same table the major DCC vendors: Discreet, Alias, Softimage •Released v1.0 specification in August 2004 •Gathered feedback, waiting for tools to provide useful
    [Show full text]
  • The Openvx™ Specification
    The OpenVX™ Specification Version 1.2 Document Revision: dba1aa3 Generated on Wed Oct 11 2017 20:00:10 Khronos Vision Working Group Editor: Stephen Ramm Copyright ©2016-2017 The Khronos Group Inc. i Copyright ©2016-2017 The Khronos Group Inc. All Rights Reserved. This specification is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. It or any components may not be reproduced, republished, distributed, transmitted, displayed, broadcast or otherwise exploited in any manner without the express prior written permission of Khronos Group. You may use this specifica- tion for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. Khronos Group grants express permission to any current Promoter, Contributor or Adopter member of Khronos to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be re-formatted AS LONG AS the contents of the specifi- cation are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the Khronos Group web-site should be included whenever possible with specification distributions.
    [Show full text]
  • 모바일 그래픽스 라이브러리들: 크로노스 그룹의 표준을 중심으로 Mobile Graphics Libraries: Focusing on the Standards from Khronos Group
    50 한국콘텐츠학회 제8권 제2호 모바일 그래픽스 라이브러리들: 크로노스 그룹의 표준을 중심으로 Mobile Graphics Libraries: focusing on the standards from Khronos Group 백낙훈 (경북대학교), 이환용 (㈜휴원 CTO, 경북대학교 박사과정) 차 례 1. 서론 2. OpenGL ES 3. OpenGL SC 4. OpenVG 5. 결론 1. 서론 전력 소모가 낮은 기기를 채택할 수 밖에 없는 것이다. 액정뿐만 아니라, 모든 컴퓨팅 자원들이 궁극적으로 전 컴퓨터는 그 출현 이후, 계속해서 그 크기를 줄여 왔고, 력 문제에 민감하여야 하고, 이 때문에, 제한된 기능만을 현재는 휴대폰, 네비게이터, 휴대용 게임기 등의 형태로 제공할 수 밖에 없는 상황이다. 모바일 컴퓨팅 환경을 제공하고 있다. 모바일 컴퓨팅 환 경의 대두와 함께, 이를 이용한 그래픽스 출력이 요구되 었고, 모바일 환경에서의 그래픽스 기능을 의미하는, 모 바일 그래픽스 환경이 구축되었다. 이 글에서는 현재의 모바일 그래픽스 환경 중에서도 특히 표준 라이브러리들 에 대해 이야기하고자 한다. 지난 10여년 사이에 모바일 그래픽스 분야는 눈부신 발전을 이루었다. 가장 대표적 인 기기인 휴대폰을 기준으로 본다면, 최초에 나온, 저해 상도에 흑백의 투박한 액정을 가진 모델이 불과 몇 년 사 이에 상당한 수준의 컬러 액정을 가진 제품으로 변했고, 3차원 그래픽스를 지원하는 특별한 하드웨어 칩들을 사 (a) 저해상도 2D (b) 3D 용하는 것도 이상하지 않은 상황이 되었다. 이에 따라, 소프트웨어 기술들도 눈부시게 발전하여, 그림 1에서 보 는 바와 같이, 2차원 저해상도에서 3차원 화면을 거쳐, 거의 PC 화면에 필적하는 수준의 고해상도 3차원 화면 이 급속히 사용되고 있다. 모바일 그래픽스 환경은 태생 상, 기존의 데스크 탑 또는 그 이상의 고급 기종들에 비 해, 상대적으로 열등한 하드웨어 환경을 제공할 수 밖에 없다. 가장 문제가 되는 것은 제한된 용량의 전원, 즉 배 터리의 수명을 고려해야 한다는 점이다. PC급의 고해상 (c) 하드웨어로 가속되는 3D 도 액정이 기술적으로 문제가 있는 것이 아니라, 채택하 ▶▶ 그림 1.
    [Show full text]
  • The Opengl ES Shading Language
    The OpenGL ES® Shading Language Language Version: 3.20 Document Revision: 12 246 JuneAugust 2015 Editor: Robert J. Simpson, Qualcomm OpenGL GLSL editor: John Kessenich, LunarG GLSL version 1.1 Authors: John Kessenich, Dave Baldwin, Randi Rost 1 Copyright (c) 2013-2015 The Khronos Group Inc. All Rights Reserved. This specification is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. It or any components may not be reproduced, republished, distributed, transmitted, displayed, broadcast, or otherwise exploited in any manner without the express prior written permission of Khronos Group. You may use this specification for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. Khronos Group grants express permission to any current Promoter, Contributor or Adopter member of Khronos to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be reformatted AS LONG AS the contents of the specification are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the Khronos Group website should be included whenever possible with specification distributions.
    [Show full text]
  • The Opengl ES Shading Language
    The OpenGL ES® Shading Language Language Version: 3.00 Document Revision: 6 29 January 2016 Editor: Robert J. Simpson, Qualcomm OpenGL GLSL editor: John Kessenich, LunarG GLSL version 1.1 Authors: John Kessenich, Dave Baldwin, Randi Rost Copyright © 2008-2016 The Khronos Group Inc. All Rights Reserved. This specification is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. It or any components may not be reproduced, republished, distributed, transmitted, displayed, broadcast, or otherwise exploited in any manner without the express prior written permission of Khronos Group. You may use this specification for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. Khronos Group grants express permission to any current Promoter, Contributor or Adopter member of Khronos to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be reformatted AS LONG AS the contents of the specification are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the Khronos Group website should be included whenever possible with specification distributions.
    [Show full text]
  • Opengl ES & Khronos Update
    SIGGRAPH 2006 BOF Jon Leech OpenGL ARB Secretary © Copyright Khronos Group, 2006 - Page 1 ARB Status • Released OpenGL 2.1 & GLSL 1.20 - Pixel Buffer Objects - Non-square uniform matrix support (glUniformMatrix2x3fv() etc.) - sRGB Textures - New shading language features • OpenGL on Windows Vista support solved • Working Groups busy with new object model - To be used for all new ARB-approved OpenGL features - Transition path to “OpenGL 3.0” - Making sure we have this right is what's holding up ARB FBO, sync object, etc. specs • New Ecosystem Working Group - docs, SDKs, etc. • gDEBugger Academic Program • ARB transition to Khronos © Copyright Khronos Group, 2006 - Page 2 ARB -> Khronos Transition • Desktop OpenGL & OpenGL ES can work more closely - Keep APIs close together - reconverge in “OpenGL 3.0”? - Work under uniform IP policies - Work with other Khronos APIs - Collada (interchange), OpenKODE (EGL), OpenVG (2D), etc. - Share admin / developer / documentation resources • ARB and Khronos processes are very similar - Some relabelling - “ARB Secretary” -> “OpenGL Working Group Chair”, “ARB WG Chair” -> “Sub-WG Chair” • Khronos has agreed to “catch” • ARB is in the process of “throwing” - Step by step handover of Specifications, Working Groups, documentation, Website, budget, etc. • Expect to complete transition by October 2006 © Copyright Khronos Group, 2006 - Page 3 Agenda • OpenGL on Windows Vista (Neil Trevett) • “OpenGL 3.0” Status (Benj Lipchak) • New Object Model (Michael Gold) • Ecosystem WG (Benj) • gDEBugger Academic Program (Avi Shapira) • Superbuffers WG (Barthold Lichtenbelt) • OpenGL Shading Language WG (Bill Licea-Kane) • Async WG (Barthold) • OpenGL ES & Khronos update (Neil) • Upcoming NVIDIA Extensions (Barthold) • Trivia Quiz in between speakers (Barthold) • Open Q&A © Copyright Khronos Group, 2006 - Page 4.
    [Show full text]
  • EGL 1.5 Specification
    Khronos Native Platform Graphics Interface (EGL Version 1.5 - August 27, 2014) Editor: Jon Leech 2 Copyright (c) 2002-2014 The Khronos Group Inc. All Rights Reserved. This specification is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. It or any components may not be reproduced, repub- lished, distributed, transmitted, displayed, broadcast or otherwise exploited in any manner without the express prior written permission of Khronos Group. You may use this specification for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. Khronos Group grants express permission to any current Promoter, Contributor or Adopter member of Khronos to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be re- formatted AS LONG AS the contents of the specification are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the Khronos Group web-site should be included whenever possible with specification distributions. Khronos Group makes no, and expressly disclaims any, representations or war- ranties, express or implied, regarding this specification, including, without limita- tion, any implied warranties of merchantability or fitness for a particular purpose or non-infringement of any intellectual property.
    [Show full text]
  • Introduction to Opencl Adaptation and Diffusion Strictly Forbidden Without Acsys Written Agreement Written Acsys Without Forbidden Strictly Diffusion and Adaptation
    Introduction to OpenCL Adaptation and diffusion strictly forbidden without Acsys written agreement written Acsys without forbidden strictly diffusion and Adaptation RTS 2013 April 11th 2013 training This lecture is brought to you by Bernard Dautrevaux Chief Technical Officer – Ac6 Alumni of École Normale Supérieure (ENS Cachan) Master of Mathematics Master of Computer Science University of Paris, Orsay Should you have any question later on feel free to contact me at Adaptation and diffusion strictly forbidden without Acsys written agreement written Acsys without forbidden strictly diffusion and Adaptation mailto:[email protected] You could also find more information on our web site: http://www.ac6.fr or http://www.ac6-training.com training Page 1 Agenda Why OpenCL? The Goals of OpenCL Overview Adaptation and diffusion strictly forbidden without Acsys written agreement written Acsys without forbidden strictly diffusion and Adaptation The OpenCL Language OpenCL Implementations training Page 2 Why OpenCL? Adaptation and diffusion strictly forbidden without Acsys written agreement written Acsys without forbidden strictly diffusion and Adaptation training Processor Parallelism CPUs GPUs Multiple cores Increasingly general provides increased Emerging purpose data-parallel performance Intersection computing Adaptation and diffusion strictly forbidden without Acsys written agreement written Acsys without forbidden strictly diffusion and Adaptation Multiprocessor Heteregeneous Graphics APIs and programming Computing Shading Languages (for example OpenMP) OpenCL is a programming framework for heterogeneous computing resources training Page 4 Original graphics design from The Khronos Group The Origins of OpenCL AMD Ericsson Merged, needed Nokia commonality across products IBM ATI Sony EA Freescale GPU vendor, wants TI Nvidia to steal market share from CPU vendors Wrote a rough draft, STM straw man API ..
    [Show full text]