| >> writing SIMD is just about as easy as a for loop > and then the first example requires 12 lines to replace one line of scalar code. > Be honest and say SIMD is hard but the results are worth it! I think SIMD, and certainly that first example is way more tedious than it is hard. What makes it tedious are - you have to figure out how many things your hardware can do in parallel - you have to chop up the work in packets of that size - once you have your results, you have to ‘unchop’ them - if there is a chance ‘chopping up’ leaves you with remaining items, you have to handle that case separately - if the code you want to apply SIMD to uses constants, you have to create vectors containing copies of them Neither of those is particularly hard, but each adds work, making things tedious. |