I don't know that much about vectorization, but I am interested in understanding why a language like python can not provide vectorization on iterables through a library interface, much like it provides threading support. I am aware that many numpy methods are vectorized, but it can be limiting to have to work with numpy for generic computations.
My current understanding is that python is not capable of vectorizing functions even if they match the "SIMD" pattern. For instance, in theory shouldn't any list comprehension or use of the map()
function be vectorizable because they output a list which is the result of running the same function on independent inputs from an input list?
With my niave understanding, it seems that anytime I use map()
, in theory, I should be able to create an instruction set that represents the function; then each element in the input just needs to be run through the same function that was compiled. What is the technical challenge to designing a tool that provides simd_map(func, iterable)
, which attempts to compile func
"just in time" and then grabs batches of input from iterable
and utilizes the processor's simd capabilities to run those batches through func()
?
Thanks!