checkasm 1.0.1
Assembly testing and benchmarking framework
Loading...
Searching...
No Matches
Buffer Comparison Utilities

Functions and macros for comparing multi-dimensional buffers. More...

Collaboration diagram for Buffer Comparison Utilities:

Macros

#define CHECKASM_ALIGN(x)
 Declare a variable with platform-specific alignment requirements.
#define checkasm_check(type, ...)
 Compare two 2D buffers and fail test if different.
#define checkasm_check_padded(type, ...)
 Compare two 2D buffers, including padding regions (detect over-write).

Detailed Description

Functions and macros for comparing multi-dimensional buffers.

These utilities compare 2D buffers (with stride support) and detect differences, including in padding regions. Used to verify that optimized implementations produce bit-identical output to reference implementations.

Macro Definition Documentation

◆ CHECKASM_ALIGN

#define CHECKASM_ALIGN ( x)
Value:
x __attribute__((aligned(CHECKASM_ALIGNMENT)))

Declare a variable with platform-specific alignment requirements.

Parameters
xVariable declaration
Note
This must be applied to each buffer individually!
// correct
CHECKASM_ALIGN(uint8_t buf1[64*64]);
CHECKASM_ALIGN(uint8_t buf2[64*64]);
// wrong
CHECKASM_ALIGN(uint8_t buf1[64*64], buf2[64*64]);
#define CHECKASM_ALIGN(x)
Declare a variable with platform-specific alignment requirements.
Definition utils.h:408

◆ checkasm_check

#define checkasm_check ( type,
... )
Value:
checkasm_check2(type, __VA_ARGS__, 0, 0, 0)

Compare two 2D buffers and fail test if different.

Parameters
typeElement type (e.g., uint8_t, int, float)
buf1First buffer pointer to compare
stride1First buffer stride in bytes
buf2Second buffer pointer to compare
stride2Second buffer stride in bytes
wWidth of the buffers in elements
hHeight of the buffers in lines
nameName of the buffer (for error reporting)
...Extra parameters (e.g. max_ulp for checkasm_check(float_ulp, ...))
Note
This will automatically print a hexdump of the differing regions on failure, if verbose mode is enabled.
CHECKASM_ALIGN(uint8_t buf1[128]);
CHECKASM_ALIGN(uint8_t buf2[128]);
for (int w = 8; w <= 128; w <<= 1) {
if (checkasm_check_func(..., "myfunc_w%d", w)) {
checkasm_check(uint8_t, buf1, 0, buf2, 0, w, 1, "buffer");
}
}
#define checkasm_check(type,...)
Compare two 2D buffers and fail test if different.
Definition utils.h:480
#define checkasm_call_ref(...)
Call the reference implementation.
Definition test.h:327
#define checkasm_call_new(...)
Call the implementation being tested with validation.
Definition test.h:342
#define checkasm_check_func(func,...)
Check if a function should be tested and set up function references.
Definition test.h:76

◆ checkasm_check_padded

#define checkasm_check_padded ( type,
... )
Value:
checkasm_check2(type, __VA_ARGS__)

Compare two 2D buffers, including padding regions (detect over-write).

Parameters
typeElement type (e.g., uint8_t, int, float)
buf1First buffer pointer to compare
stride1First buffer stride in bytes
buf2Second buffer pointer to compare
stride2Second buffer stride in bytes
wWidth of the buffers in elements
hHeight of the buffers in lines
nameName of the buffer (for error reporting)
...Extra parameters (e.g. max_ulp for checkasm_check(float_ulp, ...))
align_wHorizontal alignment of the allowed over-write (elements)
align_hVertical alignment of the allowed over-write (lines)
paddingNumber of extra elements/lines of padding to check (past the alignment boundaries)
See also
checkasm_check(), checkasm_check_rect_padded()