Hacker News new | ask | show | jobs
by Someone 6 days ago
>> 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.

1 comments

I hate to be the one to invoke AI in this otherwise virgin thread, but AI is absolutely terrific for doing the not-hard, tedious work. This seems like a place where AI tools could be used to help the user learn - so long as he instructs the tool for each small task and doesn't lazily just have the tool do the thinking for him.