github ↗
docs menu

Module Device.Tiny_elf

A compiled program's parameters, as a runtime packs them.

#type param = {
  1. #name : string option;
    (*

    The parameter's name, if it has one.

    *)
  2. #addrspace : Dtype.addr_space;
    (*

    Dtype.addr_space.Alu for a scalar, passed as its value; any other for a buffer, passed as its address.

    *)
  3. #dtype : Dtype.t;
    (*

    The type of its elements.

    *)
  4. #shape : int list;
    (*

    [n] for a buffer of n elements, [] for a scalar.

    *)
}

The type for the parameters of a program.

#val iter_sig : ?offset:int -> param list -> (int * Dtype.t) list

iter_sig ~offset signature is where the value of each parameter of signature lies when their values are packed in order from byte offset, each aligned to its size: its byte offset and its type, a scalar's own and a buffer's address's Dtype.t.Uint64. offset defaults to 0.

#val layout : Ops.t list -> (int * Dtype.t) list

layout params is iter_sig of the parameters params, in their order: how a kernel's arguments lie when packed, on every target.

Raises Invalid_argument if an element of params is no parameter.