Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-11916

base::IsAarch64 should be inlined

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • Impala 4.3.0
    • Backend
    • None
    • ghx-label-3

    Description

      In a perf test, I see base::IsAarch64() show up:

      Overhead  Shared Object                    Symbol
        27.20%  impalad                         [.] kudu::BlockBloomFilter::BucketFindAVX2
        22.78%  impalad                         [.] snappy::RawUncompress
         2.90%  impalad                         [.] kudu::BlockBloomFilter::Find
         2.86%  impalad                         [.] impala::BitPacking::UnpackAndDecodeValues<impala::StringValue>
         2.79%  [kernel]                        [k] 0xffffffffb51b507e
         2.44%  impalad                         [.] impala::BitPacking::UnpackAndDecode32Values<impala::StringValue, 3>
         2.26%  impalad                         [.] impala::ScalarColumnReader<long, (parquet::Type::type)2, true>::ReadSlotsNoConversion
         1.72%  impalad                         [.] impala::BitPacking::UnpackAndDecode32Values<impala::DecimalValue<long>, 6>
         1.71%  libc-2.27.so                    [.] __memset_avx2_erms
         1.70%  impalad                         [.] impala::ScalarColumnReader<impala::StringValue, (parquet::Type::type)6, true>::ReadSlotsNoConversion
         1.61%  libhadoop.so.1.0.0              [.] pipelined_crc32c
         0.65%  [kernel]                        [k] 0xffffffffb51cedf7
         0.57%  impalad                         [.] impala::ScalarColumnReader<impala::DecimalValue<long>, (parquet::Type::type)7, true>::ReadSlotsNoConversion
         0.47%  libc-2.27.so                    [.] __memcpy_avx_unaligned_erms
         0.43%  [kernel]                        [k] 0xffffffffb49db710
         0.41%  impalad                         [.] base::IsAarch64
         0.32%  impalad                         [.] impala::HdfsParquetScanner::AssembleRows<false>
         0.28%  impalad                         [.] impala::RleBatchDecoder<unsigned int>::DecodeLiteralValues<impala::DecimalValue<long> >
         0.27%  libc-2.27.so                    [.] __memcmp_avx2_movbe
         0.25%  impalad                         [.] impala::HdfsParquetScanner::FillScratchMicroBatches
         0.18%  impalad                         [.] impala::BitPacking::UnpackAndDecodeValues<impala::DecimalValue<long> >
         0.16%  impalad                         [.] free
      

      It just simply returns true for ARM and false for X86 so should be inlined:

      bool IsAarch64(void) {
      #ifdef __aarch64__
        return true;
      #else
        return false;
      #endif
      }
      

      Note that the hot path that uses it is in HashUtil::Hash() (be/src/util/hash-util.h):

        static uint32_t Hash(const void* data, int32_t bytes, uint32_t seed) {
          if (base::IsAarch64() || LIKELY(CpuInfo::IsSupported(CpuInfo::SSE4_2))) {
            return CrcHash(data, bytes, seed);
          } else {
            return MurmurHash2_64(data, bytes, seed);
          }   
        }
      

      Attachments

        Activity

          People

            stigahuang Quanlong Huang
            stigahuang Quanlong Huang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: