Presentation is loading. Please wait.

Presentation is loading. Please wait.

Source Multicore 1 November 2006.

Similar presentations


Presentation on theme: "Source Multicore 1 November 2006."— Presentation transcript:

1 Source Multicore 1 November 2006

2 New Source Features Dynamic Shadow Mapping New Foliage System Cinematic Physics Version 2 of Facial Animation System Dynamic Scripted Sequences Particle System 64-Bit Source Engine Reworked Character Lighting Model Companion AI (Alyx in Episode One) Real-Time statistics gathering Automatic game cache defragmentation Multicore

3 Multiple Approches to multi-core games
New Features in Source Multiple Approches to multi-core games Source is implementing Hybrid-Threading Close to linear improvements Pretty but dumb era is ending, scalability we've seen in graphics will now apply to rest of the game Hybrid Threading Source will ship before Episode Two You'll get a version of this engine to take home to test with

4 Most significant development since 3D cards
Multicore Most significant development since 3D cards Huge potential Huge challenge

5 Most significant development since 3D cards
Multicore Most significant development since 3D cards Huge potential Huge challenge The decisions faced with multiple cores How we are using multiple cores

6 Most significant development since 3D cards
Multicore Most significant development since 3D cards Huge potential Huge challenge The decisions faced with multiple cores How we are using multiple cores Four cores is more than twice as interesting as two cores

7 Challenges

8 Games always want 100% CPU utilization
Challenges Games always want 100% CPU utilization

9 Games always want 100% CPU utilization Games are inherently serial
Challenges Games always want 100% CPU utilization Games are inherently serial

10 Games always want 100% CPU utilization Games are inherently serial
Challenges Games always want 100% CPU utilization Games are inherently serial Decades of experience in single threaded optimization

11 Games always want 100% CPU utilization Games are inherently serial
Challenges Games always want 100% CPU utilization Games are inherently serial Decades of experience in single threaded optimization Millions of lines of code written for single threading

12 Strategies Threading model Threading framework Application of cores

13 Fine grained threading Hybrid threading
Theading Models Single threading Coarse threading Fine grained threading Hybrid threading

14 Single threading Easy Obsolete

15 Put whole systems on cores Pretty easy, “multiple single threads”
Coarse threading Put whole systems on cores Pretty easy, “multiple single threads” Stay partially serialized, or double buffer

16 Coarse threading: Early experimentation
Client User input Rendering Graphics simulation Server AI Physics Game logic

17 Coarse threading: Early experimentation
Experiment: run client and server each on own core

18 Coarse threading: Early experimentation
Experiment: run client and server each on own core Benefits: forced to confront systems that are not thread safe or not thread efficient

19 Coarse threading: Early experimentation
Experiment: run client and server each on own core Benefits: forced to confront systems that are not thread safe or not thread efficient Outcome: Can approach 2x in contrived maps

20 Coarse threading: Early experimentation

21 Coarse threading: Early experimentation

22 Coarse threading: Early experimentation
Experiment: run client and server each on own core Benefits: forced to confront systems that are not thread safe or not thread efficient Outcome: Can approach 2x in contrived maps More like 1.2x in real single player Added latency to single player game

23 Coarse threading: Early experimentation
Experiment: run client and server each on own core Benefits: forced to confront systems that are not thread safe or not thread efficient Outcome: Can approach 2x in contrived maps More like 1.2x in real single player Added latency to single player game Opened door to improved listen servers

24 Put whole systems on cores Pretty easy, “multiple single threads”
Coarse threading Put whole systems on cores Pretty easy, “multiple single threads” Stay partially serialized, or double buffer Scales poorly Partially idle cores Synchronization, or lag Entirely idle cores

25 Fine grained threading
Divide many small identical tasks across cores E.g., take a loop that updates state of 1000 objects and perform 1000/N on each core for N cores Moderate difficulty Scales well… Tricky if cost of each unit is variable Memory bandwidth Limited problem domains

26 Fine grained threading
Leverage multicore in production tools: VMPI

27 Fine grained threading
VVIS – Visibility calculations VRAD – Lighting calculations

28 Fine grained threading

29 Performance tuned for mid-level work sharing
Hybrid threading Performance tuned for mid-level work sharing Not splitting sets of very small operations over cores Not putting whole systems onto cores

30 Use the appropriate tool for the job
Hybrid threading Use the appropriate tool for the job Some systems on cores (e.g. sound) Some systems split internally similar to coarse Split expensive iterations across cores fine grained Queue some work to run when a core goes idle Most difficult Scales well Maximum core utilization

31 Hybrid threading: Rendering
Rough pipeline Build world lists Build object lists Graphical simulation (particles, ropes, sprites) Update animations Compute shadows Draw Once for every “view” Player’s POV TV monitors Water reflections Many times CPU bound

32 Hybrid threading: Rendering
Revised pipeline Construct scene rendering lists for multiple scenes in parallel (e.g., the world and its reflection in water) Overlap graphics simulation Compute character bone transformations for all characters in all scenes in parallel Compute shadows for all characters Allow multiple threads to draw in parallel Serialize drawing operations on another core

33 Implementing Hybrid Threading Operating system: pools, synchronization
Threading Tools Implementing Hybrid Threading Operating system: pools, synchronization Compiler extensions: OpenMP, fine threading Tailored tools Programmers solve game development problems, not threading problems

34 Operating system Too low level Prone to error Lots of stalling Unpredictable scheduling Unpredictable cost

35 Focused on fine threading Lack of control Implementation interferes
Compiler extensions OpenMP Focused on fine threading Lack of control Implementation interferes

36 Tailored tools: Game Threading Infrastructure
Custom work management system Aimed at gaming problems, intuitive for game programmers Focus on keeping cores busy Thread pool: N-1 threads for N cores Support hybrid threading Function threading Array parallelism Multiple work modes Opportunistic core utilization Queued core utilization

37 Tailored tools: Game Threading Infrastructure
The simple thing is the worst thing “Lock-free” algorithms Never leave cores idle waiting on other cores Leverages atomic write primitives of the CPU Under the hood of all services and data structures See: free_algorithms Example: the spatial partition

38 Application of cores

39 Dual core CPUs: framerate
Application of cores Dual core CPUs: framerate

40 Dual core CPUs: framerate Quad core CPUs: new experiences
Application of cores Dual core CPUs: framerate Quad core CPUs: new experiences

41 Dual core CPUs: framerate Quad core CPUs: new experiences
Application of cores Dual core CPUs: framerate Quad core CPUs: new experiences Richer visuals Improved simulation Richer AI

42 Application of cores: Particle Simulation

43 Application of cores: Particle Simulation
Not simply a GPU issue Interactivity Presence

44 Application of cores: Particle Simulation
Use cores to run multiple particle systems in parallel Individual particle systems using multiple cores

45 Application of cores: Particle Simulation
More complicated systems Interactive particle systems Particles with gameplay implications Like rigid body physics, reinforce consistency of world

46 Particle Simulation Benchmark

47 Traditionally strict CPU limits
AI Traditionally strict CPU limits Interesting combinations of minimalist algorithms “What could we do if extra CPU were given to AI?”

48 Better framerate AI Run AI in parallel with other systems
Parallel agent execution

49 Example: Parallel Animation
AI Example: Parallel Animation

50 Increased sophistication
AI Better framerate Increased sophistication Without hitching by asynchronously running on secondary cores

51 Increased sophistication
AI Better framerate Increased sophistication Without hitching by asynchronously running on secondary cores Richer path finding: better world interactivity

52 Increased sophistication
AI Better framerate Increased sophistication Without hitching by asynchronously running on secondary cores Richer path finding: more analysis for better world awareness Deeper tactical analysis Increased world examination “Out of band” AI

53 Increased sophistication New kinds of AIs
Better framerate Increased sophistication New kinds of AIs Experimental creatures built with multicore in mind

54 Integrate multicore across Valve’s business
Broader Goals Integrate multicore across Valve’s business

55 Integrate multicore across Valve’s business
Broader Goals Integrate multicore across Valve’s business Boost developer effectiveness

56 Integrate multicore across Valve’s business
Broader Goals Integrate multicore across Valve’s business Boost developer effectiveness Expose to game programmers, licensees and MOD authors

57 Integrate multicore across Valve’s business
Broader Goals Integrate multicore across Valve’s business Boost developer effectiveness Expose to game programmers, licensees and MOD authors Transparently scale to cores without recompile

58 Integrate multicore across Valve’s business
Broader Goals Integrate multicore across Valve’s business Boost developer effectiveness Expose to game programmers, licensees and MOD authors Transparently scale to cores without recompile Leverage to 360

59 Integrate multicore across Valve’s business
Broader Goals Integrate multicore across Valve’s business Boost developer effectiveness Expose to game programmers, licensees and MOD authors Transparently scale to cores without recompile Leverage to 360 Provide value to our customers beyond framerate

60 Integrate multicore across Valve’s business
Broader Goals Integrate multicore across Valve’s business Boost developer effectiveness Expose to game programmers, licensees and MOD authors Transparently scale to cores without recompile Leverage to 360 Provide value to our customers beyond framerate Pre-Episode 2 Steam to deliver to customers, MOD authors, and licensees

61 Multicore is exciting and scary Accessible solutions Hybrid Threading
Closing thoughts Multicore is exciting and scary Accessible solutions Hybrid Threading Scalable More broadly applicable Game Threading Infrastructure Closely controlled core usage Tools framed in terms of game problems Apply cores to new visual gameplay opportunities

62 Experiments and Benchmarks
Particle System Multicore AI Provided to take home: VRAD benchmark, particle simulation benchmark


Download ppt "Source Multicore 1 November 2006."

Similar presentations


Ads by Google