Mryange opened a new pull request, #69840:
URL: https://github.com/apache/doris/pull/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
   


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