Skip to content

Commit 9afc4ec

Browse files
authored
Minor improvements to docs (#46)
1 parent e1ca0be commit 9afc4ec

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

docs/src/compiler.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Inside codelets defined with [`@codelet`](@ref) all calls to random functions
3737
* `randn(Float32)`
3838

3939
result to call to corresponding IPU builtins for [random number generation](https://docs.graphcore.ai/projects/poplar-api/en/latest/ipu_intrinsics/ipu_builtins.html#random-number-generation).
40-
The uniformly distributed numbers follow the general semantic of the Julia function `rand` (numbers uniformely distributed in the $[0, 1)$ range), while the normally distributed numbers have the properties described in the Poplar SDK documentation (numbers are in the range $[-5-13/16, 5+13/16]$).
40+
The uniformly distributed numbers follow the general semantic of the Julia function `rand` (floating point numbers are uniformely distributed in the $[0, 1)$ range), while the normally distributed numbers have the properties described in the Poplar SDK documentation (numbers are in the range $[-93/16, 93/16]$).
4141

4242
Additionally, you can use the [IPU builtins](https://docs.graphcore.ai/projects/poplar-api/en/latest/ipu_intrinsics/ipu_builtins.html) listed below.
4343

@@ -87,7 +87,7 @@ The printing macros `@ipucycles` and `@ipushowcycles` can be made completely no-
8787

8888
If your kernel references a non-constant (`const`) global variable, the generated code will result in a reference to a memory address on the host, and this will fatally fail at runtime because programs running on the IPU don't have access to the host memory.
8989
Constant variables are not affected by this problem because their values are inlined when the function is compiled.
90-
If you can't or don't want to make a variable constant you can interpolate its value with a top-level `@eval` when defining the codelet.
90+
If you can't or don't want to make a variable constant you can interpolate its value with a top-level [`@eval`](https://docs.julialang.org/en/v1/base/base/#Base.@eval) when defining the codelet.
9191
For example:
9292

9393
```julia

docs/src/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Other versions of the Poplar SDK are not currently supported.
3030
* the Poplar SDK version 2.2 uses LLVM 13, which is available in Julia v1.8;
3131
* the Poplar SDK versions 2.3-2.5 use LLVM 14, which is available in Julia v1.9;
3232
* the Poplar SDK versions 2.6-3.2 use LLVM 15, which is available in Julia v1.10;
33-
* the Poplar SDK version 3.3 use LLVM 16, which as of 2023-07-05 is not available in any Julia version.
33+
* the Poplar SDK version 3.3 uses LLVM 16, which is available in Julia v1.11.
3434

3535
## Installation
3636

@@ -72,5 +72,6 @@ These approaches are exploratory of the functionalities, and are often limited i
7272
Here is some material that you may find useful for learning more about Julia on the IPU and trying it out yourself:
7373

7474
* [Pluto notebook](https://giordano.github.io/blog/2023-07-20-julia-ipu/) of presentation given at Graphcore and at JuliaCon in July 2023
75+
* Talk "[Julia meets the Intelligence Processing Unit](https://www.youtube.com/watch?v=-fxB0kmcCVE)" at JuliaCon 2023
7576
* [JuliaIpuDemo](https://github.com/JuliaIPU/JuliaIpuDemo), repository with instructions for running some Jupyter notebooks on Paperspace cloud.
7677
This service offers also IPU time for free, these sessions are limited to 6 hours each and one at the time, but you can run as many as you want.

src/compiler/output.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ to match, eg. printing a 64-bit Julia integer requires the `%ld` formatting stri
5353
More user-friendly versions of this macro are [`@ipuprint`](@ref), [`@ipuprintln`](@ref).
5454
See also [`@ipushow`](@ref), which is built on top of `@ipuprintf` functionalities.
5555
56-
Printing can be completely disabled by setting
56+
Printing can be completely disabled by setting [`IPUCompiler.DISABLE_PRINT`](@ref):
5757
```julia
5858
$(@__MODULE__).DISABLE_PRINT[] = true
5959
```
@@ -241,7 +241,7 @@ Limited string interpolation is also possible:
241241
@ipuprint "Hello, World \$(42)\\n"
242242
```
243243
244-
Printing can be completely disabled by setting
244+
Printing can be completely disabled by setting [`IPUCompiler.DISABLE_PRINT`](@ref):
245245
```julia
246246
$(@__MODULE__).DISABLE_PRINT[] = true
247247
```
@@ -300,7 +300,7 @@ IPU analogue of `Base.@show`. It comes with the same type restrictions as [`@ipu
300300
@ipushow x
301301
```
302302
303-
Printing can be completely disabled by setting
303+
Printing can be completely disabled by setting [`IPUCompiler.DISABLE_PRINT`](@ref):
304304
```julia
305305
$(@__MODULE__).DISABLE_PRINT[] = true
306306
```

src/compiler/runtime.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ Base.rand(T::Type{Float16}) = ccall("extern _llvm_colossus_urand_f16", llvmcall
4949
Base.rand(T::Type{Float32}) = ccall("extern _llvm_colossus_urand_f32", llvmcall, Float32, ()) + T(0.5)
5050
Base.rand(T::Type{UInt32}) = ccall("extern _llvm_colossus_urand32", llvmcall, UInt32, ()) + T(0.5)
5151
Base.rand(T::Type{UInt64}) = ccall("extern _llvm_colossus_urand64", llvmcall, UInt64, ()) + T(0.5)
52+
# Note: `llvm.colossus.f{16,32}v2grand` return 2-tuples of numbers, but Julia's `Base.randn`
53+
# returns a single number at a time, sadly we have to discard one of the numbers to keep the
54+
# same semantic.
5255
Base.randn(T::Type{Float16}) = @inbounds ccall("extern _llvm_colossus_f16v2grand", llvmcall, NTuple{2, VecElement{Float16}}, ())[1].value
5356
Base.randn(T::Type{Float32}) = @inbounds ccall("extern _llvm_colossus_f32v2grand", llvmcall, NTuple{2, VecElement{Float32}}, ())[1].value
5457

0 commit comments

Comments
 (0)