Buffer

Flat mutable Int buffers for ``@llvm`` / ``@gpu`` kernels. Names are prefixed (``buf_*``) so they do not clash with linear ``Array`` ``get``/``set`` when both libraries are open. The LLVM lowerer treats these names as aliases of the buffer builtins.
Table of Contents

Types

Buffer

(type)
type Buffer

Functions

buf_length

def buf_length (xs : Buffer) : {n : Int | n ≥ 0 && n = buf_size xs}

buf_get

def buf_get (xs : Buffer) (i : Int | 0 ≤ i && i < buf_size xs) : Int

buf_set

def buf_set (xs : Buffer) (i : Int | 0 ≤ i && i < buf_size xs) (v : Int) : {r : Buffer | buf_size r = buf_size xs}

buf_alloc

``bytes`` is the allocation size in bytes (``n_ints * 4``).
def buf_alloc (bytes : Int | bytes ≥ 0) : {r : Buffer | buf_size r = bytes / 4}

buf_free

def buf_free (xs : Buffer) : Unit

Uninterpreted

Functions declared as def f ... = uninterpreted: only their signature is known to the verifier; they have no body.

buf_size

uninterpreted
def buf_size : (xs : Buffer) → Int