Broadcast Operations
This section describes all operations in the PTO ISA that perform broadcast along rows or columns. All operations act on local buffers (tile_buf, located in the loc=vec space) and adopt the Destination-Passing Style (DPS): the operation itself does not produce an SSA return value, but instead writes the result directly into a pre-allocated target tile_buf. All operations are executed on the vector pipe (PIPE_V).
This category of operations typically has the following assembly form:
pto.op ins(%src : !pto.tile_buf<...>)
outs(%dst : !pto.tile_buf<...>)Common constraints typically include:
- All tiles must be located in
loc=vec(VEC/UB storage space). - Input tiles use ND-style layout (
blayout=row_major,slayout=none_box).
Contents
pto.tcolexpand: Column Broadcastpto.trowexpand: Row Broadcastpto.trowexpandsub: Row Broadcast Subtractionpto.trowexpandmul: Row Broadcast Multiplicationpto.trowexpanddiv: Row Broadcast Divisionpto.tcolexpandmax: Column Broadcast Maximum Valuepto.tcolexpandmin: Column Broadcast Minimum Valuepto.tcolexpandmul: Column Broadcast Multiplicationpto.tcolexpandadd: Column Broadcast Additionpto.tcolexpanddiv: Column Broadcast Divisionpto.tcolexpandexpdif: Column Broadcast Exponential Differencepto.tcolexpandsub: Column Broadcast Subtractionpto.trowexpandadd: Row Broadcast Additionpto.trowexpandexpdif: Row Broadcast Exponential Differencepto.trowexpandmax: Row Broadcast Maximumpto.trowexpandmin: Row Broadcast Minimum
Operation Details
pto.tcolexpand: Column Broadcast
pto.tcolexpand: Column Broadcastpto.tcolexpand ins(<src> : <src_type>) outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = src[0, j]Parameters:
| Name | Type | Description |
|---|---|---|
src | pto.tile_buf | Source tile, a row vector, where each column carries one logical scalar. |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
- Implementation check (Atlas A2 products/Atlas A3 products/Ascend 950PR&950DT products)
srcanddstmust useloc=vec.srcanddstmust use ND-style layout (blayout=row_major,slayout=none_box).- Element types must be consistent:
dst_type == src_type. - Data types:
i8,i16,i32,f16,bf16,f32 src valid column == dst valid column
Example:
pto.tcolexpand ins(%src : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16,
v_row=1, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.trowexpand: Row Broadcast
pto.trowexpand: Row Broadcastpto.trowexpand ins(<src> : <src_type>) outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = src[i, 0]Parameters:
| Name | Type | Description |
|---|---|---|
src | pto.tile_buf | Source tile, a column vector, where each row carries one logical scalar. |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
- Implementation check (Atlas A2 products/Atlas A3 products/Ascend 950PR&950DT products)
srcanddstmust useloc=vec.srcmust useslayout=none_box.dstmust use an ND-style layout (blayout=row_major,slayout=none_box).- Element types must be consistent:
dst_type == src_type. - Data types:
i8,i16,i32,f16,bf16,f32 src valid row == dst valid rowsrc valid row != 0,src valid column != 0,dst valid row != 0, anddst valid column != 0
Example:
pto.trowexpand ins(%src : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=8,
v_row=16, v_col=1, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.trowexpandsub: Row Broadcast Subtraction
pto.trowexpandsub: Row Broadcast Subtractionpto.trowexpandsub ins(<src0>, <src1>[, <tmp>] : <src0_type>, <src1_type>[, <tmp_type>])
outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = src0[i, j] - src1[i, 0]Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile. |
src1 | pto.tile_buf | Per-row scalar vector (subtrahend broadcast source). |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
Implementation check (Atlas A2 products/Atlas A3 products)
src0,src1, anddsthave the same element type.- Data types:
i16,i32,f16,f32 dstusesblayout=row_major.src0anddsthave the same shape and valid_shape.- Optional
tmpoperand: used for overloads that require tmp in pto-isa.
Implementation check (Ascend 950PR&950DT products)
src0,src1, anddsthave consistent element types.- Data types:
i8,i16,i32,f16,f32 dstusesblayout=row_major.src0anddsthave the same shape and valid_shape.- Optional
tmpoperand: used for overloads that require tmp in pto-isa.
Example:
pto.trowexpandsub ins(%src0, %src1, %tmp : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=1,
v_row=16, v_col=1, blayout=col_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.trowexpandmul: Row Broadcast Multiplication
pto.trowexpandmul: Row Broadcast Multiplicationpto.trowexpandmul ins(<src0>, <src1>[, <tmp>] : <src0_type>, <src1_type>[, <tmp_type>])
outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = src0[i, j] * src1[i, 0]Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile. |
src1 | pto.tile_buf | Per-row scalar vector (multiplier broadcast source). |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
- Implementation check (Atlas A2 products/Atlas A3 products/Ascend 950PR&950DT products)
src0,src1, anddsthave the same element type.- Data types:
f16,f32 dstusesblayout=row_major.- Optional
tmpoperand: used for overloads that require tmp in pto-isa.
Example:
pto.trowexpandmul ins(%src0, %src1, %tmp : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=1,
v_row=16, v_col=1, blayout=col_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.trowexpanddiv: Row Broadcast Division
pto.trowexpanddiv: Row Broadcast Division// Default precision.
pto.trowexpanddiv ins(<src0>, <src1> : <src0_type>, <src1_type>)
outs(<dst> : <dst_type>)
// High precision (requires tmp).
pto.trowexpanddiv ins(<src0>, <src1>, <tmp> : <src0_type>, <src1_type>, <tmp_type>)
outs(<dst> : <dst_type>)
{precisionType = #pto<div_precision high_precision>}Semantics:
For each element (i, j):
dst[i, j] = src0[i, j] / src1[i, 0]Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile (dividend). |
src1 | pto.tile_buf | Per-row scalar vector (divisor broadcast source). |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Attributes:
precisionType: division precision mode. The default value is#pto<div_precision default>.#pto<div_precision default>: standard precision division.#pto<div_precision high_precision>: high-precision division, which requires a floating-point element type and an additionaltmpoperand.
Constraints:
- Implementation check (Atlas A2 products/Atlas A3 products/Ascend 950PR&950DT products)
src0,src1, anddsthave the same element type.- Only floating-point types are supported:
f16,f32. dstusesblayout=row_major.- In high-precision mode, the
tmpoperand must be provided.
Example:
// Default precision.
pto.trowexpanddiv ins(%src0, %src1 : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=1,
v_row=16, v_col=1, blayout=col_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
// High precision.
pto.trowexpanddiv ins(%src0, %src1, %tmp : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=1,
v_row=16, v_col=1, blayout=col_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
{precisionType = #pto<div_precision high_precision>}pto.tcolexpandmax: Column Broadcast Maximum Value
pto.tcolexpandmax: Column Broadcast Maximum Valuepto.tcolexpandmax ins(<src0>, <src1> : <src0_type>, <src1_type>)
outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = max(src0[i, j], src1[0, j])Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile. |
src1 | pto.tile_buf | Per-column scalar vector. |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
Implementation check (Atlas A2 products/Atlas A3 products)
src0,src1, anddsthave the same element type.- Data types:
i16,i32,f16,f32 src0anddsthave the same shape and valid_shape.src0,src1, anddstuseblayout=row_major.src1 valid_shape[1] == dst valid_shape[1]
Implementation check (Ascend 950PR&950DT Products)
src0,src1, anddsthave the same element type.- Data types:
i8,i16,i32,f16,f32 src0anddsthave the same shape and valid_shape.src0,src1, anddstuseblayout=row_major.src1 valid_shape[1] == dst valid_shape[1]
Example:
pto.tcolexpandmax ins(%src0, %src1 : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16,
v_row=1, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.tcolexpandmin: Column Broadcast Minimum Value
pto.tcolexpandmin: Column Broadcast Minimum Valuepto.tcolexpandmin ins(<src0>, <src1> : <src0_type>, <src1_type>)
outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = min(src0[i, j], src1[0, j])Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile. |
src1 | pto.tile_buf | Per-column scalar vector. |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
Implementation check (Atlas A2 products/Atlas A3 products)
src0,src1, anddsthave the same element type.- Data types:
i16,i32,f16,f32 src0anddsthave the same shape and valid_shape.src0,src1, anddstuseblayout=row_major.src1 valid_shape[1] == dst valid_shape[1]
Implementation check (Ascend 950PR&950DT Products)
src0,src1, anddsthave the same element type.- Data types:
i8,i16,i32,f16,f32 src0anddsthave the same shape and valid_shape.src0,src1, anddstuseblayout=row_major.src1 valid_shape[1] == dst valid_shape[1]
Example:
pto.tcolexpandmin ins(%src0, %src1 : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16,
v_row=1, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.tcolexpandmul: Column Broadcast Multiplication
pto.tcolexpandmul: Column Broadcast Multiplicationpto.tcolexpandmul ins(<src0>, <src1> : <src0_type>, <src1_type>)
outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = src0[i, j] * src1[0, j]Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile. |
src1 | pto.tile_buf | Per-column scalar vector. |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
Implementation check (Atlas A2 products/Atlas A3 products)
src0,src1, anddsthave the same element type.- Data types:
i16,i32,f16,f32 src0anddsthave the same shape and valid_shape.src0,src1, anddstuseblayout=row_major.src1 valid_shape[1] == dst valid_shape[1]
Implementation check (Ascend 950PR&950DT Products)
src0,src1, anddsthave the same element type.- Data types:
i8,i16,i32,f16,f32 src0anddsthave the same shape and valid_shape.src0,src1, anddstuseblayout=row_major.src1 valid_shape[1] == dst valid_shape[1]
Example:
pto.tcolexpandmul ins(%src0, %src1 : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16,
v_row=1, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.tcolexpandadd: Column Broadcast Addition
pto.tcolexpandadd: Column Broadcast Additionpto.tcolexpandadd ins(<src0>, <src1> : <src0_type>, <src1_type>)
outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = src0[i, j] + src1[0, j]Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile. |
src1 | pto.tile_buf | Per-column scalar vector. |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
Implementation check (Atlas A2 products/Atlas A3 products)
src0,src1, anddsthave the same element type.- Data types:
i16,i32,f16,f32 src0anddsthave the same shape and valid_shape.src0,src1, anddstuseblayout=row_major.src1 valid_shape[1] == dst valid_shape[1]
Implementation check (Ascend 950PR&950DT Products)
src0,src1, anddsthave the same element type.- Data types:
i8,i16,i32,f16,f32 src0anddsthave the same shape and valid_shape.src0,src1, anddstuseblayout=row_major.src1 valid_shape[1] == dst valid_shape[1]
Example:
pto.tcolexpandadd ins(%src0, %src1 : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16,
v_row=1, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.tcolexpanddiv: Column Broadcast Division
pto.tcolexpanddiv: Column Broadcast Divisionpto.tcolexpanddiv ins(<src0>, <src1> : <src0_type>, <src1_type>)
outs(<dst> : <dst_type>)
{precisionType = <precision>}Semantics:
For each element (i, j):
dst[i, j] = src0[i, j] / src1[0, j]Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile (dividend). |
src1 | pto.tile_buf | Per-column scalar vector (divisor). |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Attributes:
precisionType: division precision mode. The default value is#pto<div_precision default>.#pto<div_precision default>: standard precision division.#pto<div_precision high_precision>: high precision division, valid only when the element type isf16orf32.
Constraints:
- Implementation check (Atlas A2 products/Atlas A3 products/Ascend 950PR&950DT products)
src0,src1, anddsthave the same element type.- Only floating-point types are supported:
f16andf32. src0anddsthave the same shape and valid_shape.src0,src1, anddstuseblayout=row_major.src1 valid_shape[1] == dst valid_shape[1]
Example:
pto.tcolexpanddiv ins(%src0, %src1 : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16,
v_row=1, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.tcolexpandexpdif: Column Broadcast Exponential Difference
pto.tcolexpandexpdif: Column Broadcast Exponential Differencepto.tcolexpandexpdif ins(<src0>, <src1> : <src0_type>, <src1_type>)
outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = exp(src0[i, j] - src1[0, j])Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile. |
src1 | pto.tile_buf | Per-column scalar vector (the subtrahend in the exponential difference). |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
- Implementation check (Atlas A2 products/Atlas A3 products/Ascend 950PR&950DT products)
src0,src1, anddsthave the same element type.- Only floating-point types are supported:
f16,f32. src0anddsthave the same shape and valid_shape.src0,src1, anddstuseblayout=row_major.src1 valid_shape[1] == dst valid_shape[1]
Example:
pto.tcolexpandexpdif ins(%src0, %src1 : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16,
v_row=1, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.tcolexpandsub: Column Broadcast Subtraction
pto.tcolexpandsub: Column Broadcast Subtractionpto.tcolexpandsub ins(<src0>, <src1> : <src0_type>, <src1_type>)
outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = src0[i, j] - src1[0, j]Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile. |
src1 | pto.tile_buf | Per-column scalar vector (subtrahend broadcast source). |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
Implementation check (Atlas A2 products/Atlas A3 products)
src0,src1, anddsthave the same element type.- Data types:
i16,i32,f16,f32 src0anddsthave the same shape and valid_shape.src0,src1, anddstuseblayout=row_major.src1 valid_shape[1] == dst valid_shape[1]
Implementation check (Ascend 950PR&950DT products)
src0,src1, anddsthave the same element type.- Data types:
i8,i16,i32,f16,f32 src0anddsthave the same shape and valid_shape.src0,src1, anddstuseblayout=row_major.src1 valid_shape[1] == dst valid_shape[1]
Example:
pto.tcolexpandsub ins(%src0, %src1 : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16,
v_row=1, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.trowexpandadd: Row Broadcast Addition
pto.trowexpandadd: Row Broadcast Additionpto.trowexpandadd ins(<src0>, <src1> : <src0_type>, <src1_type>)
outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = src0[i, j] + src1[i, 0]Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile. |
src1 | pto.tile_buf | Per-row scalar vector. |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
Implementation check (Atlas A2 products/Atlas A3 products)
src0,src1, anddsthave the same element type.- Data types:
i16,i32,f16,f32 src0anddsthave the same shape and valid_shape.src0anddstuseblayout=row_major.src1 valid_shape[0] == dst valid_shape[0]- When
src1is row_major:src1 valid_shape[1] == 32 / sizeof(dtype); otherwise:src1 valid_shape[1] == 1
Implementation check (Ascend 950PR&950DT products)
src0,src1, anddsthave the same element type.- Data types:
i8,i16,i32,f16,f32 src0anddsthave the same shape and valid_shape.src0anddstuseblayout=row_major.src1 valid_shape[0] == dst valid_shape[0]- When
src1is row_major:src1 valid_shape[1] == 32 / sizeof(dtype); otherwise:src1 valid_shape[1] == 1
Example:
pto.trowexpandadd ins(%src0, %src1 : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=1,
v_row=16, v_col=1, blayout=col_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.trowexpandexpdif: Row Broadcast Exponential Difference
pto.trowexpandexpdif: Row Broadcast Exponential Differencepto.trowexpandexpdif ins(<src0>, <src1>[, <tmp>] : <src0_type>, <src1_type>[, <tmp_type>])
outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = exp(src0[i, j] - src1[i, 0])Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile. |
src1 | pto.tile_buf | Per-row scalar vector (the subtrahend in the exponential difference). |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
- Implementation check (Atlas A2 products/Atlas A3 products/Ascend 950PR&950DT products)
src0,src1, anddsthave the same element type.- Only floating-point types are supported:
f16,f32. dstusesblayout=row_major.- Optional
tmpoperand: used for overloads that require tmp in pto-isa.
Example:
pto.trowexpandexpdif ins(%src0, %src1 : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=1,
v_row=16, v_col=1, blayout=col_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.trowexpandmax: Row Broadcast Maximum
pto.trowexpandmax: Row Broadcast Maximumpto.trowexpandmax ins(<src0>, <src1>[, <tmp>] : <src0_type>, <src1_type>[, <tmp_type>])
outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = max(src0[i, j], src1[i, 0])Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile. |
src1 | pto.tile_buf | Per-row scalar vector. |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
Implementation check (Atlas A2 products/Atlas A3 products)
src0,src1, anddsthave the same element type.- Data types:
i16,i32,f16,f32 dstusesblayout=row_major.- Optional
tmpoperand: used for overloads that require tmp in pto-isa.
Implementation check (Ascend 950PR&950DT products)
src0,src1, anddsthave the same element type.- Data types:
i8,i16,i32,f16,bf16,f32 dstusesblayout=row_major.- Optional
tmpoperand: used for overloads that require tmp in pto-isa.
Example:
The per-row scalar vector in the example uses a column-major single-column tile. If a row-major vector is used instead, its valid column count must be 32/sizeof(dtype), which is 8 for f32.
pto.trowexpandmax ins(%src0, %src1 : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=1,
v_row=16, v_col=1, blayout=col_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)pto.trowexpandmin: Row Broadcast Minimum
pto.trowexpandmin: Row Broadcast Minimumpto.trowexpandmin ins(<src0>, <src1>[, <tmp>] : <src0_type>, <src1_type>[, <tmp_type>])
outs(<dst> : <dst_type>)Semantics:
For each element (i, j):
dst[i, j] = min(src0[i, j], src1[i, 0])Parameters:
| Name | Type | Description |
|---|---|---|
src0 | pto.tile_buf | Primary source tile. |
src1 | pto.tile_buf | Per-row scalar vector. |
dst | pto.tile_buf | Target tile. |
Returns: None. Writes to dst in DPS form.
Constraints:
Implementation check (Atlas A2/A3 products)
src0,src1, anddsthave the same element type.- Data types:
i16,i32,f16,f32 dstusesblayout=row_major.- Optional
tmpoperand: used for overloads that require tmp in pto-isa.
Implementation check (Ascend 950PR&950DT products)
src0,src1, anddsthave the same element type.- Data types:
i8,i16,i32,f16,bf16,f32 dstusesblayout=row_major.- Optional
tmpoperand: used for overloads that require tmp in pto-isa.
Example:
The per-row scalar vector in the example uses a column-major single-column tile. If a row-major vector is used instead, its valid column count must be 32/sizeof(dtype), which is 8 for f32.
pto.trowexpandmin ins(%src0, %src1 : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>,
!pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=1,
v_row=16, v_col=1, blayout=col_major, slayout=none_box,
fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=16,
v_row=16, v_col=16, blayout=row_major, slayout=none_box,
fractal=512, pad=0>)