Abstracting the Work Queue
?
?

Keyboard Navigation

Global Keys

[, < / ], > Jump to previous / next episode
W, K, P / S, J, N Jump to previous / next timestamp
t / T Toggle theatre / SUPERtheatre mode
V Revert filter to original state Y Select link (requires manual Ctrl-c)

Menu toggling

q Quotes r References f Filter y Link c Credits

In-Menu and Index Controls

a
w
s
d
h j k l


Esc Close menu / unfocus timestamp

Quotes and References Menus and Index

Enter Jump to timestamp

Quotes, References and Credits Menus

o Open URL (in new tab)

Filter Menu

x, Space Toggle category and focus next
X, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus

Filter and Link Menus

z Toggle filter / linking mode

Credits Menu

Enter Open URL (in new tab)
0:07We are absolute control freaks here, peopleα
0:07We are absolute control freaks here, peopleα
0:07We are absolute control freaks here, peopleα
1:25Recap and set the stage for today
1:25Recap and set the stage for today
1:25Recap and set the stage for today
3:46win32_handmade.cpp: Introduce DoWorkerWork
3:46win32_handmade.cpp: Introduce DoWorkerWork
3:46win32_handmade.cpp: Introduce DoWorkerWork
5:43Let our normal thread do work
5:43Let our normal thread do work
5:43Let our normal thread do work
6:55Run and see what the threads are doing
6:55Run and see what the threads are doing
6:55Run and see what the threads are doing
7:37Follow the compression oriented programming approach
7:37Follow the compression oriented programming approach
7:37Follow the compression oriented programming approach
9:10handmade_render_group.cpp: Figure out a way to do TiledRenderGroupToOutput on multiple threads
9:10handmade_render_group.cpp: Figure out a way to do TiledRenderGroupToOutput on multiple threads
9:10handmade_render_group.cpp: Figure out a way to do TiledRenderGroupToOutput on multiple threads
10:38handmade_platform.h: Consider pulling in work_queue_entry
10:38handmade_platform.h: Consider pulling in work_queue_entry
10:38handmade_platform.h: Consider pulling in work_queue_entry
11:54win32_handmade.cpp: Rewrite PushString as AddWorkQueueEntry
11:54win32_handmade.cpp: Rewrite PushString as AddWorkQueueEntry
11:54win32_handmade.cpp: Rewrite PushString as AddWorkQueueEntry
15:18Note the necessity of _mm_sfence
15:18Note the necessity of _mm_sfence
15:18Note the necessity of _mm_sfence
16:13Pull work_queue_entry down into the test code
16:13Pull work_queue_entry down into the test code
16:13Pull work_queue_entry down into the test code
17:18Split DoWorkerWork in two
17:18Split DoWorkerWork in two
17:18Split DoWorkerWork in two
20:34Think
20:34Think
20:34Think
21:18Put while(EntryCount != EntryCompletionCount) into QueueWorkStillInProgress
21:18Put while(EntryCount != EntryCompletionCount) into QueueWorkStillInProgress
21:18Put while(EntryCount != EntryCompletionCount) into QueueWorkStillInProgress
22:49Rename and finish writing these functions
22:49Rename and finish writing these functions
22:49Rename and finish writing these functions
30:48Compile and run and see what the threads are doing
30:48Compile and run and see what the threads are doing
30:48Compile and run and see what the threads are doing
31:14Discuss our options
31:14Discuss our options
31:14Discuss our options
34:31Rename GetNextWorkQueueEntry to CompleteAndGetNextWorkQueueEntry and make it take work_queue_entry Completed
34:31Rename GetNextWorkQueueEntry to CompleteAndGetNextWorkQueueEntry and make it take work_queue_entry Completed
34:31Rename GetNextWorkQueueEntry to CompleteAndGetNextWorkQueueEntry and make it take work_queue_entry Completed
35:29Rearrange ThreadProc slightly
35:29Rearrange ThreadProc slightly
35:29Rearrange ThreadProc slightly
37:24Massage DoWorkerWork
37:24Massage DoWorkerWork
37:24Massage DoWorkerWork
37:51Tweak the QueueWorkStillInProgress loop
37:51Tweak the QueueWorkStillInProgress loop
37:51Tweak the QueueWorkStillInProgress loop
38:55Compile and consider removing one more call
38:55Compile and consider removing one more call
38:55Compile and consider removing one more call
40:12Go for it and make the work_queue two separate things
40:12Go for it and make the work_queue two separate things
40:12Go for it and make the work_queue two separate things
44:22Run this again
44:22Run this again
44:22Run this again
45:19handmade_platform.h: Hoist these functions in
45:19handmade_platform.h: Hoist these functions in
45:19handmade_platform.h: Hoist these functions in
46:01Think about this a little bit more
46:01Think about this a little bit more
46:01Think about this a little bit more
47:11handmade_render_group.cpp: Write the usage code first
47:11handmade_render_group.cpp: Write the usage code first
47:11handmade_render_group.cpp: Write the usage code first
50:06Compile and express hate for constβ
50:06Compile and express hate for constβ
50:06Compile and express hate for constβ
50:40Finish writing TiledRenderGroupToOutput
50:40Finish writing TiledRenderGroupToOutput
50:40Finish writing TiledRenderGroupToOutput
54:58Compile and run and crashγ
54:58Compile and run and crashγ
54:58Compile and run and crashγ
55:22Moment of realisation: Gotta increment by the correct value
55:22Moment of realisation: Gotta increment by the correct value
55:22Moment of realisation: Gotta increment by the correct value
55:32Recap and glimpse into the multithreaded future
55:32Recap and glimpse into the multithreaded future
55:32Recap and glimpse into the multithreaded future
56:09Q&A
🗩
56:09Q&A
🗩
56:09Q&A
🗩
57:35BrainCruser Will you start new threads for every queue that you make?
🗪
57:35BrainCruser Will you start new threads for every queue that you make?
🗪
57:35BrainCruser Will you start new threads for every queue that you make?
🗪
59:29niegrfiegr0 Still don't understand the use of volatile and memory barrier
🗪
59:29niegrfiegr0 Still don't understand the use of volatile and memory barrier
🗪
59:29niegrfiegr0 Still don't understand the use of volatile and memory barrier
🗪
59:53Blackboard: Memory and Code Fences
59:53Blackboard: Memory and Code Fences
59:53Blackboard: Memory and Code Fences
1:07:46kelimion Can Entry.IsValid be removed and replaced with a test to see if Entry.Data != NULL?
🗪
1:07:46kelimion Can Entry.IsValid be removed and replaced with a test to see if Entry.Data != NULL?
🗪
1:07:46kelimion Can Entry.IsValid be removed and replaced with a test to see if Entry.Data != NULL?
🗪
1:08:04kil4h What is your take on Naughty Dog's approach using fibers (+ manual management) and thread affinity to core instead of using classic worker / job approach for multithreaded gameplay?
🗪
1:08:04kil4h What is your take on Naughty Dog's approach using fibers (+ manual management) and thread affinity to core instead of using classic worker / job approach for multithreaded gameplay?
🗪
1:08:04kil4h What is your take on Naughty Dog's approach using fibers (+ manual management) and thread affinity to core instead of using classic worker / job approach for multithreaded gameplay?
🗪
1:08:23robrobby The work queue will take any function to do it multithreaded? Does the function need to be special so that this will work?
🗪
1:08:23robrobby The work queue will take any function to do it multithreaded? Does the function need to be special so that this will work?
🗪
1:08:23robrobby The work queue will take any function to do it multithreaded? Does the function need to be special so that this will work?
🗪
1:08:53waterlimon Please write a lock free queue, even though I don't know what those are and if you used one
🗪
1:08:53waterlimon Please write a lock free queue, even though I don't know what those are and if you used one
🗪
1:08:53waterlimon Please write a lock free queue, even though I don't know what those are and if you used one
🗪
1:09:33boogie0815 How many CPU cycles does spawning a thread cost? Or better: what's the minimum amount of cycles to work in 2 threads to gain speed?
🗪
1:09:33boogie0815 How many CPU cycles does spawning a thread cost? Or better: what's the minimum amount of cycles to work in 2 threads to gain speed?
🗪
1:09:33boogie0815 How many CPU cycles does spawning a thread cost? Or better: what's the minimum amount of cycles to work in 2 threads to gain speed?
🗪
1:10:45gasto5 I don't understand why you call it a queue if it is done potentially simultaneously
🗪
1:10:45gasto5 I don't understand why you call it a queue if it is done potentially simultaneously
🗪
1:10:45gasto5 I don't understand why you call it a queue if it is done potentially simultaneously
🗪
1:11:46flyingwafflenyc Wasn't there already a bit of thread-related code in the win32 file?
🗪
1:11:46flyingwafflenyc Wasn't there already a bit of thread-related code in the win32 file?
🗪
1:11:46flyingwafflenyc Wasn't there already a bit of thread-related code in the win32 file?
🗪
1:12:04waterlimon Will you add a cool graph over time that shows what task (e.g. from which subsystem) each thread is working on at each moment?
🗪
1:12:04waterlimon Will you add a cool graph over time that shows what task (e.g. from which subsystem) each thread is working on at each moment?
🗪
1:12:04waterlimon Will you add a cool graph over time that shows what task (e.g. from which subsystem) each thread is working on at each moment?
🗪
1:14:19zuurr_ Is false sharing between the entries in the work queue potentially problematic (from a performance standpoint)?
🗪
1:14:19zuurr_ Is false sharing between the entries in the work queue potentially problematic (from a performance standpoint)?
🗪
1:14:19zuurr_ Is false sharing between the entries in the work queue potentially problematic (from a performance standpoint)?
🗪
1:14:34popcorn0x90 Does volatile clear the assembly registers by pushing them into the stack and then restore by popping?
🗪
1:14:34popcorn0x90 Does volatile clear the assembly registers by pushing them into the stack and then restore by popping?
🗪
1:14:34popcorn0x90 Does volatile clear the assembly registers by pushing them into the stack and then restore by popping?
🗪
1:14:56grubuck Why would you want a compiler fence and not a process fence, and vice versa?
🗪
1:14:56grubuck Why would you want a compiler fence and not a process fence, and vice versa?
🗪
1:14:56grubuck Why would you want a compiler fence and not a process fence, and vice versa?
🗪
1:15:41Pseudonym73 Shouldn't _mm_fence() imply a compiler fence? Surely there's no point otherwise...
🗪
1:15:41Pseudonym73 Shouldn't _mm_fence() imply a compiler fence? Surely there's no point otherwise...
🗪
1:15:41Pseudonym73 Shouldn't _mm_fence() imply a compiler fence? Surely there's no point otherwise...
🗪
1:16:44thordura Have you implemented friction?
🗪
1:16:44thordura Have you implemented friction?
🗪
1:16:44thordura Have you implemented friction?
🗪
1:16:54jameswidman So, thread management is a bit like memory management (in that you want to set it up ahead of time rather than allocating them on-demand)
🗪
1:16:54jameswidman So, thread management is a bit like memory management (in that you want to set it up ahead of time rather than allocating them on-demand)
🗪
1:16:54jameswidman So, thread management is a bit like memory management (in that you want to set it up ahead of time rather than allocating them on-demand)
🗪
1:17:57robrobby The code to ask how many threads will be done simultaneously by the processor is to be added?
🗪
1:17:57robrobby The code to ask how many threads will be done simultaneously by the processor is to be added?
🗪
1:17:57robrobby The code to ask how many threads will be done simultaneously by the processor is to be added?
🗪
1:18:35alephant Is it possible that a work queue entry spawn another work queue entry?
🗪
1:18:35alephant Is it possible that a work queue entry spawn another work queue entry?
🗪
1:18:35alephant Is it possible that a work queue entry spawn another work queue entry?
🗪
1:19:26zuurr_ (Not an expert at all, which was part of why I asked the question) False sharing causes the processor to skip the cache when different threads access stuff on the same cache line
🗪
1:19:26zuurr_ (Not an expert at all, which was part of why I asked the question) False sharing causes the processor to skip the cache when different threads access stuff on the same cache line
🗪
1:19:26zuurr_ (Not an expert at all, which was part of why I asked the question) False sharing causes the processor to skip the cache when different threads access stuff on the same cache line
🗪
1:21:41Pseudonym73 Actually, I can think of one use case for a compiler fence without a memory fence: writing to CPU special registers like control registers or MSRs
🗪
1:21:41Pseudonym73 Actually, I can think of one use case for a compiler fence without a memory fence: writing to CPU special registers like control registers or MSRs
🗪
1:21:41Pseudonym73 Actually, I can think of one use case for a compiler fence without a memory fence: writing to CPU special registers like control registers or MSRs
🗪
1:22:34kemosabe76 Getting back into C/C++ coding after many years. Don't know why you are mixing C-style structs and C++ structs?
🗪
1:22:34kemosabe76 Getting back into C/C++ coding after many years. Don't know why you are mixing C-style structs and C++ structs?
🗪
1:22:34kemosabe76 Getting back into C/C++ coding after many years. Don't know why you are mixing C-style structs and C++ structs?
🗪
1:22:52Close things down
🗩
1:22:52Close things down
🗩
1:22:52Close things down
🗩