Skip to content

Commit

Permalink
Reuse column_cache in OOM handling logic (#7646)
Browse files Browse the repository at this point in the history
Signed-off-by: Misiu Godfrey <misiu.godfrey@kraken.mapd.com>
  • Loading branch information
yoonminnam authored and misiugodfrey committed Aug 26, 2024
1 parent ad61921 commit c1eb564
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion QueryEngine/ColumnFetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ std::string getMemoryLevelString(Data_Namespace::MemoryLevel memoryLevel) {
}
} // namespace

ColumnFetcher::ColumnFetcher(Executor* executor, const ColumnCacheMap& column_cache)
ColumnFetcher::ColumnFetcher(Executor* executor, ColumnCacheMap& column_cache)
: executor_(executor), columnarized_table_cache_(column_cache) {}

//! Gets a column fragment chunk on CPU or on GPU depending on the effective
Expand Down
4 changes: 2 additions & 2 deletions QueryEngine/ColumnFetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ using MergedChunk = std::pair<AbstractBuffer*, AbstractBuffer*>;

class ColumnFetcher {
public:
ColumnFetcher(Executor* executor, const ColumnCacheMap& column_cache);
ColumnFetcher(Executor* executor, ColumnCacheMap& column_cache);

//! Gets one chunk's pointer and element count on either CPU or GPU.
static std::pair<const int8_t*, size_t> getOneColumnFragment(
Expand Down Expand Up @@ -183,7 +183,7 @@ class ColumnFetcher {
mutable std::mutex linearization_mutex_;
mutable std::mutex chunk_list_mutex_;
mutable std::mutex linearized_col_cache_mutex_;
mutable ColumnCacheMap columnarized_table_cache_;
ColumnCacheMap& columnarized_table_cache_;
mutable std::unordered_map<InputColDescriptor, std::unique_ptr<const ColumnarResults>>
columnarized_scan_table_cache_;
using DeviceMergedChunkIterMap = std::unordered_map<int, int8_t*>;
Expand Down
4 changes: 2 additions & 2 deletions QueryEngine/RelAlgExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3877,6 +3877,7 @@ ExecutionResult RelAlgExecutor::executeWorkUnit(
handlePersistentError(e.getErrorCode());
return handleOutOfMemoryRetry(
{ra_exe_unit, work_unit.body, local_groups_buffer_entry_guess},
column_cache,
targets_meta,
is_agg,
co,
Expand Down Expand Up @@ -4155,6 +4156,7 @@ bool RelAlgExecutor::isRowidLookup(const WorkUnit& work_unit) {

ExecutionResult RelAlgExecutor::handleOutOfMemoryRetry(
const RelAlgExecutor::WorkUnit& work_unit,
ColumnCacheMap& column_cache,
const std::vector<TargetMetaInfo>& targets_meta,
const bool is_agg,
const CompilationOptions& co,
Expand Down Expand Up @@ -4191,7 +4193,6 @@ ExecutionResult RelAlgExecutor::handleOutOfMemoryRetry(
"kernels disabled.";
const auto ra_exe_unit = decide_approx_count_distinct_implementation(
ra_exe_unit_in, table_infos, executor_, co.device_type, target_exprs_owned_);
ColumnCacheMap column_cache;
result = {executor_->executeWorkUnit(max_groups_buffer_entry_guess,
is_agg,
table_infos,
Expand Down Expand Up @@ -4227,7 +4228,6 @@ ExecutionResult RelAlgExecutor::handleOutOfMemoryRetry(
iteration_ctr++;
auto ra_exe_unit = decide_approx_count_distinct_implementation(
ra_exe_unit_in, table_infos, executor_, co_cpu.device_type, target_exprs_owned_);
ColumnCacheMap column_cache;
try {
result = {executor_->executeWorkUnit(max_groups_buffer_entry_guess,
is_agg,
Expand Down
1 change: 1 addition & 0 deletions QueryEngine/RelAlgExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ class RelAlgExecutor : private StorageIOFacility {
bool isRowidLookup(const WorkUnit& work_unit);

ExecutionResult handleOutOfMemoryRetry(const RelAlgExecutor::WorkUnit& work_unit,
ColumnCacheMap& column_cache,
const std::vector<TargetMetaInfo>& targets_meta,
const bool is_agg,
const CompilationOptions& co,
Expand Down

0 comments on commit c1eb564

Please sign in to comment.