Software LMUL Templates¶
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.
Bodies of the functions that change a software LMUL, written by one ISA (simd_ext/<isa>/<isa>_sw_lmul.json, optional): wcvt from m1 to m2 and ncvt from m2 to m1, for an ISA whose LMUL > 1 registers are software ones (sw_lmul in the ISA Descriptor, a struct of two LMUL 1 registers lo and hi). Without this file, the generator writes generic bodies (codegen/lmul_orchestrator.py): wcvt converts each half of the argument (lo / hi, then the d2 -> m1 conversion of Half-Vector Templates) and ncvt joins the conversions of the two registers with combine. An ISA gives its own body when it has better instructions (SVE: svunpklo / svunpkhi, svuzp1); the higher LMULs (m2 -> m4, ...) call these functions on each half. The code is Jinja2 and templating DSL, rendered for the LMUL of the arguments (m1 for wcvt, m2 for ncvt): %vd<tr>% is the type of the result. Each key is a function name. See Code Generation and Add an ISA.
Files (in generator/) |
Schema |
|---|---|
simd_ext/<isa>/<isa>_sw_lmul.json |
helpers_headers/schemas/sw_lmul_schema.json |
Example¶
{
"wcvt": [
{
"datatypes": [
"int8",
"int16",
"int32"
],
"code": [
"%vd<tr>% res;",
"res.lo.vd = svunpklo_{{ isa.datatypes[ctx.dt_ret].data_ext }}(vd0.vd);",
"res.hi.vd = svunpkhi_{{ isa.datatypes[ctx.dt_ret].data_ext }}(vd0.vd);",
"return res;"
]
}
]
}
Fields¶
| Field | Type | Description |
|---|---|---|
<function> |
array of object | Entries of the function, tried in order. |
<function>[].level |
any | Implementation level shown in the generated // Level comment. Optional. Without it, the level is detected from the code with the rules of the level audit (0: a single intrinsic; 1: several intrinsics, or intrinsics and MIPP functions; 2: only MIPP functions). Values: 0, 1, 2, 3. |
<function>[].datatypes |
"all_datatypes" or array of string |
Datatypes of the argument the entry applies to, or all_datatypes (the default). The first matching entry is used; a datatype without an entry keeps the generic body. |
<function>[].code |
array of string | Required. Body of the function, one line per item: Jinja2 (variables isa, isa_dt for the datatype entry of the argument in the ISA descriptor, ctx with ctx.dt_par / ctx.dt_ret, ...) and templating DSL (%vd<tr>% for the result). The result has the registers res.lo / res.hi for wcvt, the argument has vd0.lo / vd0.hi for ncvt. |