Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs and Docstrings #383

Merged
merged 15 commits into from
Nov 21, 2024
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Mooncake"
uuid = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
authors = ["Will Tebbutt, Hong Ge, and contributors"]
version = "0.4.47"
version = "0.4.48"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
22 changes: 13 additions & 9 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ makedocs(
),
)
),
size_threshold_ignore=[
joinpath("developer_documentation", "internal_docstrings.md"),
],
),
modules=[Mooncake],
checkdocs=:none,
Expand All @@ -28,20 +31,21 @@ makedocs(
pages = [
"Mooncake.jl" => "index.md",
"Understanding Mooncake.jl" => [
"Introduction" => "understanding_intro.md",
"Algorithmic Differentiation" => "algorithmic_differentiation.md",
"Mooncake.jl's Rule System" => "mathematical_interpretation.md",
joinpath("understanding_mooncake", "introduction.md"),
joinpath("understanding_mooncake", "algorithmic_differentiation.md"),
joinpath("understanding_mooncake", "rule_system.md"),
],
"Utilities" => [
"Tools for Rules" => "tools_for_rules.md",
"Debug Mode" => "debug_mode.md",
"Debugging and MWEs" => "debugging_and_mwes.md",
joinpath("utilities", "tools_for_rules.md"),
joinpath("utilities", "debug_mode.md"),
joinpath("utilities", "debugging_and_mwes.md"),
],
"Developer Documentation" => [
"Running Tests Locally" => "running_tests_locally.md",
"Developer Tools" => "developer_tools.md",
joinpath("developer_documentation", "running_tests_locally.md"),
joinpath("developer_documentation", "developer_tools.md"),
joinpath("developer_documentation", "internal_docstrings.md"),
],
"Known Limitations" => "known_limitations.md",
"known_limitations.md",
]
)

Expand Down
11 changes: 11 additions & 0 deletions docs/src/developer_documentation/internal_docstrings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Internal Docstrings

Docstrings listed here are _not_ part of the public Mooncake.jl interface.
Consequently, they can change between non-breaking changes to Mooncake.jl without warning.

The purpose of this is to make it easy for developers to find docstrings straightforwardly via the docs, as opposed to having to ctrl+f through Mooncake.jl's source code, or looking at the docstrings via the Julia REPL.

```@autodocs; canonical=false
Modules = [Mooncake]
Public = false
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Mooncake.jl and Reverse-Mode AD
# Introduction

The point of Mooncake.jl is to perform reverse-mode algorithmic differentiation (AD).
The purpose of this section is to explain _what_ precisely is meant by this, and _how_ it can be interpreted mathematically.
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Mooncake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ include("stack.jl")

include(joinpath("interpreter", "contexts.jl"))
include(joinpath("interpreter", "abstract_interpretation.jl"))
include(joinpath("interpreter", "bbcode.jl"))
include(joinpath("interpreter", "ir_utils.jl"))
include(joinpath("interpreter", "bbcode.jl"))
include(joinpath("interpreter", "ir_normalisation.jl"))
include(joinpath("interpreter", "zero_like_rdata.jl"))
include(joinpath("interpreter", "s2s_reverse_mode_ad.jl"))
Expand Down
4 changes: 2 additions & 2 deletions src/fwds_rvs_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -901,9 +901,9 @@ Useful for implementation getfield-like rules for mutable structs, pointers, dic
increment_rdata!!(t::T, r) where {T} = tangent(fdata(t), increment!!(rdata(t), r))::T

"""
zero_tangent(p, ::NoFData)

zero_tangent(primal, fdata)

Equivalent to `tangent(fdata, rdata(zero_tangent(primal)))`.
"""
zero_tangent(p, ::NoFData) = zero_tangent(p)

Expand Down
6 changes: 5 additions & 1 deletion src/interpreter/abstract_interpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ MooncakeInterpreter() = MooncakeInterpreter(DefaultCtx)

context_type(::MooncakeInterpreter{C}) where {C} = C

# Globally cached interpreter. Should only be accessed via `get_interpreter`.
"""
const GLOBAL_INTERPRETER

Globally cached interpreter. Should only be accessed via `get_interpreter`.
"""
const GLOBAL_INTERPRETER = Ref(MooncakeInterpreter())

"""
Expand Down
Loading
Loading