Data Padding
vec_dup
Description
Copies a Scalar variable or an immediate for multiple times and fills it in the vector (PAR indicates the degree of parallelism):
Prototype
vec_dup(mask, dst, scalar, repeat_times, dst_rep_stride)
Pipe: Vector
Parameters
Parameter |
Input/Output |
Description |
---|---|---|
mask |
Input |
For details, see the description of the mask parameter in Table 12-25. |
dst |
Output |
A tensor for the start element of the destination operand. Must be one of the following data types: uint16, int16, float16, uint32, int32, float32 |
scalar |
Input |
A scalar or an immediate, for the source operand to be copied. Has the same dtype as dst. |
repeat_times |
Input |
Number of iteration repeats. The addresses of the source and destination operands change upon every iteration. The value range is [0, 255]. If repeat_times is an immediate, 0 is not supported. Must be a scalar of type int16/int32/int64/uint16/uint32/uint64, an immediate of type int, or an Expr of type int16/int32/int64/uint16/uint32/uint64. |
dst_rep_stride |
Input |
Block-to-block stride in a single iteration of the destination operand. The value range is [0, 255], in the unit of 32 bytes. Must be a scalar of type int16/int32/int64/uint16/uint32/uint64, an immediate of type int, or an Expr of type int16/int32/int64/uint16/uint32/uint64. |
Restrictions
- For details about the alignment requirements of the operand address offset, see General Restrictions.
- The caller needs to guarantee that the scalar argument is within the valid range.
Returns
None
Example
from te import tik tik_instance = tik.Tik() dst_ub = tik_instance.Tensor("float16", (128, ), tik.scope_ubuf, "dst_ub") src_scalar = tik_instance.Scalar(init_value=0, dtype="float16") tik_instance.vec_dup(128, dst_ub, src_scalar, 1, 8)