HEBench
Vector Dot Product Workload

Operation Description

Summary

This operation is defined as:

c = op(A, B)

where

op(A, B) = A . B

and operation . is the standard vector dot product.

Operation Parameters

Input: 2 parameters

Parameter Description
0 A is a vector with n components.
1 B is a vector with n components.

Result:

Output: 1 output

Output Description
0 c is a scalar. It is the result of dot product between A and B.

Details

If Z[i] denotes the element at component i in vector Z, then, the standard vector dot product operation is defined as:

c = A[0] * B[0] + A[1] * B[1] + ... + A[n - 1] * B[n - 1]

Workloads

This document applies to the following workloads:

Workload Parameters

Required workload parameters: 1

Index Name Type Description
0 n uint64_t Number of components in a vector.

Above parameters are required for the workload in the specified order. A backend must specify, at least, a set of default arguments for these parameters.

Backends can require extra parameters beyond the base requirements. If a backend requires extra parameters, these must have default values in every set of default arguments for the workload parameters.

Categories

This workload supports the following categories:

Category Parameters

Latency

See Latency Category .

Offline

See Offline Category .

Value ranges for elements in CategoryParams::offline::data_count. Default value is used when the backend implementation sets the data_count for the corresponding operand to 0, but user specified 0 or no value at run-time.

Parameter Lower bound Upper bound Default
0 1 none 5
1 1 none 5

Data Type

This workload is defined for the following data types:

@ Float64
64 bits IEEE 754 standard floating point real numbers.
Definition: types.h:306
@ Int64
64 bits signed integers.
Definition: types.h:304
@ Float32
32 bits IEEE 754 standard floating point real numbers.
Definition: types.h:382
@ Int32
32 bits signed integers.
Definition: types.h:380

Data Layout

1. Vectors

All scalar elements in a vector with elements of type T (where T is any of the supported types) lie contiguous in memory.

For example, given the following vector A with n = 3 components:

A = [ a0, a1, a2 ]

The elements will be stored in memory as:

Offset: 0 1 2
A a0 a1 a2

Backends should expect this layout for their raw, clear text inputs, and must generate this layout for their decoded outputs.

Notes

If several vectors will be pointed at by a single pointer, consecutive vectors will follow each other in memory.

2. Scalars

All scalars will be represented as vectors with a single element.

Dataset

Supported modes:

Generate External
yes yes

Data generation for vectors used as input for this workload occurs during workload initialization by Test Harness. Ground truths are pre-computed during data generation. There is no standard dataset.

During data generation, all vector elements are extracted from a pseudo-random normal distribution of mean 0 and standard deviation of 10: n(0, 10).