|
| str | _detect_arch () |
| |
| Path | _kernel_source (str arch, str subdir, str filename) |
| |
| list[str] | _include_dirs () |
| |
| int | _dtype_to_bit_width (dtype, *str factory_name) |
| |
| tuple[str, list[str]] | _conv_act_dtype_info (str base_name, act_dtype, *str factory_name) |
| |
| None | _require_fixed_tile_size (str factory_name, int tile_size, int expected=1024) |
| |
| int | _min_dma_aligned_elems (dtype, int align=4) |
| |
| Path | _default_source_path (str filename, str|None subdir=None) |
| |
| | _arg_type_key (t) |
| |
| ExternalFunction | _make_extern (str func_name, "Path | str" source_path, list arg_types, *list[str]|None compile_flags=None, bool use_chess=False, str|None shared_object_file_name=None) |
| |
Shared helpers for the kernels submodules.
| ExternalFunction iron.kernels._common._make_extern |
( |
str |
func_name, |
|
|
"Path | str" |
source_path, |
|
|
list |
arg_types, |
|
|
*list[str] | None |
compile_flags = None, |
|
|
bool |
use_chess = False, |
|
|
str | None |
shared_object_file_name = None |
|
) |
| |
|
protected |
Construct (or reuse) an ExternalFunction with the standard include_dirs.
Memoized on (func_name, source_path, arg_types, compile_flags,
use_chess) so repeated calls with identical parameters return the
SAME ExternalFunction instance (see ``_EXTERN_CACHE`` for rationale).
Different parameterizations get distinct instances AND distinct
``object_file_name``s — the latter is auto-suffixed with a short
digest of the cache key so per-parameterization .o files don't
overwrite each other on disk. The default ``<name>.o`` is preserved
when ``compile_flags`` is empty AND ``use_chess`` is False (no
parameterization to disambiguate).
``use_chess`` selects the Chess (xchesscc) compiler instead of Peano
for this kernel's .o build. See
:class:`aie.iron.kernel.ExternalFunction` for the design-level
contract: all EFs in a single ``@iron.jit`` design must share the
same toolchain choice (mixed peano/chess is rejected at compile
time).
``shared_object_file_name`` pins the output ``.o`` filename so
multiple factories targeting the SAME source file (e.g. companion
symbols like ``reduce_max_vector`` + ``compute_max`` both in
``reduce_max.cc``) can share one compile. The first call builds
the ``.o``; subsequent calls with the same ``shared_object_file_name``
skip the build and link against the existing one. Without this,
each factory would produce a distinct ``.o`` each carrying ALL
symbols from the ``.cc``, tripping a duplicate-symbol link error.