Skip to content

GGML Operation Requirements #53

@ypapadop-amd

Description

@ypapadop-amd

Here's the list of requirements for supporting GGML operations:

  1. A tensor is described by its data type, shape (4 dimensions), and strides in bytes on those dimensions. Since the stride is in bytes, it's derived from the data type. The stride is in bytes because they support sub-byte quantized types. There are no limitations in the shape or the strides. One can have a tensor that is 5005 elements (common in the test cases).
  2. A lot of models are FP16. We convert automatically from FP16 to BF16.
  3. Each operation has up to 10 input tensors and 1 output tensor. 4. The output may be an alias for any of the inputs. An input can be a view, i.e., an alias over another tensor with modified layout. E.g., in the transpose operation Tvw = T', Tvw is a tensor that aliases the data of T with modified strides to mimic iterating over a transposed matrix; Tvw may be passed to another operation, but not all operations support views as inputs.5. Some operations support additional invariants, e.g., a scale factor and a bias in the scale operation. These invariants are set dynamically during the operation instantiation, but they remain static after.
  4. The data types of the inputs and/or the output are not necessarily the same.
  5. For some operators, broadcast is supported in one or more of the inputs. E.g., doing C = A + B where A is a vector Mx1 and B is a matrix MxN replicates A on-the-fly to do a matrix addition without need for extra storage.

Additional requirements for integration:

  1. Compilation artifacts are stored in directories that are dictated by the GGML library.
  2. PDIs / insts files follow a specific naming scheme that is generated in the GGML library.
  3. Compilation artifacts are kept in directories that match the name of the PDI file they produced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions