26 static const int BLOCK_DIM_ENCODE = 256;
27 static const int BLOCK_DIM_DEFLATE = 256;
28 static const int ENC_SEQUENTIALITY = 4;
29 static const int DEFLATE_CONSTANT = 4;
34#define HF_SPACE phf::Buf<E>
35#define HF_STREAM void*
44 using M = PHF_METADATA;
47 static const int SCRATCH = 0;
48 static const int FREQ = 1;
49 static const int BK = 2;
50 static const int REVBK = 3;
51 static const int PAR_NBIT = 4;
52 static const int PAR_NCELL = 5;
53 static const int PAR_ENTRY = 6;
54 static const int BITSTREAM = 7;
55 static const int END = 8;
58 struct memcpy_helper {
65 using Header = phf_header;
72 const size_t revbk4_bytes;
73 const size_t bitstream_max_len;
85 const size_t scratch4_len;
90 size_t total_footprint_d = 0;
91 size_t total_footprint_h = 0;
122 uint32_t* d_book_meta;
123 uint32_t* h_book_meta;
126 static int _revbk4_bytes(
int bklen);
127 static int _revbk8_bytes(
int bklen);
140 static size_t _bitstream4_len(
size_t pardeg,
size_t sublen);
143 Buf(
const Buf&) =
delete;
144 Buf& operator=(
const Buf&) =
delete;
146 Buf& operator=(Buf&&) =
delete;
155 Buf(
size_t inlen,
size_t _bklen,
fz::MemoryPool* pool,
int _pardeg = -1);
159 void register_runtime_bklen(
int _rt_bklen) { rt_bklen = _rt_bklen; }
161 void memcpy_merge(phf_header& header, phf_stream_t stream);
167 std::weak_ptr<const void> pool_alive_;
175 static int build_book(Buf<E>* buf, uint32_t* h_hist,
176 uint16_t rt_bklen, HF_STREAM stream);
181 static int encode(Buf<E>* buf, E* in_data,
size_t data_len,
182 uint8_t** out_encoded,
size_t* encoded_len,
183 phf_header& header, HF_STREAM stream);
187 static int decode(Buf<E>* buf, phf_header& header,
188 PHF_BYTE* in_encoded, E* out_decoded, HF_STREAM stream);
Stream-ordered CUDA memory pool for pipeline buffer management.
Backend-neutral GPU type aliases.