This is an automated email from the ASF dual-hosted git repository.

Mryange pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 7596090adee [opt](column) Inline column creation to enable cast 
vectorization (#69840)
7596090adee is described below

commit 7596090adee512f24cf7fe66dbc806468ce89901
Author: Mryange <[email protected]>
AuthorDate: Fri Oct 30 09:55:09 2026 +0800

    [opt](column) Inline column creation to enable cast vectorization (#69840)
    
    ### What problem does this PR solve?
    
    Issue Number: N/A
    
    Problem Summary:
    
    Some simple CAST loops remain scalar because
    `COWHelper::create(Args&&...)` is not inlined. Root cause: forwarding a
    row-count lvalue passes its address to the factory. When output stores
    may alias that escaped variable, the compiler cannot prove the loop
    bound is invariant and reports `UnsupportedUncountableLoop`.
    
    On x86 with Clang 20.1.8, `-O3` and AVX2, the factory exceeds the inline
    threshold for INT-to-BIGINT (cost 260 vs. 250) and
    numeric/Decimal-to-BOOLEAN (255 vs. 250). This is not ARM-specific. Mark
    the small factory wrapper `ALWAYS_INLINE` so the compiler can see
    through column construction and optimize affected callers.
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test
    - [x] Manual test: compiled `function_cast_int.cpp` before/after with
    Clang optimization remarks and inspected assembly. The non-null
    INT-to-BIGINT loop changes from scalar code to AVX2 `vpmovsxdq`, with
    vectorization width 4 and interleave count 4. The null-map path still
    has a separate vectorization blocker.
    - [x] Manual test: diagnostic compilation of `function_cast_bool.cpp`
    confirms the same escaped-bound blocker in 26 numeric/Decimal-to-BOOLEAN
    instances; an isolated temporary-row-count experiment removes that
    blocker. This BOOLEAN experiment validates the cause, not the final
    patch across every instance.
    - [x] Formatting, `git diff --check`, and
    `build-support/check-build-hygiene.sh` passed.
    - Full BE build, runtime benchmarks, SQL regression tests and ARM
    recompilation were not run. In the INT translation-unit experiment,
    object text grows from 448,711 to 478,128 bytes (about 6.6%); runtime
    speedup has not been measured.
    - Behavior changed:
        - [x] No. SQL conversion semantics are unchanged.
    - Does this need documentation?
        - [x] No.
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label
---
 be/src/core/cow.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/be/src/core/cow.h b/be/src/core/cow.h
index 7fb4cb4f754..89c6228223d 100644
--- a/be/src/core/cow.h
+++ b/be/src/core/cow.h
@@ -429,7 +429,7 @@ public:
     //       |                               ~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~
     // ColumnPtr res_data_column = ColumnUInt8::create(1, 1);
     template <typename... Args>
-    static MutablePtr create(Args&&... args) {
+    ALWAYS_INLINE static MutablePtr create(Args&&... args) {
         return MutablePtr(new Derived(std::forward<Args>(args)...));
     }
 #include "common/compile_check_avoid_end.h"


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

Reply via email to