Skip to main content

ClikaRT::ops::hash_lanes

function

hash_lanes()​

Tensor hash_lanes(
    Tensor input,
    std::uint64_t key = 0,
    HashLaneAlgo algo = HashLaneAlgo::Auto,
    std::int64_t mask_bits = 0
)

Elementwise per-lane BIJECTIVE hash, shape-preserving: every lane of an integer input maps through a permutation of its width, so distinct lane values stay distinct (a lane-wise content id, a bucket index, a deterministic shuffle key). A 32-bit lane lands as UInt32, a 64-bit lane as UInt64; algo selects the permutation within the input's width (HashLaneAlgo::Auto: Triple32 for 32-bit lanes, Moremur for 64-bit ones). key perturbs the permutation (0 is a fixed valid default, so the same key gives the same map on every platform and backend). mask_bits in (0, width] restricts the bijection to [0, 2^mask_bits): a lane below that bound maps to a lane below it, so a table of that size is permuted onto itself; 0 (and the lane width) keeps the full width.

Parameters

  • input: an Int32 / UInt32 / Int64 / UInt64 tensor.
  • key: the permutation key; 0 = the fixed default.
  • algo: the permutation (see HashLaneAlgo).
  • mask_bits: the bijection's bit width, 0 = the lane's full width.

Returns: input's shape at UInt32 (32-bit lanes) or UInt64 (64-bit lanes).

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) on an algo of the other width or a mask_bits below 0 or past the lane width, and when the input's dtype is not served (the machine-readable reason rides code_name()).

Declared in ClikaRT/compute/ops.h, line 4527