Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

Add private attributes and data annotations to eve Nodes #88

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 14 commits
Commits
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
28 changes: 0 additions & 28 deletions examples/eve/workshop-2020-10/solution/day1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -86,115 +86,87 @@
"text": [
"<ipython-input-1-b15736de57c7>:6 <module>\n",
" binop: BinaryOp(\n",
" id_='BinaryOp_3',\n",
" left=Literal(\n",
" id_='Literal_1',\n",
" value='1',\n",
" ),\n",
" right=Literal(\n",
" id_='Literal_2',\n",
" value='1',\n",
" ),\n",
" op='+',\n",
" ) (BinaryOp)\n",
"<ipython-input-1-b15736de57c7>:16 <module>\n",
" lap: Fun(\n",
" id_='Fun_28',\n",
" name='lap',\n",
" params=[\n",
" FieldDecl(\n",
" id_='FieldDecl_26',\n",
" name='out',\n",
" ),\n",
" FieldDecl(\n",
" id_='FieldDecl_27',\n",
" name='in',\n",
" ),\n",
" ],\n",
" horizontal_loops=[\n",
" HorizontalLoop(\n",
" id_='HorizontalLoop_25',\n",
" i_indent=Indent(\n",
" id_='Indent_23',\n",
" left=1,\n",
" right=1,\n",
" ),\n",
" j_indent=Indent(\n",
" id_='Indent_24',\n",
" left=1,\n",
" right=1,\n",
" ),\n",
" body=[\n",
" AssignStmt(\n",
" id_='AssignStmt_22',\n",
" left=FieldAccess(\n",
" id_='FieldAccess_21',\n",
" name='out',\n",
" offset=Offset(\n",
" id_='Offset_20',\n",
" i=0,\n",
" j=0,\n",
" ),\n",
" ),\n",
" right=BinaryOp(\n",
" id_='BinaryOp_19',\n",
" left=BinaryOp(\n",
" id_='BinaryOp_7',\n",
" left=Literal(\n",
" id_='Literal_4',\n",
" value='-4',\n",
" ),\n",
" right=FieldAccess(\n",
" id_='FieldAccess_6',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_5',\n",
" i=0,\n",
" j=0,\n",
" ),\n",
" ),\n",
" op='*',\n",
" ),\n",
" right=BinaryOp(\n",
" id_='BinaryOp_18',\n",
" left=BinaryOp(\n",
" id_='BinaryOp_12',\n",
" left=FieldAccess(\n",
" id_='FieldAccess_9',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_8',\n",
" i=-1,\n",
" j=0,\n",
" ),\n",
" ),\n",
" right=FieldAccess(\n",
" id_='FieldAccess_11',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_10',\n",
" i=1,\n",
" j=0,\n",
" ),\n",
" ),\n",
" op='+',\n",
" ),\n",
" right=BinaryOp(\n",
" id_='BinaryOp_17',\n",
" left=FieldAccess(\n",
" id_='FieldAccess_14',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_13',\n",
" i=0,\n",
" j=-1,\n",
" ),\n",
" ),\n",
" right=FieldAccess(\n",
" id_='FieldAccess_16',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_15',\n",
" i=0,\n",
" j=1,\n",
" ),\n",
Expand Down
55 changes: 4 additions & 51 deletions examples/eve/workshop-2020-10/solution/day2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,89 +40,67 @@
"text": [
"<ipython-input-1-6c194486fea7>:11 <module>\n",
" stencil: Stencil(\n",
" id_='Stencil_22',\n",
" name='lap',\n",
" params=[\n",
" FieldParam(\n",
" id_='FieldParam_20',\n",
" name='out',\n",
" ),\n",
" FieldParam(\n",
" id_='FieldParam_21',\n",
" name='in',\n",
" ),\n",
" ],\n",
" body=[\n",
" AssignStmt(\n",
" id_='AssignStmt_19',\n",
" left=FieldAccess(\n",
" id_='FieldAccess_18',\n",
" name='out',\n",
" offset=Offset(\n",
" id_='Offset_17',\n",
" i=0,\n",
" j=0,\n",
" ),\n",
" ),\n",
" right=BinaryOp(\n",
" id_='BinaryOp_16',\n",
" left=BinaryOp(\n",
" id_='BinaryOp_4',\n",
" left=Literal(\n",
" id_='Literal_1',\n",
" value='-4',\n",
" ),\n",
" right=FieldAccess(\n",
" id_='FieldAccess_3',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_2',\n",
" i=0,\n",
" j=0,\n",
" ),\n",
" ),\n",
" op='*',\n",
" ),\n",
" right=BinaryOp(\n",
" id_='BinaryOp_15',\n",
" left=BinaryOp(\n",
" id_='BinaryOp_9',\n",
" left=FieldAccess(\n",
" id_='FieldAccess_6',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_5',\n",
" i=-1,\n",
" j=0,\n",
" ),\n",
" ),\n",
" right=FieldAccess(\n",
" id_='FieldAccess_8',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_7',\n",
" i=1,\n",
" j=0,\n",
" ),\n",
" ),\n",
" op='+',\n",
" ),\n",
" right=BinaryOp(\n",
" id_='BinaryOp_14',\n",
" left=FieldAccess(\n",
" id_='FieldAccess_11',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_10',\n",
" i=0,\n",
" j=-1,\n",
" ),\n",
" ),\n",
" right=FieldAccess(\n",
" id_='FieldAccess_13',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_12',\n",
" i=0,\n",
" j=1,\n",
" ),\n",
Expand Down Expand Up @@ -199,8 +177,8 @@
"# self.extents[kwargs[\"cur_assign\"]] += Extent.from_offset(node.offset)\n",
"\n",
"# def visit_AssignStmt(self, node: AssignStmt, **kwargs):\n",
"# self.extents[node.id_] = Extent.zero()\n",
"# self.visit(node.right, cur_assign = node.id_)\n",
"# self.extents[node.__node_id__] = Extent.zero()\n",
"# self.visit(node.right, cur_assign = node.__node_id__)\n",
"\n",
"\n",
"class ExtentAnalysis(eve.NodeVisitor):\n",
Expand All @@ -221,7 +199,7 @@
" return self.visit(node.right, **kwargs)\n",
" \n",
" def visit_Stencil(self, node: Stencil, **kwargs):\n",
" return {s.id_: self.visit(s, **kwargs) for s in node.body}\n"
" return {s.__node_id__: self.visit(s, **kwargs) for s in node.body}\n"
]
},
{
Expand Down Expand Up @@ -270,7 +248,7 @@
" return lir.FieldDecl(name=node.name)\n",
"\n",
" def visit_AssignStmt(self, node: AssignStmt, **kwargs):\n",
" extent : Extent = self.extents[node.id_]\n",
" extent : Extent = self.extents[node.__node_id__]\n",
" return lir.HorizontalLoop(body=[lir.AssignStmt(left=self.visit(node.left), right=self.visit(node.right))], i_indent=lir.Indent(left=-extent.i_left, right=extent.i_right), j_indent=lir.Indent(left=-extent.j_left, right=extent.j_right))\n",
"\n",
" def visit_Stencil(self, node: Stencil, **kwargs):\n",
Expand All @@ -288,102 +266,77 @@
"text": [
"<ipython-input-1-0d1a6690ead8>:5 <module>\n",
" lir_stencil: Fun(\n",
" id_='Fun_47',\n",
" name='lap',\n",
" params=[\n",
" FieldDecl(\n",
" id_='FieldDecl_23',\n",
" name='out',\n",
" ),\n",
" FieldDecl(\n",
" id_='FieldDecl_24',\n",
" name='in',\n",
" ),\n",
" ],\n",
" horizontal_loops=[\n",
" HorizontalLoop(\n",
" id_='HorizontalLoop_46',\n",
" i_indent=Indent(\n",
" id_='Indent_44',\n",
" left=1,\n",
" right=1,\n",
" ),\n",
" j_indent=Indent(\n",
" id_='Indent_45',\n",
" left=1,\n",
" right=1,\n",
" ),\n",
" body=[\n",
" AssignStmt(\n",
" id_='AssignStmt_43',\n",
" left=FieldAccess(\n",
" id_='FieldAccess_26',\n",
" name='out',\n",
" offset=Offset(\n",
" id_='Offset_25',\n",
" i=0,\n",
" j=0,\n",
" ),\n",
" ),\n",
" right=BinaryOp(\n",
" id_='BinaryOp_42',\n",
" left=BinaryOp(\n",
" id_='BinaryOp_30',\n",
" left=Literal(\n",
" id_='Literal_27',\n",
" value=-4,\n",
" ),\n",
" right=FieldAccess(\n",
" id_='FieldAccess_29',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_28',\n",
" i=0,\n",
" j=0,\n",
" ),\n",
" ),\n",
" op='*',\n",
" ),\n",
" right=BinaryOp(\n",
" id_='BinaryOp_41',\n",
" left=BinaryOp(\n",
" id_='BinaryOp_35',\n",
" left=FieldAccess(\n",
" id_='FieldAccess_32',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_31',\n",
" i=-1,\n",
" j=0,\n",
" ),\n",
" ),\n",
" right=FieldAccess(\n",
" id_='FieldAccess_34',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_33',\n",
" i=1,\n",
" j=0,\n",
" ),\n",
" ),\n",
" op='+',\n",
" ),\n",
" right=BinaryOp(\n",
" id_='BinaryOp_40',\n",
" left=FieldAccess(\n",
" id_='FieldAccess_37',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_36',\n",
" i=0,\n",
" j=-1,\n",
" ),\n",
" ),\n",
" right=FieldAccess(\n",
" id_='FieldAccess_39',\n",
" name='in',\n",
" offset=Offset(\n",
" id_='Offset_38',\n",
" i=0,\n",
" j=1,\n",
" ),\n",
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ install_requires =
numpy>=1.17
packaging>=20.0
pybind11>=2.5
pydantic>=1.5
pydantic>=1.7.2
typing_extensions>=3.4
typing_inspect>=0.6.0
xxhash>=1.4.4
Expand Down
Loading