Porting and Maintaining a Developing Optix Path Tracer for Non-NVIDIA Devices
Total Page:16
File Type:pdf, Size:1020Kb
Master Thesis Porting and Maintaining a Developing OptiX Path Tracer for Non-NVIDIA Devices Supervisors: Dr. ing. Jacco Bikker, Dr. Zerrin Yumak Satwiko Wirawan Indrawanto ICA-6201539 Faculty of Science Department of Informatics and Computing Science 13 August 2019 Contents 1. Introduction ............................................................................................................................................ 4 1.1 Objectives ..................................................................................................................................... 4 1.2 Research Questions ...................................................................................................................... 4 1.3 Content Overview ........................................................................................................................ 4 2. Preliminaries .......................................................................................................................................... 6 2.1 Rendering ..................................................................................................................................... 6 2.1.1 Rendering Equation ................................................................................................................. 6 2.1.2 Path Tracing ............................................................................................................................. 7 2.1.3 Performance ............................................................................................................................. 8 2.2 Case Study: LightHouse 2 ............................................................................................................ 8 2.2.1 Application Layer .................................................................................................................... 9 2.2.2 Rendering System .................................................................................................................... 9 2.2.3 Rendering Core ........................................................................................................................ 9 2.3 OptiX .......................................................................................................................................... 10 3. Literature Review ................................................................................................................................ 12 3.1 Portability Concepts ................................................................................................................... 12 3.2 Porting Cost ................................................................................................................................ 14 3.3 GPGPU Development Technologies .......................................................................................... 15 3.4 NVIDIA CUDA ......................................................................................................................... 16 3.5 OpenCL ...................................................................................................................................... 17 3.6 HIP ............................................................................................................................................. 18 3.7 Automatic Porting ...................................................................................................................... 19 3.7.1 CU2CL ................................................................................................................................... 19 3.7.2 Hipify ..................................................................................................................................... 19 3.8 Ray Tracing API ......................................................................................................................... 19 3.8.1 Radeon Rays .......................................................................................................................... 19 4. Research Methodology ........................................................................................................................ 21 4.1 Porting Implementation .............................................................................................................. 21 4.2 Portability Experiment ............................................................................................................... 21 4.3 Features Experiment ................................................................................................................... 21 4.4 Performance Experiment ............................................................................................................ 22 5. Implementation .................................................................................................................................... 23 5.1 Device Selection ......................................................................................................................... 23 5.1.1 OpenCL-OpenGL Interoperability ......................................................................................... 24 5.1.2 Use of Persistent Threads ....................................................................................................... 24 2 5.2 Data Structure ............................................................................................................................. 24 5.2.1 Data Alignment ...................................................................................................................... 25 5.2.2 Half Data Type ....................................................................................................................... 26 5.2.3 Buffer with Device Pointers ................................................................................................... 27 5.2.4 Pass-by-Reference .................................................................................................................. 27 5.2.5 Constant Variables and Buffers ............................................................................................. 28 5.2.6 Fixed-point Arithmetic ........................................................................................................... 29 5.3 Ray Tracing Engine .................................................................................................................... 29 5.3.1 Ray Structure ......................................................................................................................... 30 5.3.2 Intersection Structure ............................................................................................................. 30 5.4 Scene Geometry Loading ........................................................................................................... 31 5.5 Rendering ................................................................................................................................... 32 5.5.1 On-render Buffer Initialization .............................................................................................. 32 5.5.2 Primary Rays .......................................................................................................................... 32 5.5.3 Shading .................................................................................................................................. 33 5.5.4 Shadow Rays .......................................................................................................................... 34 5.6 Persistent Threads ...................................................................................................................... 35 6. Results .................................................................................................................................................. 36 6.1 Measure of Software Similarity ................................................................................................. 36 6.2 Image Comparison ..................................................................................................................... 37 6.2.1 Mean Squared Error ............................................................................................................... 38 6.2.2 Structural Similarity ............................................................................................................... 41 6.2.3 Cross-platform Image Comparison ........................................................................................ 43 6.2.4 Cross-core Image Comparison ............................................................................................... 45 6.3 Performance ............................................................................................................................... 48 6.3.1 Cross-platform Performance .................................................................................................. 49 6.3.2 Persistent Threads .................................................................................................................. 50 7. Conclusion ........................................................................................................................................... 52 7.1 Future Work ............................................................................................................................... 53 8. References ...........................................................................................................................................