summaryrefslogtreecommitdiff
path: root/chapter09/docs/09-graph5.svg
diff options
context:
space:
mode:
authorDibyendu Majumdar <dibyendumajumdar@users.noreply.github.com>2024-03-03 17:55:47 +0000
committerGitHub <noreply@github.com>2024-03-03 17:55:47 +0000
commitc3842e2a01522f52ae4690de3e9c90efa33f0f27 (patch)
treebcedc8d459d74a57acc7ea3b1b968aa60db4a5e6 /chapter09/docs/09-graph5.svg
parent29bc63423aeba9327b2e60959f8dbb2c8e718a29 (diff)
downloadSimple-c3842e2a01522f52ae4690de3e9c90efa33f0f27.tar.gz
Simple-c3842e2a01522f52ae4690de3e9c90efa33f0f27.zip
Chapter 9 (#66)
* chapter9 * merge fixes to chapter8 * Ch 9 notes * Ch 9 work Add a Iterate phase, after parsing. Add a Worklist with fast dup removal & rand pull. Add a Node.iter() call which returns progress or null. Peephole calls it. Iter() also asserts that Types make monotonic progress. Intern all types, so we can do a cheap/easy "isa" test. * GVN * rename temporarily * Apply Cliff's worklist changes * Apply Cliff's GVN changes * Revert "GVN" This reverts commit 9dc6db1cac7e40de4a58333cbc3c9c3e7c088e6f. * Revert "Ch 9 work" This reverts commit df5b74e6c017a4f237a5d1a550a83b40a7928876. * Fix 3-1+2 Was computing as 3-(1+2) == 0, not 4 as expected. Add tests. Unlock in swap12. * Missed some cut-n-paste changes * Break up the test file per-chapter * Fix keep-alive while looping expressions Must "hook" LHS prior to calling peepholes * Ch9 Region optimization Bug fix, GVN hits 2 inProgress Loops Bug fix lifetime tracking when parsing dead code Bug fix debug find call GraphViz post-iterate * Readme overhaul Progress on Ch 9 readme * Fix bugs hashcode Was relying on label() hashCode for Phi, Proj; since this is debug-only cannot be relied on. Proj relies on _idx field, Phi needs a !inProgress check. * Constant nodes print "#" before con * Add a farther neighbor check Peeps that check more than the nearest neighbor register a dependency on the Node that failed them. Should that Node later change, the peep root is put back on the worklist and revisited. * Fix addDeps assert Unwind golden test print, print smarter. Unlock edges in subsume * Update README * shuffle adddeps forward one its needed again shortly in another test, so just cover it now * Fix fuzzer bugs Peep x+(-y) to x-y Handle TOP inputs; didn't think it could happen before running an optimistic pass, but fuzzer proved me wrong. Deleting an input can recursively delete the self-node. When checking the compute() type assert, delay setting _type so the method can just be re-run in the debugger. Missing addDep in Phi Parser mis-handling stacked operators like "1+-2" or "1==!=<=<>=>2" Make Work list deterministic between tests. * Update fuzzer to run iterate (#62) * Update fuzzer to run iterate * Work seed is now reset by reset * A few more fuzzer tests Set _type in iter() even later, better debugging. Handle dead active scopes in visiualizer. Region ideal honors Loop invariants; finish Region ideal for single input; inProgress check is a little tighter. Type.isConstant is true strictly for lattice centerline constants. Clean up TypeInteger. ideaj warning removal * Fix all fuzzer bugs iter() does not call peep(), instead peep() is self-recursive. This allows Iterate() to call iter(), and not get into arbitrary recursive peep() changes that do not track on the worklist. Div, Minus, If all monotonic. Catch a bunch of progress issues. Robustify IRPrinter and Iterate and Region ideal * Reducer could run into an infinite loop (#63) * Write up how the Evaluator works (#64) * Write up how the Evaluator works * Some small improvements and a slightly better wrap up. * Series of fuzzer bugs. Fix monotonicity for all data nodes. Generic compute intercept for data nodes, check all inputs for TOP/BOTTOM, and again for IntDataNodes. Fix general progress bug allow high Types as constants. Fix progress Region 1-input has obvious idom. Make shortcut for fuzzer; renames Fuzzer to not have "Test" in the class name. Fix invert comment in TypeInteger * All fuzzer tests pass Turn off expensive assert accidentally turned on CSE needs to join types. Add a type join. Missing dep in Phi * More README * Hacking alternative way to fix the type compute * Node is no longer IntSupplier Renamed Work to WorkList Renamed Iterate to IterOptim Renamed Node.iter() to Node.peepholeOpt() WorkList expects elements to be of Node * Add an example of GVN * Rename the method depsClear to moveDepsToWorklist - to better capture what it actually does. * Add a second example of GVN benefits * Fix typo * Add example of worklist opt * Prepare to allow alternative post parse worklist opt * Alternative WorkList opt that has following differences: 1. It does not require dependencies between nodes 2. It does not require calls from inside the Node class, and therefore runs totally independently as a post parse step. 3. It is simple * Alternative WorkList opt that has following differences: 1. It does not require dependencies between nodes 2. It does not require calls from inside the Node class, and therefore runs totally independently as a post parse step. 3. It is simple * The RPO list was incomplete as it only identified the subgraph accessible from the STOP node. * Fix iter count * Add test suggested by Xmilia * Fix bug where after the region is peeped the phis get consistent number of inputs * Fix bug where after the region is peeped the phis get consistent number of inputs * Dump out stats on how many nodes we peepd during the post parse iterative opt. * Make it easy to switch the IterOpt * Use deps based worklist by default * Sharper worklist add * Copy across Cliff's changes * Merge changes to Iterate * Revert failing change * Update readme * Add comments / update docs to explain the patterns where we call addDep(). * As before, unconditionally made dep a dependent of region. * Fix a lot of missing dep issues Rename IterOptim -> IterPeeps Some grammar changes in comments & readme * Bump up fuzzer limits, more testing Missing dep in idom calc in IfNode. Missed idom cache clear on Region edit. * Remove RPO based peeps O(n^2) behavior * Minor updates README * fix compile bug --------- Co-authored-by: Cliff Click <cliffc@acm.org> Co-authored-by: XmiliaH <45106915+XmiliaH@users.noreply.github.com> Co-authored-by: Darrick Wiebe <darrickw@untether.ai>
Diffstat (limited to 'chapter09/docs/09-graph5.svg')
-rw-r--r--chapter09/docs/09-graph5.svg210
1 files changed, 210 insertions, 0 deletions
diff --git a/chapter09/docs/09-graph5.svg b/chapter09/docs/09-graph5.svg
new file mode 100644
index 00000000..9d0698db
--- /dev/null
+++ b/chapter09/docs/09-graph5.svg
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.43.0 (0)
+ -->
+<!-- Title: chapter09 Pages: 1 -->
+<svg width="338pt" height="492pt"
+ viewBox="0.00 0.00 338.00 492.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 488)">
+<title>chapter09</title>
+<polygon fill="white" stroke="transparent" points="-4,4 -4,-488 334,-488 334,4 -4,4"/>
+<g id="clust1" class="cluster">
+<title>cluster_Nodes</title>
+<polygon fill="none" stroke="black" points="8,-8 8,-476 322,-476 322,-8 8,-8"/>
+</g>
+<!-- Start2 -->
+<g id="node1" class="node">
+<title>Start2</title>
+<polygon fill="yellow" stroke="transparent" points="153,-439 153,-464 234,-464 234,-439 153,-439"/>
+<polygon fill="none" stroke="black" points="153,-439 153,-464 234,-464 234,-439 153,-439"/>
+<text text-anchor="start" x="175" y="-447.8" font-family="Times,serif" font-size="14.00">Start</text>
+<polygon fill="none" stroke="black" points="153,-408 153,-439 234,-439 234,-408 153,-408"/>
+<polygon fill="yellow" stroke="transparent" points="158,-413 158,-434 198,-434 198,-413 158,-413"/>
+<polygon fill="none" stroke="black" points="158,-413 158,-434 198,-434 198,-413 158,-413"/>
+<text text-anchor="start" x="161" y="-419.8" font-family="Times,serif" font-size="14.00">$ctrl</text>
+<polygon fill="none" stroke="black" points="198,-413 198,-434 229,-434 229,-413 198,-413"/>
+<text text-anchor="start" x="201" y="-419.8" font-family="Times,serif" font-size="14.00">arg</text>
+</g>
+<!-- Stop3 -->
+<g id="node2" class="node">
+<title>Stop3</title>
+<polygon fill="yellow" stroke="black" points="271,-52 217,-52 217,-16 271,-16 271,-52"/>
+<text text-anchor="middle" x="244" y="-30.3" font-family="Times,serif" font-size="14.00">Stop</text>
+</g>
+<!-- Return21 -->
+<g id="node11" class="node">
+<title>Return21</title>
+<polygon fill="yellow" stroke="black" points="277,-124 211,-124 211,-88 277,-88 277,-124"/>
+<text text-anchor="middle" x="244" y="-102.3" font-family="Times,serif" font-size="14.00">Return</text>
+</g>
+<!-- Stop3&#45;&gt;Return21 -->
+<g id="edge1" class="edge">
+<title>Stop3&#45;&gt;Return21</title>
+<path fill="none" stroke="red" d="M244,-52.3C244,-60.02 244,-69.29 244,-77.89"/>
+<polygon fill="red" stroke="red" points="240.5,-77.9 244,-87.9 247.5,-77.9 240.5,-77.9"/>
+<text text-anchor="middle" x="241" y="-54.9" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- Con_6 -->
+<g id="node3" class="node">
+<title>Con_6</title>
+<ellipse fill="none" stroke="black" cx="43" cy="-350" rx="27" ry="18"/>
+<text text-anchor="middle" x="43" y="-346.3" font-family="Times,serif" font-size="14.00">#1</text>
+</g>
+<!-- Loop7 -->
+<g id="node4" class="node">
+<title>Loop7</title>
+<polygon fill="yellow" stroke="black" points="142,-368 88,-368 88,-332 142,-332 142,-368"/>
+<text text-anchor="middle" x="115" y="-346.3" font-family="Times,serif" font-size="14.00">Loop</text>
+</g>
+<!-- Loop7&#45;&gt;Start2 -->
+<g id="edge2" class="edge">
+<title>Loop7&#45;&gt;Start2:p0</title>
+<path fill="none" stroke="red" d="M117.35,-368.06C120.75,-386.19 128.75,-413.28 146.69,-420.93"/>
+<polygon fill="red" stroke="red" points="146.51,-424.46 157,-423 147.89,-417.6 146.51,-424.46"/>
+<text text-anchor="middle" x="114.35" y="-370.66" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- If12 -->
+<g id="node8" class="node">
+<title>If12</title>
+<polygon fill="yellow" stroke="transparent" points="147,-195 147,-220 241,-220 241,-195 147,-195"/>
+<polygon fill="none" stroke="black" points="147,-195 147,-220 241,-220 241,-195 147,-195"/>
+<text text-anchor="start" x="188.5" y="-203.8" font-family="Times,serif" font-size="14.00">If</text>
+<polygon fill="none" stroke="black" points="147,-164 147,-195 241,-195 241,-164 147,-164"/>
+<polygon fill="yellow" stroke="transparent" points="152,-169 152,-190 192,-190 192,-169 152,-169"/>
+<polygon fill="none" stroke="black" points="152,-169 152,-190 192,-190 192,-169 152,-169"/>
+<text text-anchor="start" x="155" y="-175.8" font-family="Times,serif" font-size="14.00">True</text>
+<polygon fill="yellow" stroke="transparent" points="192,-169 192,-190 236,-190 236,-169 192,-169"/>
+<polygon fill="none" stroke="black" points="192,-169 192,-190 236,-190 236,-169 192,-169"/>
+<text text-anchor="start" x="195" y="-175.8" font-family="Times,serif" font-size="14.00">False</text>
+</g>
+<!-- Loop7&#45;&gt;If12 -->
+<g id="edge3" class="edge">
+<title>Loop7&#45;&gt;If12:p0</title>
+<path fill="none" stroke="red" d="M142.11,-336.15C145.11,-334.74 148.12,-333.34 151,-332 186,-315.76 209.13,-328.45 230,-296 238.66,-282.54 239,-273.23 230,-260 205.55,-224.03 163.45,-259.97 139,-224 125.26,-203.78 121.98,-186.54 139,-169 146.02,-161.76 158.99,-157.07 166.4,-159.61"/>
+<polygon fill="red" stroke="red" points="163.54,-161.62 172,-168 169.36,-157.74 163.54,-161.62"/>
+<text text-anchor="middle" x="145.11" y="-329.75" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Phi_arg9 -->
+<g id="node5" class="node">
+<title>Phi_arg9</title>
+<ellipse fill="lightyellow" stroke="black" cx="277" cy="-350" rx="37.09" ry="18"/>
+<text text-anchor="middle" x="277" y="-346.3" font-family="Times,serif" font-size="14.00">φ_arg</text>
+</g>
+<!-- Phi_arg9&#45;&gt;Start2 -->
+<g id="edge5" class="edge">
+<title>Phi_arg9&#45;&gt;Start2:p1</title>
+<path fill="none" stroke="black" d="M273.71,-368.06C269.21,-386.44 259.37,-414.03 239.96,-421.23"/>
+<polygon fill="black" stroke="black" points="239.23,-417.81 230,-423 240.46,-424.7 239.23,-417.81"/>
+<text text-anchor="middle" x="270.71" y="-370.66" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Phi_arg9&#45;&gt;Loop7 -->
+<g id="edge4" class="edge">
+<title>Phi_arg9&#45;&gt;Loop7</title>
+<path fill="none" stroke="black" stroke-dasharray="1,5" d="M258.53,-334.01C248.46,-326.34 235.34,-317.98 222,-314 195.59,-306.13 186,-304.88 160,-314 152.86,-316.5 146.01,-320.67 139.91,-325.3"/>
+<polygon fill="black" stroke="black" points="137.55,-322.71 132.08,-331.78 142.01,-328.1 137.55,-322.71"/>
+<text text-anchor="middle" x="255.53" y="-327.61" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- Add18 -->
+<g id="node10" class="node">
+<title>Add18</title>
+<ellipse fill="none" stroke="black" cx="66" cy="-192" rx="27" ry="18"/>
+<text text-anchor="middle" x="66" y="-188.3" font-family="Times,serif" font-size="14.00">+</text>
+</g>
+<!-- Phi_arg9&#45;&gt;Add18 -->
+<g id="edge6" class="edge">
+<title>Phi_arg9&#45;&gt;Add18</title>
+<path fill="none" stroke="black" d="M249.01,-337.87C243.12,-335.75 236.9,-333.68 231,-332 153.36,-309.94 104.1,-358.47 53,-296 35.4,-274.49 43.72,-241.53 53.12,-218.71"/>
+<polygon fill="black" stroke="black" points="56.43,-219.88 57.28,-209.32 50.03,-217.04 56.43,-219.88"/>
+<text text-anchor="middle" x="246.01" y="-331.47" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- LT10 -->
+<g id="node6" class="node">
+<title>LT10</title>
+<ellipse fill="none" stroke="black" cx="194" cy="-278" rx="27" ry="18"/>
+<text text-anchor="middle" x="194" y="-274.3" font-family="Times,serif" font-size="14.00">&lt;</text>
+</g>
+<!-- LT10&#45;&gt;Phi_arg9 -->
+<g id="edge7" class="edge">
+<title>LT10&#45;&gt;Phi_arg9</title>
+<path fill="none" stroke="black" d="M210.4,-292.83C222.06,-302.66 237.95,-316.07 251.29,-327.31"/>
+<polygon fill="black" stroke="black" points="249.3,-330.22 259.2,-333.99 253.81,-324.86 249.3,-330.22"/>
+<text text-anchor="middle" x="207.4" y="-295.43" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Con_11 -->
+<g id="node7" class="node">
+<title>Con_11</title>
+<ellipse fill="none" stroke="black" cx="191" cy="-350" rx="30.59" ry="18"/>
+<text text-anchor="middle" x="191" y="-346.3" font-family="Times,serif" font-size="14.00">#10</text>
+</g>
+<!-- LT10&#45;&gt;Con_11 -->
+<g id="edge8" class="edge">
+<title>LT10&#45;&gt;Con_11</title>
+<path fill="none" stroke="black" d="M193.26,-296.3C192.93,-304.02 192.53,-313.29 192.16,-321.89"/>
+<polygon fill="black" stroke="black" points="188.66,-321.75 191.73,-331.9 195.66,-322.05 188.66,-321.75"/>
+<text text-anchor="middle" x="190.26" y="-298.9" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- If12&#45;&gt;Loop7 -->
+<g id="edge9" class="edge">
+<title>If12&#45;&gt;Loop7</title>
+<path fill="none" stroke="red" d="M176.87,-224.21C170.8,-235.44 164,-248.24 158,-260 147.34,-280.9 135.81,-304.85 127.37,-322.64"/>
+<polygon fill="red" stroke="red" points="124.14,-321.29 123.03,-331.83 130.46,-324.29 124.14,-321.29"/>
+<text text-anchor="middle" x="173.87" y="-226.81" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- If12&#45;&gt;LT10 -->
+<g id="edge10" class="edge">
+<title>If12&#45;&gt;LT10</title>
+<path fill="none" stroke="black" d="M194,-224.28C194,-232.58 194,-241.48 194,-249.56"/>
+<polygon fill="black" stroke="black" points="190.5,-249.6 194,-259.6 197.5,-249.6 190.5,-249.6"/>
+<text text-anchor="middle" x="191" y="-226.88" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Add16 -->
+<g id="node9" class="node">
+<title>Add16</title>
+<ellipse fill="none" stroke="black" cx="89" cy="-278" rx="27" ry="18"/>
+<text text-anchor="middle" x="89" y="-274.3" font-family="Times,serif" font-size="14.00">+</text>
+</g>
+<!-- Add16&#45;&gt;Con_6 -->
+<g id="edge11" class="edge">
+<title>Add16&#45;&gt;Con_6</title>
+<path fill="none" stroke="black" d="M78.56,-294.88C72.8,-303.66 65.52,-314.74 59.04,-324.58"/>
+<polygon fill="black" stroke="black" points="55.96,-322.9 53.4,-333.18 61.81,-326.74 55.96,-322.9"/>
+<text text-anchor="middle" x="75.56" y="-297.48" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Add16&#45;&gt;Phi_arg9 -->
+<g id="edge12" class="edge">
+<title>Add16&#45;&gt;Phi_arg9</title>
+<path fill="none" stroke="black" d="M112.05,-287.58C143.64,-299.35 200.8,-320.63 238.83,-334.79"/>
+<polygon fill="black" stroke="black" points="237.94,-338.19 248.54,-338.4 240.39,-331.63 237.94,-338.19"/>
+<text text-anchor="middle" x="115.05" y="-290.18" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Add18&#45;&gt;Con_6 -->
+<g id="edge14" class="edge">
+<title>Add18&#45;&gt;Con_6</title>
+<path fill="none" stroke="black" d="M62.31,-210.01C59.48,-223.51 55.62,-242.9 53,-260 49.85,-280.62 47.25,-304.07 45.5,-321.72"/>
+<polygon fill="black" stroke="black" points="41.99,-321.59 44.51,-331.88 48.96,-322.27 41.99,-321.59"/>
+<text text-anchor="middle" x="59.31" y="-212.61" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Add18&#45;&gt;Add16 -->
+<g id="edge13" class="edge">
+<title>Add18&#45;&gt;Add16</title>
+<path fill="none" stroke="black" d="M70.65,-210C73.8,-221.5 78.03,-236.93 81.63,-250.08"/>
+<polygon fill="black" stroke="black" points="78.34,-251.31 84.35,-260.03 85.09,-249.46 78.34,-251.31"/>
+<text text-anchor="middle" x="67.65" y="-212.6" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Return21&#45;&gt;Phi_arg9 -->
+<g id="edge16" class="edge">
+<title>Return21&#45;&gt;Phi_arg9</title>
+<path fill="none" stroke="black" d="M249.23,-124.03C252.22,-134.35 255.79,-147.83 258,-160 268.31,-216.9 273.41,-284.53 275.6,-321.49"/>
+<polygon fill="black" stroke="black" points="272.13,-322.15 276.19,-331.93 279.12,-321.75 272.13,-322.15"/>
+<text text-anchor="middle" x="246.23" y="-126.63" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Return21&#45;&gt;If12 -->
+<g id="edge15" class="edge">
+<title>Return21&#45;&gt;If12:p1</title>
+<path fill="none" stroke="red" d="M230.4,-124.06C224.14,-133.27 217.55,-145.31 215.05,-157.87"/>
+<polygon fill="red" stroke="red" points="211.55,-157.69 214,-168 218.51,-158.41 211.55,-157.69"/>
+<text text-anchor="middle" x="227.4" y="-126.66" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+</g>
+</svg>