Native executables, std/array and std/simd
"Projects and packages" gets a section on Native AOT: (aot #t), where the executable goes, what it gives and costs, and (aot-cpu ...) for the CPU it is built for. The standard library chapter gets std/array and std/simd after std/maths, and "Performance" a section on vectors: the kernels first, a loop with its tail, masks, and when vectors pay, with the measurements from the Advent of Code solutions. modules/std/array.sz and modules/std/simd.sz are the reference pages, generated from the modules' docs. 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-opus-4-7) Co-Authored-By: eca-agent <git@eca.dev>
This commit is contained in:
parent
ca170a7e24
commit
15bfc18167
4 changed files with 82 additions and 0 deletions
|
|
@ -12,6 +12,11 @@ For more details, see @link["modules/std/prelude.html"]{@code{(std prelude)}}.
|
|||
Numbers beyond the operators. Integer division has Racket's names: @code{quotient} and @code{remainder} are what @code{/} and @code{%} do, and @code{modulo} takes the sign of the divisor, so @code{(modulo -1 10)} is 9. There are @code{gcd}, @code{lcm}, an integer @code{expt} and an exact @code{integer-sqrt} at every integer type, the @code{exact-} roundings from a double to an int, and the rest of @code{System.Math} over doubles. The prelude has @code{abs}, @code{min}, @code{max} and @code{clamp} from here without an import.
|
||||
For more details, see @link["modules/std/maths.html"]{@code{(std maths)}}.
|
||||
|
||||
@subsection{std/array and std/simd}
|
||||
|
||||
Two modules for numbers in bulk, with the CPU's vector instructions. @code{(std array)} has whole-array operations: @code{array-sum}, @code{array-dot}, @code{array-min}, @code{array-max}, @code{array-add!}, @code{array-scale!}, @code{array-count}, @code{array-index-of} and @code{array-fill!}. Each is one loop in the runtime, which works on as many elements per instruction as a vector register holds when the element is a primitive number, and one at a time for a type such as @code{bigint}. At @code{double}, a sum adds lane by lane, so its last bits can differ from a left fold. @code{(std simd)} has the vectors themselves, for the loops that the kernels do not cover. @code{(Simd128 %a)} and @code{(Simd256 %a)} are .NET's @code{Vector128<T>} and @code{Vector256<T>}, with a name per element type: @code{Float64x4} is four doubles, @code{UInt8x32} is 32 bytes. The operations are the methods of one trait, @code{Simd}, at both widths: @code{simd-add}, @code{simd-mul}, the comparisons @code{simd-lt} and the others, which give masks, @code{simd-select}, @code{simd-count-true}, @code{simd-sum} and more. A vector is made with @code{simd256-load}, @code{simd128-splat} or @code{simd256-zero}, and @code{simd256-whole} says where the elements after the last whole vector start. A 128-bit vector is fast on every x86-64 and ARM64 CPU. A 256-bit vector needs AVX2, and @code{simd256-accelerated?} says whether the CPU has it. The section on performance in "Writing programs" says when vectors pay.
|
||||
For more details, see @link["modules/std/array.html"]{@code{(std array)}} and @link["modules/std/simd.html"]{@code{(std simd)}}.
|
||||
|
||||
@subsection{std/fmt}
|
||||
|
||||
Formatting in Bjolang is divided into two layers: interpolation and layout.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue