summaryrefslogtreecommitdiff
path: root/chapters/core/implementation/03-translation.tex
diff options
context:
space:
mode:
authorericmarin <maarin.eric@gmail.com>2026-06-19 12:39:13 +0200
committerericmarin <maarin.eric@gmail.com>2026-06-26 09:57:03 +0200
commitd3e761a2286d04a3c0005b199653df2f6501f070 (patch)
treebc4c77a68d94662ad41c67710e07af851e5d3287 /chapters/core/implementation/03-translation.tex
parent8eb2ce59ae307984a5b40a05cefec1f7e112fb02 (diff)
downloadvein-d3e761a2286d04a3c0005b199653df2f6501f070.tar.gz
vein-d3e761a2286d04a3c0005b199653df2f6501f070.zip
refined core
Diffstat (limited to 'chapters/core/implementation/03-translation.tex')
-rw-r--r--chapters/core/implementation/03-translation.tex32
1 files changed, 16 insertions, 16 deletions
diff --git a/chapters/core/implementation/03-translation.tex b/chapters/core/implementation/03-translation.tex
index 638ff17..0a2eec0 100644
--- a/chapters/core/implementation/03-translation.tex
+++ b/chapters/core/implementation/03-translation.tex
@@ -11,15 +11,7 @@ to be able to instantiate the correct number of \textit{Dup} agents. The main al
in \textbf{\Cref{alg:onnx-to-in}}, maintains an \textit{interactions} dictionary data-structure, that maps each tensor
name to a list of ports, to keep track of the graph traversal.
-To maximize the concurrency of the INPLA engine, the translation layer avoids generating linear
-chains of agents, opting instead for balanced binary trees for signal distribution (single input to
-multiple output) and signal reduction (multiple input to single output). As \textbf{\Cref{alg:balanced-fan-in}}
-and \textbf{\Cref{alg:balanced-fan-out}} illustrate, the depth of agent chains (especially \textit{Dup} chains)
-is limited to $O(\log N)$. The two algorithms are very similar, the difference is in how they wire the
-agents together: in the \textit{Fan-In} the principal port of the agents are facing the leaves, while in the
-\textit{Fan-Out} they are facing the root.
-
-\begin{algorithm}[ht]
+\begin{algorithm}[H]
\caption{Backwards ONNX-to-IN Translation}
\label{alg:onnx-to-in}
\SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output}
@@ -67,22 +59,31 @@ agents together: in the \textit{Fan-In} the principal port of the agents are fac
$S.\text{append}(root \sim sink)$
}
}
- \Case{Identity}{
- $interactions[N.input] \leftarrow interactions[N.output]$
- }
}
}
\ForEach{neuron $x$ in $G.input$}{
$sink \leftarrow \text{BalancedFanOut}(interactions[G.input][x], \text{Dup}, S)$
- $S.\text{append}(sink \sim \text{Linear}(\text{Symbolic}(x), 1.0, 0.0))$
+ $S.\text{append}(sink \sim \text{Linear}(\text{TermSymbolic}(x), 1.0, 0.0))$
+ }
+
+ \ForEach{$y$ in $\text{len}(interactions[G.output])$}{
+ $S.\text{append}(result_y)$
}
\Return{S}
\end{algorithm}
-\begin{algorithm}[ht]
+To maximize the concurrency of the INPLA engine, the translation layer avoids generating linear
+chains of agents, opting instead for balanced binary trees for signal distribution (single input to
+multiple output) and signal reduction (multiple input to single output). As \textbf{\Cref{alg:balanced-fan-in}}
+and \textbf{\Cref{alg:balanced-fan-out}} illustrate, the depth of agent chains (especially \textit{Dup} chains)
+is limited to $O(\log N)$. The two algorithms are very similar, the difference is in how they wire the
+agents together: in the \textit{Fan-In} the principal port of the agents are facing the leaves, while in the
+\textit{Fan-Out} they are facing the root.
+
+\begin{algorithm}[H]
\caption{Balanced Fan-In}
\label{alg:balanced-fan-in}
\SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output}
@@ -111,8 +112,7 @@ agents together: in the \textit{Fan-In} the principal port of the agents are fac
\Return{$T[0]$}
\end{algorithm}
-
-\begin{algorithm}[ht]
+\begin{algorithm}[H]
\caption{Balanced Fan-Out}
\label{alg:balanced-fan-out}
\SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output}