da4ml.codegen.hls package

Submodules

da4ml.codegen.hls.hls_codegen module

da4ml.codegen.hls.hls_codegen.gen_mem_def(sol: CombLogic, typestr_fn: Callable[[bool | int, int, int], str])
da4ml.codegen.hls.hls_codegen.gen_table_name_defline(sol: CombLogic, op: Op, typestr_fn: Callable[[bool | int, int, int], str]) tuple[str, str]
da4ml.codegen.hls.hls_codegen.get_io_types(sol: CombLogic, flavor: str)
da4ml.codegen.hls.hls_codegen.get_typestr_fn(flavor: str)
da4ml.codegen.hls.hls_codegen.hls_logic_and_bridge_gen(sol: CombLogic, fn_name: str, flavor: str, pragmas: Sequence[str] | None = None, n_indent: int = 4, n_base_indent: int = 0, print_latency: bool = False, namespace: str = '')
da4ml.codegen.hls.hls_codegen.kif_to_hlslib_type(k: bool | int = 1, i: int = 0, f: int = 0)
da4ml.codegen.hls.hls_codegen.kif_to_oneapi_type(k: bool | int = 1, i: int = 0, f: int = 0)
da4ml.codegen.hls.hls_codegen.kif_to_vitis_type(k: bool | int = 1, i: int = 0, f: int = 0)
da4ml.codegen.hls.hls_codegen.output_gen(sol: CombLogic, typestr_fn: Callable[[bool | int, int, int], str])
da4ml.codegen.hls.hls_codegen.ssa_gen(comb: CombLogic, print_latency: bool, typestr_fn: Callable[[bool | int, int, int], str])

da4ml.codegen.hls.hls_model module

class da4ml.codegen.hls.hls_model.HLSModel(solution: CombLogic, prj_name: str, path: str | Path, flavor: str = 'vitis', print_latency: bool = True, part_name: str = 'xcvu13p-flga2577-2-e', pragma: Sequence[str] | None = None, clock_period: float = 5, clock_uncertainty: float = 0.1, io_delay_minmax: tuple[float, float] = (0.2, 0.4), namespace: str = 'comb_logic', inline_header: bool = True)

Bases: object

compile(verbose=False, openmp=True, o3: bool = False, clean=True, metadata: dict[str, str | float] | None = None)

Compile the model to a shared object file

Parameters:
  • verbose (bool, optional) – Verbose output, by default False

  • openmp (bool, optional) – Enable openmp, by default True

  • o3 (bool | None, optional) – Turn on -O3 flag, by default False

  • clean (bool, optional) – Remove obsolete shared object files, by default True

  • metadata (dict[str, str | float] | None, optional) – Extra metadata to write to the model folder, by default None

Raises:

RuntimeError – If compilation fails

predict(data: ndarray[tuple[Any, ...], dtype[T]] | Sequence[ndarray[tuple[Any, ...], dtype[T]]], n_threads: int = 0) ndarray[tuple[Any, ...], dtype[T]]

Run the model on the input data.

Parameters:

data (NDArray[np.floating] | Sequence[NDArray[np.floating]]) – Input data to the model. The shape is ignored, and the number of samples is determined by the size of the data.

Returns:

  • NDArray[np.floating] – Output of the model in shape (n_samples, output_size).

  • n_threads (int, optional) – Number of threads to use for inference. If 0, will use all available threads, or the value of the DA_DEFAULT_THREADS environment variable if set. If < 0, OpenMP will be disabled. Default is 0.

write(metadata: dict[str, str | float] | None = None)

Module contents