diff options
Diffstat (limited to 'chapters/core/implementation/03-translation.tex')
| -rw-r--r-- | chapters/core/implementation/03-translation.tex | 32 |
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} |
