Michael Smith has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/20733 )

Change subject: IMPALA-11805: Use llvm ObjectCache for codegen caching
......................................................................


Patch Set 2:

(11 comments)

http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-codegen-cache-test.cc
File be/src/codegen/llvm-codegen-cache-test.cc:

http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-codegen-cache-test.cc@298
PS2, Line 298:   // 130B for optimal mode, or 148B on ARM systems
I experimented with this. In practice I saw minimal (<= 8B) difference between 
normal and optimal modes.


http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-codegen-cache.h
File be/src/codegen/llvm-codegen-cache.h:

http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-codegen-cache.h@308
PS2, Line 308:   std::unordered_map<const LlvmObjCacheWrapper*, 
std::shared_ptr<LlvmObjCacheWrapper>>
This would also work as a std::unordered_set. 
https://en.cppreference.com/w/cpp/memory/shared_ptr/hash means the lookup would 
be based on pointer value. Lookups would construct a temporary shared_ptr, but 
it would reduce memory use.


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

http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-codegen.h@33
PS2, Line 33: #include <llvm/ADT/StringMap.h>
What's this used for?


http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-codegen.h@353
PS2, Line 353:   /// Returns the module id  if module_id is not nullptr.
Can you expand what module_id is used for. Would help to identify when to pass 
a non-null argument.


http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-codegen.h@920
PS2, Line 920:   /// engine_cache_wrapper_.
engine_cache_wrapper no longer owns an execution engine, so this comment is 
incorrect. Should be

  module_ is owned by execution_engine_.


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

http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-codegen.cc@a1185
PS2, Line 1185:
I thought this comment was kind of useful. And I see you still use it at line 
1207, so we should keep them all.


http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-codegen.cc@496
PS2, Line 496:   unique_ptr<CodeGenObjectCache> obj_cache(new 
CodeGenObjectCache);
Why initialize it this way? You could also just pass "new CodegenObjectCache" 
on line 503.


http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-codegen.cc@498
PS2, Line 498:   execution_engine_ = std::move(execution_engine);
You could directly assign to execution_engine_ on line 479. Lots of extra moves 
here for no additional use or clarity.


http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-codegen.cc@499
PS2, Line 499:   unique_ptr<CodegenSymbolEmitter> symbol_emitter =
Why not assign directly to symbol_emitter_?


http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-object-cache-wrapper.h
File be/src/codegen/llvm-object-cache-wrapper.h:

http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-object-cache-wrapper.h@44
PS2, Line 44: /// Class that encapsulates a non-NULL 'CodeGenObjectCache' and 
possibly other objects
possibly other objects seems weird as there aren't other objects. Do we really 
need this wrapper?


http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-object-cache-wrapper.cc
File be/src/codegen/llvm-object-cache-wrapper.cc:

http://gerrit.cloudera.org:8080/#/c/20733/2/be/src/codegen/llvm-object-cache-wrapper.cc@66
PS2, Line 66: size_t CodeGenObjectCache::objSize() {
Is sizeof(CodeGenObjectCache) accounted for elsewhere?



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic3c1b46bb9018ed0320817141785a3bdc41fa677
Gerrit-Change-Number: 20733
Gerrit-PatchSet: 2
Gerrit-Owner: Yida Wu <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Comment-Date: Tue, 28 Nov 2023 18:19:32 +0000
Gerrit-HasComments: Yes

Reply via email to