Csaba Ringhofer has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/24940 )

Change subject: IMPALA-11917: Upgrade to GCC 15 and LLVM 22
......................................................................


Patch Set 15:

(12 comments)

Most comments are about removing meaningless code after the opaque pointer 
change.I am ok with doing this in a different patch, but I think that it should 
be cleaned up, as the current code is very weird at some points unless the 
readers understands that it was migrated from old llvm code.

http://gerrit.cloudera.org:8080/#/c/24940/8//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/24940/8//COMMIT_MSG@56
PS8, Line 56:
> Perf runs:
thx, more optimizations can be investigated after this is merged


http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/codegen/codegen-anyval.cc
File be/src/codegen/codegen-anyval.cc:

http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/codegen/codegen-anyval.cc@97
PS15, Line 97:
             : llvm::PointerType* CodegenAnyVal::GetLoweredPtrType(
             :     LlvmCodeGen* cg, const ColumnType& type) {
             :   return cg->ptr_type();
             : }
Wouldn't it be clearer to remove this (+GetUnloweredPtrType and 
GetAnyValPtrType)? typed pointers are not gonna return AFAIK


http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/codegen/llvm-codegen-test.cc
File be/src/codegen/llvm-codegen-test.cc:

http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/codegen/llvm-codegen-test.cc@639
PS15, Line 639:     "struct.impala_udf::BooleanVal",
CollectionValue could be added as it has special handling


http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/codegen/llvm-codegen.h
File be/src/codegen/llvm-codegen.h:

http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/codegen/llvm-codegen.h@101
PS15, Line 101: Overloads
It seems clearer to me to use different name instead of overloads to make it 
clearer that these are not builtin llvm functions. Maybe 
"CreateAnyValLoad/Store"?


http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/codegen/llvm-codegen.h@102
PS15, Line 102: t tuple slots are only 8-byte aligned.
Is this correct? If I understand correctly the issue is about DecimalVal, not 
slots.


http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/codegen/llvm-codegen.h@310
PS15, Line 310:   template<class T>
              :   llvm::PointerType* GetStructPtrType() { return ptr_type_; }
              :
              :   template<class T>
              :   llvm::PointerType* GetStructPtrPtrType() { return ptr_type_; }
Remove these?


http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/codegen/llvm-codegen.h@577
PS15, Line 577:   llvm::PointerType* i8_ptr_type() { return ptr_type_; }
              :   llvm::PointerType* i16_ptr_type() { return ptr_type_; }
              :   llvm::PointerType* i32_ptr_type() { return ptr_type_; }
              :   llvm::PointerType* i64_ptr_type() { return ptr_type_; }
              :   llvm::PointerType* float_ptr_type() { return ptr_type_; }
              :   llvm::PointerType* double_ptr_type() { return ptr_type_; }
              :   llvm::PointerType* ptr_ptr_type() { return ptr_type_; }
Remove these?


http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/codegen/llvm-codegen.cc
File be/src/codegen/llvm-codegen.cc:

http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/codegen/llvm-codegen.cc@445
PS15, Line 445:   // Field layout mirrors what 
CodegenReadingStringOrCollectionVal uses: { ptr, i32 }.
This looks a bit odd - can't we ensure that it is always emitted?

Also, even if the current logic is needed, I would prefer to move it another 
function, e.g. codegen->GetTimestampValueStructType();

+same for FilterContext below


http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/codegen/llvm-codegen.cc@643
PS15, Line 643: GetSlotPtrType
Why not replace call sites with GetPtrType? Same for GetNamedPtrType. Or 
builder_->getPtrTy() could be called directly.


http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/exec/filter-context.cc
File be/src/exec/filter-context.cc:

http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/exec/filter-context.cc@422
PS15, Line 422: CreatePointerCast
This looks noop now - CreateStructGEP returns a pointer to a member, which we 
convert into a pointer.

Similarly, the GetNamedPtrType call is meaningless now. This seems a common 
pattern that can be simplified.


http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/udf/udf.h
File be/src/udf/udf.h:

http://gerrit.cloudera.org:8080/#/c/24940/15/be/src/udf/udf.h@735
PS15, Line 735: DecimalVals routinely live in 8-byte aligned
              : // memory (tuple slots, UDA buffers),
This sounds a bit wrong to me, the whole DecimalVals don't live in slots, as 
null handling is different


http://gerrit.cloudera.org:8080/#/c/24940/8/be/src/udf/udf.h
File be/src/udf/udf.h:

http://gerrit.cloudera.org:8080/#/c/24940/8/be/src/udf/udf.h@735
PS8, Line 735: // __int128_t has 16-byte alignment, but DecimalVals routinely 
live in 8-byte aligned
             : // memory (tuple slots, UDA buffers), where aligned SSE accesses 
(movaps) would fault.
             : // Lowering val16's alignment to 8 avoids that while keeping the 
layout (size 32, val16
             : // at offset 16) that UDFs compiled against earlier headers 
expect.
             : typedef __int128_t int128_align8_t __attribute__((aligned(8)));
             :
> Minor correction: is_null is the first byte of DecimalVal.
Can you extend the comment about what "earlier" means? Ideally udf.h should be 
understandable for someone not that familiar with Impala.
I think that we assume c++11 now, so static_asserts could check the size of 
structs. Maybe best done in another patch like "Impala 5 udf.h cleanup".

I am ok with the current solution, but another solution besides the 3 above 
would also make sense: we could go for 8 byte alignment and keep implicit 
padding of 7. This would break x86_64, but save 8 bytes and would be consistent 
with other AnyVal structs (unlike marking this packed).



--
To view, visit http://gerrit.cloudera.org:8080/24940
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I7dda730fa98ebe3825969265627a560b0c3095f9
Gerrit-Change-Number: 24940
Gerrit-PatchSet: 15
Gerrit-Owner: Michael Smith <[email protected]>
Gerrit-Reviewer: Balazs Hevele <[email protected]>
Gerrit-Reviewer: Csaba Ringhofer <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Joe McDonnell <[email protected]>
Gerrit-Reviewer: Laszlo Gaal <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Comment-Date: Fri, 02 Oct 2026 12:53:46 +0000
Gerrit-HasComments: Yes

Reply via email to