Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/PTO_IR_manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -7475,7 +7475,7 @@ pto.tconcatidx ins(%src0, %src1, %idx0, %idx1 :

**Summary:** Gathers elements from a source tile using one of three PTO-ISA-compatible forms:

- index gather: `src + indices + tmp -> dst`
- index gather: `src + indices[+ tmp] -> dst`
- compare gather: `src + kValue + tmp -> dst + cdst`
- mask-pattern gather: `src + maskPattern -> dst`

Expand All @@ -7501,7 +7501,7 @@ Mask form:
| `dst` | `pto.tile_buf` | Main destination tile |
| `cdst` | `Optional<pto.tile_buf>` | Secondary destination tile used only by compare form |
| `indices` | `Optional<pto.tile_buf>` | Index tile used only by index form |
| `tmp` | `Optional<pto.tile_buf>` | Temporary tile used by index form and compare form |
| `tmp` | `Optional<pto.tile_buf>` | Temporary tile used by compare form; optionally used by index form on A2/A3 (required), A5 (optional) |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A2A3和A5的行为都需要lit用例看护

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhangstevenunity IR手册修改,请review是否合理

| `kValue` | `Optional<scalar>` | Scalar compare value used only by compare form |
| `maskPattern` | `Optional<MaskPatternAttr>` | Mask pattern used only by mask form |
| `cmpMode` | `Optional<CmpModeAttr>` | Compare mode used only by compare form; defaults to `eq` when omitted |
Expand Down Expand Up @@ -7535,18 +7535,18 @@ pto.tgather ins(%src, {maskPattern = #pto.mask_pattern<Pxxxx>} : !pto.tile_buf<.
**Constraints & Verification:**

- Exactly one of the following forms must be used:
- index form: `indices` and `tmp`
- index form: `indices` (A5: `tmp` is optional; A2/A3: `tmp` is required)
- compare form: `kValue`, `tmp`, and `cdst`
- mask form: `maskPattern`
- **Index gather: implementation checks (A2/A3)**:
- `src` and `dst` element types must match and be one of `i16/i32/f16/f32`.
- `indices` element type must be `i32`.
- `tmp` element type must match `indices`.
- `tmp` is required; `tmp` element type must match `indices`.
- `indices` and `tmp` must have the same valid shape.
- **Index gather: implementation checks (A5)**:
- `src` and `dst` element types must match and be one of `i8/i16/i32/f16/f32`, or a target-supported fp8 type (`f8E4M3*`/`f8E5M2*`).
- `indices` element type must be `i16` or `i32`.
- PTO IR does not impose an extra tmp shape or valid-shape relation in the A5 index form.
- `tmp` is optional; PTO IR does not impose an extra tmp shape or valid-shape relation in the A5 index form.
- **Compare gather: implementation checks (A2/A3)**:
- `dst` element type must be `i32`.
- `src` element type must be `f16/f32`, or `i32` when `cmpMode=eq`.
Expand Down
17 changes: 10 additions & 7 deletions lib/PTO/IR/PTO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7757,12 +7757,15 @@ llvm::LogicalResult mlir::pto::TGatherOp::verify() {
Type srcTy = getSrc().getType();
Type dstTy = getDst().getType();
Type idxTy = getIndices().getType();
Type tmpTy = getTmp().getType();
if (failed(verifyTileBufCommon(*this, srcTy, "src", allowA5ElemTypes)) ||
failed(verifyTileBufCommon(*this, dstTy, "dst", allowA5ElemTypes)) ||
failed(verifyTileBufCommon(*this, idxTy, "indices")) ||
failed(verifyTileBufCommon(*this, tmpTy, "tmp")))
failed(verifyTileBufCommon(*this, idxTy, "indices")))
return failure();
if (getTmp()) {
Type tmpTy = getTmp().getType();
if (failed(verifyTileBufCommon(*this, tmpTy, "tmp")))
return failure();
}

Type srcElem = getElemTy(srcTy);
Type dstElem = getElemTy(dstTy);
Expand Down Expand Up @@ -7806,10 +7809,10 @@ llvm::LogicalResult mlir::pto::TGatherOp::verify() {
}

if (!allowA5ElemTypes) {
Type tmpElem = getElemTy(tmpTy);
Type tmpElem = getElemTy(getTmp().getType());
if (tmpElem != idxElem)
return emitOpError("expects tmp and indices to have the same element type");
if (failed(verifyTileBufSameValidShape(*this, idxTy, tmpTy, "indices", "tmp")))
if (failed(verifyTileBufSameValidShape(*this, idxTy, getTmp().getType(), "indices", "tmp")))
return failure();
}
return success();
Expand Down Expand Up @@ -7897,8 +7900,8 @@ llvm::LogicalResult mlir::pto::TGatherOp::verify() {
return emitOpError("compare-form tgather does not take indices");
return verifyCompareForm(/*allowA5SrcTypes=*/true);
}
if (!getIndices() || !getTmp())
return emitOpError("index-form tgather expects both indices and tmp");
if (!getIndices())
return emitOpError("index-form tgather expects indices");
return verifyIndexForm(/*allow16BitIndices=*/true, /*allowA5ElemTypes=*/true);
};

Expand Down
8 changes: 5 additions & 3 deletions lib/PTO/Transforms/PTOToEmitC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10078,15 +10078,17 @@ struct PTOGatherToEmitC : public OpConversionPattern<pto::TGatherOp> {
return rewriter.notifyMatchFailure(op, (name + " must be emitc::OpaqueType (tile)").str());
};

// Case 1: index-based TGATHER(dst, src0, indices, tmp)
// Case 1: index-based TGATHER(dst, src0, indices[, tmp])
if (Value idx = adaptor.getIndices()) {
idx = peelUnrealized(idx);
Value tmp = peelUnrealized(adaptor.getTmp());
SmallVector<Value, 4> operands{dst, src0, idx};
if (Value tmp = adaptor.getTmp())
operands.push_back(peelUnrealized(tmp));

rewriter.create<emitc::CallOpaqueOp>(
loc, TypeRange{}, "TGATHER",
/*args=*/ArrayAttr{}, /*templateArgs=*/ArrayAttr{},
/*operands=*/ValueRange{dst, src0, idx, tmp});
/*operands=*/operands);

rewriter.eraseOp(op);
return success();
Expand Down
28 changes: 20 additions & 8 deletions lib/PTO/Transforms/PTOViewToMemref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3654,7 +3654,8 @@ struct PTOViewToMemrefPass
}

if (maskPattern) {
rewriter.replaceOpWithNewOp<pto::TGatherOp>(
replaceOpWithClonedAttrs<pto::TGatherOp>(
rewriter,
op,
TypeRange{},
src,
Expand All @@ -3678,7 +3679,8 @@ struct PTOViewToMemrefPass
return;
}

rewriter.replaceOpWithNewOp<pto::TGatherOp>(
replaceOpWithClonedAttrs<pto::TGatherOp>(
rewriter,
op,
TypeRange{},
src,
Expand All @@ -3693,23 +3695,33 @@ struct PTOViewToMemrefPass
continue;
}

if (indices || tmp) {
if (indices) {
auto indicesTy = dyn_cast<MemRefType>(indices.getType());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里应该先判断indices是否存在,否则tmp存在而indices不存在的情况编译器会crash

auto tmpTy = dyn_cast<MemRefType>(tmp.getType());
if (!indicesTy || !tmpTy) {
op.emitError("index-form tgather expects indices/tmp to be memref yet");
if (!indicesTy) {
op.emitError("index-form tgather expects indices to be memref yet");
signalPassFailure();
return;
}
Value tmpVal;
if (tmp) {
auto tmpTy = dyn_cast<MemRefType>(tmp.getType());
if (!tmpTy) {
op.emitError("index-form tgather expects tmp to be memref yet");
signalPassFailure();
return;
}
tmpVal = tmp;
}

rewriter.replaceOpWithNewOp<pto::TGatherOp>(
replaceOpWithClonedAttrs<pto::TGatherOp>(
rewriter,
op,
TypeRange{},
src,
dst,
/*cdst=*/Value(),
indices,
tmp,
tmpVal,
/*kValue=*/Value(),
/*maskPattern=*/pto::MaskPatternAttr(),
/*cmpMode=*/pto::CmpModeAttr(),
Expand Down
1 change: 1 addition & 0 deletions ptodsl/ptodsl/tilelib/templates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
("a5", "pto.tfillpad"): ".a5.tfillpad",
("a5", "pto.tfillpad_expand"): ".a5.tfillpad_expand",
("a5", "pto.tfillpad_inplace"): ".a5.tfillpad_inplace",
("a5", "pto.tgather"): ".a5.tgather",
("a5", "pto.tgatherb"): ".a5.tgatherb",
("a5", "pto.tgemv"): ".a5.tgemv",
("a5", "pto.tgemv.acc"): ".a5.tgemv_acc",
Expand Down
88 changes: 88 additions & 0 deletions ptodsl/ptodsl/tilelib/templates/a5/tgather.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Copyright (c) 2026 Huawei Technologies Co., Ltd.
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
# CANN Open Software License Agreement Version 2.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.

"""PTODSL TileLib templates for pto.tgather."""

from ptodsl import pto
import ptodsl.tilelib as tilelib
from ._common import NUMERIC_DTYPES
from ._common import element_store_dist


def gather_dtype_signatures(dtypes=NUMERIC_DTYPES):
res = []
for dtype in dtypes:
for dtype_indices in ('i16', 'ui16', "i32", "ui32"):
res.append((dtype, dtype, dtype_indices))
return res


@tilelib.tile_template(
op="pto.tgather",
target="a5",
name="template_tgather",
dtypes=gather_dtype_signatures(),
iteration_axis="none",
op_engine="vector",
op_class="other",
layouts=("row_major",),
loop_depth=2,
is_post_update=False
)
def template_tgather(
src: pto.Tile,
dst: pto.Tile,
indices: pto.Tile):
dtype = dst.element_type
dtype_indices = indices.element_type
elem_bytes = pto.bytewidth(dtype)
elem_bytes_s1 = pto.bytewidth(dtype_indices)
valid_rows, valid_cols = indices.valid_shape
src_ptr = src.as_ptr()
if pto.const_expr(elem_bytes == 2 and elem_bytes_s1 == 4):
indices_type = pto.ui32
lanes = pto.elements_per_vreg(indices_type)
for row in range(0, valid_rows, 1):
remained = valid_cols
for col in range(0, valid_cols, lanes):
indices_reg = pto.vlds(indices[row, col:])
mask, remained = pto.make_mask(indices_type, remained)
dst_reg = pto.vgather2_bc(src_ptr, pto.vbitcast(indices_reg, indices_type), mask)
pto.vsts(dst_reg, dst[row, col:], mask)
elif pto.const_expr(elem_bytes == 1):
packed_lanes = pto.elements_per_vreg(dtype) >> 1
result_elem = pto.ui16 if pto.const_expr(dtype == pto.ui8) else pto.i16
result_ty = pto.vreg_type(packed_lanes, result_elem)
for row in range(0, valid_rows, 1):
remained = valid_cols
for col in range(0, valid_cols, packed_lanes):
indices_reg = pto.vlds(indices[row, col:])
mask, remained = pto.make_mask(result_elem, remained)
dst_reg = pto.vgather2(src_ptr, pto.vbitcast(indices_reg, pto.ui16), mask, result_vreg_type=result_ty)
pto.vsts(dst_reg, dst[row, col:], mask, dist=pto.VStoreDist.PK_B16)
Comment on lines +47 to +67

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里4个分支大部分逻辑是相同的,能否合并,降低维护难度

elif pto.const_expr(elem_bytes == 4):
indices_type = pto.ui32
lanes = pto.elements_per_vreg(indices_type)
for row in range(0, valid_rows, 1):
remained = valid_cols
for col in range(0, valid_cols, lanes):
indices_reg = pto.vlds(indices[row, col:])
mask, remained = pto.make_mask(indices_type, remained)
dst_reg = pto.vgather2(src_ptr, pto.vbitcast(indices_reg, indices_type), mask)
pto.vsts(dst_reg, dst[row, col:], mask)
else:
indices_type = pto.ui16
lanes = pto.elements_per_vreg(indices_type)
for row in range(0, valid_rows, 1):
remained = valid_cols
for col in range(0, valid_cols, lanes):
indices_reg = pto.vlds(indices[row, col:])
mask, remained = pto.make_mask(indices_type, remained)
dst_reg = pto.vgather2(src_ptr, pto.vbitcast(indices_reg, indices_type), mask)
pto.vsts(dst_reg, dst[row, col:], mask)

15 changes: 15 additions & 0 deletions test/lit/pto/tgather_a2a3_index_emitc.pto
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// RUN: ptoas --pto-arch=a3 %s 2>&1 | FileCheck %s

module {
func.func @tgather_a2a3_index_with_tmp() {
%src = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%indices = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%tmp = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%dst = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
pto.tgather ins(%src, %indices, %tmp : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>, !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>, !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
return
}
}

// CHECK: TGATHER({{[_A-Za-z][_A-Za-z0-9]*}}, {{[_A-Za-z][_A-Za-z0-9]*}}, {{[_A-Za-z][_A-Za-z0-9]*}}, {{[_A-Za-z][_A-Za-z0-9]*}});
45 changes: 45 additions & 0 deletions test/lit/pto/tgather_a2a3_index_invalid.pto
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// RUN: not ptoas --pto-arch=a3 %s 2>&1 | FileCheck %s

module {
func.func @tgather_a2a3_index_missing_tmp() {
%src = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%indices = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%dst = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
pto.tgather ins(%src, %indices : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>, !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
return
}

func.func @tgather_a2a3_index_missing_indices() {
%src = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%dst = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
pto.tgather ins(%src : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
return
}

func.func @tgather_a2a3_index_invalid_src_dtype() {
%src = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=i8, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%indices = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%tmp = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%dst = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=i8, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
pto.tgather ins(%src, %indices, %tmp : !pto.tile_buf<loc=vec, dtype=i8, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>, !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>, !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=i8, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
return
}

func.func @tgather_a2a3_index_invalid_indices_dtype() {
%src = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%indices = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=i16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%tmp = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=i16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%dst = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
pto.tgather ins(%src, %indices, %tmp : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>, !pto.tile_buf<loc=vec, dtype=i16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>, !pto.tile_buf<loc=vec, dtype=i16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f16, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
return
}
}

// CHECK: error: 'pto.tgather' op index-form tgather expects both indices and tmp
// CHECK: error: 'pto.tgather' op index-form tgather expects both indices and tmp
// CHECK: error: 'pto.tgather' op expects gather src/dst element type to be i16/i32/f16/f32
// CHECK: error: 'pto.tgather' op expects indices element type to be i32
25 changes: 25 additions & 0 deletions test/lit/pto/tgather_a5_index_no_tmp_emitc.pto
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// RUN: ptoas --pto-arch=a5 %s 2>&1 | FileCheck %s

module {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本PR的主要变更是把tmp变为可选参数,这里要有相应的正负例测试

func.func @tgather_a5_index_no_tmp() {
%src = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%indices = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%dst = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
pto.tgather ins(%src, %indices : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>, !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
return
}

func.func @tgather_a5_index_with_tmp() {
%src = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%indices = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%tmp = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%dst = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>
pto.tgather ins(%src, %indices, %tmp : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>, !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>, !pto.tile_buf<loc=vec, dtype=i32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=32, v_row=1, v_col=32, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
return
}
}

// CHECK: TGATHER

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lit只check TGATHER op name,没有check tmp参数等是否符合预期

// CHECK: TGATHER
Loading
Loading