tilus.Script.dot

Contents

tilus.Script.dot

Script.dot(a, b, c=None, /, *, acc_dtype=None, out=None)[source]

Dot product.

This instruction computes the dot product: out = a @ b + c.

The a, b and (optional) c tensors must be 2D register tensors, where

  • a has shape [m, k]

  • b has shape [k, n]

  • c has shape [m, n]

If c is not provided, it’s assumed to be a zero-initialized accumulator tensor with acc_dtype as its data type. If both c and acc_dtype are not provided, an error is raised.

The out tensor is optional. If provided, it will be used to store the result of the dot product. If not provided, a new register tensor will be allocated to hold the result.

The data type of the c and out must be the same and match the acc_dtype if they are provided.

Parameters:
  • a (RegisterTensor) – The first input tensor with shape [m, k].

  • b (RegisterTensor) – The second input tensor with shape [k, n].

  • c (RegisterTensor, optional) – The accumulator tensor with shape [m, n]. If not provided, a zero-initialized tensor will be used.

  • acc_dtype (DataType, optional) – The data type of the accumulation computation. If c is not provided, this is used to determine the data type of the c tensor. If c is provided, it must match the data type of c.

  • out (RegisterTensor, optional) – The output tensor to store the result of the dot product. If not provided, a new register tensor will be allocated to hold the result.

Returns:

ret – The result of the dot product, which is a register tensor with shape [m, n]. It will be out if provided, or a new register tensor if not.

Return type:

RegisterTensor