250 likes | 399 Views
WORLDCOMP Conference: PDPTA-2014 Las Vegas, Nevada, USA. “Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming ”. July 21-24, 2014. WORLDCOMP Conference: PDPTA-2014 Las Vegas, Nevada, USA.
E N D
WORLDCOMP Conference: PDPTA-2014 Las Vegas, Nevada, USA “Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” July 21-24, 2014
WORLDCOMP Conference: PDPTA-2014 Las Vegas, Nevada, USA “Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Presented by: Dr. Abu Asaduzzaman Assistant Professor in Computer Architecture and Director of CAPPLab Department of Electrical Engineering and Computer Science (EECS) Wichita State University (WSU), USA July 23, 2014
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Outline ► • Introduction • Problem Statement and Contributions • Background and Motivation • Important Techniques for Game Engine • Data Level Parallelism • Task Level Parallelism • Experimentations • Test Game Engine: Tower Defense Game • Different Implementations • Experimental Results • Discussion QUESTIONS? Any time!
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Authors • Abu Asaduzzaman, Assistant Professor • EECS Department, Wichita State University (WSU), USA • Director, Computer Arch & Parallel Prog Lab (CAPPLab) • Hin Y. Lee, MS in CS • EECS Department, Wichita State University (WSU), USA • Graduation: Fall 2012 • Deepthi Gummadi, MS/CN Student • EECS Department, Wichita State University (WSU), USA • Graduation: Spring 2014
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Introduction • Xbox 360 • 3 cores • GPU card • PS3 • 1 master core • 6 worker core • GPU card
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Introduction • Game Technology • In addition to standalone game machines, game engines are nowadays being used for educational, engineering, and scientific applications. • To fulfill the high performance requirements, game engines are adopting new hardware technologies like multicore CPUs and software technologies like parallel programming. • As the number of cores in a processor increases, multithreading can be very helpful to get as much performance out of a system as possible to the advancement of video game technologies.
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Introduction • Game Engine • Many Components: Physics, Graphics, etc. • Multithreading • Concurrent and Parallel Processing • Data Level Parallelism and Task Level Parallelism • (Thread) Synchronization • Load Balancing, etc.
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Introduction • Contributions • Multi-object interactive game console in an 8-core system • Single-Threaded Model (STM) • Multithreaded Asynchronous Model (MAM) • Multithreaded Synchronous Model (MSM) • MSM with Data Parallelism (MSMDP) • We investigate the challenges and benefits of thread synchronization and data level parallelism.
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Introduction • Background and Motivation • The game industry has surpassed the movie and music industry in U.S. in 2005 and 2007, respectively. In 2008, the game industry surpassed the music industry in the U.K. and is expected to surpass DVD sales in the future. • Multicore architecture is a recent design trend and most vendors are adopting multicore processors to their products. Multicore systems are very suitable for multithreaded processing as multiple threads can be executed on multiple cores at the same time.
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Introduction • Background and Motivation • Data parallelism is where the same type of data is parallelized in multiple threads. The use of this in a game engine is when a component spawns multiple worker threads to process one type of data. • Task level parallelism is a popular method for game engine multithreading, where components run asynchronously in their own loop or synchronously in a single loop with multiple forks and joins. • To properly scale a multicore game engine, data parallelism and task parallelism have to be employed.
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Outline ► • Introduction • Problem Statement and Contributions • Background Work and Motivation • Important Techniques for Game Engine • Data Level Parallelism • Task Level Parallelism • Experimentations • Test Game Engine: Tower Defense Game • Different Implementations • Experimental Results • Discussion
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Important Techniques for Game Engine • Data Level Parallelism • Data parallelism is where the same type of data in a component is parallelized in multiple threads. • Example: The animation subcomponent in the graphics component is divided into 3 batches of data for simultaneous processing.
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Important Techniques for Game Engine • Task Level Parallelism • The use of task parallelism in game engine is by running each component task in its own thread. • Example: In synchronized model (left) all tasks must finish in a single clock cycle. In asynchronous model (right) the tasks can run and finish at their own time.
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Important Techniques for Game Engine • Thread Pool • Thread pool is a system where tasks are queued in a list and assigned to any available threads that are idle. • Max. amount of threads should run at the same time.
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Outline ► • Introduction • Problem Statement and Contributions • Background Work and Motivation • Important Techniques for Game Engine • Data Level Parallelism • Task Level Parallelism • Experimentations • Test Game Engine: Tower Defense Game • Different Implementations • Experimental Results • Discussion
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Test Game Engine • CAPPLab Tower Defense Game v1 • Defend the Base Structure; players are to build Defensive Structures and try to survive as many waves as possible. For every enemy destroyed, the player gains credits. Maximum 20 objects in the screen at one time. • The game is over if • (i) Player survives 3 minutes, • (ii) Base Struct. is destroyed, or • (iii) Abnormal termination
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Test Game Engine • Single Threaded Model (STM) • The order of operations in the single threaded implementation is: 1) Capture input 2) Update input operation (graphics) 3) Update game logic 4) Update AI 5) Update physics 6) Process navigational mesh updates 7) Simulate physics 8) Render graphics
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Test Game Engine • Multithreaded Asynchronous Model (MAM) • The order of operations is: Thread 1: 1) Capture input 2) Update game logic 3) Update AI 4) Update physics 5) Process navigational mesh updates 6) Simulate physics Thread 2: 1) Update graphics 2) Render graphics
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Test Game Engine • Multithreaded Synchronous Model (MSM) • The order of operations is: Serial Stage: 1) Capture input 2) Update logic 3) Update AI 4) Update physics 5) Update graphics Parallel stage: (One possible order) 1) Process navigational mesh updates 2) Simulate physics 3) Render graphics
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Test Game Engine • MSMwith Data Parallelism (MSMDP) • The order of operations is: Serial Stage: 1) Capture input 2) Update logic 3) Update AI 4) Update physics 5) Update graphics Parallel stage: (One possible order) 1) Update navigational mesh 2) Simulate physics 3) Perform collision detection on object batch 1 4) Perform collision detection on object batch 2 5) Render graphics
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Outline ► • Introduction • Problem Statement and Contributions • Background Work and Motivation • Important Techniques for Game Engine • Data Level Parallelism • Task Level Parallelism • Experimentations • Test Game Engine: Tower Defense Game • Different Implementations • Experimental Results • Discussion
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Experimental Results • Generation and processing of Frames • MSMDP generates more frames than other implementations. • SMT takes more time to process a frame than multithreaded ones.
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Experimental Results • Processing Time for Components and Speedup • Physics simulation takes the maximum amount of time. • About 14x speedup is achieved due to MSMDP for 512 threads.
“Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” Conclusions and Future Extension • We explore the challenges due to thread synchronization and data parallelism by developing a multicore video game console. • Experimental results show that the MSMDP generates more frames and takes less amount of time to process the frames. • On an 8-core system, the speedup due to MSMDP is about 14 with respect to the STM implementation. • Higher speedup needed for future game engines can be achieved by GPU computing.
Thank You! WORLDCOMP Conference: PDPTA; Las Vegas, USA; 2014 “Impact of Thread Synchronization and Data Parallelism on Multicore Game Programming” QUESTIONS? Contact: Abu AsaduzzamanE-mail: abuasaduzzaman@ieee.orgPhone: +1-316-978-5261 CAPPLab: http://www.cs.wichita.edu/~capplab/