zclllyybb opened a new pull request, #64161:
URL: https://github.com/apache/doris/pull/64161

   Root cause: clang lowers Doris floating mod/fmod to libm std::fmod for every 
non-null row. On the arithmetic operator benchmark distribution, especially 
large lhs with sub-unit or small rhs and float inputs promoted to double, that 
libm path dominates expression execution while SR/GCC-like code uses x87 fprem 
plus cheap finite and magnitude fast paths.
   
   Fix: add fmod_fast helpers for double/float on x86_64 that inline the x87 
fprem sequence, keep std::fmod fallback for zero divisor and non-finite inputs, 
and preserve Doris null semantics by still writing the null map for 
vector-vector and constant/vector shapes. Wire only floating mod/fmod paths to 
the helpers; integer, decimal, and pmod behavior stay unchanged.
   
   ```
   case                  baseline mean    patched mean    speedup
   ━━━━━━━━━━━━━━━━━━━━  ━━━━━━━━━━━━━━━  ━━━━━━━━━━━━━━  ━━━━━━━━━
     Double_DB_DB                91.2 ms         76.1 ms      1.20x
   ────────────────────  ───────────────  ──────────────  ─────────
     Double_IN_ONE_DB           102.2 ms         87.1 ms      1.17x
   ────────────────────  ───────────────  ──────────────  ─────────
     Double_DB_IN_ONE           473.7 ms        120.7 ms      3.92x
   ────────────────────  ───────────────  ──────────────  ─────────
     Double_DB_IN_TEN           205.4 ms        108.5 ms      1.89x
   ────────────────────  ───────────────  ──────────────  ─────────
     Double_MIXED_ZERO          302.1 ms        141.7 ms      2.13x
   ────────────────────  ───────────────  ──────────────  ─────────
     Double_VectorConst         413.6 ms        102.5 ms      4.03x
   ────────────────────  ───────────────  ──────────────  ─────────
     Double_ConstVector          80.0 ms         79.1 ms      1.01x
   ────────────────────  ───────────────  ──────────────  ─────────
     Double_Nullable            488.4 ms        153.2 ms      3.19x
   ────────────────────  ───────────────  ──────────────  ─────────
     Float_DB_DB                 75.2 ms         70.7 ms      1.06x
   ────────────────────  ───────────────  ──────────────  ─────────
     Float_DB_IN_ONE            525.7 ms        114.7 ms      4.58x
   ────────────────────  ───────────────  ──────────────  ─────────
     Float_VectorConst          414.2 ms        106.4 ms      3.89x
   ```


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to