augustoasilva commented on a change in pull request #11193:
URL: https://github.com/apache/arrow/pull/11193#discussion_r713854557
##########
File path: cpp/src/gandiva/llvm_generator.h
##########
@@ -49,10 +51,48 @@ class GANDIVA_EXPORT LLVMGenerator {
static Status Make(std::shared_ptr<Configuration> config,
std::unique_ptr<LLVMGenerator>* llvm_generator);
+ static std::shared_ptr<Cache<BaseCacheKey,
std::shared_ptr<llvm::MemoryBuffer>>>
+ GetCache();
+
/// \brief Build the code for the expression trees for default mode. Each
/// element in the vector represents an expression tree
Status Build(const ExpressionVector& exprs, SelectionVector::Mode mode);
+ /// \brief Build the code for the expression trees for default mode with a
LLVM
+ /// ObjectCache. Each element in the vector represents an expression tree
+ template <class KeyType>
+ Status Build(const ExpressionVector& exprs, SelectionVector::Mode mode,
+ GandivaObjectCache<KeyType>& obj_cache) {
+ selection_vector_mode_ = mode;
+
+ // Start measuring code gen time
+ auto begin = std::chrono::high_resolution_clock::now();
+ for (auto& expr : exprs) {
+ auto output = annotator_.AddOutputFieldDescriptor(expr->result());
+ ARROW_RETURN_NOT_OK(Add(expr, output));
+ }
+
+ // Stop measuring time, calculate the elapsed time and pass it to object
cache
+ auto end = std::chrono::high_resolution_clock::now();
+ size_t elapsed =
Review comment:
I know, but when the FinalizeModule is called, the LLVM will access the
GandivaObjectCache file to execute the logic for the object code manipulation
(to cache it or to get it from cache) so I need to set GandivaObjectCache
before the FinalizeModule execution, and before the code sets the
GandivaObjectCache it needs to know the elapsed time so the greedy dual cache
logic works.
Do you have any suggestions how to proceed with that case?
--
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]