Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into dace-gtir-scan
Browse files Browse the repository at this point in the history
  • Loading branch information
edopao committed Dec 6, 2024
2 parents 397acae + 54f176f commit acf5ac0
Show file tree
Hide file tree
Showing 38 changed files with 91 additions and 1,926 deletions.
2 changes: 1 addition & 1 deletion docs/user/next/advanced/HackTheToolchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ from gt4py import eve

```python
cached_lowering_toolchain = gtx.backend.DEFAULT_TRANSFORMS.replace(
past_to_itir=gtx.ffront.past_to_itir.past_to_itir_factory(cached=False)
past_to_itir=gtx.ffront.past_to_itir.past_to_gtir_factory(cached=False)
)
```

Expand Down
18 changes: 3 additions & 15 deletions src/gt4py/next/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from gt4py.next import allocators as next_allocators
from gt4py.next.ffront import (
foast_to_gtir,
foast_to_itir,
foast_to_past,
func_to_foast,
func_to_past,
Expand All @@ -41,7 +40,7 @@

ARGS: typing.TypeAlias = arguments.JITArgs
CARG: typing.TypeAlias = arguments.CompileTimeArgs
IT_PRG: typing.TypeAlias = itir.FencilDefinition | itir.Program
IT_PRG: typing.TypeAlias = itir.Program


INPUT_DATA: typing.TypeAlias = DSL_FOP | FOP | DSL_PRG | PRG | IT_PRG
Expand Down Expand Up @@ -93,7 +92,7 @@ class Transforms(workflow.MultiWorkflow[INPUT_PAIR, stages.CompilableProgram]):
)

past_to_itir: workflow.Workflow[AOT_PRG, stages.CompilableProgram] = dataclasses.field(
default_factory=past_to_itir.past_to_itir_factory
default_factory=past_to_itir.past_to_gtir_factory
)

def step_order(self, inp: INPUT_PAIR) -> list[str]:
Expand Down Expand Up @@ -126,7 +125,7 @@ def step_order(self, inp: INPUT_PAIR) -> list[str]:
)
case PRG():
steps.extend(["past_lint", "field_view_prog_args_transform", "past_to_itir"])
case itir.FencilDefinition() | itir.Program():
case itir.Program():
pass
case _:
raise ValueError("Unexpected input.")
Expand All @@ -135,17 +134,6 @@ def step_order(self, inp: INPUT_PAIR) -> list[str]:

DEFAULT_TRANSFORMS: Transforms = Transforms()

# FIXME[#1582](havogt): remove after refactoring to GTIR
# note: this step is deliberately placed here, such that the cache is shared
_foast_to_itir_step = foast_to_itir.adapted_foast_to_itir_factory(cached=True)
LEGACY_TRANSFORMS: Transforms = Transforms(
past_to_itir=past_to_itir.past_to_itir_factory(to_gtir=False),
foast_to_itir=_foast_to_itir_step,
field_view_op_to_prog=foast_to_past.operator_to_program_factory(
foast_to_itir_step=_foast_to_itir_step
),
)


# TODO(tehrengruber): Rename class and `executor` & `transforms` attribute. Maybe:
# `Backend` -> `Toolchain`
Expand Down
5 changes: 2 additions & 3 deletions src/gt4py/next/ffront/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from gt4py.next.ffront import (
field_operator_ast as foast,
foast_to_gtir,
foast_to_itir,
past_process_args,
signature,
stages as ffront_stages,
Expand Down Expand Up @@ -186,7 +185,7 @@ def _all_closure_vars(self) -> dict[str, Any]:
return transform_utils._get_closure_vars_recursively(self.past_stage.closure_vars)

@functools.cached_property
def itir(self) -> itir.FencilDefinition:
def gtir(self) -> itir.Program:
no_args_past = toolchain.CompilableProgram(
data=ffront_stages.PastProgramDefinition(
past_node=self.past_stage.past_node,
Expand Down Expand Up @@ -561,7 +560,7 @@ def with_grid_type(self, grid_type: common.GridType) -> FieldOperator:
# a different backend than the one of the program that calls this field operator. Just use
# the hard-coded lowering until this is cleaned up.
def __gt_itir__(self) -> itir.FunctionDefinition:
return foast_to_itir.foast_to_itir(self.foast_stage)
return foast_to_gtir.foast_to_gtir(self.foast_stage)

# FIXME[#1582](tehrengruber): remove after refactoring to GTIR
def __gt_gtir__(self) -> itir.FunctionDefinition:
Expand Down
Loading

0 comments on commit acf5ac0

Please sign in to comment.