On 10/11/26 12:16 AM, zengxx wrote:
Hi,

While looking at wide numeric aggregates, I found that the digit
accumulation loop in accum_sum_add() did not auto-vectorize.  It advances
two indexes together:

     for (val_i = 0; val_i < val_ndigits; val_i++)
     {
         accum_digits[i] += (int32) val_digits[val_i];
         i++;
     }

The attached patch advances the destination pointer once before the loop:

     accum_digits += accum->weight - val->weight;
     for (val_i = 0; val_i < val_ndigits; val_i++)
         accum_digits[val_i] += (int32) val_digits[val_i];

LGTM

Performance below is from one local machine, so it is motivation rather
than a universal claim.  The machine is WSL2/Linux on an i5-14400F using
GCC 13.3.0.  Each number is the median of 11 runs after 2 warmups; base
and feature used identical task files, settings, row counts, and
disposable clusters.
Please provide the test script. So as to facilitate testing on other
platforms.



Reply via email to