FZGPUModules 2.0
GPU-accelerated modular compression pipelines
Loading...
Searching...
No Matches
histogram.h
1// Internal utility — NOT part of the public API.
2// Do not include from user or example code.
3//
4// Adapted from PHF reference (hist.hh)
5// Original authors: Cody Rivera, Megan Hickman Fulp
6// Changes: removed SEQ/Cauchy variants (unused), replaced include guard with #pragma once.
7
8#pragma once
9
10// nvcc declares threadIdx/blockDim/__syncthreads/atomicAdd implicitly; HIP's
11// clang requires the runtime header to be included for them to be visible.
12#include "backend/api.h"
13
14#include <cstddef>
15#include <cstdint>
16
17namespace fz::module {
18
19// Compute kernel launch parameters once at initialization time.
20// Stores results in grid_dim, block_dim, shmem_use, r_per_block.
21// Must be called from a .cu translation unit (references a __global__ kernel pointer).
22template <typename E>
23void GPU_histogram_generic_optimizer_on_initialization(
24 size_t const data_len, uint16_t const hist_len,
25 int& grid_dim, int& block_dim, int& shmem_use, int& r_per_block);
26
27// Launch the p2013 privatized histogram kernel.
28// Caller is responsible for zeroing out_hist before the call.
29template <typename E>
30int GPU_histogram_generic(
31 E* in_data, size_t const data_len, uint32_t* out_hist, uint16_t const hist_len,
32 int const grid_dim, int const block_dim, int const shmem_use, int const r_per_block,
33 void* stream);
34
35} // namespace fz::module
Backend-neutral spelling of the host-side GPU runtime API.