MLIR 22.0.0git
impl::MemRefDataVerifier< T > Struct Template Reference

Verify the result of two computations are equivalent up to a small numerical error and return the number of errors. More...

#include "mlir/ExecutionEngine/RunnerUtils.h"

Public Member Functions

bool verifyElem (double actual, double expected)
bool verifyElem (float actual, float expected)

Static Public Member Functions

static bool verifyRelErrorSmallerThan (T actual, T expected, T epsilon)
 Verify the relative difference of the values is smaller than epsilon.
static bool verifyElem (T actual, T expected)
 Verify the values are equivalent (integers) or are close (floating-point).
static int64_t verify (std::ostream &os, T *actualBasePtr, T *expectedBasePtr, int64_t dim, int64_t offset, const int64_t *sizes, const int64_t *strides, int64_t &printCounter)
 Verify the data element-by-element and return the number of errors.

Static Public Attributes

static constexpr int printLimit = 10
 Maximum number of errors printed by the verifier.

Detailed Description

template<typename T>
struct impl::MemRefDataVerifier< T >

Verify the result of two computations are equivalent up to a small numerical error and return the number of errors.

Definition at line 245 of file RunnerUtils.h.

Member Function Documentation

◆ verify()

template<typename T>
int64_t impl::MemRefDataVerifier< T >::verify ( std::ostream & os,
T * actualBasePtr,
T * expectedBasePtr,
int64_t dim,
int64_t offset,
const int64_t * sizes,
const int64_t * strides,
int64_t & printCounter )
static

Verify the data element-by-element and return the number of errors.

Definition at line 290 of file RunnerUtils.h.

References printLimit, verify(), and verifyElem().

Referenced by verify(), and impl::verifyMemRef().

◆ verifyElem() [1/3]

bool impl::MemRefDataVerifier< double >::verifyElem ( double actual,
double expected )
inline

Definition at line 278 of file RunnerUtils.h.

References verifyRelErrorSmallerThan().

◆ verifyElem() [2/3]

bool impl::MemRefDataVerifier< float >::verifyElem ( float actual,
float expected )
inline

Definition at line 284 of file RunnerUtils.h.

References verifyRelErrorSmallerThan().

◆ verifyElem() [3/3]

template<typename T>
bool impl::MemRefDataVerifier< T >::verifyElem ( T actual,
T expected )
static

Verify the values are equivalent (integers) or are close (floating-point).

Definition at line 273 of file RunnerUtils.h.

Referenced by verify().

◆ verifyRelErrorSmallerThan()

template<typename T>
bool impl::MemRefDataVerifier< T >::verifyRelErrorSmallerThan ( T actual,
T expected,
T epsilon )
static

Verify the relative difference of the values is smaller than epsilon.

Definition at line 262 of file RunnerUtils.h.

Referenced by verifyElem(), and verifyElem().

Member Data Documentation

◆ printLimit

template<typename T>
int impl::MemRefDataVerifier< T >::printLimit = 10
staticconstexpr

Maximum number of errors printed by the verifier.

Definition at line 247 of file RunnerUtils.h.

Referenced by verify().


The documentation for this struct was generated from the following file: