Youwei Wang has posted comments on this change. Change subject: IMPALA-2809: Improve ByteSwap with builtin function or SSE or AVX2. ......................................................................
Patch Set 3: (3 comments) http://gerrit.cloudera.org:8080/#/c/3081/3/be/src/benchmarks/bswap-benchmark.cc File be/src/benchmarks/bswap-benchmark.cc: Line 35: // Impala 317.2 1X > Please fix them in the code so future readers will understand. Done Line 156: if (num_bytes == 4) { > I think more than comments will be necessary. Can you reduce the repetition Sorry for missing that. DONE in the lastest submit. http://gerrit.cloudera.org:8080/#/c/3081/3/be/src/util/bit-util.inline.h File be/src/util/bit-util.inline.h: Line 140: const __m128i mask = _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, > Pseudocode: Hi Jim. Thank you for providing this pseudocode. Actually, the macro " #ifndef IR_COMPILE" has the same effect as "#ifdef SOME_MACRO_INDICATING_AVX_SUPPORT". The issue comes from this code: const __m128i mask = ... And the situation is a little complicated here. GCC has better support for SSE4.2 than AVX2. So it is okay to put this code " const __m128i mask = _mm_set_epi8(0, 1, 2, ... " outside the function body. However, the code "const __m256i mask = _mm256_set_epi8(0, 1, 2, 3, 4, ..." should not be moved out the function or it will not compile. (Proof here: https://godbolt.org/g/2K4CzQ[CAN'T compile], https://godbolt.org/g/CM3mlu[CAN compile]). As for the assemble code, this link: https://godbolt.org/g/Nn1ohp(WITH static) seems to store the mask128i value into some data segment while this link: https://godbolt.org/g/2A9DJC(WITHOUT static) not. I am preparing the testcode, and I will publish the result as soon as possible. -- To view, visit http://gerrit.cloudera.org:8080/3081 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I392ed5a8d5683f30f161282c228c1aedd7b648c1 Gerrit-PatchSet: 3 Gerrit-Project: Impala Gerrit-Branch: cdh5-trunk Gerrit-Owner: Youwei Wang <[email protected]> Gerrit-Reviewer: Alex Behm <[email protected]> Gerrit-Reviewer: Jim Apple <[email protected]> Gerrit-Reviewer: Marcel Kornacker <[email protected]> Gerrit-Reviewer: Mostafa Mokhtar <[email protected]> Gerrit-Reviewer: Tim Armstrong <[email protected]> Gerrit-Reviewer: Youwei Wang <[email protected]> Gerrit-HasComments: Yes
