I can't find them in the Intel Intrinsic Guide v2.7. Do you know if AVX or AVX2 instruction sets support them?

有帮助吗?

解决方案

  • There are no scatter or gather instructions in the original AVX instruction set.

  • AVX2 adds gather, but not scatter instructions.

  • AVX512F includes both scatter and gather instructions.

  • AVX512PF additionally provides prefetch variants of gather and scatter instructions.

  • AVX512CD provides instructions to detect conflicts in scatter addresses.

  • Intel MIC (aka Xeon Phi, Knights Corner) does include gather and scatter instructions, but it is a separate coprocessor, and it can not run normal x86-64 code.

其他提示

As the other answer indicated, it is not possible to implement scatter for now, even on AVX2. However intel Optimization manual does provide us with a hand written version of scatter operation. It is on page 11-17 of Intel optimization manual 2013 version. Basically what do they do is they read the index everytime and store it into a general-purpose register, say, rax and then shift the correct number you want to a xmm register using things like vpalignr. Then we store the result to memory location with vmovss---move scalar single to memory. I guess this will be of low efficiency but I guess this is the only way to realize data scatter on X86 CPU architecture for now. On Xeon Phi things are beautiful, they provide native support for scatter operations and the first op, of course, is a memory location. So I believe if your code involves a lot of gather and scatter, switching to Xeon Phi will be a good choice. Please do reply to tell me if there is anything wrong in my reply.

Good Luck!

xiangpisaiMM

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top