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

Merged
merged 32 commits into from
Sep 10, 2024
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e37fb21
Implement support for syntax field(I+1,J-1) for embedded
SF-N Mar 8, 2024
54c630f
Merge branch 'main' into cartesian_offset_syntax
SF-N Mar 8, 2024
53da840
Make _call_recursive and add type annotation (to be checked)
SF-N Mar 8, 2024
7073713
Try to fix arguments and annotations
SF-N Mar 11, 2024
c80e394
Fix test_laplacian
SF-N Mar 11, 2024
4c3dddf
Update and extend various parts
SF-N Mar 11, 2024
5b237d7
Remove comma
SF-N Mar 11, 2024
e479b96
Add support fir IDim + 1 + 1
SF-N Mar 13, 2024
b7fdc68
Only support one argument in case order matters
SF-N Mar 13, 2024
c50b083
Modify laplacian tests to avoid symmetry, extend visit_shift to also …
SF-N Mar 14, 2024
c1f2194
Use squared inpit field in laplacian tests, remove support for IDim +…
SF-N Mar 22, 2024
876e5b0
merge main
SF-N Mar 22, 2024
2c22920
Add annotation
SF-N Mar 22, 2024
b57afa0
Start working on review comments
SF-N Mar 27, 2024
79e8154
Extend offset_provider automatically
SF-N Mar 27, 2024
c080415
Update comments and add support for IDim+1+2 again (in foast_to_itir)
SF-N Mar 28, 2024
f95c6ca
Minor refactoring
SF-N Mar 28, 2024
72e2a1e
Reformat wrt pre-commit
SF-N Mar 28, 2024
d10ae99
Fix some problems occuring during PMAP-L implementation
SF-N Apr 11, 2024
5f8ab74
Implement review comments
SF-N Apr 12, 2024
c2d2188
Minor
SF-N Apr 12, 2024
f425e43
Minor
SF-N Apr 12, 2024
684fa0d
Remove support for (Idim + 1) + 2 again
SF-N Apr 12, 2024
6567c65
pre-commit changes
SF-N Apr 12, 2024
dc5616f
Merge origin/main
tehrengruber Sep 9, 2024
25786f8
General cleanup, added & adopted new offset syntax into new GTIR lowe…
tehrengruber Sep 9, 2024
267660f
Minor cleanups
tehrengruber Sep 9, 2024
1bc5a7e
Merge branch 'main' into cartesian_offset_syntax
tehrengruber Sep 9, 2024
c3e0a9a
Fix broken tests
tehrengruber Sep 9, 2024
2d2bd45
Merge remote-tracking branch 'origin_sf_n/cartesian_offset_syntax' in…
tehrengruber Sep 9, 2024
9dbe6c2
Cleanup
tehrengruber Sep 9, 2024
4d9394a
Fix dace sdfg-convertible program
tehrengruber Sep 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update comments and add support for IDim+1+2 again (in foast_to_itir)
SF-N committed Mar 28, 2024

Unverified

This user has not yet uploaded their public signing key.
commit c0804156e7883add229d2ca9d96c68a0b3efae40
3 changes: 2 additions & 1 deletion src/gt4py/next/ffront/foast_passes/type_deduction.py
Original file line number Diff line number Diff line change
@@ -629,11 +629,12 @@ def _deduce_binop_type(
# this relies on the convention that for each dimension we have an offset provider
# with the same name as the dimension
return ts.OffsetType(source=left.type.dim, target=(left.type.dim,))
# e.g. `IDim+1+2`: this is currently only implemented for embedded
if (
isinstance(left.type, ts.OffsetType)
and isinstance(right.type, ts.ScalarType)
and type_info.is_integral(right.type)
): #TODO: add comment
):
return ts.OffsetType(source=left.type.source, target=(left.type.source,))

logical_ops = {
16 changes: 16 additions & 0 deletions src/gt4py/next/ffront/foast_to_itir.py
Original file line number Diff line number Diff line change
@@ -309,6 +309,22 @@ def _visit_shift(self, node: foast.Call, **kwargs: Any) -> itir.Expr:
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))
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:
offset_index *= -1
shift_offsets.append(
im.shift(f"{dimension}off", offset_index_left + offset_index)
)
case foast.Name(id=offset_name):
assert len(node.args) == 1
return im.lifted_neighbors(