| … | … | @@ -21,5 +21,45 @@ need to run locally before getting pushed off to the GPU, and the rules |
| 21 | 21 | for these could be very arcane and detailed and prone to bugs. |
| 22 | 22 | |
| 23 | 23 | Another possibility is to have an `(ExecOnGPULink AST)`, similar to |
| 24 | | `(PureExec AST)` |
| 24 | `(PureExec AST)`. In fact, it could be PureExec, given extensions. |
| 25 | Lets review. |
| 25 | 26 | |
| 27 | `PureExec` was originally invented to allow "pure execution" i.e. |
| 28 | side-effect free execution of some AST by grabbing a temp AtomSpace, |
| 29 | child of the current AtomSpace, and running the AST there. Any changes |
| 30 | to the AtomSpace are thus made only to this temp space, and are thus |
| 31 | discarded when execution completes. Thus, the execution is "pure". |
| 32 | |
| 33 | Next `PureExec` got used to define tail-recursive loops. The structure |
| 34 | here is |
| 35 | ``` |
| 36 | (DefineLink (DefinedProcedutre "foo") |
| 37 | (PureExec AST (DefinedProcedutre "foo"))) |
| 38 | ``` |
| 39 | so the AST performs a single-step of the loop, and the |
| 40 | `DefinedProcedure` recurses. The `CondLink` can be used to limit |
| 41 | recursion. This is more or less just like tail recursion on scheme. |
| 42 | |
| 43 | Note that an earlier realization of this idea was with the behavior |
| 44 | trees infrastructure, with `SequentialAndLink`. This used evaluation, |
| 45 | not execution, and the `SequentialAnd` had a built-in "keep going or |
| 46 | stop" character in it, that avoided the need for an explicit `CondLink`. |
| 47 | It's inappropriate for execution, because the returned Value is |
| 48 | generally not interpretable as a bool flag "keep going". |
| 49 | |
| 50 | Until `PureExec` was introduced, there wasn't anything analogous for |
| 51 | execution. The `ParallelLink` and cousins run threads, but there was no |
| 52 | `SerialLink` mostly because step-wise execution was not needed. |
| 53 | |
| 54 | The whole Threaded/Serial Atomese toolset needs to be revised to be |
| 55 | cleaner. ThreadJoinLink should be marked obsolete. PureExec needs to |
| 56 | be redesigned as described below. |
| 57 | |
| 58 | Since the initial idea of `PureExec` was purity, it could not be used |
| 59 | for tail-recursive, serialized execution in the current AtomSpace: so an |
| 60 | argument is added: which AtomSpace the execution |
| 61 | |
| 62 | TODO List |
| 63 | --------- |
| 64 | Writiing the above, the TODO list expands: |
| 65 | * |