Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions omniscidb/QueryEngine/CompilationOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,17 @@ std::ostream& operator<<(std::ostream& os, const ExecutionOptions& eo) {
<< "preserve_order=" << eo.preserve_order << "\n";
return os;
}

std::ostream& operator<<(std::ostream& os, const ExecutorOptLevel& ol) {
switch (ol) {
case ExecutorOptLevel::Default:
return os << "ExecutorOptLevel::Default";

case ExecutorOptLevel::ReductionJIT:
return os << "ExecutorOptLevel::ReductionJIT";

default:
return os << "Unknown ExecutorOptLevel";
}
}
#endif
1 change: 1 addition & 0 deletions omniscidb/QueryEngine/CompilationOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ struct ExecutionOptions {

#ifndef __CUDACC__
std::ostream& operator<<(std::ostream& os, const ExecutionOptions& eo);
std::ostream& operator<<(std::ostream& os, const ExecutorOptLevel& ol);
#endif

#endif // QUERYENGINE_COMPILATIONOPTIONS_H
4 changes: 3 additions & 1 deletion omniscidb/QueryEngine/Execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,9 @@ ReductionCode get_reduction_code(
this_result_set->getTargetInitVals(),
config,
executor);
return reduction_jit.codegen();
auto reduction_co = CompilationOptions::makeCpuOnly(co);
reduction_co.opt_level = ExecutorOptLevel::ReductionJIT;
return reduction_jit.codegen(reduction_co);
};

} // namespace
Expand Down
5 changes: 4 additions & 1 deletion omniscidb/QueryEngine/ResultSetReduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,10 @@ ResultSet* ResultSetManager::reduce(std::vector<ResultSet*>& result_sets,
result_rs->getTargetInitVals(),
config,
executor);
auto reduction_code = reduction_jit.codegen();
CompilationOptions co = {
ExecutorDeviceType::CPU, false, ExecutorOptLevel::ReductionJIT, false};
co.codegen_traits_desc = co.getCgenTraitsDesc(ExecutorDeviceType::CPU);
auto reduction_code = reduction_jit.codegen(co);
size_t ctr = 1;
for (auto result_it = result_sets.begin() + 1; result_it != result_sets.end();
++result_it) {
Expand Down
10 changes: 5 additions & 5 deletions omniscidb/QueryEngine/ResultSetReductionJIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,12 @@ ResultSetReductionJIT::ResultSetReductionJIT(const QueryMemoryDescriptor& query_
// for that_entry_index in [start_entry_index, end_entry_index):
// reduce_func_idx(this_buff, that_buff, that_entry_index)

ReductionCode ResultSetReductionJIT::codegen() const {
ReductionCode ResultSetReductionJIT::codegen(const CompilationOptions& co) const {
CHECK_EQ(co.device_type, ExecutorDeviceType::CPU);
CHECK_EQ(co.hoist_literals, false);
CHECK_EQ(co.opt_level, ExecutorOptLevel::ReductionJIT);
CHECK_EQ(co.allow_lazy_fetch, false);
const auto hash_type = query_mem_desc_.getQueryDescriptionType();
CompilationOptions co{
ExecutorDeviceType::CPU, false, ExecutorOptLevel::ReductionJIT, false};

co.codegen_traits_desc = co.getCgenTraitsDesc(ExecutorDeviceType::CPU);

if (query_mem_desc_.didOutputColumnar() || !is_aggregate_query(hash_type)) {
return {};
Expand Down
2 changes: 1 addition & 1 deletion omniscidb/QueryEngine/ResultSetReductionJIT.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ResultSetReductionJIT {
virtual ~ResultSetReductionJIT() = default;

// Generate the code for the result set reduction loop.
virtual ReductionCode codegen() const;
virtual ReductionCode codegen(const CompilationOptions& co) const;

protected:
// Generate a function which checks whether a row is empty.
Expand Down
15 changes: 12 additions & 3 deletions omniscidb/Tests/ResultSetTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,10 @@ TEST(MoreReduce, MissingValues) {
rs1->getTargetInitVals(),
config(),
executor.get());
const auto reduction_code = reduction_jit.codegen();
CompilationOptions co = {
ExecutorDeviceType::CPU, false, ExecutorOptLevel::ReductionJIT, false};
co.codegen_traits_desc = co.getCgenTraitsDesc(ExecutorDeviceType::CPU);
const auto reduction_code = reduction_jit.codegen(co);
ResultSetReduction::reduce(
*storage1, *storage2, {}, reduction_code, config(), executor.get());
{
Expand Down Expand Up @@ -2091,7 +2094,10 @@ TEST(MoreReduce, MissingValuesKeyless) {
rs1->getTargetInitVals(),
config(),
executor.get());
const auto reduction_code = reduction_jit.codegen();
CompilationOptions co = {
ExecutorDeviceType::CPU, false, ExecutorOptLevel::ReductionJIT, false};
co.codegen_traits_desc = co.getCgenTraitsDesc(ExecutorDeviceType::CPU);
const auto reduction_code = reduction_jit.codegen(co);
ResultSetReduction::reduce(
*storage1, *storage2, {}, reduction_code, config(), executor.get());
{
Expand Down Expand Up @@ -2183,7 +2189,10 @@ TEST(MoreReduce, OffsetRewrite) {
rs1->getTargetInitVals(),
config(),
executor.get());
const auto reduction_code = reduction_jit.codegen();
CompilationOptions co = {
ExecutorDeviceType::CPU, false, ExecutorOptLevel::ReductionJIT, false};
co.codegen_traits_desc = co.getCgenTraitsDesc(ExecutorDeviceType::CPU);
const auto reduction_code = reduction_jit.codegen(co);
ResultSetReduction::reduce(*storage1,
*storage2,
serialized_varlen_buffer,
Expand Down