Document the new DPF surfaces in one command set, and test the field, half-tree, and multipoint edges.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ryan Henry 2026-09-24 23:18:10 -06:00
parent 0d8a5a8131
commit 0dff6df8ed
250 changed files with 12199 additions and 1981 deletions

View file

@ -65,7 +65,12 @@ struct lane_codec
return out;
}
/// Element `index` is the packed byte range `[index * sizeof(T), ...)`.
/// @brief Element `index` is the packed byte range `[index * sizeof(T), ...)`.
/// @param seed the PRG seed
/// @param index the index
/// @param out the output buffer
/// @param count the number of blocks
/// @throws std::invalid_argument if `prg lane index is out of range`
static void fill(block_type seed, std::uint64_t index, T * out, std::size_t count)
{
if (count == 0)
@ -85,8 +90,8 @@ struct lane_codec
HEDLEY_PRAGMA(GCC diagnostic push)
HEDLEY_PRAGMA(GCC diagnostic ignored "-Wignored-attributes")
dpf::aligned_allocator<block_type> alloc;
auto blocks = alloc.allocate_unique_ptr(static_cast<std::size_t>(nblocks));
HEDLEY_PRAGMA(GCC diagnostic pop)
auto blocks = alloc.allocate_unique_ptr(static_cast<std::size_t>(nblocks));
PRG::eval(seed, blocks.get(), static_cast<psnip_uint32_t>(nblocks),
static_cast<psnip_uint32_t>(start));
auto * bytes = reinterpret_cast<const unsigned char *>(blocks.get());
@ -167,13 +172,15 @@ typename PRG::block_type sample_master_seed()
return dpf::uniform_sample<typename PRG::block_type>();
}
/// Forward cursor over one PRG stream per value type.
/// @brief Forward cursor over one PRG stream per value type.
///
/// `get<I>()` and `fill<I>()` consume the cursor. `at<I>(index)` reads an
/// absolute index and leaves the cursor where it is. `sampled<I>()` reports
/// how far `get` and `fill` have advanced. `per_stream_buffer_elems` is at
/// least 1.
/// @snippet evaluation/buffered_prg.cpp buffered-prg
/// @tparam PRG pseudorandom generator
/// @tparam Ts ts
template <typename PRG, typename... Ts>
class buffered_prg
{
@ -248,12 +255,14 @@ private:
template <typename... Ts>
using aes_buffered_prg = buffered_prg<dpf::prg::aes128, Ts...>;
/// Seekable value and mask streams for a runtime set of roles.
/// @brief Seekable value and mask streams for a runtime set of roles.
///
/// `value_at(role, index)` and `mask_at(role, index)` are independent of
/// call order. A repeated index returns the same element. `window` is at
/// least 1.
/// @snippet evaluation/buffered_prg.cpp lane-table
/// @tparam T value type
/// @tparam PRG pseudorandom generator
template <typename T, typename PRG = dpf::prg::aes128>
class lane_table
{