HEBench
|
#include <cstdint>
#include "version.h"
Go to the source code of this file.
Classes | |
struct | hebench::APIBridge::WorkloadParam |
Defines a single workload parameter. More... | |
struct | hebench::APIBridge::WorkloadParams |
Specifies the parameters for a workload. More... | |
struct | hebench::APIBridge::CategoryParams |
Specifies parameters for a category. More... | |
struct | hebench::APIBridge::BenchmarkDescriptor |
Defines a benchmark test. More... | |
struct | hebench::APIBridge::_FlexibleData |
Structure to contain flexible data. More... | |
struct | hebench::APIBridge::DataPack |
Defines a data package for an operation. More... | |
struct | hebench::APIBridge::DataPackCollection |
Defines a collection of data packs. More... | |
struct | hebench::APIBridge::ParameterIndexer |
Indexes a DataPack . More... | |
union | hebench::APIBridge::WorkloadParam.__unnamed5__ |
union | hebench::APIBridge::CategoryParams.__unnamed7__ |
struct | hebench::APIBridge::CategoryParams.__unnamed7__.latency |
struct | hebench::APIBridge::CategoryParams.__unnamed7__.offline |
Namespaces | |
hebench | |
hebench::APIBridge | |
hebench::APIBridge::WorkloadParamType | |
Macros | |
#define | HEBENCH_ECODE_SUCCESS 0 |
Function call succeeded without error. More... | |
#define | HEBENCH_ECODE_INVALID_ARGS 0x7ffffffe |
Indicates invalid arguments to function call. More... | |
#define | HEBENCH_ECODE_CRITICAL_ERROR 0x7fffffff |
Specifies a critical error. More... | |
#define | HEBENCH_MAX_BUFFER_SIZE 256 |
#define | HEBENCH_MAX_OP_PARAMS 32 |
Maximum number of parameters supported by an operation. More... | |
#define | HEBENCH_MAX_CATEGORY_PARAMS HEBENCH_MAX_OP_PARAMS * 2 |
Maximum number of parameters for Category benchmark descriptor. More... | |
#define | HEBENCH_HE_SCHEME_CKKS 100 |
#define | HEBENCH_HE_SCHEME_BFV 101 |
#define | HEBENCH_HE_SCHEME_BGV 102 |
#define | HEBENCH_HE_PARAM_FLAGS_ALL_CIPHER 0xffffffff |
#define | HEBENCH_HE_PARAM_FLAGS_ALL_PLAIN 0x0 |
#define | NULL_HANDLE hebench::APIBridge::_FlexibleData({ 0, 0, 0 }) |
Typedefs | |
typedef std::int32_t | hebench::APIBridge::ErrorCode |
Return value for API bridge functions. More... | |
typedef std::int32_t | hebench::APIBridge::Scheme |
Open-ended homomorphic encryption scheme ID. More... | |
typedef std::int32_t | hebench::APIBridge::Security |
Open-ended homomorphic encryption scheme security ID. More... | |
typedef _FlexibleData | hebench::APIBridge::NativeDataBuffer |
Represents a native data buffer maintained by the Test Harness. More... | |
typedef _FlexibleData | hebench::APIBridge::Handle |
Encapsulates an opaque handle to backend data. More... | |
struct hebench::APIBridge::WorkloadParam |
Defines a single workload parameter.
This struct holds the value and meta data for a workload parameter. The correct type is workload specific and specified per workload.
Class Members | ||
---|---|---|
union WorkloadParam | __unnamed__ | |
WorkloadParamType | data_type | Type of the parameter data. |
char | name[HEBENCH_MAX_BUFFER_SIZE] |
Null-terminated string containing the name for the parameter. This name if for description purposes only and should not be used as identifier or any other specific purpose. |
struct hebench::APIBridge::WorkloadParams |
Specifies the parameters for a workload.
A workload can have 0
or more flexible parameters that can be specified during benchmark initialization; for example, vector element-wise operations have the number of elements in a vector as a parameter.
The number of parameters is workload specific.
Class Members | ||
---|---|---|
uint64_t | count | Number of workload parameters. |
WorkloadParam * | params | Parameters for the workload. |
struct hebench::APIBridge::CategoryParams |
Specifies parameters for a category.
This type contains a union to accomodate parameters for all categories. Clients must be mindful that writing data to parameters for a category will overwrite data for all other categories in the same union, thus, separate instaces of this type should be used for different categories.
Class Members | ||
---|---|---|
union CategoryParams | __unnamed__ | |
uint64_t | min_test_time_ms |
Specifies the minimum time, in milliseconds, to run the test. Latency benchmark will submit an operation with the same set of inputs as many times as needed until the time elapsed during the test is, at least, the number of milliseconds specified. Offline benchmark will submit the complete dataset for the test in a single operation. Test Harness will continue to submit operation requests on the whole dataset until the time elapsed during the test is, at least, the number of milliseconds specified. A value of Regardless of the time specified, for latency category, Test Harness will submit, at least, two iterations; and for offline category, Test Harness will submit, at least, one iteration. It is clear that the full test will take, at least, as much time as specified by this field, since the last operation request that satisfies the elapsed time will not be interrupted until it completes. |
struct hebench::APIBridge::BenchmarkDescriptor |
Defines a benchmark test.
A benchmark test is defined by a Workload, a Category for said workload, a scheme for such Category, which inputs are plain text of cipher text, the security level for the scheme, and an extra parameter that is backend specific.
cipher_param_mask
is a bit mask that defines which operation parameters are cipher or plain text. If bit i
is set, then parameter i
is cipher text, otherwise, it is plain text. Only the least significant n
bits of this field will be used for an operation that supports n
operands. The rest are ignored.
Test Harness will request the list of BenchmarkDescriptor objects for which a backend is subscribing. When Test Harness is about to execute a benchmark, the BenchmarkDescriptor is passed down to the backend with the same values used during subscription.
Fields workload
, data_type
, category
, cat_params
and cypher_param_mask
specify the actual operation for the benchmark that Test Harness will execute. Different combination of values specified by scheme
, security
, and other
fields do not affect the type of benchmark, but further describe it.
A benchmark is defined by the combination of the values for all these fields, thus, two benchmarks are considered the same if all fields have the same value. So, if we are running two benchmark with workload matrix multiplication, latency category, CKKS scheme with 128 bits security and BFV scheme with 128 bits security, then scheme field for both benchmarks must be different. Note that two benchmarks with the same descriptor can differ in the workload parameters, effectively performing the same benchmark on a workload with different parameter sets.
Class Members | ||
---|---|---|
CategoryParams | cat_params | Parameters for the category. |
Category | category | Category for the benchmark. |
uint32_t | cipher_param_mask | Input mask to define which operation parameters for the computation are plain text or cipher text. |
DataType | data_type | Data type for the workload. |
int64_t | other | Backend specific extra parameter. |
Scheme | scheme | Scheme for the benchmark. |
Security | security | Security for the scheme. |
Workload | workload | Workload for the benchmark. |
struct hebench::APIBridge::_FlexibleData |
Structure to contain flexible data.
What all of this structure's fields actually represent, is custom-defined by the structure user. Field names are just provided as a guideline. It is the client's responsibility to define the meaning of each field based on where is this structure used and to adhere to this definition.
struct hebench::APIBridge::DataPack |
Defines a data package for an operation.
This data pack contains a list of samples (one sample per NativeDataBuffer
) for the same component.
Field param_position
specifies the zero-based position of the data as a parameter in the call order for the operation to execute, or the zero-based componenet in the result. For example, in (R0, R1) = op(A, B, C)
, based on the input components: A
is at position 0
, B
is at position 1
, and C
is at 2
; and for the output components: R0
is at position 0
, and R1
is at position 1
.
Class Members | ||
---|---|---|
uint64_t | buffer_count |
Number of data buffers in p_buffers . |
NativeDataBuffer * | p_buffers | Array of data buffers for parameter. |
uint64_t | param_position | The 0-based position of this parameter in the corresponding function call. |
struct hebench::APIBridge::DataPackCollection |
Defines a collection of data packs.
This struct is used to encode/decode a collection of data packs, in a single call instead of encoding each data pack at a time. This is useful for backends to optimize large amounts of data.
Class Members | ||
---|---|---|
DataPack * | p_data_packs | Collection of data packs. |
uint64_t | pack_count | Number of data packs in the collection. |
struct hebench::APIBridge::ParameterIndexer |
Indexes a DataPack
.
In a call to operate(), a list of ParameterIndexer
is passed, where each element of that list corresponds to an input parameter position in the call order. For that call to operate()
, the i
-th ParameterIndexer
specifies the index for the first component sample to use from the corresponding DataPack
and how many values in the batch to use for the operation.
Typically, for a latency benchmark, the indexer for each input component will be value_index = 0
and batch_size = 1
, indicating the first element of the dataset for that component.
For an offline benchmark, unless otherwise specified, each input component will be value_index = 0
and batch_size = all_samples_for_component
, indicating the complete dataset.
For details on the ordering of results based on the operation parameter sample index see Ordering of Results Based on Input Batch Sizes .
Class Members | ||
---|---|---|
uint64_t | batch_size | Number of values to use, starting from index. |
uint64_t | value_index | Index of parameter value inside the data pack. |
union hebench::APIBridge::WorkloadParam.__unnamed5__ |
union hebench::APIBridge::CategoryParams.__unnamed7__ |
Class Members | ||
---|---|---|
__unnamed7__ | latency | Specifies the parameters for the latency category. |
__unnamed7__ | offline | Specifies the parameters for the offline category. |
uint64_t | reserved[HEBENCH_MAX_CATEGORY_PARAMS] |
Generic placeholder for categories. This field is used to allocate memory for the whole union. It is advised to access the parameters through the respective category field instead. |
struct hebench::APIBridge::CategoryParams.__unnamed7__.latency |
struct hebench::APIBridge::CategoryParams.__unnamed7__.offline |
Class Members | ||
---|---|---|
uint64_t | data_count[HEBENCH_MAX_OP_PARAMS] |
Specifies the number of data samples for each parameter for Category::Offline. This specifies the the number of samples submitted by Test Harness for each parameter for the offline operation. A value larger than available input samples will see the whole dataset of inputs be used for that parameter in a single operation. Note that in case that there is not enough data samples for a parameter, the number of samples will be lower than requested. A value of Regardless of the sample sizes (specified or default), the actual number of samples may be limited by the dataset for the workload, if any. |
#define HEBENCH_ECODE_CRITICAL_ERROR 0x7fffffff |
#define HEBENCH_ECODE_INVALID_ARGS 0x7ffffffe |
#define HEBENCH_ECODE_SUCCESS 0 |
#define HEBENCH_MAX_CATEGORY_PARAMS HEBENCH_MAX_OP_PARAMS * 2 |
#define HEBENCH_MAX_OP_PARAMS 32 |
#define NULL_HANDLE hebench::APIBridge::_FlexibleData({ 0, 0, 0 }) |