Skip to content

Commit

Permalink
Add FAQ section to docs (#1343)
Browse files Browse the repository at this point in the history
* Explain why Duplicated requires identical types

* Restructure docs

* Remove noise

* Doctest setup

* Wrong page name

* Fix ref

* Fix error message

* Fix links

* Add remarks

* More remarks

* Rename section
  • Loading branch information
gdalle authored Mar 22, 2024
1 parent 2e1b77e commit 71b685a
Show file tree
Hide file tree
Showing 8 changed files with 431 additions and 401 deletions.
12 changes: 7 additions & 5 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples")
const OUTPUT_DIR = joinpath(@__DIR__, "src/generated")

examples = Pair{String,String}[
"Basics" => "autodiff"
"Box model" => "box"
"AutoDiff API" => "autodiff"
"Custom rules" => "custom_rule"
]

Expand Down Expand Up @@ -51,10 +51,12 @@ makedocs(;
pages = [
"Home" => "index.md",
"Examples" => examples,
"API" => "api.md",
"Implementing pullbacks" => "pullbacks.md",
"For developers" => "dev_docs.md",
"Internal API" => "internal_api.md",
"FAQ" => "faq.md",
"API reference" => "api.md",
"Advanced" => [
"For developers" => "dev_docs.md",
"Internal API" => "internal_api.md",
]
],
doctest = true,
strict = true,
Expand Down
4 changes: 2 additions & 2 deletions docs/src/api.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# API
# API reference

## Types and constants

Expand All @@ -14,7 +14,7 @@ Modules = [Enzyme, EnzymeCore, EnzymeCore.EnzymeRules, EnzymeTestUtils, Enzyme.A
Order = [:macro, :function]
```

# Documentation
## Documentation

```@autodocs
Modules = [Enzyme, EnzymeCore, EnzymeCore.EnzymeRules, EnzymeTestUtils, Enzyme.API]
Expand Down
410 changes: 410 additions & 0 deletions docs/src/faq.md

Large diffs are not rendered by default.

351 changes: 8 additions & 343 deletions docs/src/index.md

Large diffs are not rendered by default.

47 changes: 0 additions & 47 deletions docs/src/pullbacks.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/autodiff.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# # AutoDiff API
# # Basics

# The goal of this tutorial is to give users already familiar with automatic
# differentiation (AD) an overview
Expand Down
2 changes: 1 addition & 1 deletion src/Enzyme.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ Enzyme.autodiff(ReverseWithPrimal, x->x*x, Active(3.0))
return (fused, results[2:end]...)
end

throw(ErrorException("Reverse-mode Active Complex return is ambiguous and requires more information to specify the desired result. See https://enzyme.mit.edu/julia/stable/#Complex for more details."))
throw(ErrorException("Reverse-mode Active Complex return is ambiguous and requires more information to specify the desired result. See https://enzyme.mit.edu/julia/stable/faq/#Complex-numbers for more details."))
end

thunk = Enzyme.Compiler.thunk(Val(world), FA, A, tt′, #=Split=# Val(API.DEM_ReverseModeCombined), Val(width), ModifiedBetween, Val(ReturnPrimal), #=ShadowInit=#Val(false), RABI)
Expand Down
4 changes: 2 additions & 2 deletions src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ end
return true
end
@assert state == MixedState
throw(AssertionError(string(T)*" has mixed internal activity types. See https://enzyme.mit.edu/julia/dev/#Mixed-Activity for more information"))
throw(AssertionError(string(T)*" has mixed internal activity types. See https://enzyme.mit.edu/julia/stable/faq/#Mixed-activity for more information"))
else
return false
end
Expand Down Expand Up @@ -1820,7 +1820,7 @@ function julia_error(cstr::Cstring, val::LLVM.API.LLVMValueRef, errtype::API.Err
println(io, Base.unsafe_string(st))
API.EnzymeStringFree(st)
end
println(io, "You may be using a constant variable as temporary storage for active memory (https://enzyme.mit.edu/julia/stable/#Activity-of-temporary-storage). If not, please open an issue, and either rewrite this variable to not be conditionally active or use Enzyme.API.runtimeActivity!(true) as a workaround for now")
println(io, "You may be using a constant variable as temporary storage for active memory (https://enzyme.mit.edu/julia/stable/faq/#Activity-of-temporary-storage). If not, please open an issue, and either rewrite this variable to not be conditionally active or use Enzyme.API.runtimeActivity!(true) as a workaround for now")
if bt !== nothing
Base.show_backtrace(io, bt)
end
Expand Down

0 comments on commit 71b685a

Please sign in to comment.