Skip to content

Commit 86bea8f

Browse files
authored
docs: add verbosity levels to the docs (#1841)
* docs: add verbosity levels to the docs * docs: cleanup readme and remove old message
1 parent e2f5c8c commit 86bea8f

File tree

2 files changed

+41
-20
lines changed

2 files changed

+41
-20
lines changed

README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
# Reactant.jl
22

3-
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://enzymead.github.io/Reactant.jl/stable)
4-
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://enzymead.github.io/Reactant.jl/dev)
5-
[![Build Status](https://github.com/EnzymeAD/Reactant.jl/workflows/CI/badge.svg)](https://github.com/EnzymeAD/Reactant.jl/actions)
3+
<div align="center">
4+
5+
[![Latest Docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://enzymead.github.io/Reactant.jl/dev)
6+
[![Stable Docs](https://img.shields.io/badge/docs-stable-blue.svg)](https://enzymead.github.io/Reactant.jl/stable)
7+
8+
[![CI](https://github.com/EnzymeAD/Reactant.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/EnzymeAD/Reactant.jl/actions/workflows/CI.yml)
69
[![Coverage](https://codecov.io/gh/EnzymeAD/Reactant.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/EnzymeAD/Reactant.jl)
10+
[![Benchmarks](https://github.com/EnzymeAD/Reactant.jl/actions/workflows/benchmark.yml/badge.svg?branch=main)](https://enzymead.github.io/Reactant.jl/benchmarks/)
11+
12+
[![Downloads](https://img.shields.io/badge/dynamic/json?url=http%3A%2F%2Fjuliapkgstats.com%2Fapi%2Fv1%2Fmonthly_downloads%2FReactant&query=total_requests&suffix=%2Fmonth&label=Downloads)](https://juliapkgstats.com/pkg/Reactant)
13+
[![Downloads](https://img.shields.io/badge/dynamic/json?url=http%3A%2F%2Fjuliapkgstats.com%2Fapi%2Fv1%2Ftotal_downloads%2FReactant&query=total_requests&&label=Total%20Downloads)](https://juliapkgstats.com/pkg/Reactant)
714

8-
> [!WARNING]
9-
> This package is under active development at the moment and may change its API and supported end systems at any time. End-users are advised to wait until a corresponding release with broader availability is made. Package developers are suggested to try out Reactant for integration, but should be advised of the same risks.
15+
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
16+
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
17+
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/JuliaDiff/BlueStyle)
18+
19+
</div>
1020

1121
Reactant takes Julia function and compile it into MLIR and run fancy optimizations on top of it, including using EnzymeMLIR for automatic differentiation, and create relevant executables for CPU/GPU/TPU via XLA. It presently operates as a tracing system. Compiled functions will assume the same control flow pattern as was originally taken by objects used at compile time, and control flow (e.g. if, for) as well as any type instabilities will be removed. The benefits of this approach is immediately making all such code available for advanced optimization with little developer effort. This system and corresponding semantics is subject to change to a (potentially partial) source rewriter in the future.
1222

@@ -16,7 +26,7 @@ Reactant provides two new array types at its core, a ConcreteRArray and a Traced
1626
using Reactant
1727

1828
julia_data = ones(2, 10)
19-
reactant_data = Reactant.ConcreteRArray(julia_data)
29+
reactant_data = Reactant.to_rarray(julia_data)
2030
```
2131

2232
You can also create a ConcreteRArray-version of an arbitrary data type by tracing through the structure, like below. This method will automatically handle recursive data structures or shared objects.
@@ -30,13 +40,13 @@ end
3040
pair = Pair(ones(3), ones(10))
3141

3242
reactant_pair = Reactant.to_rarray(pair)
33-
```
43+
```
3444

3545
To compile programs using ConcreteRArray's, one uses the compile function, like as follows:
3646

3747
```julia
38-
input1 = Reactant.ConcreteRArray(ones(10))
39-
input2 = Reactant.ConcreteRArray(ones(10))
48+
input1 = Reactant.to_rarray(ones(10))
49+
input2 = Reactant.to_rarray(ones(10))
4050

4151
function sinsum_add(x, y)
4252
return sum(sin.(x) .+ y)

docs/src/introduction/FAQs.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ When you encounter OOM (Out of Memory) errors, you can try to clear the cache by
1919
Julia's builtin `GC.gc()` between memory-intensive operations.
2020

2121
!!! note
22+
2223
This will only free memory which is not currently live. If the result of compiled
2324
function was stored in a vector, it will still be alive and `GC.gc()` won't free it.
2425

@@ -85,7 +86,7 @@ After using Julia's built-in `GC.gc()`:
8586
## Benchmark results feel suspiciously fast
8687
8788
If you see benchmark results that are suspiciously fast, it's likely because the benchmark
88-
was executed with compiled functions where `sync=false` was used (the default). In this case, the compiled
89+
was executed with compiled functions where `sync=false` was used (the default). In this case, the compiled
8990
function will be executed asynchronously, and the benchmark results will be the time it takes
9091
for the function to schedule the computation on the device. Compile functions with `sync=true` to get the actual runtime. You can also use the `Reactant.synchronize` on the result of the computation to block until the computation is complete.
9192
@@ -106,13 +107,13 @@ y = Reactant.to_rarray(rand(Float32, 1000))
106107
@benchmark f($x, $y) setup=(f = @compile sync=false myfunc($x, $y))
107108
```
108109
109-
```
110+
```julia
110111
BenchmarkTools.Trial: 199 samples with 9 evaluations per sample.
111112
Range (min … max): 2.926 μs … 14.333 μs ┊ GC (min … max): 0.00% … 0.00%
112113
Time (median): 3.607 μs ┊ GC (median): 0.00%
113114
Time (mean ± σ): 4.210 μs ± 1.968 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
114115
115-
█▅▄▂
116+
█▅▄▂
116117
▇█████▇█▅▅▃▃▂▃▄▂▂▁▁▂▁▁▂▁▁▁▁▁▂▁▁▁▁▂▁▁▁▃▁▁▁▁▁▂▁▁▁▁▁▁▁▂▃▁▂▁▁▃ ▂
117118
2.93 μs Histogram: frequency by time 12.5 μs <
118119
@@ -123,35 +124,45 @@ BenchmarkTools.Trial: 199 samples with 9 evaluations per sample.
123124
@benchmark f($x, $y) setup=(f = @compile sync=true myfunc($x, $y))
124125
```
125126
126-
```
127+
```julia
127128
BenchmarkTools.Trial: 221 samples with 8 evaluations per sample.
128129
Range (min … max): 8.974 μs … 42.443 μs ┊ GC (min … max): 0.00% … 0.00%
129130
Time (median): 11.688 μs ┊ GC (median): 0.00%
130131
Time (mean ± σ): 12.264 μs ± 3.070 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
131132
132-
█▃ ▅▇██▃▄ ▄█▃▄▂▅ ▇ ▂ ▂
133+
█▃ ▅▇██▃▄ ▄█▃▄▂▅ ▇ ▂ ▂
133134
▇▆████████████████▇███▇▃▆▆██▅▅▅▆▆▅▇▁▆▁▁▃▁▃▁▆▁▁▃▁▁▁▁▃▁▁▁▅▁▁▅ ▅
134135
8.97 μs Histogram: frequency by time 20.2 μs <
135136
136137
Memory estimate: 400 bytes, allocs estimate: 14.
137138
```
138139
139140
```julia
140-
@benchmark begin
141-
result = f($x, $y);
142-
Reactant.synchronize(result)
141+
@benchmark begin
142+
result = f($x, $y);
143+
Reactant.synchronize(result)
143144
end setup=(f = @compile sync=false myfunc(x, y))
144145
```
145146
146-
```
147+
```julia
147148
BenchmarkTools.Trial: 233 samples with 8 evaluations per sample.
148149
Range (min … max): 8.911 μs … 19.609 μs ┊ GC (min … max): 0.00% … 0.00%
149150
Time (median): 12.479 μs ┊ GC (median): 0.00%
150151
Time (mean ± σ): 12.758 μs ± 2.219 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
151152
152-
▁▄▄▄▃▂▁ ▃ ▄█▂ ▆▄▂ ▃ ▁ ▃ ▁
153+
▁▄▄▄▃▂▁ ▃ ▄█▂ ▆▄▂ ▃ ▁ ▃ ▁
153154
▄▃▄▆▆████████▆██▆▇███▆███▇█▄▄▆██▇▇█▇▆▄██▇▁▆▄▃▃▁▁▁▁▃▁▁▁▁▄▁▁▃ ▄
154155
8.91 μs Histogram: frequency by time 19.3 μs <
155156
156157
Memory estimate: 400 bytes, allocs estimate: 14.
157-
```
158+
```
159+
160+
## XLA verbosity flags
161+
162+
XLA has special logging flags that can be used to get more information about the compilation
163+
process. These flags are:
164+
165+
1. `TF_CPP_MAX_VLOG_LEVEL`: This set the max verbosity level for XLA, i.e. all logging
166+
for `VLOG(level)` where `level <= TF_CPP_MAX_VLOG_LEVEL` will be printed.
167+
2. `TF_CPP_MIN_VLOG_LEVEL`: This set the min verbosity level for XLA, i.e. all logging
168+
for `VLOG(level)` where `level >= TF_CPP_MIN_VLOG_LEVEL` will be printed.

0 commit comments

Comments
 (0)