OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState Struct Reference
+ Collaboration diagram for anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState:

Public Types

enum  TuningDirection { TuningDirection::SMALLER, TuningDirection::LARGER }
 

Public Member Functions

 TuningState (const size_t bbox_intersect_max_table_size_bytes, const double bbox_intersect_target_entries_per_bin)
 
bool operator() (const HashTableProps &new_props, const bool new_bbox_intersect_threshold)
 
bool hashTableTooBig () const
 
bool keysPerBinIncreasing () const
 
bool previousIterationValid () const
 
bool keysPerBinUnderThreshold () const
 

Public Attributes

HashTableProps crt_props
 
HashTableProps prev_props
 
double chosen_bbox_intersect_threshold
 
TuningDirection tuning_direction {TuningDirection::SMALLER}
 
size_t crt_step
 
size_t crt_reverse_search_iteration
 
size_t bbox_intersect_max_table_size_bytes
 
double bbox_intersect_target_entries_per_bin
 
const size_t max_reverse_search_iterations {8}
 

Detailed Description

Definition at line 268 of file BoundingBoxIntersectJoinHashTable.cpp.

Member Enumeration Documentation

enum anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState::TuningDirection
strong
Enumerator
SMALLER 
LARGER 

Definition at line 285 of file BoundingBoxIntersectJoinHashTable.cpp.

285 { SMALLER, LARGER };

Constructor & Destructor Documentation

anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState::TuningState ( const size_t  bbox_intersect_max_table_size_bytes,
const double  bbox_intersect_target_entries_per_bin 
)
inline

Definition at line 269 of file BoundingBoxIntersectJoinHashTable.cpp.

274  , crt_step(0)

Member Function Documentation

bool anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState::operator() ( const HashTableProps new_props,
const bool  new_bbox_intersect_threshold 
)
inline

Returns true to continue tuning, false to end the loop with the above threshold

Definition at line 298 of file BoundingBoxIntersectJoinHashTable.cpp.

References CHECK, UNREACHABLE, and VLOG.

299  {
301  crt_props = new_props;
302  crt_step++;
303 
305  if (hashTableTooBig()) {
306  VLOG(1) << "Reached hash table size limit: "
308  << crt_props.hash_table_size << " byte hash table, "
309  << crt_props.keys_per_bin << " keys per bin.";
310  } else if (keysPerBinIncreasing()) {
311  VLOG(1) << "Keys per bin increasing from " << prev_props.keys_per_bin << " to "
314  }
315  if (previousIterationValid()) {
316  VLOG(1) << "Using previous threshold value " << chosen_bbox_intersect_threshold;
318  return false;
319  } else {
322  chosen_bbox_intersect_threshold = new_bbox_intersect_threshold;
323 
325  VLOG(1) << "Hit maximum number (" << max_reverse_search_iterations
326  << ") of reverse tuning iterations. Aborting tuning";
327  // use the crt props, but don't bother trying to tune any farther
328  return false;
329  }
330 
333  // hash table size is not changing, bail
334  VLOG(1) << "Hash table size not decreasing (" << crt_props.hash_table_size
335  << " bytes) and still above maximum allowed size ("
336  << bbox_intersect_max_table_size_bytes << " bytes). Aborting tuning";
337  return false;
338  }
339 
340  // if the hash table is too big on the very first step, change direction towards
341  // larger bins to see if a slightly smaller hash table will fit
342  if (crt_step == 1 && crt_reverse_search_iteration == 1) {
343  VLOG(1)
344  << "First iteration of tuning led to hash table size over "
345  "limit. Reversing search to try larger bin sizes (previous threshold: "
347  // Need to change direction of tuning to tune "up" towards larger bins
349  }
350  return true;
351  }
352  UNREACHABLE();
353  }
354 
355  chosen_bbox_intersect_threshold = new_bbox_intersect_threshold;
356 
357  if (keysPerBinUnderThreshold()) {
358  VLOG(1) << "Hash table reached size " << crt_props.hash_table_size
359  << " with keys per bin " << crt_props.keys_per_bin << " under threshold "
361  << ". Terminating bucket size loop.";
362  return false;
363  }
364 
366  // We always take the first tuning iteration that succeeds when reversing
367  // direction, as if we're here we haven't had a successful iteration and we're
368  // "backtracking" our search by making bin sizes larger
369  VLOG(1) << "On reverse (larger tuning direction) search found workable "
370  << " hash table size of " << crt_props.hash_table_size
371  << " with keys per bin " << crt_props.keys_per_bin
372  << ". Terminating bucket size loop.";
373  return false;
374  }
375 
376  return true;
377  }
#define UNREACHABLE()
Definition: Logger.h:338
#define CHECK(condition)
Definition: Logger.h:291
#define VLOG(n)
Definition: Logger.h:388

Member Data Documentation

size_t anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState::bbox_intersect_max_table_size_bytes

Definition at line 291 of file BoundingBoxIntersectJoinHashTable.cpp.

double anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState::bbox_intersect_target_entries_per_bin

Definition at line 292 of file BoundingBoxIntersectJoinHashTable.cpp.

double anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState::chosen_bbox_intersect_threshold

Definition at line 284 of file BoundingBoxIntersectJoinHashTable.cpp.

HashTableProps anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState::crt_props

Definition at line 280 of file BoundingBoxIntersectJoinHashTable.cpp.

size_t anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState::crt_reverse_search_iteration

Definition at line 290 of file BoundingBoxIntersectJoinHashTable.cpp.

size_t anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState::crt_step

Definition at line 289 of file BoundingBoxIntersectJoinHashTable.cpp.

const size_t anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState::max_reverse_search_iterations {8}

Definition at line 293 of file BoundingBoxIntersectJoinHashTable.cpp.

HashTableProps anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState::prev_props

Definition at line 281 of file BoundingBoxIntersectJoinHashTable.cpp.

TuningDirection anonymous_namespace{BoundingBoxIntersectJoinHashTable.cpp}::TuningState::tuning_direction {TuningDirection::SMALLER}

Definition at line 286 of file BoundingBoxIntersectJoinHashTable.cpp.


The documentation for this struct was generated from the following file: