Skip to content

Scalar Implementations

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.

Reference implementations of the functions. They define what each function computes: they are the code of the scalar ISA, the Level 3 fallback of the other ISAs, and the reference of the generated tests. A function can have several entries that split its datatypes or its mask variants.

Checked when the file is loaded: every declared function has entries, every datatype of a function is covered by an entry, and a function that is not declared in registry_interfaces.json is a blocking error. Before the code generation, gen_mipp_headers.py also checks that every mask variant of a function is covered by an entry.

Files (in generator/) Schema
helpers_headers/registry_scalar_implems.json helpers_headers/schemas/scalar_implems_schema.json

Example

{
    "absdiff": [
        {
            "type": "element-wide",
            "datatypes": "all_defs",
            "variants": [],
            "implem": [
                "res.vd[i] = %!pred_cond!% (vd0.vd[i] > vd1.vd[i] ? vd0.vd[i] - vd1.vd[i] : vd1.vd[i] - vd0.vd[i]) %!pred_alt!%;"
            ]
        }
    ]
}

Fields

Field Type Description
<function> array of object Entries of the function.
<function>[].type string Required. element-wide: implem is the body of a loop over the lanes, written by the generator (i is the lane index, vd0.vd[i] a lane of the first argument, res.vd[i] a lane of the result). vector-wide: implem is the whole body of the function (reductions, permutations).
<function>[].datatypes string or array of string Required. all_defs (the datatypes of the interface), an alias of DATATYPES_MAP or an explicit list.
<function>[].variants array of any Required. []: every variant allowed by the variants of the function in registry_interfaces.json. Otherwise the variants of this entry, among u (unmasked), m (Merge-Masked), z (Zero-Masked) and s (Source-Masked).
<function>[].implem string or array of string Required. Code, as a string or a list of lines, in the templating DSL. %!pred_cond!% and %!pred_alt!% implement the mask variants (Predication of the Scalar Implementations).