Skip to content

stage

CompilerMode dataclass

Safe mode checks tensor extents; debug also checks buffer accesses.

Source code in src/finch/symbolic/stage.py
 5
 6
 7
 8
 9
10
@dataclass(frozen=True)
class CompilerMode:
    """Safe mode checks tensor extents; debug also checks buffer accesses."""

    safe: bool = False
    debug: bool = False

Form

Bases: ABC

A Form represents the invariants that must hold for the inputs to be valid for a given stage. It will typically be a combination of a grammar and a set of constraints on the inputs. Stages should inherit from a Form to validate their inputs.

Source code in src/finch/symbolic/stage.py
25
26
27
28
29
30
31
32
33
34
class Form(ABC):
    """
    A Form represents the invariants that must hold for the inputs to be valid
    for a given stage. It will typically be a combination of a grammar and a
    set of constraints on the inputs. Stages should inherit from a Form to
    validate their inputs.
    """

    @abstractmethod
    def validate_inputs(cls, *inputs): ...

UnvalidatedForm

Bases: Form

UnvalidatedForm does not perform any validation on the input logic. This is essentially a to-do for validation and should be replaced.

Source code in src/finch/symbolic/stage.py
37
38
39
40
41
42
43
44
class UnvalidatedForm(Form):
    """
    UnvalidatedForm does not perform any validation on the input logic.
    This is essentially a to-do for validation and should be replaced.
    """

    def validate_inputs(self, *inputs):
        return