Skip to content

stages

LogicEvaluator

Bases: Stage

Source code in src/finch/finch_logic/stages.py
13
14
15
16
17
18
19
20
class LogicEvaluator(Stage):
    @abstractmethod
    def lower(
        self, term: lgc.LogicNode, bindings: dict[lgc.Alias, Tensor] | None = None
    ):
        """
        Evaluate the given logic.
        """

lower(term, bindings=None) abstractmethod

Evaluate the given logic.

Source code in src/finch/finch_logic/stages.py
14
15
16
17
18
19
20
@abstractmethod
def lower(
    self, term: lgc.LogicNode, bindings: dict[lgc.Alias, Tensor] | None = None
):
    """
    Evaluate the given logic.
    """

LogicLoader

Bases: Stage

Source code in src/finch/finch_logic/stages.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class LogicLoader(Stage):
    @abstractmethod
    def lower(
        self,
        prgm: lgc.LogicStatement,
        bindings: dict[lgc.Alias, TensorFType],
        stats: dict[lgc.Alias, TensorStats],
        stats_factory: StatsFactory,
    ) -> tuple[
        AssemblyLibrary,
        dict[lgc.Alias, TensorFType],
        dict[lgc.Alias, tuple[lgc.Field | None, ...]],
        lgc.LogicStatement,
    ]:
        """
        Generate Finch Library from the given logic and input types, with a
        single method called `main` which implements the logic. Also return a
        dictionary including additional tables needed to run the kernel, and
        the final program as lowered, for bind-time inference (e.g. resolving
        dynamic output fills against actual argument fills).
        """

lower(prgm, bindings, stats, stats_factory) abstractmethod

Generate Finch Library from the given logic and input types, with a single method called main which implements the logic. Also return a dictionary including additional tables needed to run the kernel, and the final program as lowered, for bind-time inference (e.g. resolving dynamic output fills against actual argument fills).

Source code in src/finch/finch_logic/stages.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@abstractmethod
def lower(
    self,
    prgm: lgc.LogicStatement,
    bindings: dict[lgc.Alias, TensorFType],
    stats: dict[lgc.Alias, TensorStats],
    stats_factory: StatsFactory,
) -> tuple[
    AssemblyLibrary,
    dict[lgc.Alias, TensorFType],
    dict[lgc.Alias, tuple[lgc.Field | None, ...]],
    lgc.LogicStatement,
]:
    """
    Generate Finch Library from the given logic and input types, with a
    single method called `main` which implements the logic. Also return a
    dictionary including additional tables needed to run the kernel, and
    the final program as lowered, for bind-time inference (e.g. resolving
    dynamic output fills against actual argument fills).
    """