3 ms·
Actual ELI5: SIMD, or Single Instruction, Multiple Data, allows the computer to do the same operation (like adding numbers) on many pieces of data all at once.
by alecco 3y ago
Actual ELI5:
SIMD, or Single Instruction, Multiple Data, allows the computer to do the same operation (like adding numbers) on many pieces of data all at once. This is just like if you had multiple pairs of numbers and you could add all pairs together at the same time.
So instead of doing:
1 + 5 = 6
2 + 6 = 8
3 + 7 = 10
4 + 8 = 12
All separately, the computer can do in one go:
(1,2,3,4) + (5,6,7,8) = (6,8,10,12)
But what if we don't want to add all pairs of numbers? What if we wanted to keep one of the numbers from the first group the same, and not add anything to it? That's where "masking" comes in.
Using the mask (true/yes, true/yes, false/no, true/yes), we tell the computer to only add the pairs where the mask says 'yes', and skip where it says 'no'.
So, instead of getting (6,8,10,12), we get (6,8,3,12) because we told the computer to skip adding anything to the third number in the first group.
sum_masked(mask=(true,true,false,true), a=(1,2,3,4), b=(5,6,7,8)) = (6,8,10,12)
This saves a lot of work. And the problem gets worse as the vectors get larger. AVX-512 vectors are very large so this is significant.
(with rephrasing from https://chat.openai.com/?model=gpt-4 https://chat.openai.com/?model=gpt-4)