Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature[next]: Extend cartesian offset syntax #1484

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

SF-N
Copy link
Contributor

@SF-N SF-N commented Mar 8, 2024

Description

Add support for replacing the syntax for Cartesian offsets field(Ioff[1])(Joff[-1]) by field(I+1,J-1).

Current status: finished for embedded execution

Requirements

TODOs

  • Move transformation to foast_to_itir and extend for other backends

@SF-N SF-N requested a review from tehrengruber March 8, 2024 12:10
@tehrengruber tehrengruber changed the title Extend cartesian offset syntax feature[next]: Extend cartesian offset syntax Mar 8, 2024
Copy link
Contributor

@tehrengruber tehrengruber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review.

src/gt4py/next/common.py Show resolved Hide resolved
src/gt4py/next/common.py Outdated Show resolved Hide resolved
src/gt4py/next/common.py Outdated Show resolved Hide resolved
src/gt4py/next/ffront/foast_passes/type_deduction.py Outdated Show resolved Hide resolved
src/gt4py/next/ffront/foast_to_itir.py Show resolved Hide resolved
@SF-N SF-N requested a review from tehrengruber March 28, 2024 11:54
Copy link
Contributor

@havogt havogt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a reminder. We should wait with the merge until CAA is sorted out.

src/gt4py/next/ffront/foast_passes/type_deduction.py Outdated Show resolved Hide resolved
src/gt4py/next/type_system/type_info.py Outdated Show resolved Hide resolved
src/gt4py/next/common.py Outdated Show resolved Hide resolved
src/gt4py/next/common.py Outdated Show resolved Hide resolved
src/gt4py/next/common.py Outdated Show resolved Hide resolved
src/gt4py/next/ffront/foast_to_itir.py Outdated Show resolved Hide resolved
Comment on lines 312 to 327
case foast.BinOp(
op=dialect_ast_enums.BinaryOperator.ADD
| dialect_ast_enums.BinaryOperator.SUB,
left=foast.BinOp(
op=dialect_ast_enums.BinaryOperator.ADD
| dialect_ast_enums.BinaryOperator.SUB,
left=foast.Name(id=dimension),
right=foast.Constant(value=offset_index_left),
),
right=foast.Constant(value=offset_index),
):
if node.args[i].op == dialect_ast_enums.BinaryOperator.SUB: # type: ignore[attr-defined] # ensured by pattern
offset_index *= -1
shift_offsets.append(
im.shift(f"{dimension}off", offset_index_left + offset_index)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for the IDim+1+1 case right? Let's remove it for now since it is not generic anyway (i.e. doesn't work for IDim+1+1+1).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, I removed all sopport for (IDim +1) + 1 again and raise an error in type_deduction.py instaed.

src/gt4py/next/ffront/foast_to_itir.py Outdated Show resolved Hide resolved
src/gt4py/next/ffront/foast_to_itir.py Outdated Show resolved Hide resolved
src/gt4py/next/ffront/foast_to_itir.py Outdated Show resolved Hide resolved
@SF-N SF-N requested a review from tehrengruber April 12, 2024 15:33
@SF-N
Copy link
Contributor Author

SF-N commented Apr 12, 2024

I tried to resolve the conflict with next/program_processors/runners/gtfn.py but pre-commit reverts it back. Might it need to be adapted in main?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants