Skip to content

Commit

Permalink
Revert "Revert "apacheGH-37848: [C++][Gandiva] Migrate LLVM JIT engin…
Browse files Browse the repository at this point in the history
…e from MCJIT to ORC v2/LLJIT (apache#39098)""

This reverts commit 2f34923.
  • Loading branch information
ryantse committed Mar 30, 2024
1 parent fa3716f commit f2aaf08
Show file tree
Hide file tree
Showing 18 changed files with 441 additions and 199 deletions.
2 changes: 1 addition & 1 deletion cpp/cmake_modules/FindLLVMAlt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ if(LLVM_FOUND)
debuginfodwarf
ipo
linker
mcjit
native
orcjit
target)
if(LLVM_VERSION_MAJOR GREATER_EQUAL 14)
list(APPEND LLVM_TARGET_COMPONENTS passes)
Expand Down
17 changes: 15 additions & 2 deletions cpp/src/gandiva/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ class GANDIVA_EXPORT Configuration {

explicit Configuration(bool optimize,
std::shared_ptr<FunctionRegistry> function_registry =
gandiva::default_function_registry())
gandiva::default_function_registry(),
bool dump_ir = false)
: optimize_(optimize),
target_host_cpu_(true),
function_registry_(function_registry) {}
function_registry_(std::move(function_registry)),
dump_ir_(dump_ir) {}

Configuration() : Configuration(true) {}

Expand All @@ -50,11 +52,13 @@ class GANDIVA_EXPORT Configuration {

bool optimize() const { return optimize_; }
bool target_host_cpu() const { return target_host_cpu_; }
bool dump_ir() const { return dump_ir_; }
std::shared_ptr<FunctionRegistry> function_registry() const {
return function_registry_;
}

void set_optimize(bool optimize) { optimize_ = optimize; }
void set_dump_ir(bool dump_ir) { dump_ir_ = dump_ir; }
void target_host_cpu(bool target_host_cpu) { target_host_cpu_ = target_host_cpu; }
void set_function_registry(std::shared_ptr<FunctionRegistry> function_registry) {
function_registry_ = std::move(function_registry);
Expand All @@ -65,6 +69,9 @@ class GANDIVA_EXPORT Configuration {
bool target_host_cpu_; /* set the mcpu flag to host cpu while compiling llvm ir */
std::shared_ptr<FunctionRegistry>
function_registry_; /* function registry that may contain external functions */
// flag indicating if IR dumping is needed, defaults to false, and turning it on will
// negatively affect performance
bool dump_ir_ = false;
};

/// \brief configuration builder for gandiva
Expand All @@ -83,6 +90,12 @@ class GANDIVA_EXPORT ConfigurationBuilder {
return configuration;
}

std::shared_ptr<Configuration> build_with_ir_dumping(bool dump_ir) {
std::shared_ptr<Configuration> configuration(
new Configuration(true, gandiva::default_function_registry(), dump_ir));
return configuration;
}

std::shared_ptr<Configuration> build(
std::shared_ptr<FunctionRegistry> function_registry) {
std::shared_ptr<Configuration> configuration(
Expand Down
Loading

0 comments on commit f2aaf08

Please sign in to comment.