forked from GridTools/gt4py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix[next]: Fix Program.itir (GridTools#1523)
## Description Fix diverging behavior of `Program.itir` for embedded vs backend. Temporary regression test included until `next.decorator` can be type checked, which should render it obsolete. Co-authored-by: Till Ehrengruber <[email protected]>
- Loading branch information
1 parent
f857184
commit 609a5c9
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/next_tests/integration_tests/feature_tests/ffront_tests/test_decorator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# GT4Py - GridTools Framework | ||
# | ||
# Copyright (c) 2014-2023, ETH Zurich | ||
# All rights reserved. | ||
# | ||
# This file is part of the GT4Py project and the GridTools framework. | ||
# GT4Py is free software: you can redistribute it and/or modify it under | ||
# the terms of the GNU General Public License as published by the | ||
# Free Software Foundation, either version 3 of the License, or any later | ||
# version. See the LICENSE.txt file at the top-level directory of this | ||
# distribution for a copy of the license or check <https://www.gnu.org/licenses/>. | ||
# | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# TODO(dropd): Remove as soon as `gt4py.next.ffront.decorator` is type checked. | ||
from gt4py import next as gtx | ||
from gt4py.next.iterator import ir as itir | ||
|
||
from next_tests.integration_tests import cases | ||
from next_tests.integration_tests.cases import cartesian_case | ||
from next_tests.integration_tests.feature_tests.ffront_tests.ffront_test_utils import ( | ||
exec_alloc_descriptor, | ||
) | ||
|
||
|
||
def test_program_itir_regression(cartesian_case): | ||
@gtx.field_operator(backend=None) | ||
def testee_op(a: cases.IField) -> cases.IField: | ||
return a | ||
|
||
@gtx.program(backend=None) | ||
def testee(a: cases.IField, out: cases.IField): | ||
testee_op(a, out=out) | ||
|
||
assert isinstance(testee.itir, itir.FencilDefinition) | ||
assert isinstance(testee.with_backend(cartesian_case.executor).itir, itir.FencilDefinition) |