|
| | Dpf (Prg prg) |
| | Configure the pseudorandom generator.
|
| void | Gen (cuda::std::span< int4 > cws, In &tr, cuda::std::span< const int4, 2 > s0s, In a, int4 b_buf, size_t stride=1) |
| | Generate correction words in a caller-strided layout and packed control bits.
|
| int4 | Eval (bool b, int4 s0, cuda::std::span< const int4 > cws, In tr, In x, size_t stride=1) |
| | Evaluate one point using separate correction components.
|
| void | EvalRange (bool b, In first, In last, int4 s0, cuda::std::span< const int4 > cws, In tr, cuda::std::span< int4 > ys, int par_depth=0, size_t stride=1) |
| | Evaluate the closed input interval [first, last] on the host from split correction words.
|
| void | EvalAll (bool b, int4 s0, cuda::std::span< const int4 > cws, In tr, int4 ys[], int par_depth=0, size_t stride=1) |
| | Evaluate the full domain on the host from split correction words.
|
template<int frontier_depth = 16, int threads_per_block = 256>
requires (ValidForInputBits<In, in_bits> && Groupable<Group> && Prgable<Prg, 2>) |
| cudaError_t | EvalRangeGpu (bool b, In first, In last, int4 s0, cuda::std::span< const int4 > cws, In tr, cuda::std::span< int4 > ys, cudaStream_t stream=0, size_t stride=1) const |
| | Evaluate the closed interval [first, last] on the given CUDA stream from split arrays.
|
template<int frontier_depth = 16, int threads_per_block = 256>
requires (in_bits < sizeof(size_t) * 8) |
| cudaError_t | EvalAllGpu (bool b, int4 s0, cuda::std::span< const int4 > cws, In tr, cuda::std::span< int4 > ys, cudaStream_t stream=0, size_t stride=1) const |
| | Launch full-domain CUDA evaluation from split device arrays.
|
template<int frontier_depth = 16, int threads_per_block = 256>
requires (in_bits < sizeof(size_t) * 8) |
| cudaError_t | EvalAllGpuBatch (bool b, cuda::std::span< const int4 > s0s, cuda::std::span< const int4 > cws, cuda::std::span< const In > tr, cuda::std::span< int4 > ys, cudaStream_t stream=0, size_t stride=0) const |
| | Launch full-domain CUDA evaluation for s0s.size() keys from split device arrays.
|
template<int in_bits, typename Group, typename Prg, typename In = uint>
requires (ValidForInputBits<In, in_bits> &&
Groupable<Group> &&
Prgable<Prg, 2>)
class fss::Dpf< in_bits, Group, Prg, In >
2-party DPF scheme.
- Template Parameters
-
| in_bits | Input domain bit size. |
| Group | Type for the output domain. See Groupable. |
| Prg | See Prgable. |
| In | Type for the input domain. From uint8_t to __uint128_t. |
Gen() and scalar Eval() are callable from host and device when the backend supports the execution space and all accessed storage is accessible there. EvalRange() and EvalAll() are host operations. EvalAllGpu() and EvalAllGpuBatch() are host launch methods compiled with a CUDA compiler; they do not run on the device.
template<int in_bits, typename Group, typename Prg, typename In>
requires (in_bits < sizeof(size_t) * 8)
template<int frontier_depth, int threads_per_block>
requires (in_bits < sizeof(size_t) * 8)
| cudaError_t fss::Dpf< in_bits, Group, Prg, In >::EvalAllGpu |
( |
bool | b, |
|
|
int4 | s0, |
|
|
cuda::std::span< const int4 > | cws, |
|
|
In | tr, |
|
|
cuda::std::span< int4 > | ys, |
|
|
cudaStream_t | stream = 0, |
|
|
size_t | stride = 1 ) const |
|
inline |
Launch full-domain CUDA evaluation from split device arrays.
Layer i is read from cws[i*stride] and the terminal from cws[in_bits*stride]. Packed bit i of tr is the right-control correction at layer i, and the left-control correction is the LSB of the layer's cws entry, exactly as the component form of Gen() writes them. Bits of tr at and above in_bits are ignored. Backend values, resource rules and tuning rules match EvalAllGpu().
- Parameters
-
| b | Party index, false for party 0 and true for party 1. |
| s0 | This party's seed, passed by value as a kernel argument. |
| cws | Device correction words, layer i at index i*stride and the terminal at index in_bits*stride. |
| tr | Packed right-control bits, bit i for layer i. |
| ys | Device output storage containing at least 2^in_bits blocks. |
| stream | Stream on the device owning the referenced resources. |
| stride | Positive element stride between correction-word entries. |
- Precondition
- stride > 0 and cws holds at least in_bits*stride+1 elements.
-
The buffers and referenced backend resources remain valid until work completes.
- Returns
- Immediate CUDA status. Invalid dimensions, buffers, strides, null used buffers, or unaddressable sizes return cudaErrorInvalidValue. Execution completion remains asynchronous.
template<int in_bits, typename Group, typename Prg, typename In>
requires (in_bits < sizeof(size_t) * 8)
template<int frontier_depth, int threads_per_block>
requires (in_bits < sizeof(size_t) * 8)
| cudaError_t fss::Dpf< in_bits, Group, Prg, In >::EvalAllGpuBatch |
( |
bool | b, |
|
|
cuda::std::span< const int4 > | s0s, |
|
|
cuda::std::span< const int4 > | cws, |
|
|
cuda::std::span< const In > | tr, |
|
|
cuda::std::span< int4 > | ys, |
|
|
cudaStream_t | stream = 0, |
|
|
size_t | stride = 0 ) const |
|
inline |
Launch full-domain CUDA evaluation for s0s.size() keys from split device arrays.
The batch uses the level-major layout: key k layer i is read from cws[i*stride + k], key k's packed control is tr[k], and key k's terminal is cws[in_bits*stride + k]. Packed bit i of tr[k] is the right-control correction at layer i, and the left-control correction is the LSB of the layer's cws entry, exactly as the split form of Gen() writes them. Bits of tr[k] at and above in_bits are ignored. stride selects the layout. 0 selects the dense level-major layout, in which the stride is the key count of this call. Any other value is a positive stride of at least s0s.size(). Uses the same resource, execution, and tuning rules as EvalAllGpu(). All keys share this scheme's backend configuration, and every key produces the whole domain.
- Parameters
-
| b | Party index shared by the batch. |
| s0s | Device storage containing this party's seed for each key. |
| cws | Device level-major correction words. |
| tr | Device packed right-control bits, one value per key. |
| ys | Device key-major rows of 2^in_bits output blocks per key. |
| stream | Stream on the device owning the referenced resources. |
| stride | 0 for the dense level-major layout, where the stride is the key count of this call, or a positive element stride >= s0s.size(). |
- Precondition
- stride is 0 or at least s0s.size().
-
cws holds at least in_bits*stride + s0s.size() elements, where a stride of 0 counts as s0s.size(), and tr holds at least s0s.size() values.
-
The buffers and referenced backend resources remain valid until work completes.
- Returns
- Immediate CUDA status. An empty batch succeeds without reading buffers. Invalid dimensions, null used buffers, strides, or unaddressable sizes return cudaErrorInvalidValue; an oversized grid returns cudaErrorInvalidConfiguration. Execution completion remains asynchronous.
template<int in_bits, typename Group, typename Prg, typename In>
requires (ValidForInputBits<In, in_bits> &&
Groupable<Group> &&
Prgable<Prg, 2>)
| void fss::Dpf< in_bits, Group, Prg, In >::EvalRange |
( |
bool | b, |
|
|
In | first, |
|
|
In | last, |
|
|
int4 | s0, |
|
|
cuda::std::span< const int4 > | cws, |
|
|
In | tr, |
|
|
cuda::std::span< int4 > | ys, |
|
|
int | par_depth = 0, |
|
|
size_t | stride = 1 ) |
|
inline |
Evaluate the closed input interval [first, last] on the host from split correction words.
Layer i is read from cws[i*stride] and the terminal from cws[in_bits*stride]. Packed bit i of tr is the right-control correction at layer i, and the left-control correction is the LSB of the layer's cws entry, exactly as the component form of Gen() writes them. Bits of tr at and above in_bits are ignored.
- Parameters
-
| b | Party index, false for party 0 and true for party 1. |
| first | First input in the interval. |
| last | Last input in the interval, included in the output. |
| s0 | This party's seed from generation. |
| cws | Correction words, layer i at index i*stride and the terminal at index in_bits*stride. |
| tr | Packed right-control bits, bit i for layer i. |
| ys | Output storage with at least last-first+1 elements. |
| par_depth | Nonnegative OpenMP split depth for this call. Zero runs sequentially. Positive depths require backends that support concurrent calls. |
| stride | Positive element stride between correction-word entries. |
- Precondition
- first <= last and both endpoints are in [0, 2^in_bits).
-
stride > 0.
-
With M = numeric_limits<size_t>::max()/sizeof(int4), stride <= (M-1)/in_bits and cws has at least in_bits*stride+1 elements.
-
cws[in_bits*stride].w & 1 == 0. A violation aborts with a diagnostic in Debug builds and is undefined behavior in Release builds.
-
cws and ys.data() are nonnull and refer to accessible host storage.
- Exceptions
-
| std::invalid_argument | if first > last, an endpoint is outside the input domain, the interval does not fit size_t, ys is too short, stride is zero or too large, or cws is shorter than in_bits*stride+1. |
- Postcondition
- ys[x-first] contains this party's output share for each x in the interval. Any extra elements of ys remain unchanged.
template<int in_bits, typename Group, typename Prg, typename In>
requires (ValidForInputBits<In, in_bits> &&
Groupable<Group> &&
Prgable<Prg, 2>)
template<int frontier_depth, int threads_per_block>
requires (ValidForInputBits<In, in_bits> &&
Groupable<Group> &&
Prgable<Prg, 2>)
| cudaError_t fss::Dpf< in_bits, Group, Prg, In >::EvalRangeGpu |
( |
bool | b, |
|
|
In | first, |
|
|
In | last, |
|
|
int4 | s0, |
|
|
cuda::std::span< const int4 > | cws, |
|
|
In | tr, |
|
|
cuda::std::span< int4 > | ys, |
|
|
cudaStream_t | stream = 0, |
|
|
size_t | stride = 1 ) const |
|
inline |
Evaluate the closed interval [first, last] on the given CUDA stream from split arrays.
Output ys[j] corresponds to first+j. Extra output capacity is unchanged.
Layer i is read from cws[i*stride] and the terminal from cws[in_bits*stride]. Packed bit i of tr is the right-control correction at layer i, and the left-control correction is the LSB of the layer's cws entry, exactly as the component form of Gen() writes them. Bits of tr at and above in_bits are ignored. Resources, subdivision and asynchronous error handling follow EvalRangeGpu().
- Parameters
-
| b | Party index, false for party 0 and true for party 1. |
| first | First input in the interval. |
| last | Last input in the interval, included in the output. |
| s0 | This party's seed, passed by value as a kernel argument. |
| cws | Device correction words, layer i at index i*stride and the terminal at index in_bits*stride. |
| tr | Packed right-control bits, bit i for layer i. |
| ys | Device output storage. Entry x-first receives this party's share at x. |
| stream | Stream on the device owning the referenced resources. |
| stride | Positive element stride between correction-word entries. |
- Precondition
- stride > 0 and cws holds at least in_bits*stride+1 elements.
-
The buffers and referenced backend resources remain valid until work completes.
- Returns
- Immediate CUDA status. Invalid endpoints, buffers, strides, counts or byte sizes return cudaErrorInvalidValue. Execution completion remains asynchronous. The grid limit cannot be exceeded, because the subdivision caps the block-root depth at 30.