HEBench
|
Provides boilerplate implementation to common methods of interface IBenchmarkDescription and implements some mechanisms to ease implementation of the interface. More...
#include <hebench_ibenchmark.h>
Classes | |
struct | WorkloadDescriptionOutput |
Bundles values that need to be filled by a workload during completeWorkloadDescription() . More... | |
Public Member Functions | |
PartialBenchmarkDescriptor () | |
~PartialBenchmarkDescriptor () override | |
DescriptionToken::Ptr | matchDescriptor (const Engine &engine, const BenchmarkDescription::Backend &backend_desc, const BenchmarkDescription::Configuration &config) const override final |
Implementation of IBenchmarkDescriptor::matchDescriptor(). More... | |
Public Member Functions inherited from hebench::TestHarness::IBenchmarkDescriptor | |
IBenchmarkDescriptor ()=default | |
virtual | ~IBenchmarkDescriptor ()=default |
virtual PartialBenchmark * | createBenchmark (std::shared_ptr< Engine > p_engine, const DescriptionToken &description_token)=0 |
Creates the represented IBenchmark object that can perform the workload specified by the HEBench benchmark descriptor. More... | |
virtual void | destroyBenchmark (PartialBenchmark *p_bench)=0 |
Destroys an object returned by createBenchmark() . More... | |
Static Public Member Functions | |
static bool | getForceConfigValues () |
Specifies whether frontend will override backend descriptors using configuration data or not. More... | |
static void | setForceConfigValues (bool value) |
Sets whether frontend will override backend descriptors using configuration data or not. More... | |
static std::uint64_t | computeSampleSizes (std::uint64_t *sample_sizes, std::size_t param_count, const std::vector< std::uint64_t > &config_sample_sizes, const hebench::APIBridge::BenchmarkDescriptor &bench_desc, std::uint64_t default_sample_size_fallback, bool force_config) |
Extracts the batch sizes for a workload from a specified HEBench API benchmark descriptor. More... | |
Protected Member Functions | |
virtual bool | matchBenchmarkDescriptor (const hebench::APIBridge::BenchmarkDescriptor &bench_desc, const std::vector< hebench::APIBridge::WorkloadParam > &w_params) const =0 |
Determines if the represented benchmark can perform the workload described by a specified HEBench benchmark descriptor and workload parameters. More... | |
virtual void | completeWorkloadDescription (WorkloadDescriptionOutput &output, const Engine &engine, const BenchmarkDescription::Backend &backend_desc, const BenchmarkDescription::Configuration &config) const =0 |
Completes the description for the matched benchmark. More... | |
Protected Member Functions inherited from hebench::TestHarness::IBenchmarkDescriptor | |
DescriptionToken::Ptr | createToken (const BenchmarkDescription::Backend &backend_desc, const BenchmarkDescription::Configuration &config, const BenchmarkDescription::Description &text_desc) const |
Creates a DescriptionToken object associated to this IBenchmarkDescription object using the specified benchmark description. More... | |
Static Protected Member Functions | |
static std::unordered_set< std::size_t > | getCipherParamPositions (std::uint32_t cipher_param_mask) |
static std::string | getCategoryName (hebench::APIBridge::Category category) |
static std::string | getDataTypeName (hebench::APIBridge::DataType data_type) |
static void | completeCategoryParams (hebench::APIBridge::BenchmarkDescriptor &out_descriptor, const hebench::APIBridge::BenchmarkDescriptor &in_descriptor, const BenchmarkDescription::Configuration &config, bool force_config) |
Completes common elements of category parameters in a descriptor using the specified configuration. More... | |
Provides boilerplate implementation to common methods of interface IBenchmarkDescription and implements some mechanisms to ease implementation of the interface.
Clients looking to implement interface IBenchmarkDescription can derive from this class.
This class provides a default implementation to IBenchmarkDescription::matchBenchmarkDescriptor()
. This implementation calls PartialBenchmarkDescriptor::matchBenchmarkDescriptor(const hebench::APIBridge::BenchmarkDescriptor &)
, and then, only if true
is returned, it fills out the Description
structure with general information about the matched benchmark; completeDescription()
is called afterwards for clients to add or modify the general description.
Clients need to implement:
IBenchmarkDescription::createBenchmark()
IBenchmarkDescription::destroyBenchmark()
PartialBenchmarkDescriptor::matchBenchmarkDescriptor()
PartialBenchmarkDescriptor::completeWorkloadDescription()
Definition at line 182 of file hebench_ibenchmark.h.
struct hebench::TestHarness::PartialBenchmarkDescriptor::WorkloadDescriptionOutput |
Bundles values that need to be filled by a workload during completeWorkloadDescription()
.
Definition at line 293 of file hebench_ibenchmark.h.
hebench::TestHarness::PartialBenchmarkDescriptor::PartialBenchmarkDescriptor | ( | ) |
Definition at line 44 of file hebench_ibenchmark.cpp.
|
override |
Definition at line 48 of file hebench_ibenchmark.cpp.
|
staticprotected |
Completes common elements of category parameters in a descriptor using the specified configuration.
out_descriptor | |
in_descriptor | |
config | |
force_config |
It sets the common values of cat_params based on the force config policy.
Common cat_params
fields:
cat_params.min_test_time_ms
Definition at line 193 of file hebench_ibenchmark.cpp.
|
protectedpure virtual |
Completes the description for the matched benchmark.
[out] | output | Structure to receive the completed description. |
[in] | engine | Engine that requested the matching. |
[in] | backend_desc | Backend descriptor to be described. |
[in] | config | Configuration for the benchmark being described. |
std::invalid_argument | if fields in backend_desc or config are not supported or invalid. |
This method will only be called if PartialBenchmarkDescriptor::matchBenchmarkDescriptor(const hebench::APIBridge::BenchmarkDescriptor &, const std::vector<hebench::APIBridge::WorkloadParam> &)
returns true
.
All fields in config
are valid. In backend_desc:
field operation_params_count
is expected to be returned by this method; field descriptor
is the original returned from the backend, and it is expected that this method returns the final, concrete version. All other input parameters are valid. Use these values to complete all fields in output
.
This method must fill out all fields in the output
structure. Field workload_header
may be set to empty string, but workload_name
and operation_params_count
must be set to the correct values. Field concrete_descriptor
must be set to the completed benchmark descriptor, where all configurable values are replaced by the concrete, final values. See WorkloadDescriptionOutput
for more details.
If extra header information returned in workload_header
is not empty, it will be appended in the report to a pre-generated header in CSV format. The following is an example of a pre-generated header:
output
.workload_header
will be appended at the next line immediately after this.
WorkloadDescriptionOutput
Implemented in hebench::TestHarness::SimpleSetIntersection::Offline::BenchmarkDescriptor, hebench::TestHarness::SimpleSetIntersection::Latency::BenchmarkDescriptor, hebench::TestHarness::SimpleSetIntersection::BenchmarkDescriptorCategory, hebench::TestHarness::MatrixMultiply::Offline::BenchmarkDescriptor, hebench::TestHarness::MatrixMultiply::Latency::BenchmarkDescriptor, hebench::TestHarness::MatrixMultiply::BenchmarkDescriptorCategory, hebench::TestHarness::LogisticRegression::Offline::BenchmarkDescriptor, hebench::TestHarness::LogisticRegression::Latency::BenchmarkDescriptor, hebench::TestHarness::LogisticRegression::BenchmarkDescriptorCategory, hebench::TestHarness::GenericWL::Offline::BenchmarkDescriptor, hebench::TestHarness::GenericWL::Latency::BenchmarkDescriptor, hebench::TestHarness::GenericWL::BenchmarkDescriptorCategory, hebench::TestHarness::EltwiseMult::Offline::BenchmarkDescriptor, hebench::TestHarness::EltwiseMult::Latency::BenchmarkDescriptor, hebench::TestHarness::EltwiseMult::BenchmarkDescriptorCategory, hebench::TestHarness::EltwiseAdd::Offline::BenchmarkDescriptor, hebench::TestHarness::EltwiseAdd::Latency::BenchmarkDescriptor, hebench::TestHarness::EltwiseAdd::BenchmarkDescriptorCategory, hebench::TestHarness::DotProduct::Offline::BenchmarkDescriptor, hebench::TestHarness::DotProduct::Latency::BenchmarkDescriptor, and hebench::TestHarness::DotProduct::BenchmarkDescriptorCategory.
|
static |
Extracts the batch sizes for a workload from a specified HEBench API benchmark descriptor.
[out] | sample_sizes | Array with param_count elements to receive the sample sizes for each operation parameter. This is the final value to be used during testing. |
[in] | param_count | Number of parameters for the workload operation. |
[in] | config_sample_sizes | User-requested (configured) sample sizes per operand. |
[in] | bench_desc | HEBench API benchmark descriptor from which to extract the workload batch sizes. |
[in] | default_sample_size_fallback | Fallback sample size for when none is specified in bench_desc or default_sample_sizes . Must be greater than 0 . |
[in] | force_config | If true default_sample_sizes values have priority over the those in bench_desc .cat_params.offline.data_count |
For an operation parameter the sample size priority is:
For force_config == false
bench_desc.cat_params.offline.data_count[i]
)config_sample_sizes[i]
)For force_config == false
config_sample_sizes[i]
)bench_desc.cat_params.offline.data_count[i]
)If any of these is 0
, then the next down the list is used. Workload specification must always be greater than 0
. Workload specification sizes are always supported. Sample sizes from any other sources are requests and may be satisfied based on actual dataset size.
Definition at line 114 of file hebench_ibenchmark.cpp.
|
staticprotected |
Definition at line 62 of file hebench_ibenchmark.cpp.
|
staticprotected |
Definition at line 52 of file hebench_ibenchmark.cpp.
|
staticprotected |
Definition at line 84 of file hebench_ibenchmark.cpp.
|
inlinestatic |
Specifies whether frontend will override backend descriptors using configuration data or not.
true
to have the frontend override the backend descriptors. false
to have the frontend respect the backend descriptors.When true
, frontend implementations should attempt to override backend descriptors with the corresponding configuration values. In this case, it is expected that backend implementations will validate the concrete benchmark descriptor during hebench::APIBridge::initBenchmark()
to detect invalid configurations.
If false
, frontend implementations should maintain non-flexible values of backend descriptors and ignore respective configuration data.
Definition at line 205 of file hebench_ibenchmark.h.
|
protectedpure virtual |
Determines if the represented benchmark can perform the workload described by a specified HEBench benchmark descriptor and workload parameters.
[in] | bench_desc | Descriptor to which compare. |
[in] | w_params | Arguments for the workload parameters. |
This method is used by BenchmarkFactory::createBenchmark()
to select the appropriate benchmark to create based on the descriptor.
Implemented in hebench::TestHarness::SimpleSetIntersection::Offline::BenchmarkDescriptor, hebench::TestHarness::SimpleSetIntersection::Latency::BenchmarkDescriptor, hebench::TestHarness::SimpleSetIntersection::BenchmarkDescriptorCategory, hebench::TestHarness::MatrixMultiply::Offline::BenchmarkDescriptor, hebench::TestHarness::MatrixMultiply::Latency::BenchmarkDescriptor, hebench::TestHarness::MatrixMultiply::BenchmarkDescriptorCategory, hebench::TestHarness::LogisticRegression::Offline::BenchmarkDescriptor, hebench::TestHarness::LogisticRegression::Latency::BenchmarkDescriptor, hebench::TestHarness::LogisticRegression::BenchmarkDescriptorCategory, hebench::TestHarness::GenericWL::Offline::BenchmarkDescriptor, hebench::TestHarness::GenericWL::Latency::BenchmarkDescriptor, hebench::TestHarness::GenericWL::BenchmarkDescriptorCategory, hebench::TestHarness::EltwiseMult::Offline::BenchmarkDescriptor, hebench::TestHarness::EltwiseMult::Latency::BenchmarkDescriptor, hebench::TestHarness::EltwiseMult::BenchmarkDescriptorCategory, hebench::TestHarness::EltwiseAdd::Offline::BenchmarkDescriptor, hebench::TestHarness::EltwiseAdd::Latency::BenchmarkDescriptor, hebench::TestHarness::EltwiseAdd::BenchmarkDescriptorCategory, hebench::TestHarness::DotProduct::Offline::BenchmarkDescriptor, hebench::TestHarness::DotProduct::Latency::BenchmarkDescriptor, and hebench::TestHarness::DotProduct::BenchmarkDescriptorCategory.
|
finaloverridevirtual |
Implementation of IBenchmarkDescriptor::matchDescriptor().
Clients cannot override this method.
This method calls the internal PartialBenchmarkDescriptor::matchBenchmarkDescriptor() which clients must implement. If matchBenchmarkDescriptor() returns true
, then method PartialBenchmarkDescriptor::completeWorkloadDescription() is called to complete the description with information specific to the workload.
Implements hebench::TestHarness::IBenchmarkDescriptor.
Definition at line 163 of file hebench_ibenchmark.cpp.
|
inlinestatic |
Sets whether frontend will override backend descriptors using configuration data or not.
[in] | value | New value to set. |
When set to true
, frontend implementations should attempt to override backend descriptors with the corresponding configuration values. In this case, it is expected that backend implementations will validate the concrete benchmark descriptor during hebench::APIBridge::initBenchmark()
to detect invalid configurations.
If set to false
, frontend implementations should maintain non-flexible values of backend descriptors and ignore respective configuration data.
Definition at line 219 of file hebench_ibenchmark.h.