1 Real World Multithreading in PC Games Case Studies Maxim Perminov, [email protected]Aaron Coday, [email protected]Will Damon, [email protected]Agenda • Hyper-Threading Technology Review • Multithreading Challenges & Strategies for Games • Case Studies – Lego/Argonaut “Bionicle” – Codemasters/SixByNine “Colin McRae Rally 4” • Summary
14
Embed
Real World Multi-Threading in PC Gamestwvideo01.ubm-us.net/.../gdc04/slides/real_world_multithreading.pdf · – OpenMP ™ My_thrd_func(void ... Real World Multi-Threading in PC
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
visible to OSvisible to OSPhysical processor Physical processor resource allocationresource allocation ThroughputThroughput
TimeTime
Resource 1Resource 1
Resource 2Resource 2
Resource 3Resource 3
Thread 2Thread 2 Thread 1
With
out
Hyp
erW
ithou
t H
yper
--T
hre
adin
gT
hre
adin
gW
ith H
yper
With
Hyp
er--
Th
read
ing
Th
read
ing
Thread 2Thread 2
Thread 1 Resource 1Resource 1
Resource 2Resource 2
Resource 3Resource 3
+
Higher resource utilization, higher outputwith two simultaneous threads
Higher resource utilization, higher outputwith two simultaneous threads
HT Technology, Not Magic
MultiprocessorMultiprocessor HyperHyper--ThreadingThreadingArch State Arch StateArch StateArch State
Data Caches
CPUFront-End
Out-of-Order
ExecutionEngine
Data Caches
CPUFront-End
Out-of-Order
ExecutionEngine
Data Caches
CPUFront-End
Out-of-Order
ExecutionEngine
HT Technology increases processor performance by improving resource utilization
HT Technology increases processor performance by improving resource utilization
3
Agenda
• Hyper-Threading Technology Review
• Multithreading Challenges & Strategies for Games
• Case Studies
– Lego/Argonaut “Bionicle”
– Codemasters/SixByNine “Colin McRae Rally 4”
• Summary
Why Games Are Hard to Thread
• Technical Reasons– Sequential pipeline model with single dataset shared among stages (à
next slide)– Highly optimized, dense code minimizes HT benefits
– Threading frequently involves significant high level design change
• Business Reasons– Little experience in multithreading programming
– Limited market share of systems w. HT (e.g. vs. SSE)
– Consumer unaware of HT
4
Why should you thread your game
• Technical reasons– Parallelism is the future of CPU architectures -> easy to scale (HT,
multi-core, etc)– Do other things while waiting for the graphics card/driver– Good MT design scales, and prevents repeated re-writes
• Biz reasons– Differentiate yourself in a competitive landscape– All PC platforms will support Multi-threading– Parallel programming education will pay off with multiple