Functions and macros for comparing multi-dimensional buffers.
More...
|
| #define | CHECKASM_ALIGN(x) x __attribute__((aligned(CHECKASM_ALIGNMENT))) |
| | Declare a variable with platform-specific alignment requirements. More...
|
| |
| #define | checkasm_check2d(type, ...) checkasm_check2(type, __VA_ARGS__, 0, 0, 0) |
| | Compare two 2D buffers and fail test if different. More...
|
| |
| #define | checkasm_check2d_padded(type, ...) checkasm_check2(type, __VA_ARGS__) |
| | Compare two 2D buffers, including padding regions (detect over-write) More...
|
| |
| #define | BUF_RECT(type, name, w, h) |
| |
| #define | CLEAR_BUF_RECT(name) CLEAR_BUF(name##_buf) |
| | Clear a rectangular buffer (including padding) More...
|
| |
| #define | INITIALIZE_BUF_RECT(name) INITIALIZE_BUF(name##_buf) |
| | Initialize a rectangular buffer (including padding) with pathological values. More...
|
| |
| #define | RANDOMIZE_BUF_RECT(name) RANDOMIZE_BUF(name##_buf) |
| | Randomize a rectangular buffer (including padding) More...
|
| |
| #define | checkasm_check_rect(rect1, ...) checkasm_check2d(rect1##_type, rect1, __VA_ARGS__) |
| | Compare two rectangular buffers. More...
|
| |
| #define | checkasm_check_rect_padded(rect1, ...) checkasm_check2d_padded(rect1##_type, rect1, __VA_ARGS__, 1, 1, 8) |
| | Compare two rectangular buffers including padding. More...
|
| |
| #define | checkasm_check_rect_padded_align(rect1, ...) checkasm_check2d_padded(rect1##_type, rect1, __VA_ARGS__, 8) |
| | Compare two rectangular buffers, with custom alignment (over-write) More...
|
| |
| #define | CHECK_BUF_RECT(buf1, buf2, w, h) |
| | Compare two rectangular buffers (convenience macro) More...
|
| |
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.
◆ CHECKASM_ALIGN
Declare a variable with platform-specific alignment requirements.
- Parameters
-
- Note
- This must be applied to each buffer individually!
Definition at line 408 of file utils.h.
◆ checkasm_check2d
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) {
}
}
Definition at line 482 of file utils.h.
◆ checkasm_check2d_padded
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()
Definition at line 504 of file utils.h.
◆ BUF_RECT
Value:
= 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; \
Definition at line 605 of file utils.h.
◆ CLEAR_BUF_RECT
Clear a rectangular buffer (including padding)
- Parameters
-
| name | Buffer name (from BUF_RECT) |
- See also
- checkasm_clear()
Definition at line 623 of file utils.h.
◆ INITIALIZE_BUF_RECT
Initialize a rectangular buffer (including padding) with pathological values.
- Parameters
-
| name | Buffer name (from BUF_RECT) |
- See also
- checkasm_init()
Definition at line 631 of file utils.h.
◆ RANDOMIZE_BUF_RECT
Randomize a rectangular buffer (including padding)
- Parameters
-
| name | Buffer name (from BUF_RECT) |
- See also
- checkasm_randomize()
Definition at line 639 of file utils.h.
◆ checkasm_check_rect
| #define checkasm_check_rect |
( |
|
rect1, |
|
|
|
... |
|
) |
| checkasm_check2d(rect1##_type, rect1, __VA_ARGS__) |
Compare two rectangular buffers.
- Parameters
-
| rect1 | First buffer (from BUF_RECT) |
| ... | rect2, stride2, w, h, name |
- See also
- checkasm_check2d()
Definition at line 648 of file utils.h.
◆ checkasm_check_rect_padded
| #define checkasm_check_rect_padded |
( |
|
rect1, |
|
|
|
... |
|
) |
| checkasm_check2d_padded(rect1##_type, rect1, __VA_ARGS__, 1, 1, 8) |
Compare two rectangular buffers including padding.
- Parameters
-
| rect1 | First buffer (from BUF_RECT) |
| ... | rect2, stride2, w, h, name |
- See also
- checkasm_check2d()
Definition at line 657 of file utils.h.
◆ checkasm_check_rect_padded_align
| #define checkasm_check_rect_padded_align |
( |
|
rect1, |
|
|
|
... |
|
) |
| checkasm_check2d_padded(rect1##_type, rect1, __VA_ARGS__, 8) |
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()
Definition at line 673 of file utils.h.
◆ CHECK_BUF_RECT
| #define CHECK_BUF_RECT |
( |
|
buf1, |
|
|
|
buf2, |
|
|
|
w, |
|
|
|
h |
|
) |
| |
Value:
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()
Definition at line 685 of file utils.h.