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

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


Patch Set 5:

(15 comments)

http://gerrit.cloudera.org:8080/#/c/20733/3//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/20733/3//COMMIT_MSG@28
PS3, Line 28: compared to the previous use of ExecutionEngine. Post-change,
> Doesn't the benchmarking framework print a grand total? If not, we can let
It seems our benchmarking framework doesn't print the total. Will double check 
and file a jira if we don't have it.


http://gerrit.cloudera.org:8080/#/c/20733/4//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/20733/4//COMMIT_MSG@18
PS4, Line 18:  the executi
> Why are they pre-compiled? Aren't they compiled already? Or you mean they a
I think the "pre-compiled" means it is compiled in the last round and ready for 
use. Yeah, maybe call it "compiled" is better, because in this case it means 
the first round to write the compiled stuff into the cache.


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

http://gerrit.cloudera.org:8080/#/c/20733/4/be/src/codegen/llvm-codegen-cache.h@164
PS4, Line 164: cached_engine
> Thinking about this, wouldn't 'cached_engine...' express the meaning better
Done


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

http://gerrit.cloudera.org:8080/#/c/20733/4/be/src/codegen/llvm-codegen-cache.cc@155
PS4, Line 155: y
> I think removing the negation and inverting the branches is better, one les
Done


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

http://gerrit.cloudera.org:8080/#/c/20733/4/be/src/codegen/llvm-codegen-object-cache.cc@39
PS4, Line 39: uffer().size();
> Is a copy necessary here? Can't we move the buffer somehow?
CodeGenObjectCache doesn't have the ownership of ObjBuffer, the llvm engine may 
use the ObjBuffer later, so it is safer to make a copy. (And MemoryBufferRef 
may not allow to move the real Buffer, the example I can see is to do a copy)


http://gerrit.cloudera.org:8080/#/c/20733/4/be/src/codegen/llvm-codegen-object-cache.cc@42
PS4, Line 42:     // can conserve memory.
> Shouldn't we add a DCHECK here? If this happens it is a bug.
Done


http://gerrit.cloudera.org:8080/#/c/20733/4/be/src/codegen/llvm-codegen-object-cache.cc@57
PS4, Line 57:   // ID. If the ID doesn't match the one in the object cache, a 
warning is logged for
> Will it always copy the buffer? Is there a way to access it without copying
>From the definition of the interface getObject(), "Returns a pointer to a 
>newly allocated MemoryBuffer that contains the object which corresponds with 
>Module M", it would be safer to return the copy of the buffer. 
>https://llvm.org/doxygen/classllvm_1_1ObjectCache.html#details


http://gerrit.cloudera.org:8080/#/c/20733/4/be/src/codegen/llvm-codegen-object-cache.cc@60
PS4, Line 60:   std::lock_guard<std::mutex> l(mutex_);
> Shouldn't we add a DCHECK here? If this happens it is a bug.
Done


http://gerrit.cloudera.org:8080/#/c/20733/4/be/src/codegen/llvm-codegen-object-cache.cc@63
PS4, Line 63:               << cached_obj_->getMemBufferRef().getBufferSize();
> Can this function be called when 'key_' is empty? Isn't that a bug?
If there is no cache yet, would return nullptr, for example, the llvm engine 
would look up the cache to see if it contains the pre-compiled module, if it 
doesn't contain any, the llvm engine would proceed to compile the module and 
then write compiled module to the cache. This happens in cache look up and 
doesn't hit any.


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

http://gerrit.cloudera.org:8080/#/c/20733/4/be/src/codegen/llvm-codegen.h@330
PS4, Line 330:
> See comment on llvm-codegen-cache.h:164.
Changed the one in llvm-codegen-cache.h, but would prefer to keep this, because 
this one is the cache for llvm engine to write the compiled functions to, it 
doesn't have to be anything "cached". Added some comments.


http://gerrit.cloudera.org:8080/#/c/20733/4/be/src/codegen/llvm-codegen.h@925
PS4, Line 925:
> Do I understand it correctly that this is for writing to the cache (storing
Yes, we can say that the engine_cache_ is for writing, and engine_cache_cached_ 
is for reading. Added some comments.


http://gerrit.cloudera.org:8080/#/c/20733/4/be/src/codegen/llvm-codegen.h@929
PS4, Line 929:
> We could extend the comment with what is written on llvm-codegen.cc:1499, i
Added some comments.


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

http://gerrit.cloudera.org:8080/#/c/20733/4/be/src/codegen/llvm-codegen.cc@1192
PS4, Line 1192: the compiled codegened
> We no longer cache the engine.
Done


http://gerrit.cloudera.org:8080/#/c/20733/4/tests/custom_cluster/test_codegen_cache.py
File tests/custom_cluster/test_codegen_cache.py:

http://gerrit.cloudera.org:8080/#/c/20733/4/tests/custom_cluster/test_codegen_cache.py@169
PS4, Line 169:     When an 'llvm::ExecutionEngine', which is part of the cache 
entry, is destroyed, it
> The situation described in this paragraph is no longer true after this chan
Added some comments in the back.


http://gerrit.cloudera.org:8080/#/c/20733/4/tests/custom_cluster/test_codegen_cache.py@228
PS4, Line 228:
> 'fragments_ran' (plural) would be better. Applies also to L239.
Done



--
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: 5
Gerrit-Owner: Yida Wu <[email protected]>
Gerrit-Reviewer: Daniel Becker <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Yida Wu <[email protected]>
Gerrit-Comment-Date: Thu, 07 Dec 2023 13:32:56 +0000
Gerrit-HasComments: Yes

Reply via email to