OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InValuesBitmap.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
23 #ifndef QUERYENGINE_INVALUESBITMAP_H
24 #define QUERYENGINE_INVALUESBITMAP_H
25 
26 #include "../DataMgr/DataMgr.h"
28 
29 #include <llvm/IR/Value.h>
30 
31 #include <cstdint>
32 #include <stdexcept>
33 #include <vector>
34 
35 class Executor;
36 
37 class FailedToCreateBitmap : public std::runtime_error {
38  public:
39  FailedToCreateBitmap() : std::runtime_error("FailedToCreateBitmap") {}
40 };
41 
43  public:
44  InValuesBitmap(const std::vector<int64_t>& values,
45  const int64_t null_val,
46  const Data_Namespace::MemoryLevel memory_level,
47  const int device_count,
48  Data_Namespace::DataMgr* data_mgr,
49  CompilationOptions const& co);
51 
52  llvm::Value* codegen(llvm::Value* needle, Executor* executor) const;
53 
54  bool isEmpty() const;
55 
56  bool hasNull() const;
57 
58  size_t gpuBuffers() const { return gpu_buffers_.size(); }
59 
60  struct BitIsSetParams {
61  llvm::Value* bitmap_ptr_lv;
62  llvm::Value* min_val_lv;
63  llvm::Value* max_val_lv;
64  llvm::Value* null_val_lv;
65  };
66 
68  Executor* executor,
69  std::vector<std::shared_ptr<const Analyzer::Constant>> const& constant_owned) const;
70 
71  private:
72  std::vector<Data_Namespace::AbstractBuffer*> gpu_buffers_;
73  std::vector<int8_t*> bitsets_;
75  int64_t min_val_;
76  int64_t max_val_;
77  const int64_t null_val_;
79  const int device_count_;
82 };
83 
84 #endif // QUERYENGINE_INVALUESBITMAP_H
BitIsSetParams prepareBitIsSetParams(Executor *executor, std::vector< std::shared_ptr< const Analyzer::Constant >> const &constant_owned) const
CompilationOptions co_
bool hasNull() const
size_t gpuBuffers() const
std::vector< int8_t * > bitsets_
std::vector< Data_Namespace::AbstractBuffer * > gpu_buffers_
const int64_t null_val_
Executor(const ExecutorId id, Data_Namespace::DataMgr *data_mgr, const size_t block_size_x, const size_t grid_size_x, const size_t max_gpu_slab_size, const std::string &debug_dir, const std::string &debug_file)
Definition: Execute.cpp:276
llvm::Value * codegen(llvm::Value *needle, Executor *executor) const
Data_Namespace::DataMgr * data_mgr_
const int device_count_
InValuesBitmap(const std::vector< int64_t > &values, const int64_t null_val, const Data_Namespace::MemoryLevel memory_level, const int device_count, Data_Namespace::DataMgr *data_mgr, CompilationOptions const &co)
bool isEmpty() const
const Data_Namespace::MemoryLevel memory_level_