Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
havogt committed Dec 6, 2024
1 parent b7ac391 commit 2f9ab07
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 545 deletions.
12 changes: 0 additions & 12 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 Down Expand Up @@ -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_gtir_factory(),
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
512 changes: 0 additions & 512 deletions src/gt4py/next/ffront/foast_to_itir.py

This file was deleted.

3 changes: 1 addition & 2 deletions src/gt4py/next/ffront/past_to_itir.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def past_to_gtir(inp: AOT_PRG) -> stages.CompilableProgram:
... column_axis=None,
... )
>>> itir_copy = past_to_itir(
>>> itir_copy = past_to_gtir(
... toolchain.CompilableProgram(copy_program.past_stage, compile_time_args)
... )
Expand Down Expand Up @@ -191,7 +191,6 @@ class ProgramLowering(
"""

grid_type: common.GridType
to_gtir: bool = False # FIXME[#1582](havogt): remove after refactoring to GTIR

# TODO(tehrengruber): enable doctests again. For unknown / obscure reasons
# the above doctest fails when executed using `pytest --doctest-modules`.
Expand Down
2 changes: 1 addition & 1 deletion src/gt4py/next/program_processors/runners/roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def decorated_fencil(

gtir = next_backend.Backend(
name="roundtrip_gtir",
executor=Roundtrip(transforms=itir_transforms.apply_fieldview_transforms),
executor=Roundtrip(transforms=itir_transforms.apply_fieldview_transforms), # type: ignore[arg-type] # don't understand why mypy complains
allocator=next_allocators.StandardCPUFieldBufferAllocator(),
transforms=next_backend.Transforms(
past_to_itir=past_to_itir.past_to_gtir_factory(),
Expand Down
11 changes: 2 additions & 9 deletions tests/next_tests/unit_tests/ffront_tests/test_past_to_gtir.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def test_copy_lowering(copy_program_def, gtir_identity_fundef):
past_node,
function_definitions=[gtir_identity_fundef],
grid_type=gtx.GridType.CARTESIAN,
to_gtir=True,
)
set_at_pattern = P(
itir.SetAt,
Expand Down Expand Up @@ -93,7 +92,6 @@ def test_copy_restrict_lowering(copy_restrict_program_def, gtir_identity_fundef)
past_node,
function_definitions=[gtir_identity_fundef],
grid_type=gtx.GridType.CARTESIAN,
to_gtir=True,
)
set_at_pattern = P(
itir.SetAt,
Expand Down Expand Up @@ -149,9 +147,7 @@ def tuple_program(
make_tuple_op(inp, out=(out1[1:], out2[1:]))

parsed = ProgramParser.apply_to_function(tuple_program)
ProgramLowering.apply(
parsed, function_definitions=[], grid_type=gtx.GridType.CARTESIAN, to_gtir=True
)
ProgramLowering.apply(parsed, function_definitions=[], grid_type=gtx.GridType.CARTESIAN)


@pytest.mark.xfail(
Expand All @@ -166,9 +162,7 @@ def tuple_program(
make_tuple_op(inp, out=(out1[1:], out2))

parsed = ProgramParser.apply_to_function(tuple_program)
ProgramLowering.apply(
parsed, function_definitions=[], grid_type=gtx.GridType.CARTESIAN, to_gtir=True
)
ProgramLowering.apply(parsed, function_definitions=[], grid_type=gtx.GridType.CARTESIAN)


@pytest.mark.xfail
Expand All @@ -194,7 +188,6 @@ def test_invalid_call_sig_program(invalid_call_sig_program_def):
ProgramParser.apply_to_function(invalid_call_sig_program_def),
function_definitions=[],
grid_type=gtx.GridType.CARTESIAN,
to_gtir=True,
)

assert exc_info.match("Invalid call to 'identity'")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@

# TODO(SF-N): test scan operator

import pytest
from typing import Iterable, Literal, Optional, Union

import numpy as np
from typing import Iterable, Optional, Literal, Union
import pytest

from gt4py import eve
from gt4py.next.iterator.ir_utils import common_pattern_matcher as cpm, ir_makers as im
from gt4py.next import constructors
from gt4py.next import common, constructors, utils
from gt4py.next.common import Dimension
from gt4py.next.iterator import ir as itir
from gt4py.next.iterator.ir_utils import (
common_pattern_matcher as cpm,
domain_utils,
ir_makers as im,
)
from gt4py.next.iterator.transforms import infer_domain
from gt4py.next.iterator.ir_utils import domain_utils
from gt4py.next.common import Dimension
from gt4py.next import common
from gt4py.next.type_system import type_specifications as ts
from gt4py.next.iterator.transforms.constant_folding import ConstantFolding
from gt4py.next import utils
from gt4py.next.type_system import type_specifications as ts


float_type = ts.ScalarType(kind=ts.ScalarKind.FLOAT64)
IDim = common.Dimension(value="IDim", kind=common.DimensionKind.HORIZONTAL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

from . import pytestmark


dace_backend = pytest.importorskip("gt4py.next.program_processors.runners.dace_fieldview")


Expand Down

0 comments on commit 2f9ab07

Please sign in to comment.