Skip to content

Command-Line Reference

Generated page

This page is generated by gen_mipp_docs.py from the argparse parsers of the generators (build_arg_parser()): --help prints the same information. To change it, edit the help strings in the scripts, not this page.

All the generators run from generator/, in the virtual environment of the generator (see Setup). They take their inputs in generator/ and write their outputs next to it, in the repository.

Script Role
gen_mipp_headers.py Generate the MIPP headers in ../include/ from the JSON files of generator/.
gen_mipp_tests.py Generate the Catch2 unit tests of MIPP in ../tests/src/ from registry_interfaces.json, helpers_tests/tests_specs.json and helpers_tests/tests_templates.json.
gen_mipp_docs.py Generate the generated parts of the documentation in ../docs/, from the same JSON files as the headers.

gen_mipp_headers.py

Generate the MIPP headers in ../include/ from the JSON files of generator/.

The script validates the JSON files and runs the audits, generates the C code of each ISA (one layer per directory of simd_ext/), then the C, C++ Functional and C++ Object interfaces and the public headers. It ends with a table of the number of functions per implementation level and per ISA.

usage: gen_mipp_headers.py [-h] [-l LAYER [LAYER ...]] [--no-clean]
                           [--simd-ext ISA [ISA ...]]
                           [--header-type {function_header,category_header}]
                           [--granularity {coarse,fine}] [--audit AUDIT [AUDIT ...]]

Options

Option Default Description
-l, --layers LAYER [LAYER ...] all Parts of the tree to (re)generate: an ISA layer (one per directory of simd_ext/), all_isas (every ISA layer), wrappers (the C, C++ Functional and C++ Object interfaces and the public headers) or all. Comma-separated lists are accepted. Mostly useful with --no-clean, to regenerate a part of an existing tree. ISA layers: avx, avx512, neon, rvv, scalar, sse, sve.
--no-clean off Do not delete ../include/ before generating. Needed when --layers regenerates only a part of the tree.
--simd-ext ISA [ISA ...] all ISAs present in the generated tree (all for every directory of simd_ext/; comma-separated lists are accepted). The sub_isa chain of each selected ISA and the scalar fallback are always added: --simd-ext avx512 generates AVX-512, AVX, SSE and scalar. ISAs: avx, avx512, neon, rvv, scalar, sse, sve.
--header-type HEADER_TYPE function_header Organization of the internal headers: one header per function (function_header) or one header per category (category_header, experimental). Choices: function_header, category_header.
--granularity GRANULARITY coarse coarse: one public header per function and per category (<mipp/cpp/fun/add.hpp>). fine: in addition, one header per mask variant, per LMUL and per (variant, LMUL) pair (<mipp/cpp/fun/m/m2/add.hpp>), built on atomic internal headers. Choices: coarse, fine.
--audit AUDIT [AUDIT ...] all Audits to run. They print warnings and never stop the generation (the validation checks always run and do). levels: an implementation is in the file of the wrong level. dead-code: templates and implementations that are never used. duplicates: overlapping implementations of the same function and datatype. json-structure: unsorted keys and empty lists in the JSON files. Choices: levels, dead-code, duplicates, json-structure, all, none.

Examples

./gen_mipp_headers.py                               # every ISA, coarse granularity
./gen_mipp_headers.py --granularity fine            # every ISA, fine granularity (as in the CI)
./gen_mipp_headers.py --simd-ext neon --audit none  # NEON and scalar only, no audit
./gen_mipp_headers.py --layers neon --no-clean      # regenerate the NEON layer in place

See also: Static Audits, Header Layout, Headers & Compile Time.


gen_mipp_tests.py

Generate the Catch2 unit tests of MIPP in ../tests/src/ from registry_interfaces.json, helpers_tests/tests_specs.json and helpers_tests/tests_templates.json.

Each test fills its inputs with random values, calls the function under test and compares every lane with the scalar reference (Level 3). The C API gets one file per function, LMUL and mask variant (tests/src/c/<category>/<m1|d2|...>/<variant>/<function>.cpp), the C++ Functional and Object APIs one file per function (tests/src/<cpp|obj>/<category>/<function>.cpp) that covers every datatype, LMUL and mask variant.

usage: gen_mipp_tests.py [-h] [-N NUM_ITERATIONS] [--no-clean] [--lmul [LMUL ...]]
                         [--ldiv LDIV [LDIV ...]] [--no-ldiv]
                         [--mask-kind KIND [KIND ...]] [--skip-lmul-cpp]
                         [--skip-mask-cpp] [--audit AUDIT [AUDIT ...]]
                         [API]

Arguments

Argument Default Description
[API] c cpp obj API to generate the tests for: C, C++ Functional or C++ Object. Without it, the three APIs. Choices: c, cpp, obj.

Options

Option Default Description
-N, --num-iterations NUM_ITERATIONS 10 Number of random iterations of each test (the N_ITER environment variable overrides it at run time).
--no-clean off Do not delete the test sources of the selected APIs before generating.
--lmul [LMUL ...] 0 1 2 4 8 LMUL values to test. 0 and 1 both stand for the base registers (LMUL 1). Choices: 0, 1, 2, 4, 8.
--ldiv LDIV [LDIV ...] 2 LDIV values to test: 2 tests the half-vectors (d2). Choices: 2.
--no-ldiv off Do not test the half-vectors (same as an empty --ldiv).
--mask-kind KIND [KIND ...] unmasked maskm maskz masks Variants to test: unmasked, maskm (Merge-Masked), maskz (Zero-Masked) and masks (Source-Masked). A function is only tested for the variants of its variants. Choices: unmasked, maskm, maskz, masks.
--skip-lmul-cpp off Deprecated, no effect. Kept for backward compatibility.
--skip-mask-cpp off Deprecated, no effect. Kept for backward compatibility.
--audit AUDIT [AUDIT ...] all Audits of tests_specs.json. They print warnings and never stop the generation. consistency: entries of tests_specs.json that are not declared functions. Choices: consistency, all, none.

Examples

./gen_mipp_tests.py                                            # the three APIs, every LMUL and variant
./gen_mipp_tests.py obj --lmul 0 8 --ldiv 2                    # C++ Object tests, as in the CI
./gen_mipp_tests.py c --lmul 1 --no-ldiv --mask-kind unmasked  # smallest C test set

See also: Test Generator, Test Specifications, Build and Run the Unit Tests.


gen_mipp_docs.py

Generate the generated parts of the documentation in ../docs/, from the same JSON files as the headers.

Parts (selected with --only):

  • isas_support: Hardware Support pages (docs/isas_support/), the implementation level of each function per ISA, found with the candidate resolver of the header generator;
  • funcs_support: Function Support pages (docs/funcs_support/), one page per function with its prototypes and support tables;
  • explorer: data files of the API Explorer (docs/assets/data/mipp_api_index.json and mipp_api_details.json) and the symbol tables of its Algorithm modal (docs/assets/data/algo/), read from the generated headers: run gen_mipp_headers.py first, otherwise the tables are skipped. It also validates the <isa>_explorer.json files;
  • simulator: WebAssembly modules of the scalar simulator of the API Explorer (docs/assets/data/sim/): the scalar references compiled with clang for WebAssembly, one module per register size (128 to 2048 bits) and LMUL, from the generated headers and the explorer data. It needs a WebAssembly toolchain (WASI_SDK_PATH, or clang, wasm-ld and wasi-libc installed), otherwise it is skipped with a warning;
  • dev_reference: command-line and registry reference of the Developer Guide (docs/developer/reference/cli.md and docs/developer/reference/registries/);
  • includes: tables included in the hand-written pages (docs/includes/generated/): LMUL and half-vector availability per target, datatypes, categories, variants lists, scalar forms, the latest release of MIPPv2 (nearest Git tag), the functions to write first for a new ISA (about 30 s: the candidate resolver is run a few hundred times).

All these outputs are ignored by Git.

usage: gen_mipp_docs.py [-h] [--only PART [PART ...]]

Options

Option Default Description
--only PART [PART ...] all Parts to generate. Choices: isas_support, funcs_support, explorer, simulator, dev_reference, includes, all.

Examples

./gen_mipp_docs.py                                # every part, as in the CI
./gen_mipp_docs.py --only dev_reference includes  # parts needed by the hand-written pages only

See also: Docs & API Explorer.