OmniSciDB  a5dc49c757
 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 269 of file BoundingBoxIntersectJoinHashTable.cpp.

Member Enumeration Documentation

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

Definition at line 286 of file BoundingBoxIntersectJoinHashTable.cpp.

286 { 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 270 of file BoundingBoxIntersectJoinHashTable.cpp.

275  , 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 299 of file BoundingBoxIntersectJoinHashTable.cpp.

References CHECK, UNREACHABLE, and VLOG.

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

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

Definition at line 293 of file BoundingBoxIntersectJoinHashTable.cpp.

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

Definition at line 285 of file BoundingBoxIntersectJoinHashTable.cpp.

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

Definition at line 281 of file BoundingBoxIntersectJoinHashTable.cpp.

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

Definition at line 291 of file BoundingBoxIntersectJoinHashTable.cpp.

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

Definition at line 290 of file BoundingBoxIntersectJoinHashTable.cpp.

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

Definition at line 294 of file BoundingBoxIntersectJoinHashTable.cpp.

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

Definition at line 282 of file BoundingBoxIntersectJoinHashTable.cpp.

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

Definition at line 287 of file BoundingBoxIntersectJoinHashTable.cpp.


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