Functions and macros for comparing multi-dimensional buffers.
More...
|
| #define | CHECKASM_ALIGN(x) |
| | Declare a variable with platform-specific alignment requirements.
|
| #define | checkasm_check2d(type, ...) |
| | Compare two 2D buffers and fail test if different.
|
| #define | checkasm_check2d_padded(type, ...) |
| | Compare two 2D buffers, including padding regions (detect over-write).
|
| #define | BUF_RECT(type, name, w, h) |
| #define | CLEAR_BUF_RECT(name) |
| | Clear a rectangular buffer (including padding).
|
| #define | INITIALIZE_BUF_RECT(name) |
| | Initialize a rectangular buffer (including padding) with pathological values.
|
| #define | RANDOMIZE_BUF_RECT(name) |
| | Randomize a rectangular buffer (including padding).
|
| #define | checkasm_check_rect(rect1, ...) |
| | Compare two rectangular buffers.
|
| #define | checkasm_check_rect_padded(rect1, ...) |
| | Compare two rectangular buffers including padding.
|
| #define | checkasm_check_rect_padded_align(rect1, ...) |
| | Compare two rectangular buffers, with custom alignment (over-write).
|
| #define | CHECK_BUF_RECT(buf1, buf2, w, h) |
| | Compare two rectangular buffers (convenience macro).
|
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.
◆ BUF_RECT
| #define BUF_RECT |
( |
| type, |
|
|
| name, |
|
|
| w, |
|
|
| h ) |
Value: DECL_CHECK_FUNC(*checkasm_check_impl_##name##_type, type) \
= checkasm_check_impl_##type; \
CHECKASM_ALIGN(type name##_buf[((h) + 32) * (CHECKASM_ROUND(w, 64) + 64) + 64]); \
const int name##_buf_w = CHECKASM_ROUND(w, 64) + 64; \
const int name##_buf_h = (h) + 32; \
ptrdiff_t name##_stride = sizeof(type) * name##_buf_w; \
(void) checkasm_check_impl(name##_type); \
(void) name##_stride; \
(void) name##_buf_h; \
type *name = name##_buf + name##_buf_w * 16 + 64
◆ CHECK_BUF_RECT
| #define CHECK_BUF_RECT |
( |
| buf1, |
|
|
| buf2, |
|
|
| w, |
|
|
| h ) |
Value:
#buf1 " vs " #buf2)
#define checkasm_check_rect_padded(rect1,...)
Compare two rectangular buffers including padding.
Definition utils.h:657
Compare two rectangular buffers (convenience macro).
- Parameters
-
| buf1 | First buffer (from BUF_RECT) |
| buf2 | Second buffer (from BUF_RECT) |
| w | Width of the usable buffer region |
| h | Height of the usable buffer region |
- See also
- checkasm_check_rect_padded()
◆ CHECKASM_ALIGN
| #define CHECKASM_ALIGN |
( |
| x | ) |
|
Value:x __attribute__((aligned(CHECKASM_ALIGNMENT)))
Declare a variable with platform-specific alignment requirements.
- Parameters
-
- Note
- This must be applied to each buffer individually!
#define CHECKASM_ALIGN(x)
Declare a variable with platform-specific alignment requirements.
Definition utils.h:408
◆ checkasm_check2d
| #define checkasm_check2d |
( |
| type, |
|
|
| ... ) |
Value:checkasm_check2(type, __VA_ARGS__, 0, 0, 0)
Compare two 2D buffers and fail test if different.
- Parameters
-
| type | Element type (e.g., uint8_t, int, float) |
| buf1 | First buffer pointer to compare |
| stride1 | First buffer stride in bytes |
| buf2 | Second buffer pointer to compare |
| stride2 | Second buffer stride in bytes |
| w | Width of the buffers in elements |
| h | Height of the buffers in lines |
| name | Name of the buffer (for error reporting) |
| ... | Extra parameters (e.g. max_ulp for checkasm_check2d(float_ulp, ...)) |
- Note
- This will automatically print a hexdump of the differing regions on failure, if verbose mode is enabled.
const ptrdiff_t stride = sizeof(buf1[0]);
for (int h = 8; h <= 64; h <<= 1) {
for (int w = 8; w <= 64; w <<= 1) {
}
}
#define checkasm_check2d(type,...)
Compare two 2D buffers and fail test if different.
Definition utils.h:482
#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_check2d_padded
| #define checkasm_check2d_padded |
( |
| type, |
|
|
| ... ) |
Value:checkasm_check2(type, __VA_ARGS__)
Compare two 2D buffers, including padding regions (detect over-write).
- Parameters
-
| type | Element type (e.g., uint8_t, int, float) |
| buf1 | First buffer pointer to compare |
| stride1 | First buffer stride in bytes |
| buf2 | Second buffer pointer to compare |
| stride2 | Second buffer stride in bytes |
| w | Width of the buffers in elements |
| h | Height of the buffers in lines |
| name | Name of the buffer (for error reporting) |
| ... | Extra parameters (e.g. max_ulp for checkasm_check2d_padded(float_ulp, ...)) |
| align_w | Horizontal alignment of the allowed over-write (elements) |
| align_h | Vertical alignment of the allowed over-write (lines), or 0 to disable top/bottom overwrite checks. |
| padding | Number of extra elements/lines of padding to check (past the alignment boundaries) |
- See also
- checkasm_check2d(), checkasm_check_rect_padded()
◆ checkasm_check_rect
| #define checkasm_check_rect |
( |
| rect1, |
|
|
| ... ) |
Value:
Compare two rectangular buffers.
- Parameters
-
| rect1 | First buffer (from BUF_RECT) |
| ... | rect2, stride2, w, h, name |
- See also
- checkasm_check2d()
◆ checkasm_check_rect_padded
| #define checkasm_check_rect_padded |
( |
| rect1, |
|
|
| ... ) |
Value:
#define checkasm_check2d_padded(type,...)
Compare two 2D buffers, including padding regions (detect over-write).
Definition utils.h:504
Compare two rectangular buffers including padding.
- Parameters
-
| rect1 | First buffer (from BUF_RECT) |
| ... | rect2, stride2, w, h, name |
- See also
- checkasm_check2d()
◆ checkasm_check_rect_padded_align
| #define checkasm_check_rect_padded_align |
( |
| rect1, |
|
|
| ... ) |
Value:
Compare two rectangular buffers, with custom alignment (over-write).
- Parameters
-
| rect1 | First buffer (from BUF_RECT) |
| ... | rect2, stride2, w, h, name, align |
- See also
- checkasm_check2d_padded()
"buffer", 16, 1);
#define checkasm_check_rect_padded_align(rect1,...)
Compare two rectangular buffers, with custom alignment (over-write).
Definition utils.h:673
◆ CLEAR_BUF_RECT
| #define CLEAR_BUF_RECT |
( |
| name | ) |
|
Value:
#define CLEAR_BUF(buf)
Clear a fixed size buffer (convenience macro).
Definition utils.h:254
Clear a rectangular buffer (including padding).
- Parameters
-
| name | Buffer name (from BUF_RECT) |
- See also
- checkasm_clear()
◆ INITIALIZE_BUF_RECT
| #define INITIALIZE_BUF_RECT |
( |
| name | ) |
|
Value:
#define INITIALIZE_BUF(buf)
Fill a fixed size buffer with pathological test data (convenience macro).
Definition utils.h:269
Initialize a rectangular buffer (including padding) with pathological values.
- Parameters
-
| name | Buffer name (from BUF_RECT) |
- See also
- checkasm_init()
◆ RANDOMIZE_BUF_RECT
| #define RANDOMIZE_BUF_RECT |
( |
| name | ) |
|
Value:
#define RANDOMIZE_BUF(buf)
Fill a fixed size buffer wth random data (convenience macro).
Definition utils.h:261
Randomize a rectangular buffer (including padding).
- Parameters
-
| name | Buffer name (from BUF_RECT) |
- See also
- checkasm_randomize()