zanmato1984 commented on issue #40333:
URL: https://github.com/apache/arrow/issues/40333#issuecomment-1976961849

   > The wording could probably be improved, but there are two categories of 
SIMD optimizations in Arrow:
   > 
   > 1. some optimizations are enabled statically at compile-time; these are 
governed by `ARROW_SIMD_LEVEL`. If you compile with `ARROW_SIMD_LEVEL=AVX2` and 
execute on non-AVX2 CPU, the code will crash.
   > 2. some optimizations are selected dynamically at runtime; these are 
governed by `ARROW_RUNTIME_SIMD_LEVEL`. If you compile with 
`ARROW_RUNTIME_SIMD_LEVEL=AVX2` and execute on non-AVX2 CPU, a non-AVX2 code 
path (perhaps SSE2) will be executed. If you compile with 
`ARROW_RUNTIME_SIMD_LEVEL=AVX2` and execute on AVX2 CPU, a AVX2 code path will 
be executed (but not AVX512, because for that you would have needed 
`ARROW_RUNTIME_SIMD_LEVEL=AVX512`)
   
   This is very clear. Thank you.
   
   IIUC, macro family `ARROW_HAVE_*` is defined by `ARROW_SIMD_LEVEL` and macro 
family `ARROW_HAVE_RUNTIME_*` is defined by `ARROW_SIMD_RUNTIME_LEVEL`. But I'm 
still a little confused about the relationship between these two families, 
specifically: is one of them superior than the other?
   
   For example, function
   
https://github.com/apache/arrow/blob/2b194ad222f4dc8ecf2eb73539ab8cab5b1fc5e7/cpp/src/arrow/compute/kernels/aggregate_basic_internal.h#L55
   and its call site
   
https://github.com/apache/arrow/blob/2b194ad222f4dc8ecf2eb73539ab8cab5b1fc5e7/cpp/src/arrow/compute/kernels/aggregate_basic.cc#L1063-L1067
   seem to be completely controlled by the "runtime" family. Does it mean that, 
theoretically, all the simd code in arrow can be fully managed by 
`ARROW_RUNTIME_SIMD_LEVEL`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to