Qifan Chen has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/16621 )

Change subject: IMPALA-3816: Codegen perf critical loops in Sorter
......................................................................


Patch Set 9:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/16621/8/be/src/runtime/sorter.cc
File be/src/runtime/sorter.cc:

http://gerrit.cloudera.org:8080/#/c/16621/8/be/src/runtime/sorter.cc@1215
PS8, Line 1215:   llvm::Function* fn = 
codegen->GetFunction(IRFunction::TUPLE_SORTER_SORT_HELPER, true);
> Looks like there is only on call to SortHelper() which is from Sorter::Tupl
Did some additional testing with instrumentation and found the return addresses 
reported via __builtin_return_address(0) in the LLVM and non-LLVM version of 
SortHelper() are quite different: In the range of 0x7f7f12135exx for LLVM and 
0x18c2yyy in non-LLVM. Note that __builtin_return_address(0) returns the 
address of the instruction after a function call.


167 Status Sorter::TupleSorter::SortHelper(TupleIterator begin, TupleIterator 
end) {
168   // Use insertion sort for smaller sequences.
169
170   printf("Enter SortHelper(): return_address(0)=%p\n", 
__builtin_return_address(0));
171
172   while (end.index() - begin.index() > INSERTION_THRESHOLD) {
173     // Select a pivot and call Partition() to split the tuples in [begin, 
end) into two
174     // groups (<= pivot and >= pivot) in-place. 'cut' is the index of the 
first tuple in
175     // the second group.
176     Tuple* pivot = SelectPivot(begin, end);
177     TupleIterator cut;
178     RETURN_IF_ERROR(Partition(begin, end, pivot, &cut));
179
180     // Recurse on the smaller partition. This limits stack size to log(n) 
stack frames.
181     if (cut.index() - begin.index() < end.index() - cut.index()) {
182       // Left partition is smaller.
183   printf("call SortHelper() for [begin, cut]\n");
184       RETURN_IF_ERROR(SortHelper(begin, cut));
185       begin = cut;
186     } else {
187       // Right partition is equal or smaller.
188   printf("call SortHelper() for [cut, end]\n");
189       RETURN_IF_ERROR(SortHelper(cut, end));
190       end = cut;
191     }
192   }
193
194   if (begin.index() < end.index()) RETURN_IF_ERROR(InsertionSort(begin, 
end));
195
196   printf("Exit SortHelper(): return_address(0)=%p\n", 
__builtin_return_address(0));
197   return Status::OK();
198 }



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie08137449d4a7b554ca8b8650260f8bd72e0a81b
Gerrit-Change-Number: 16621
Gerrit-PatchSet: 9
Gerrit-Owner: Qifan Chen <[email protected]>
Gerrit-Reviewer: Csaba Ringhofer <[email protected]>
Gerrit-Reviewer: Daniel Becker <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Qifan Chen <[email protected]>
Gerrit-Reviewer: Sahil Takiar <[email protected]>
Gerrit-Reviewer: Tim Armstrong <[email protected]>
Gerrit-Comment-Date: Tue, 03 Nov 2020 01:21:09 +0000
Gerrit-HasComments: Yes

Reply via email to