Skip to content

Commit 281154b

Browse files
author
pevnak
committed
added v2 version of lecture 9
1 parent 075e704 commit 281154b

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

docs/src/lectures/lecture_09/lecture_v2.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ using Zygote
103103
@benchmark gradient(sin σ2, 1.0)
104104
@benchmark gradient(sin σ, 1.0)
105105
```
106-
Note that we add since to prevent compiler to optimize the code to be equivalent. The difference between both executions is tiny, becuase the overhead of AD is non-trivial. You can compare it to `@benchmark gradient(σ, 1.0)` and also observe `@code_native(σ, 1.0)`
106+
Note that we add since to prevent compiler to optimize the code to be equivalent. The difference between both executions is tiny, because the overhead of AD is non-trivial. You can compare it to `@benchmark gradient(σ, 1.0)` and also observe `@code_native(σ, 1.0)`
107107

108108

109109
## Source-to-Source Automatic Differentiation with IRCode
@@ -180,23 +180,21 @@ The code is stored in `IRCode` data structure.
180180
stmts::InstructionStream
181181
argtypes::Vector{Any}
182182
sptypes::Vector{VarState}
183-
debuginfo::Compiler.DebugInfoStream
183+
lineinfo::Vector{Core.LineInfoNode}
184184
cfg::CFG
185185
new_nodes::NewNodeStream
186186
meta::Vector{Expr}
187-
valid_worlds::Compiler.WorldRange
188187
end
189188
```
190189

191190
where
192191
* `stmts` is a stream of instruction (more in this below)
193192
* `argtypes` holds types of arguments of the function whose `IRCode` we have obtained
194193
* `sptypes` is a vector of `VarState`. It seems to be related to parameters of types
195-
* `debuginfo` is a table of unique lines in the source code from which statement came from
194+
* `lineinfo` is a table of unique lines in the source code from which statement came from
196195
* `cfg` holds control flow graph, which contains building blocks and jumps between them
197196
* `new_nodes` is an infrastructure that can be used to insert new instructions to the existing `IRCode` . The idea behind is that since insertion requires a renumbering all statements, they are put in a separate queue. They are put to correct position with a correct `SSANumber` by calling `compact!`.
198197
* `meta` is something.
199-
* `valid_worlds` specify a "time" span in which the world is valid
200198

201199
**InstructionStream**
202200

@@ -325,13 +323,6 @@ for (i, stmt) in enumerate(ir.stmts)
325323
push!(new_line, stmt[:line])
326324
continue
327325
end
328-
329-
if inst isa Nothing
330-
push!(new_insts, nothing)
331-
new_ssa = SSAValue(length(new_insts))
332-
push!(new_line, stmt[:line])
333-
continue
334-
end
335326
error("unknown node $(i)")
336327
end
337328
```

0 commit comments

Comments
 (0)