HEBench
types.h
Go to the documentation of this file.
1 
2 // Copyright (C) 2021 Intel Corporation
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef _HEBench_API_Bridge_Types_H_7e5fa8c2415240ea93eff148ed73539b
6 #define _HEBench_API_Bridge_Types_H_7e5fa8c2415240ea93eff148ed73539b
7 
8 #include <cstdint>
9 
10 #include "version.h"
11 
12 namespace hebench {
13 namespace APIBridge {
14 
15 //================
16 // Error handling
17 //================
18 
34 typedef std::int32_t ErrorCode;
35 
36 // Predefined error codes
37 
39 #define HEBENCH_ECODE_SUCCESS 0
40 
42 #define HEBENCH_ECODE_INVALID_ARGS 0x7ffffffe
43 
45 
50 #define HEBENCH_ECODE_CRITICAL_ERROR 0x7fffffff
51 
52 //===============
53 // Miscellaneous
54 //===============
55 
56 #define HEBENCH_MAX_BUFFER_SIZE 256
57 
58 //=======================
59 // Benchmark descriptors
60 //=======================
61 
63 #define HEBENCH_MAX_OP_PARAMS 32
65 #define HEBENCH_MAX_CATEGORY_PARAMS HEBENCH_MAX_OP_PARAMS * 2
66 
67 // Sugested common scheme types
68 #define HEBENCH_HE_SCHEME_CKKS 100
69 #define HEBENCH_HE_SCHEME_BFV 101
70 #define HEBENCH_HE_SCHEME_BGV 102
71 
72 // common flags for parameter combinations
73 
74 #define HEBENCH_HE_PARAM_FLAGS_ALL_CIPHER 0xffffffff
75 #define HEBENCH_HE_PARAM_FLAGS_ALL_PLAIN 0x0
76 
83 {
294  Generic
295 };
296 
297 namespace WorkloadParamType {
298 
303 {
304  Int64 = 1,
306  Float64
307 };
308 
309 } // namespace WorkloadParamType
310 
318 {
329  union
330  {
336  int64_t i_param;
342  uint64_t u_param;
349  double f_param;
350  };
351 };
352 
363 {
371  std::uint64_t count;
372 };
373 
379 {
380  Int32 = 1,
383  Float64
384 };
385 
391 {
393  Latency = 1,
398  Offline
399 };
400 
406 typedef std::int32_t Scheme;
412 typedef std::int32_t Security;
413 
422 {
447  std::uint64_t min_test_time_ms;
448  union
449  {
456  std::uint64_t reserved[HEBENCH_MAX_CATEGORY_PARAMS];
457  struct
458  {
467  std::uint64_t warmup_iterations_count;
468  } latency;
469  struct
470  {
491  std::uint64_t data_count[HEBENCH_MAX_OP_PARAMS];
492  } offline;
493  };
494 };
495 
527 {
528  // benchmark specification
533  std::uint32_t cipher_param_mask;
534  // extra description
537  std::int64_t other;
538 };
539 
540 //================================
541 // Data movement and organization
542 //================================
543 
552 {
554 
558  void *p;
560 
564  std::uint64_t size;
566 
569  std::int64_t tag;
570 };
571 
572 #define NULL_HANDLE hebench::APIBridge::_FlexibleData({ 0, 0, 0 })
573 
596 
610 struct DataPack
611 {
613  std::uint64_t buffer_count;
614  std::uint64_t param_position;
615 };
616 
624 {
626  std::uint64_t pack_count;
627 };
628 
650 {
651  std::uint64_t value_index;
652  std::uint64_t batch_size;
653 };
654 
655 } // namespace APIBridge
656 } // namespace hebench
657 
658 #endif // defined _HEBench_API_Bridge_Types_H_7e5fa8c2415240ea93eff148ed73539b
WorkloadParamType
Defines the possible data types for a workload flexible parameter.
Definition: types.h:303
@ Float64
64 bits IEEE 754 standard floating point real numbers.
Definition: types.h:306
@ Int64
64 bits signed integers.
Definition: types.h:304
@ UInt64
64 bits unsigned integers.
Definition: types.h:305
Security security
Security for the scheme.
Definition: types.h:536
char name[HEBENCH_MAX_BUFFER_SIZE]
Null-terminated string containing the name for the parameter.
Definition: types.h:328
WorkloadParamType::WorkloadParamType data_type
Type of the parameter data.
Definition: types.h:322
_FlexibleData Handle
Encapsulates an opaque handle to backend data.
Definition: types.h:595
DataType
Defines data types for a workload.
Definition: types.h:379
@ Float32
32 bits IEEE 754 standard floating point real numbers.
Definition: types.h:382
@ Int32
32 bits signed integers.
Definition: types.h:380
@ Int64
64 bits signed integers.
Definition: types.h:381
@ Float64
64 bits IEEE 754 standard floating point real numbers.
Definition: types.h:383
Category
Defines all possible categories for each workload.
Definition: types.h:391
std::uint64_t count
Number of workload parameters.
Definition: types.h:371
DataPack * p_data_packs
Collection of data packs.
Definition: types.h:625
std::uint64_t min_test_time_ms
Specifies the minimum time, in milliseconds, to run the test.
Definition: types.h:447
std::uint64_t value_index
Index of parameter value inside the data pack.
Definition: types.h:651
std::uint32_t cipher_param_mask
Input mask to define which operation parameters for the computation are plain text or cipher text.
Definition: types.h:533
DataType data_type
Data type for the workload.
Definition: types.h:530
CategoryParams cat_params
Parameters for the category.
Definition: types.h:532
std::int32_t Scheme
Open-ended homomorphic encryption scheme ID.
Definition: types.h:406
std::uint64_t pack_count
Number of data packs in the collection.
Definition: types.h:626
std::int32_t Security
Open-ended homomorphic encryption scheme security ID.
Definition: types.h:412
WorkloadParam * params
Parameters for the workload.
Definition: types.h:367
std::uint64_t batch_size
Number of values to use, starting from index.
Definition: types.h:652
std::uint64_t size
Size of underlying data.
Definition: types.h:564
std::uint64_t param_position
The 0-based position of this parameter in the corresponding function call.
Definition: types.h:614
std::int64_t other
Backend specific extra parameter.
Definition: types.h:537
void * p
Pointer to underlying data.
Definition: types.h:558
Category category
Category for the benchmark.
Definition: types.h:531
std::int32_t ErrorCode
Return value for API bridge functions.
Definition: types.h:34
std::uint64_t buffer_count
Number of data buffers in p_buffers.
Definition: types.h:613
Workload workload
Workload for the benchmark.
Definition: types.h:529
Scheme scheme
Scheme for the benchmark.
Definition: types.h:535
NativeDataBuffer * p_buffers
Array of data buffers for parameter.
Definition: types.h:612
std::int64_t tag
Optional tag.
Definition: types.h:569
_FlexibleData NativeDataBuffer
Represents a native data buffer maintained by the Test Harness.
Definition: types.h:588
Workload
Defines all possible workloads.
Definition: types.h:83
@ LogisticRegression_PolyD3
Definition: types.h:203
@ SimpleSetIntersection
Definition: types.h:268
@ LogisticRegression_PolyD7
Definition: types.h:247
@ LogisticRegression_PolyD5
Definition: types.h:225
Defines a benchmark test.
Definition: types.h:527
Specifies parameters for a category.
Definition: types.h:422
Defines a data package for an operation.
Definition: types.h:611
Defines a collection of data packs.
Definition: types.h:624
Defines a single workload parameter.
Definition: types.h:318
Specifies the parameters for a workload.
Definition: types.h:363
Structure to contain flexible data.
Definition: types.h:552
#define HEBENCH_MAX_CATEGORY_PARAMS
Maximum number of parameters for Category benchmark descriptor.
Definition: types.h:65
#define HEBENCH_MAX_BUFFER_SIZE
Definition: types.h:56
#define HEBENCH_MAX_OP_PARAMS
Maximum number of parameters supported by an operation.
Definition: types.h:63