Test Specifications¶
Generated page
This page is generated by gen_mipp_docs.py from the JSON Schemas of the generator (generator/helpers_headers/schemas/, generator/helpers_tests/schemas/). To change it, edit the description fields of the schemas, not this page.
Test properties of the functions, in helpers_tests/tests_specs.json: how the inputs are drawn and how the results are compared with the scalar reference. default applies to every function; functions overrides it per function. A function that is not listed is tested with default.
The input domain can depend on the datatype, the LMUL, the target ISA (preprocessor define) and the mask variant. For each input, the generator looks for a domain in the section of the mask variant (maskm, ...), then in the entry itself, then in its unmasked section. Inside a domain, the first matching rules entry wins, then by_datatype, then by_lmul, then default; by_define emits one #if defined(...) branch per define, with the rest of the domain in the #else branch.
The consistency audit of gen_mipp_tests.py warns about the entries that are not declared functions.
Files (in generator/) |
Schema |
|---|---|
helpers_tests/tests_specs.json |
helpers_tests/schemas/specs_schema.json |
Example¶
{
"default": {
"distribution": "uniform",
"domain": {},
"tolerance": {
"type": "exact"
},
"comparison": "exact"
},
"functions": {
"acos": {
"domain": {
"min": -1.0,
"max": 1.0
},
"tolerance": {
"by_datatype": {
"float32": {
"type": "max_abs_diff",
"value": 1e-06
},
"float64": {
"type": "max_abs_diff",
"value": 1e-12
}
}
},
"comparison": "tolerance"
},
"div": {
"input_domain": [
{
"min": -100.0,
"max": 100.0
},
{
"min": -100.0,
"max": 100.0,
"exclude_zero": true
}
]
}
}
}
Fields¶
| Field | Type | Description |
|---|---|---|
default |
spec_entry |
Required. Properties of every function. |
functions |
map of spec_entry |
Required. Per-function overrides of default. |
functions.<function> |
spec_entry |
Definitions¶
domain_spec¶
Type: object. Range of the random values. min and max are used together; the other flags restrict the whole range of the type and cannot be combined with min / max, except exclude_zero. Empty: the whole range of the type.
| Field | Type | Description |
|---|---|---|
min |
number | Lower bound (with max). |
max |
number | Upper bound (with min). |
exclude_zero |
boolean | Never draw 0 (divisors). |
strictly_positive |
boolean | Values > 0. |
positive |
boolean | Values ≥ 0. |
strictly_negative |
boolean | Values < 0. |
negative |
boolean | Values ≤ 0. |
domain_spec_or_list¶
Type: domain_spec or array of domain_spec. One range for every input, or one range per input (first input first).
domain_entry¶
Type: domain_spec or object. A range, or ranges that depend on the datatype, the LMUL or the target ISA.
| Field | Type | Description |
|---|---|---|
default |
domain_spec_or_list |
Range when nothing else matches. |
by_datatype |
map of domain_spec_or_list |
Range per datatype. |
by_datatype.<datatype> |
domain_spec_or_list |
|
by_define |
map of domain_entry |
Domain per preprocessor define (MIPP_AVX2): one #if defined(...) branch each, in order. |
by_define.<define> |
domain_entry |
|
by_lmul |
map of domain_spec_or_list |
Range per LMUL (m1, m2, d2, ...). |
by_lmul.<lmul> |
domain_spec_or_list |
|
rules |
array of domain_rule |
Ordered rules; the first one whose datatype and lmul match gives the range. |
domain_rule¶
Type: object. A range restricted to a datatype and / or an LMUL.
| Field | Type | Description |
|---|---|---|
datatype |
string | Datatype of the rule (omitted: any), or a datatype pair src,dst for the conversions (float32,uint32). |
lmul |
string or number | LMUL of the rule, m2, d2 or a number (omitted: any). |
define |
string | Accepted, not used yet. |
min |
number | See domain_spec. |
max |
number | See domain_spec. |
exclude_zero |
boolean | |
strictly_positive |
boolean | |
positive |
boolean | |
strictly_negative |
boolean | |
negative |
boolean |
domain_or_list¶
Type: domain_entry or array of domain_entry. A domain for every input, or one domain per input.
tolerance_spec¶
Type: object. Allowed difference between a lane and the scalar reference, for floating-point types (integers are always compared exactly).
| Field | Type | Description |
|---|---|---|
type |
string | exact: no difference. max_abs_diff: |r − ref| ≤ value. relative_percent: |r − ref| ≤ value × |ref| (value is a fraction: 0.01 for 1 %). hybrid: |r − ref| ≤ abs_value + rel_value × |ref|. Values: exact, relative_percent, max_abs_diff, hybrid. |
value |
number | Tolerance of max_abs_diff and relative_percent. Omitted: 0.001. |
abs_value |
number | Absolute part of hybrid. |
rel_value |
number | Relative part of hybrid. |
by_lmul |
map of number | value per LMUL (numeric keys: "2", "4"). |
by_lmul.<lmul> |
number | |
by_datatype |
map of tolerance_spec |
Tolerance per datatype (float32, float64). |
by_datatype.<datatype> |
tolerance_spec |
spec_entry¶
Type: object. Test properties of a function (or the defaults). The keys unmasked, maskm, maskz and masks override the input properties (domain, input_domain, domain_src, distribution, mask_pattern) for one variant.
| Field | Type | Description |
|---|---|---|
distribution |
string or object | Distribution of the random inputs: uniform, or normal (with min / max: a truncated normal centered in the range, of standard deviation (max − min) / 6 unless sigma is given). |
distribution.type |
string | Required. Values: uniform, normal. |
distribution.sigma |
number | |
input_domain |
domain_or_list |
Domain per input, as a list (first input first). Takes precedence over domain. For a function that takes a register and a scalar (lshift, rshift), a list of two domains draws the scalar separately with the second one (otherwise the scalar is the first lane of the first input). |
domain |
domain_or_list |
Domain of the inputs (domain_or_list). |
tolerance |
tolerance_spec or object |
Tolerance of the comparison, used with comparison: tolerance: a tolerance_spec, or one per datatype or per target ISA (by_define: #if defined(...) branches). |
tolerance.default |
tolerance_spec |
|
tolerance.by_datatype |
map of tolerance_spec |
|
tolerance.by_datatype.<key> |
tolerance_spec |
|
tolerance.by_define |
map of tolerance_spec |
|
tolerance.by_define.<key> |
tolerance_spec |
|
tolerance.by_lmul |
map of number | max_abs_diff value per LMUL (numeric keys: "2", "4"), as in a tolerance_spec; 0.001 for the other LMULs. |
tolerance.by_lmul.<lmul> |
number | |
tolerance.rules |
array of object | Accepted, but not read by the test generator. |
comparison |
string or object | exact: ==. tolerance: see tolerance (floating-point types; integers stay exact). bitwise: same bits (results that may be NaN). logical: same truth value (masks, comparisons). Can be given per datatype. |
comparison.default |
string | Values: exact, logical, bitwise, tolerance. |
comparison.by_datatype |
map of string | |
comparison.by_datatype.<key> |
string | Values: exact, logical, bitwise, tolerance. |
overflow_check |
string or null | add, sub, mul: skip the lanes where the operation overflows the type (C tests only). accumulate_add, accumulate_mul: skip the test when the reduction overflows (hadd, hmul). Values: add, sub, mul, accumulate_add, accumulate_mul, null. |
disabled |
boolean | true: the generated test is commented out. |
disabled_reason |
string or null | Reason written at the top of the commented-out test. |
extra_includes |
array of string | Extra headers of the test: names of MIPP functions used by the test (tovd, get_k, ...) or verbatim include lines. |
valout_count |
boolean | The scalar written through the pointer (valout) is a number of lanes read (loadu_ff): the tests require it between 1 and the one of the scalar reference, and compare only these lanes (with skip_condition lanes_read). |
nan_inf_skip |
boolean | With a tolerance: skip the lanes where the difference with the reference is NaN or infinite. |
skip_condition |
string or null or object | Lanes to skip. {"type": "fractional_part", "value": 0.5, "tol": 1e-05} skips the lanes whose reference has a fractional part within tol of value (rounding ties of round). {"type": "subnormal_on_armv7"} skips, on NEON of ARMv7 only (MIPP_NEON_V1, which flushes the subnormals to zero), the lanes whose input or reference is subnormal. {"type": "lanes_read"} skips the lanes after the number of lanes read (loadu_ff). |
skip_condition.type |
string | Required. |
skip_condition.value |
number | Required. |
skip_condition.tol |
number | Required. |
skip_condition.type |
any | Required. Values: subnormal_on_armv7, lanes_read. |
support_obj |
boolean | false: the function has no C++ Object API overload, the Object test is commented out. |
lane_index |
string | The scalar argument is a number of lanes (index of a lane, offset of a slide): drawn at run time in [0, N) (lt_n: bcast, rotate) or [0, N] (le_n: slide, slideup, slidedown), N being the number of lanes of the tested register (it depends on the ISA and on the LMUL); lt_nb / le_nb: the same with the number of lanes of a block of 128 bits (the _b128 functions). Overrides input_domain for this argument. Values: lt_n, le_n, lt_nb, le_nb. |
mask_pattern |
string | Values of the input masks: uniform_bool (random), alternating (even lanes), sparse (one lane in four), dense (three lanes in four), all_true, all_false, or reduction_cycle (a different case at each iteration: all true, all false, all true but one lane, only one lane true, random; for the mask reductions such as any and all). Values: uniform_bool, alternating, all_true, all_false, reduction_cycle, sparse, dense. |
domain_src |
domain_entry |
Domain of the source register of the Source-Masked variant (masks). |
unmasked |
spec_entry |
Input properties of the unmasked variant. |
maskm |
spec_entry |
Input properties of the Merge-Masked variant. |
maskz |
spec_entry |
Input properties of the Zero-Masked variant. |
masks |
spec_entry |
Input properties of the Source-Masked variant. |
datatypes |
string or array of string | Datatypes to test, instead of those of the interface. |
special_values |
object | Values mixed into the random inputs: every other iteration, each lane takes one of these values (cycling, at a position that changes with the iteration). Used to test the cases that random values never hit (the halves of round, -0.0, the limits of the conversions, the NaN of the comparisons). The second and the third inputs of a function take the next values of the list. |
special_values.by_datatype |
map of array of number or string | Required. Values per datatype of the inputs (float32, float64, ...): numbers, or "nan", "inf" and "-inf" for the floating-point types. A key can also be a pair "source,destination" of a conversion ("float32,uint32": no negative value toward an unsigned type), chosen before the key of the source type. |
special_values.by_datatype.<datatype> |
array of number or string |