Yida Wu has uploaded a new patch set (#7). ( http://gerrit.cloudera.org:8080/20733 )
Change subject: IMPALA-11805: Use llvm ObjectCache for codegen caching ...................................................................... IMPALA-11805: Use llvm ObjectCache for codegen caching Currently, we employ llvm::ExecutionEngine for codegen caching, providing access to compiled functions within the cached engine. However, the real challenge is the ExecutionEngine uses a lot of memory which largely exceeds our memory estimates and it is very hard to predict. This patch addresses this issue by using llvm::ObjectCache for codegen caching. In our case, each execution engine would have only one module, after the compilation of the module, the compiled codegened functions of the module would be set to the execution engine, therefore funtions could be used by Impala. During function compilation within the module, if an ObjectCache is set to the execution engine, the compiled codegened functions would be also written into the cache. This way, if we keep the cache, when revisiting the same module (fragment), we can efficiently reuse the specific ObjectCache, loading pre-compiled codegened functions and saving time. The tpch performance test indicates no significant regression compared to the previous use of ExecutionEngine. Post-change, the actual memory usage of each codegen caching entry is notably reduced. +----------+-----------------------+---------+------------+------------+----------------+ | Workload | File Format | Avg (s) | Delta(Avg) | GeoMean(s) | Delta(GeoMean) | +----------+-----------------------+---------+------------+------------+----------------+ | TPCH(1) | parquet / none / none | 0.22 | -0.65% | 0.20 | -0.75% | +----------+-----------------------+---------+------------+------------+----------------+ +----------+----------+-----------------------+--------+-------------+------------+------------+----------------+-------+----------------+---------+-------+ | Workload | Query | File Format | Avg(s) | Base Avg(s) | Delta(Avg) | StdDev(%) | Base StdDev(%) | Iters | Median Diff(%) | MW Zval | Tval | +----------+----------+-----------------------+--------+-------------+------------+------------+----------------+-------+----------------+---------+-------+ | TPCH(1) | TPCH-Q13 | parquet / none / none | 0.49 | 0.47 | +2.80% | 5.32% | 5.07% | 10 | +1.22% | 1.63 | 1.19 | | TPCH(1) | TPCH-Q4 | parquet / none / none | 0.16 | 0.16 | +3.51% | 1.32% | * 10.38% * | 10 | +0.06% | 0.49 | 1.06 | | TPCH(1) | TPCH-Q11 | parquet / none / none | 0.12 | 0.12 | +1.39% | 2.27% | 2.24% | 10 | +1.50% | 1.90 | 1.37 | | TPCH(1) | TPCH-Q19 | parquet / none / none | 0.21 | 0.21 | +1.56% | * 10.02% * | * 11.42% * | 10 | +1.18% | 0.57 | 0.32 | | TPCH(1) | TPCH-Q18 | parquet / none / none | 0.27 | 0.27 | +1.71% | 6.46% | 1.29% | 10 | -0.19% | -1.19 | 0.81 | | TPCH(1) | TPCH-Q6 | parquet / none / none | 0.11 | 0.11 | +0.79% | 2.76% | 2.15% | 10 | +0.10% | 1.46 | 0.71 | | TPCH(1) | TPCH-Q3 | parquet / none / none | 0.26 | 0.26 | +0.71% | 6.63% | 6.18% | 10 | +0.04% | 0.49 | 0.25 | | TPCH(1) | TPCH-Q17 | parquet / none / none | 0.17 | 0.17 | +0.41% | * 14.66% * | * 13.01% * | 10 | +0.05% | 0.40 | 0.07 | | TPCH(1) | TPCH-Q14 | parquet / none / none | 0.16 | 0.16 | +0.19% | 1.41% | 1.39% | 10 | +0.25% | 1.46 | 0.31 | | TPCH(1) | TPCH-Q20 | parquet / none / none | 0.17 | 0.17 | +0.22% | 1.70% | 1.77% | 10 | -0.05% | -0.40 | 0.28 | | TPCH(1) | TPCH-Q12 | parquet / none / none | 0.16 | 0.16 | -0.27% | 0.54% | 1.46% | 10 | +0.14% | 0.93 | -0.54 | | TPCH(1) | TPCH-Q22 | parquet / none / none | 0.11 | 0.11 | -0.38% | 0.81% | 2.06% | 10 | +0.03% | 0.22 | -0.54 | | TPCH(1) | TPCH-Q16 | parquet / none / none | 0.17 | 0.17 | -0.38% | 0.67% | 1.58% | 10 | -0.01% | -0.13 | -0.70 | | TPCH(1) | TPCH-Q8 | parquet / none / none | 0.27 | 0.27 | -0.08% | 1.24% | 1.15% | 10 | -0.33% | -1.37 | -0.15 | | TPCH(1) | TPCH-Q15 | parquet / none / none | 0.16 | 0.16 | -1.18% | * 16.61% * | * 10.25% * | 10 | +0.33% | 0.40 | -0.19 | | TPCH(1) | TPCH-Q1 | parquet / none / none | 0.22 | 0.22 | -1.67% | 1.62% | 7.45% | 10 | +0.43% | 1.02 | -0.70 | | TPCH(1) | TPCH-Q5 | parquet / none / none | 0.22 | 0.22 | -0.98% | 0.22% | 1.55% | 10 | -0.26% | -2.16 | -1.97 | | TPCH(1) | TPCH-Q21 | parquet / none / none | 0.48 | 0.49 | -1.18% | 3.58% | 4.40% | 10 | -0.25% | -1.19 | -0.66 | | TPCH(1) | TPCH-Q10 | parquet / none / none | 0.26 | 0.26 | -1.93% | 7.84% | 6.24% | 10 | -0.14% | -0.13 | -0.62 | | TPCH(1) | TPCH-Q7 | parquet / none / none | 0.18 | 0.19 | -3.31% | * 11.47% * | * 12.47% * | 10 | -0.25% | -1.72 | -0.63 | | TPCH(1) | TPCH-Q9 | parquet / none / none | 0.34 | 0.35 | -5.22% | 6.87% | * 10.03% * | 10 | -2.15% | -1.28 | -1.38 | | TPCH(1) | TPCH-Q2 | parquet / none / none | 0.16 | 0.18 | -11.00% | * 16.07% * | 3.84% | 10 | -0.90% | -1.81 | -2.35 | +----------+----------+-----------------------+--------+-------------+------------+------------+----------------+-------+----------------+---------+-------+ We are no longer using ExecutionEngine for caching, so we got rid of the LlvmExecutionEngineWrapper class. Instead, we brought in a new class CodeGenObjectCache to implement llvm::ObjectCache. Testing: Passed LlvmCodeGenCacheTest and custom_cluster/test_codegen_cache.py. Change-Id: Ic3c1b46bb9018ed0320817141785a3bdc41fa677 --- M be/src/codegen/CMakeLists.txt M be/src/codegen/llvm-codegen-cache-test.cc M be/src/codegen/llvm-codegen-cache.cc M be/src/codegen/llvm-codegen-cache.h A be/src/codegen/llvm-codegen-object-cache.cc A be/src/codegen/llvm-codegen-object-cache.h M be/src/codegen/llvm-codegen.cc M be/src/codegen/llvm-codegen.h D be/src/codegen/llvm-execution-engine-wrapper.h M tests/custom_cluster/test_codegen_cache.py 10 files changed, 453 insertions(+), 263 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/33/20733/7 -- 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: newpatchset Gerrit-Change-Id: Ic3c1b46bb9018ed0320817141785a3bdc41fa677 Gerrit-Change-Number: 20733 Gerrit-PatchSet: 7 Gerrit-Owner: Yida Wu <wydbaggio...@gmail.com> Gerrit-Reviewer: Daniel Becker <daniel.bec...@cloudera.com> Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Gerrit-Reviewer: Michael Smith <michael.sm...@cloudera.com> Gerrit-Reviewer: Yida Wu <wydbaggio...@gmail.com>