Skip to content

Commit

Permalink
Fix a few typos
Browse files Browse the repository at this point in the history
  • Loading branch information
yebai authored Jun 22, 2023
1 parent 95e32aa commit b89478a
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/tapedfunction.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#=
`TapedFunction` converts a Julia function to a friendly tape for user-specified interpreters.
With this tape-like abstraction for functions, we gain some control over how the function is
With this tape-like abstraction for functions, we gain some control over how a function is
executed, like capturing continuations, caching variables, injecting additional control flows
(i.e. produce/consume) between instructions on the tape, etc.
(i.e., produce/consume) between instructions on the tape, etc.
Under the hood, we firstly used Julia's compiler API to get the IR code of the original function.
We use the unoptimised typed code in a non-strict SSA form. Then we convert each IR instruction
Under the hood, we first used Julia's compiler API to get the IR code of the original function.
We use the unoptimized typed code in a non-strict SSA form. Then we convert each IR instruction
to a Julia data structure (an object of a subtype of AbstractInstruction). All the operands
(i.e., the variables) these instructions use are stored in a data structure called `Bindings`.
This conversion/binding process is performed at compile-time / tape-recording time and is only
Expand All @@ -17,9 +16,9 @@ In a nutshell, there are two types of instructions (or primitives) on a tape:
- Control-flow instruction: GotoInstruction and CondGotoInstruction, ReturnInstruction
Once the tape is recorded, we can run the tape just like calling the original function.
We first plugin the arguments, run each instruction on the tape, and stop after encountering
We first plugin the arguments, run each instruction on the tape and stop after encountering
a ReturnInstruction. We also provide a mechanism to add a callback after each instruction.
This API allowed us to implement the `produce/consume` machanism in TapedTask. And exploiting
This API allowed us to implement the `produce/consume` mechanism in TapedTask. And exploiting
these features, we implemented a fork mechanism for TapedTask.
Some potentially sharp edges of this implementation:
Expand All @@ -29,9 +28,9 @@ Some potentially sharp edges of this implementation:
So this works well. But, if you do something like `module A v=1 end; make tapedfunction; A.eval(:(v=2)); run tf;`,
The assignment won't work.
2. QuoteNode is also evaluated at the tape-recording time (compile-time). Primarily
the result of evaluating a QuoteNode is a Symbol, which works well most of the time.
the result of evaluating a QuoteNode is a Symbol, which usually works well.
3. Each Instruction execution contains one unnecessary allocation at the moment.
So writing a function with vectorised computation will be more performant,
So writing a function with vectorized computation will be more performant,
for example, using broadcasting instead of a loop.
=#

Expand Down

0 comments on commit b89478a

Please sign in to comment.