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

core: Remove print_attribute_dictionary in favour of print_op_attributes #1171

Merged
merged 5 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
171 changes: 146 additions & 25 deletions docs/database_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@
"cell_type": "code",
"execution_count": 1,
"id": "7aaf5d7c",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.779017Z",
"iopub.status.busy": "2023-06-21T10:39:23.778696Z",
"iopub.status.idle": "2023-06-21T10:39:23.849153Z",
"shell.execute_reply": "2023-06-21T10:39:23.848719Z"
}
},
"outputs": [],
"source": [
"from xdsl.ir import *\n",
Expand Down Expand Up @@ -68,7 +75,14 @@
"cell_type": "code",
"execution_count": 2,
"id": "497c67b9",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.851039Z",
"iopub.status.busy": "2023-06-21T10:39:23.850755Z",
"iopub.status.idle": "2023-06-21T10:39:23.853846Z",
"shell.execute_reply": "2023-06-21T10:39:23.853430Z"
}
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -96,7 +110,14 @@
"cell_type": "code",
"execution_count": 3,
"id": "e9fad9ec",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.855628Z",
"iopub.status.busy": "2023-06-21T10:39:23.855294Z",
"iopub.status.idle": "2023-06-21T10:39:23.857928Z",
"shell.execute_reply": "2023-06-21T10:39:23.857539Z"
}
},
"outputs": [],
"source": [
"from xdsl.irdl import attr_def, result_def\n",
Expand Down Expand Up @@ -125,7 +146,14 @@
"cell_type": "code",
"execution_count": 4,
"id": "b0b135d3",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.859604Z",
"iopub.status.busy": "2023-06-21T10:39:23.859346Z",
"iopub.status.idle": "2023-06-21T10:39:23.862160Z",
"shell.execute_reply": "2023-06-21T10:39:23.861745Z"
}
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -155,7 +183,14 @@
"cell_type": "code",
"execution_count": 5,
"id": "bbbccc08",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.863831Z",
"iopub.status.busy": "2023-06-21T10:39:23.863585Z",
"iopub.status.idle": "2023-06-21T10:39:23.866324Z",
"shell.execute_reply": "2023-06-21T10:39:23.865909Z"
}
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -185,7 +220,14 @@
"cell_type": "code",
"execution_count": 6,
"id": "ff621a44",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.868004Z",
"iopub.status.busy": "2023-06-21T10:39:23.867755Z",
"iopub.status.idle": "2023-06-21T10:39:23.870340Z",
"shell.execute_reply": "2023-06-21T10:39:23.869932Z"
}
},
"outputs": [],
"source": [
"@irdl_op_definition\n",
Expand All @@ -209,7 +251,14 @@
"cell_type": "code",
"execution_count": 7,
"id": "e38541ac",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.872056Z",
"iopub.status.busy": "2023-06-21T10:39:23.871800Z",
"iopub.status.idle": "2023-06-21T10:39:23.875925Z",
"shell.execute_reply": "2023-06-21T10:39:23.875523Z"
}
},
"outputs": [],
"source": [
"from xdsl.builder import Builder\n",
Expand All @@ -231,16 +280,23 @@
"cell_type": "code",
"execution_count": 8,
"id": "c8d39679",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.877635Z",
"iopub.status.busy": "2023-06-21T10:39:23.877307Z",
"iopub.status.idle": "2023-06-21T10:39:23.880603Z",
"shell.execute_reply": "2023-06-21T10:39:23.880185Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"%1 = \"sql.selection\"(%0) ({\n",
"^0(%2 : i32):\n",
" %3 = \"arith.constant\"() {\"value\" = 5 : i32} : () -> i32\n",
" %4 = \"arith.constant\"() {\"value\" = 5 : i32} : () -> i32\n",
" %3 = arith.constant 5 : i32\n",
" %4 = arith.constant 5 : i32\n",
" %5 = arith.addi %3, %4 : i32\n",
" %6 = \"arith.cmpi\"(%2, %5) {\"predicate\" = 4 : i64} : (i32, i32) -> i1\n",
" \"scf.yield\"(%6) : (i1) -> ()\n",
Expand Down Expand Up @@ -269,7 +325,14 @@
"cell_type": "code",
"execution_count": 9,
"id": "0b618749",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.882299Z",
"iopub.status.busy": "2023-06-21T10:39:23.882039Z",
"iopub.status.idle": "2023-06-21T10:39:23.885646Z",
"shell.execute_reply": "2023-06-21T10:39:23.885217Z"
}
},
"outputs": [],
"source": [
"\n",
Expand All @@ -292,7 +355,14 @@
"cell_type": "code",
"execution_count": 10,
"id": "864c39f3",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.887276Z",
"iopub.status.busy": "2023-06-21T10:39:23.886995Z",
"iopub.status.idle": "2023-06-21T10:39:23.889538Z",
"shell.execute_reply": "2023-06-21T10:39:23.889104Z"
}
},
"outputs": [],
"source": [
"walker = PatternRewriteWalker(GreedyRewritePatternApplier([ConstantFolding()]),\n",
Expand All @@ -307,16 +377,23 @@
"cell_type": "code",
"execution_count": 11,
"id": "0b653e33",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.891237Z",
"iopub.status.busy": "2023-06-21T10:39:23.890919Z",
"iopub.status.idle": "2023-06-21T10:39:23.893892Z",
"shell.execute_reply": "2023-06-21T10:39:23.893474Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"%1 = \"sql.selection\"(%0) ({\n",
"^0(%2 : i32):\n",
" %3 = \"arith.constant\"() {\"value\" = 5 : i32} : () -> i32\n",
" %4 = \"arith.constant\"() {\"value\" = 5 : i32} : () -> i32\n",
" %3 = arith.constant 5 : i32\n",
" %4 = arith.constant 5 : i32\n",
" %5 = arith.addi %3, %4 : i32\n",
" %6 = \"arith.cmpi\"(%2, %5) {\"predicate\" = 4 : i64} : (i32, i32) -> i1\n",
" \"scf.yield\"(%6) : (i1) -> ()\n",
Expand All @@ -341,7 +418,14 @@
"cell_type": "code",
"execution_count": 12,
"id": "21e27fff",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.895684Z",
"iopub.status.busy": "2023-06-21T10:39:23.895433Z",
"iopub.status.idle": "2023-06-21T10:39:23.898237Z",
"shell.execute_reply": "2023-06-21T10:39:23.897844Z"
}
},
"outputs": [],
"source": [
"@dataclass\n",
Expand All @@ -357,7 +441,14 @@
"cell_type": "code",
"execution_count": 13,
"id": "c53c8eb5",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.900022Z",
"iopub.status.busy": "2023-06-21T10:39:23.899703Z",
"iopub.status.idle": "2023-06-21T10:39:23.902189Z",
"shell.execute_reply": "2023-06-21T10:39:23.901797Z"
}
},
"outputs": [],
"source": [
"walker = PatternRewriteWalker(GreedyRewritePatternApplier([DeadConstantElim()\n",
Expand All @@ -373,16 +464,23 @@
"cell_type": "code",
"execution_count": 14,
"id": "b76b2bab",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.903793Z",
"iopub.status.busy": "2023-06-21T10:39:23.903549Z",
"iopub.status.idle": "2023-06-21T10:39:23.906402Z",
"shell.execute_reply": "2023-06-21T10:39:23.905992Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"%1 = \"sql.selection\"(%0) ({\n",
"^0(%2 : i32):\n",
" %3 = \"arith.constant\"() {\"value\" = 5 : i32} : () -> i32\n",
" %4 = \"arith.constant\"() {\"value\" = 5 : i32} : () -> i32\n",
" %3 = arith.constant 5 : i32\n",
" %4 = arith.constant 5 : i32\n",
" %5 = arith.addi %3, %4 : i32\n",
" %6 = \"arith.cmpi\"(%2, %5) {\"predicate\" = 4 : i64} : (i32, i32) -> i1\n",
" \"scf.yield\"(%6) : (i1) -> ()\n",
Expand All @@ -407,7 +505,14 @@
"cell_type": "code",
"execution_count": 15,
"id": "e8fce9aa",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.908077Z",
"iopub.status.busy": "2023-06-21T10:39:23.907826Z",
"iopub.status.idle": "2023-06-21T10:39:23.910175Z",
"shell.execute_reply": "2023-06-21T10:39:23.909781Z"
}
},
"outputs": [],
"source": [
"@irdl_op_definition\n",
Expand All @@ -429,7 +534,14 @@
"cell_type": "code",
"execution_count": 16,
"id": "5deac6c5",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T10:39:23.911763Z",
"iopub.status.busy": "2023-06-21T10:39:23.911518Z",
"iopub.status.idle": "2023-06-21T10:39:23.914982Z",
"shell.execute_reply": "2023-06-21T10:39:23.914570Z"
}
},
"outputs": [
{
"name": "stdout",
Expand All @@ -439,8 +551,8 @@
" %0 = \"sql.table\"() {\"table_name\" = \"T\"} : () -> #sql.bag<i32>\n",
" %1 = \"sql.selection\"(%0) ({\n",
" ^0(%2 : i32):\n",
" %3 = \"arith.constant\"() {\"value\" = 5 : i32} : () -> i32\n",
" %4 = \"arith.constant\"() {\"value\" = 5 : i32} : () -> i32\n",
" %3 = arith.constant 5 : i32\n",
" %4 = arith.constant 5 : i32\n",
" %5 = arith.addi %3, %4 : i32\n",
" %6 = \"arith.cmpi\"(%2, %5) {\"predicate\" = 4 : i64} : (i32, i32) -> i1\n",
" \"scf.yield\"(%6) : (i1) -> ()\n",
Expand Down Expand Up @@ -468,7 +580,16 @@
],
"metadata": {
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
}
},
"nbformat": 4,
Expand Down