8 #include "../include/hebench_genericwl.h"
11 namespace TestHarness {
18 std::pair<std::vector<std::uint64_t>, std::vector<std::uint64_t>>
21 std::pair<std::vector<std::uint64_t>, std::vector<std::uint64_t>> retval;
27 <<
", but " << w_params.size() <<
"received.";
28 throw std::invalid_argument(IL_LOG_MSG_CLASS(ss.str()));
30 for (std::size_t i = 0; i < w_params.size(); ++i)
35 ss <<
"Invalid type for workload parameter " << i
36 <<
". Expected type ID " <<
WorkloadParameterType <<
", but " << w_params[i].data_type <<
" received.";
37 throw std::invalid_argument(IL_LOG_MSG_CLASS(ss.str()));
39 else if (w_params[i].u_param <= 0)
42 ss <<
"Invalid value in workload parameter " << i
43 <<
". Expected positive integer, but " << w_params[i].u_param <<
" received.";
44 throw std::invalid_argument(IL_LOG_MSG_CLASS(ss.str()));
48 std::vector<std::uint64_t> &input_sizes = retval.first;
49 std::vector<std::uint64_t> &output_sizes = retval.second;
51 input_sizes.resize(w_params[0].u_param);
52 output_sizes.resize(w_params[1].u_param);
54 const std::size_t NumWorkloadParams = input_sizes.size() + output_sizes.size() + 2;
60 <<
", but " << input_sizes.size() <<
"received.";
61 throw std::invalid_argument(IL_LOG_MSG_CLASS(ss.str()));
64 if (w_params.size() < NumWorkloadParams)
67 ss <<
"Insufficient workload parameters in 'w_params'. Expected " << NumWorkloadParams
68 <<
", but " << w_params.size() <<
"received.";
69 throw std::invalid_argument(IL_LOG_MSG_CLASS(ss.str()));
72 for (std::size_t i = 0; i < input_sizes.size(); ++i)
73 input_sizes[i] = w_params[i + 2].u_param;
74 for (std::size_t i = 0; i < output_sizes.size(); ++i)
75 output_sizes[i] = w_params[input_sizes.size() + i + 2].u_param;
81 const std::vector<hebench::APIBridge::WorkloadParam> &w_params)
const
109 std::stringstream ss;
120 ss <<
BaseWorkloadName <<
", " << op_info.first.size() <<
" Inputs, " << op_info.second.size() <<
" Outputs";
132 const std::vector<std::uint64_t> &max_batch_sizes,
133 const std::vector<std::uint64_t> &output_sizes,
135 const std::string &dataset_filename)
138 retval->init(input_sizes, max_batch_sizes, output_sizes, data_type, dataset_filename);
142 DataLoader::DataLoader()
146 void DataLoader::init(
const std::vector<std::uint64_t> &input_sizes,
147 const std::vector<std::uint64_t> &max_batch_sizes,
148 const std::vector<std::uint64_t> &output_sizes,
150 const std::string &dataset_filename)
154 if (input_sizes.size() != max_batch_sizes.size())
155 throw std::invalid_argument(IL_LOG_MSG_CLASS(
"Number of elements in `input_sizes` must match number of elements in `max_batch_sizes`."));
159 max_batch_sizes.data(),
162 output_sizes.data());
169 const std::uint64_t *param_data_pack_indices,
175 (void)param_data_pack_indices;
179 throw std::logic_error(IL_LOG_MSG_CLASS(
"Unable to compute output for generic workload operation."));
const hebench::APIBridge::BenchmarkDescriptor & descriptor
Benchmark backend descriptor, as retrieved by backend, corresponding to the registration handle h_des...
Specifies a benchmark configuration.
std::vector< hebench::APIBridge::WorkloadParam > w_params
Set of arguments for workload parameters.
void completeWorkloadDescription(WorkloadDescriptionOutput &output, const Engine &engine, const BenchmarkDescription::Backend &backend_desc, const BenchmarkDescription::Configuration &config) const override
Completes the description for the matched benchmark.
static std::pair< std::vector< std::uint64_t >, std::vector< std::uint64_t > > fetchIOVectorSizes(const std::vector< hebench::APIBridge::WorkloadParam > &w_params)
Retrieves details about the input parameters and results of the generic operation based on the specif...
static constexpr const char * BaseWorkloadName
bool matchBenchmarkDescriptor(const hebench::APIBridge::BenchmarkDescriptor &bench_desc, const std::vector< hebench::APIBridge::WorkloadParam > &w_params) const override
Determines if the represented benchmark can perform the workload described by a specified HEBench ben...
static constexpr std::uint64_t WorkloadParameterMinCount
static constexpr hebench::APIBridge::WorkloadParamType::WorkloadParamType WorkloadParameterType
static DataLoader::Ptr create(const std::vector< std::uint64_t > &input_sizes, const std::vector< std::uint64_t > &max_batch_sizes, const std::vector< std::uint64_t > &output_sizes, hebench::APIBridge::DataType data_type, const std::string &dataset_filename)
void computeResult(std::vector< hebench::APIBridge::NativeDataBuffer * > &result, const std::uint64_t *param_data_pack_indices, hebench::APIBridge::DataType data_type) override
Computes result of the operation on the input data given the of the input sample.
std::shared_ptr< DataLoader > Ptr
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.
static bool getForceConfigValues()
Specifies whether frontend will override backend descriptors using configuration data or not.
std::size_t operation_params_count
Number of parameters for the represented workload operation.
std::string workload_name
Human-readable friendly name for the represented workload to be used for its description on the repor...
hebench::APIBridge::BenchmarkDescriptor concrete_descriptor
Benchmark descriptor completed with concrete values assigned to configurable fields.
std::string workload_base_name
Human-readable friendly name for the represented workload to be used for its description on the repor...
Bundles values that need to be filled by a workload during completeWorkloadDescription().
void init(hebench::APIBridge::DataType data_type, std::size_t input_dim, const std::size_t *input_sample_count_per_dim, const std::uint64_t *input_count_per_dim, std::size_t output_dim, const std::uint64_t *output_count_per_dim, bool allocate_output)
Initializes dimensions of inputs and outputs. No allocation is performed.
DataType
Defines data types for a workload.
Workload workload
Workload for the benchmark.
Defines a benchmark test.
#define HEBENCH_MAX_OP_PARAMS
Maximum number of parameters supported by an operation.