From 90de8dfe20c25d7ab85727e26f7590f2a64d7a10 Mon Sep 17 00:00:00 2001 From: PTOAS Date: Sat, 28 Mar 2026 15:41:18 +0800 Subject: [PATCH 1/3] Improve tile_buf asm printing and add tests --- lib/PTO/IR/PTOTypeDefs.cpp | 500 +++++++++++------- test/basic/tilebuf_asm_compact.mlir | 26 + .../tilebuf_asm_error_cols_negative.mlir | 10 + .../tilebuf_asm_error_conflicting_cols.mlir | 10 + .../tilebuf_asm_error_conflicting_dtype.mlir | 10 + .../tilebuf_asm_error_conflicting_loc.mlir | 10 + ...sm_error_conflicting_positional_dtype.mlir | 10 + ...sm_error_conflicting_positional_shape.mlir | 10 + .../tilebuf_asm_error_conflicting_rows.mlir | 10 + .../tilebuf_asm_error_invalid_blayout.mlir | 10 + ...ilebuf_asm_error_invalid_dim_negative.mlir | 10 + ...ilebuf_asm_error_invalid_dim_question.mlir | 10 + ...asm_error_invalid_dim_second_negative.mlir | 10 + .../tilebuf_asm_error_invalid_fractal.mlir | 10 + test/basic/tilebuf_asm_error_invalid_pad.mlir | 10 + .../tilebuf_asm_error_invalid_slayout.mlir | 10 + .../tilebuf_asm_error_invalid_valid_neg.mlir | 10 + .../tilebuf_asm_error_invalid_vcol_value.mlir | 10 + .../tilebuf_asm_error_invalid_vrow_value.mlir | 10 + .../tilebuf_asm_error_missing_dtype.mlir | 10 + test/basic/tilebuf_asm_error_missing_loc.mlir | 10 + .../tilebuf_asm_error_missing_rows_cols.mlir | 10 + test/basic/tilebuf_asm_error_pad_nonint.mlir | 10 + .../tilebuf_asm_error_rows_negative.mlir | 10 + test/basic/tilebuf_asm_error_unknown_key.mlir | 10 + test/basic/tilebuf_asm_error_unknown_loc.mlir | 10 + test/basic/tilebuf_asm_error_valid_rank.mlir | 10 + test/basic/tilebuf_asm_error_vcol_only.mlir | 10 + test/basic/tilebuf_asm_error_vrow_only.mlir | 10 + 29 files changed, 606 insertions(+), 190 deletions(-) create mode 100644 test/basic/tilebuf_asm_compact.mlir create mode 100644 test/basic/tilebuf_asm_error_cols_negative.mlir create mode 100644 test/basic/tilebuf_asm_error_conflicting_cols.mlir create mode 100644 test/basic/tilebuf_asm_error_conflicting_dtype.mlir create mode 100644 test/basic/tilebuf_asm_error_conflicting_loc.mlir create mode 100644 test/basic/tilebuf_asm_error_conflicting_positional_dtype.mlir create mode 100644 test/basic/tilebuf_asm_error_conflicting_positional_shape.mlir create mode 100644 test/basic/tilebuf_asm_error_conflicting_rows.mlir create mode 100644 test/basic/tilebuf_asm_error_invalid_blayout.mlir create mode 100644 test/basic/tilebuf_asm_error_invalid_dim_negative.mlir create mode 100644 test/basic/tilebuf_asm_error_invalid_dim_question.mlir create mode 100644 test/basic/tilebuf_asm_error_invalid_dim_second_negative.mlir create mode 100644 test/basic/tilebuf_asm_error_invalid_fractal.mlir create mode 100644 test/basic/tilebuf_asm_error_invalid_pad.mlir create mode 100644 test/basic/tilebuf_asm_error_invalid_slayout.mlir create mode 100644 test/basic/tilebuf_asm_error_invalid_valid_neg.mlir create mode 100644 test/basic/tilebuf_asm_error_invalid_vcol_value.mlir create mode 100644 test/basic/tilebuf_asm_error_invalid_vrow_value.mlir create mode 100644 test/basic/tilebuf_asm_error_missing_dtype.mlir create mode 100644 test/basic/tilebuf_asm_error_missing_loc.mlir create mode 100644 test/basic/tilebuf_asm_error_missing_rows_cols.mlir create mode 100644 test/basic/tilebuf_asm_error_pad_nonint.mlir create mode 100644 test/basic/tilebuf_asm_error_rows_negative.mlir create mode 100644 test/basic/tilebuf_asm_error_unknown_key.mlir create mode 100644 test/basic/tilebuf_asm_error_unknown_loc.mlir create mode 100644 test/basic/tilebuf_asm_error_valid_rank.mlir create mode 100644 test/basic/tilebuf_asm_error_vcol_only.mlir create mode 100644 test/basic/tilebuf_asm_error_vrow_only.mlir diff --git a/lib/PTO/IR/PTOTypeDefs.cpp b/lib/PTO/IR/PTOTypeDefs.cpp index f00a6cda..4190e3c7 100644 --- a/lib/PTO/IR/PTOTypeDefs.cpp +++ b/lib/PTO/IR/PTOTypeDefs.cpp @@ -5,37 +5,6 @@ using namespace mlir; using namespace mlir::pto; -namespace { -thread_local PTOParserTargetArch currentParserTargetArch = - PTOParserTargetArch::Unspecified; -} - -void mlir::pto::setPTOParserTargetArch(PTOParserTargetArch arch) { - currentParserTargetArch = arch; -} - -PTOParserTargetArch mlir::pto::getPTOParserTargetArch() { - return currentParserTargetArch; -} - -mlir::pto::ScopedPTOParserTargetArch::ScopedPTOParserTargetArch( - PTOParserTargetArch arch) - : previousArch(getPTOParserTargetArch()) { - setPTOParserTargetArch(arch); -} - -mlir::pto::ScopedPTOParserTargetArch::~ScopedPTOParserTargetArch() { - setPTOParserTargetArch(previousArch); -} - -static SmallVector canonicalizeTileBufValidShape(ArrayRef validShape) { - SmallVector canonical; - canonical.reserve(validShape.size()); - for (int64_t dim : validShape) - canonical.push_back(dim < 0 ? ShapedType::kDynamic : dim); - return canonical; -} - TileBufConfigAttr TileBufType::getConfigAttr() const { // 情况 A:getConfig() 已经是 TileBufConfigAttr if constexpr (std::is_same_v) { @@ -81,187 +50,329 @@ int32_t TileBufType::getPadValueI32() const { } // ---- TileBufType custom asm ---- -// !pto.tile_buf<> +// 支持旧格式: +// !pto.tile_buf +// 支持新格式(默认打印): +// !pto.tile_buf Type TileBufType::parse(AsmParser &parser) { MLIRContext *ctx = parser.getContext(); if (failed(parser.parseLess())) return Type(); - std::string locStr; + auto defCfg = TileBufConfigAttr::getDefault(ctx); + + std::optional memorySpace; Type dtype; + bool hasDType = false; int64_t rows = 0, cols = 0; - int64_t vrow = -1, vcol = -1; - std::string blayoutStr, slayoutStr; - int64_t fractal = 0; - uint32_t padInt; + bool hasRows = false, hasCols = false; + int64_t vrow = ShapedType::kDynamic, vcol = ShapedType::kDynamic; + bool hasValid = false; + bool hasVRow = false; + bool hasVCol = false; + BLayout blayout = defCfg.getBLayout().getValue(); + SLayout slayout = defCfg.getSLayout().getValue(); + int64_t fractal = defCfg.getSFractalSize().getInt(); + PadValue pad = defCfg.getPad().getValue(); + + auto parseDim = [&](int64_t &dim) -> LogicalResult { + if (succeeded(parser.parseOptionalQuestion())) { + dim = ShapedType::kDynamic; + return success(); + } + int64_t value = 0; + if (failed(parser.parseInteger(value))) + return failure(); + if (value < 0) { + parser.emitError(parser.getCurrentLocation(), + "dimension must be '?' or a non-negative integer"); + return failure(); + } + dim = value; + return success(); + }; - auto parseKeyEq = [&](StringRef expectedKey) -> LogicalResult { - if (failed(parser.parseKeyword(expectedKey))) + auto parseValidShape = [&]() -> LogicalResult { + SmallVector dims; + if (failed(parser.parseDimensionList(dims, /*allowDynamic=*/true, + /*withTrailingX=*/false))) return failure(); - if (failed(parser.parseEqual())) + if (dims.size() != 2) { + parser.emitError(parser.getCurrentLocation(), + "valid shape expects exactly 2 dimensions"); return failure(); + } + vrow = dims[0]; + vcol = dims[1]; + hasValid = true; + hasVRow = true; + hasVCol = true; return success(); }; - // loc=Vec - { - if (failed(parseKeyEq("loc"))) return Type(); - // Vec/Mat/Acc 不是类型/属性,直接当 keyword/string 读 - if (failed(parser.parseKeywordOrString(&locStr))) return Type(); - if (failed(parser.parseComma())) return Type(); - } + auto setRowsCols = [&](int64_t r, int64_t c) -> LogicalResult { + if ((hasRows && rows != r) || (hasCols && cols != c)) { + parser.emitError(parser.getCurrentLocation(), + "conflicting rows/cols values"); + return failure(); + } + rows = r; + cols = c; + hasRows = true; + hasCols = true; + return success(); + }; - // dtype=f16 - { - if (failed(parseKeyEq("dtype"))) return Type(); - if (failed(parser.parseType(dtype))) return Type(); - if (failed(parser.parseComma())) return Type(); - } + auto setDType = [&](Type t) -> LogicalResult { + if (hasDType && t != dtype) { + parser.emitError(parser.getCurrentLocation(), + "conflicting dtype values"); + return failure(); + } + dtype = t; + hasDType = true; + return success(); + }; - // rows=16 - { - if (failed(parseKeyEq("rows"))) return Type(); - if (failed(parser.parseInteger(rows))) return Type(); - if (failed(parser.parseComma())) return Type(); - } + auto parseLocValue = [&](StringRef locStr) -> LogicalResult { + auto ms = ::llvm::StringSwitch<::std::optional>(locStr) + .Case("mat", AddressSpace::MAT) + .Case("left", AddressSpace::LEFT) + .Case("right", AddressSpace::RIGHT) + .Case("acc", AddressSpace::ACC) + .Case("vec", AddressSpace::VEC) + .Case("bias", AddressSpace::BIAS) + .Case("scaling", AddressSpace::SCALING) + .Default(::std::nullopt); + if (!ms.has_value()) { + parser.emitError(parser.getNameLoc(), "unknown loc: ") << locStr; + return failure(); + } + if (memorySpace.has_value() && memorySpace.value() != ms.value()) { + parser.emitError(parser.getCurrentLocation(), + "conflicting loc values"); + return failure(); + } + memorySpace = ms.value(); + return success(); + }; - // cols=16 - { - if (failed(parseKeyEq("cols"))) return Type(); - if (failed(parser.parseInteger(cols))) return Type(); - if (failed(parser.parseComma())) return Type(); - } - - { - // v_row=?/-1/16 , v_col=?/-1/8 (支持半动态) - if (failed(parseKeyEq("v_row"))) return Type(); + while (true) { + if (succeeded(parser.parseOptionalGreater())) + break; - // 解析 v_row:'?' -> -1,否则整数(允许 -1 兼容) - if (succeeded(parser.parseOptionalQuestion())) { - vrow = -1; - } else { - if (failed(parser.parseInteger(vrow))) return Type(); - if (vrow < -1) { - parser.emitError(parser.getCurrentLocation(), - "v_row must be '?', -1, or a non-negative integer"); + bool parsedClause = false; + // Positional shape: 16x16xf16 + { + int64_t firstDim = 0; + if (succeeded(parser.parseOptionalQuestion())) { + firstDim = ShapedType::kDynamic; + parsedClause = true; + } else { + OptionalParseResult intRes = parser.parseOptionalInteger(firstDim); + if (intRes.has_value()) { + if (failed(*intRes)) return Type(); + parsedClause = true; } + } + if (parsedClause) { + int64_t secondDim = 0; + if (failed(parser.parseXInDimensionList())) + return Type(); + if (failed(parseDim(secondDim))) + return Type(); + if (failed(parser.parseXInDimensionList())) + return Type(); + Type elemTy; + if (failed(parser.parseType(elemTy))) + return Type(); + if (failed(setRowsCols(firstDim, secondDim))) + return Type(); + if (failed(setDType(elemTy))) + return Type(); + } } - if (failed(parser.parseComma())) return Type(); - - if (failed(parseKeyEq("v_col"))) return Type(); - - // 解析 v_col:'?' -> -1,否则整数(允许 -1 兼容) - if (succeeded(parser.parseOptionalQuestion())) { - vcol = -1; - } else { - if (failed(parser.parseInteger(vcol))) return Type(); - if (vcol < -1) { + if (!parsedClause) { + std::string keyOrToken; + if (failed(parser.parseKeywordOrString(&keyOrToken))) + return Type(); + if (succeeded(parser.parseOptionalEqual())) { + if (keyOrToken == "loc") { + std::string locStr; + if (failed(parser.parseKeywordOrString(&locStr))) + return Type(); + if (failed(parseLocValue(locStr))) + return Type(); + } else if (keyOrToken == "dtype") { + Type ty; + if (failed(parser.parseType(ty))) + return Type(); + if (failed(setDType(ty))) + return Type(); + } else if (keyOrToken == "rows") { + int64_t r = 0; + if (failed(parser.parseInteger(r))) + return Type(); + if (r < 0) { parser.emitError(parser.getCurrentLocation(), - "v_col must be '?', -1, or a non-negative integer"); + "rows must be non-negative"); return Type(); + } + if (hasRows && rows != r) { + parser.emitError(parser.getCurrentLocation(), + "conflicting rows values"); + return Type(); + } + rows = r; + hasRows = true; + } else if (keyOrToken == "cols") { + int64_t c = 0; + if (failed(parser.parseInteger(c))) + return Type(); + if (c < 0) { + parser.emitError(parser.getCurrentLocation(), + "cols must be non-negative"); + return Type(); + } + if (hasCols && cols != c) { + parser.emitError(parser.getCurrentLocation(), + "conflicting cols values"); + return Type(); + } + cols = c; + hasCols = true; + } else if (keyOrToken == "v_row") { + int64_t vr = 0; + if (succeeded(parser.parseOptionalQuestion())) { + vr = ShapedType::kDynamic; + } else { + if (failed(parser.parseInteger(vr))) + return Type(); + if (vr < -1) { + parser.emitError(parser.getCurrentLocation(), + "v_row must be '?', -1, or a non-negative integer"); + return Type(); + } + if (vr == -1) + vr = ShapedType::kDynamic; + } + vrow = vr; + hasValid = true; + hasVRow = true; + } else if (keyOrToken == "v_col") { + int64_t vc = 0; + if (succeeded(parser.parseOptionalQuestion())) { + vc = ShapedType::kDynamic; + } else { + if (failed(parser.parseInteger(vc))) + return Type(); + if (vc < -1) { + parser.emitError(parser.getCurrentLocation(), + "v_col must be '?', -1, or a non-negative integer"); + return Type(); + } + if (vc == -1) + vc = ShapedType::kDynamic; + } + vcol = vc; + hasValid = true; + hasVCol = true; + } else if (keyOrToken == "valid") { + if (failed(parseValidShape())) + return Type(); + } else if (keyOrToken == "blayout") { + std::string blayoutStr; + if (failed(parser.parseKeywordOrString(&blayoutStr))) + return Type(); + auto bl = symbolizeBLayout(blayoutStr); + if (!bl.has_value()) { + parser.emitError(parser.getNameLoc(), "unknown blayout: ") + << blayoutStr; + return Type(); + } + blayout = bl.value(); + } else if (keyOrToken == "slayout") { + std::string slayoutStr; + if (failed(parser.parseKeywordOrString(&slayoutStr))) + return Type(); + auto sl = symbolizeSLayout(slayoutStr); + if (!sl.has_value()) { + parser.emitError(parser.getNameLoc(), "unknown slayout: ") + << slayoutStr; + return Type(); + } + slayout = sl.value(); + } else if (keyOrToken == "fractal") { + if (failed(parser.parseInteger(fractal))) + return Type(); + } else if (keyOrToken == "pad") { + uint32_t padInt = 0; + if (failed(parser.parseInteger(padInt))) + return Type(); + auto pv = symbolizePadValue(padInt); + if (!pv.has_value()) { + parser.emitError(parser.getNameLoc(), "unknown pad: ") << padInt; + return Type(); + } + pad = pv.value(); + } else { + parser.emitError(parser.getNameLoc(), "unknown key in tile_buf: ") + << keyOrToken; + return Type(); } + } else { + if (failed(parseLocValue(keyOrToken))) + return Type(); + } } - if (failed(parser.parseComma())) return Type(); - } - - // blayout=RowMajor - { - if (failed(parseKeyEq("blayout"))) return Type(); - if (failed(parser.parseKeywordOrString(&blayoutStr))) return Type(); - if (failed(parser.parseComma())) return Type(); - } - - - // slayout=NoneBox - { - if (failed(parseKeyEq("slayout"))) return Type(); - if (failed(parser.parseKeywordOrString(&slayoutStr))) return Type(); - if (failed(parser.parseComma())) return Type(); - } - - // fractal=512 - { - if (failed(parseKeyEq("fractal"))) return Type(); - if (failed(parser.parseInteger(fractal))) return Type(); - if (failed(parser.parseComma())) return Type(); - } - - // pad=Null - { - if (failed(parseKeyEq("pad"))) return Type(); - if (failed(parser.parseInteger(padInt))) return Type(); - } - if (failed(parser.parseGreater())) - return Type(); - - // -------- 语义校验/构造 -------- - if (rows < 0 || cols < 0) { - parser.emitError(parser.getNameLoc(), "rows/cols must be non-negative"); - return Type(); + if (succeeded(parser.parseOptionalGreater())) + break; + if (failed(parser.parseComma())) + return Type(); } - auto memorySpace = ::llvm::StringSwitch<::std::optional>(locStr) - .Case("mat", AddressSpace::MAT) - .Case("left", AddressSpace::LEFT) - .Case("right", AddressSpace::RIGHT) - .Case("acc", AddressSpace::ACC) - .Case("vec", AddressSpace::VEC) - .Case("bias", AddressSpace::BIAS) - .Case("scaling", AddressSpace::SCALING) - .Default(::std::nullopt); if (!memorySpace.has_value()) { - parser.emitError(parser.getNameLoc(), "unknown loc: ") << locStr; + parser.emitError(parser.getNameLoc(), "missing loc"); return Type(); } - - auto bl = symbolizeBLayout(blayoutStr); - auto sl = symbolizeSLayout(slayoutStr); - auto pv = symbolizePadValue(padInt); - if (!bl.has_value()) { - parser.emitError(parser.getNameLoc(), "unknown blayout: ") << blayoutStr; + if (!hasDType) { + parser.emitError(parser.getNameLoc(), "missing dtype"); return Type(); } - if (!sl.has_value()) { - parser.emitError(parser.getNameLoc(), "unknown slayout: ") << slayoutStr; + if (!(hasRows && hasCols)) { + parser.emitError(parser.getNameLoc(), "missing rows/cols"); return Type(); } - if (!pv.has_value()) { - parser.emitError(parser.getNameLoc(), "unknown pad: ") << padInt; + if (!hasValid) { + vrow = rows; + vcol = cols; + } else if (hasVRow != hasVCol) { + parser.emitError(parser.getNameLoc(), + "v_row and v_col must be provided together"); return Type(); } - - BLayout effectiveBLayout = bl.value(); - if (memorySpace.value() == AddressSpace::LEFT) { - switch (getPTOParserTargetArch()) { - case PTOParserTargetArch::A3: - effectiveBLayout = BLayout::RowMajor; - break; - case PTOParserTargetArch::A5: - effectiveBLayout = BLayout::ColMajor; - break; - case PTOParserTargetArch::Unspecified: - break; - } + if (rows < 0 || cols < 0) { + parser.emitError(parser.getNameLoc(), "rows/cols must be non-negative"); + return Type(); } - auto blAttr = BLayoutAttr::get(ctx, effectiveBLayout); - auto slAttr = SLayoutAttr::get(ctx, sl.value()); + // -------- 语义校验/构造 -------- + auto blAttr = BLayoutAttr::get(ctx, blayout); + auto slAttr = SLayoutAttr::get(ctx, slayout); auto fractalAttr = IntegerAttr::get(IntegerType::get(ctx, 32), fractal); - auto padAttr = PadValueAttr::get(ctx, pv.value()); + auto padAttr = PadValueAttr::get(ctx, pad); auto memorySpaceAttr = AddressSpaceAttr::get(ctx, memorySpace.value()); auto cfg = TileBufConfigAttr::get(ctx, blAttr, slAttr, fractalAttr, padAttr); SmallVector shape{rows, cols}; SmallVector validShape{vrow, vcol}; - auto canonicalValidShape = canonicalizeTileBufValidShape(validShape); - return TileBufType::get(ctx, shape, dtype, memorySpaceAttr, - llvm::ArrayRef(canonicalValidShape), cfg); + return TileBufType::get(ctx, shape, dtype, memorySpaceAttr, llvm::ArrayRef(validShape), cfg); } static llvm::StringRef stringifyLocFromMemorySpace(mlir::Attribute memorySpace) { @@ -294,43 +405,52 @@ static llvm::StringRef stringifyLocFromPad(mlir::Attribute pad) { void mlir::pto::TileBufType::print(mlir::AsmPrinter &printer) const { auto shape = getShape(); - int64_t rows = shape.size() > 0 ? shape[0] : 0; - int64_t cols = shape.size() > 1 ? shape[1] : 0; + int64_t rows = shape.size() > 0 ? shape[0] : ShapedType::kDynamic; + int64_t cols = shape.size() > 1 ? shape[1] : ShapedType::kDynamic; auto cfg = getConfigAttr(); if (!cfg) cfg = mlir::pto::TileBufConfigAttr::getDefault(getContext()); + auto defCfg = mlir::pto::TileBufConfigAttr::getDefault(getContext()); llvm::StringRef locStr = stringifyLocFromMemorySpace(getMemorySpace()); - printer << "<" - << "loc=" << locStr - << ", dtype="; + printer << "<" << locStr << ", "; + auto printDim = [&](int64_t dim) { + if (dim < 0) + printer << "?"; + else + printer << dim; + }; + printDim(rows); + printer << "x"; + printDim(cols); + printer << "x"; printer.printType(getElementType()); - auto blayout = llvm::dyn_cast(cfg.getBLayout()); - auto slayout = llvm::dyn_cast(cfg.getSLayout()); - auto vs = getValidShape(); // ArrayRef int64_t vrow = rows; int64_t vcol = cols; - if (vs.size() >= 2) { - vrow = vs[0]; - vcol = vs[1]; + vrow = vs[0]; + vcol = vs[1]; + } + if (!(vrow == rows && vcol == cols)) { + printer << ", valid="; + printDim(vrow); + printer << "x"; + printDim(vcol); } - printer << ", rows=" << rows - << ", cols=" << cols; - printer << ", v_row="; - if (vrow < 0) printer << "?"; - else printer << vrow; - - printer << ", v_col="; - if (vcol < 0) printer << "?"; - else printer << vcol; - - printer << ", blayout=" << stringifyBLayout(blayout.getValue()) - << ", slayout=" << stringifySLayout(slayout.getValue()) - << ", fractal=" << cfg.getSFractalSize().getInt() - << ", pad=" << stringifyLocFromPad(cfg.getPad()) - << ">"; + + auto blayout = llvm::dyn_cast(cfg.getBLayout()); + auto slayout = llvm::dyn_cast(cfg.getSLayout()); + if (cfg.getBLayout() != defCfg.getBLayout()) + printer << ", blayout=" << stringifyBLayout(blayout.getValue()); + if (cfg.getSLayout() != defCfg.getSLayout()) + printer << ", slayout=" << stringifySLayout(slayout.getValue()); + if (cfg.getSFractalSize() != defCfg.getSFractalSize()) + printer << ", fractal=" << cfg.getSFractalSize().getInt(); + if (cfg.getPad() != defCfg.getPad()) + printer << ", pad=" << stringifyLocFromPad(cfg.getPad()); + + printer << ">"; } diff --git a/test/basic/tilebuf_asm_compact.mlir b/test/basic/tilebuf_asm_compact.mlir new file mode 100644 index 00000000..d59a2c26 --- /dev/null +++ b/test/basic/tilebuf_asm_compact.mlir @@ -0,0 +1,26 @@ +// RUN: ptoas --print-ir-after-all --print-ir-after-all-func-filter=tilebuf_asm --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm( + %arg0: !pto.tile_buf, + %arg1: !pto.tile_buf) { + return + } + + func.func @tilebuf_asm_dynamic( + %arg0: !pto.tile_buf, + %arg1: !pto.tile_buf) { + return + } +} + +// CHECK: func.func @tilebuf_asm +// CHECK: !pto.tile_buf +// CHECK: !pto.tile_buf + +// CHECK: func.func @tilebuf_asm_dynamic +// CHECK: !pto.tile_buf +// CHECK: !pto.tile_buf diff --git a/test/basic/tilebuf_asm_error_cols_negative.mlir b/test/basic/tilebuf_asm_error_cols_negative.mlir new file mode 100644 index 00000000..d98a23dd --- /dev/null +++ b/test/basic/tilebuf_asm_error_cols_negative.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_cols_negative( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: cols must be non-negative diff --git a/test/basic/tilebuf_asm_error_conflicting_cols.mlir b/test/basic/tilebuf_asm_error_conflicting_cols.mlir new file mode 100644 index 00000000..e1b36566 --- /dev/null +++ b/test/basic/tilebuf_asm_error_conflicting_cols.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_conflicting_cols( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: conflicting cols values diff --git a/test/basic/tilebuf_asm_error_conflicting_dtype.mlir b/test/basic/tilebuf_asm_error_conflicting_dtype.mlir new file mode 100644 index 00000000..829cd4c5 --- /dev/null +++ b/test/basic/tilebuf_asm_error_conflicting_dtype.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_conflicting_dtype( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: conflicting dtype values diff --git a/test/basic/tilebuf_asm_error_conflicting_loc.mlir b/test/basic/tilebuf_asm_error_conflicting_loc.mlir new file mode 100644 index 00000000..9aa145fd --- /dev/null +++ b/test/basic/tilebuf_asm_error_conflicting_loc.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_conflicting_loc( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: conflicting loc values diff --git a/test/basic/tilebuf_asm_error_conflicting_positional_dtype.mlir b/test/basic/tilebuf_asm_error_conflicting_positional_dtype.mlir new file mode 100644 index 00000000..6061805c --- /dev/null +++ b/test/basic/tilebuf_asm_error_conflicting_positional_dtype.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_conflicting_positional_dtype( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: conflicting dtype values diff --git a/test/basic/tilebuf_asm_error_conflicting_positional_shape.mlir b/test/basic/tilebuf_asm_error_conflicting_positional_shape.mlir new file mode 100644 index 00000000..999c392a --- /dev/null +++ b/test/basic/tilebuf_asm_error_conflicting_positional_shape.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_conflicting_positional_shape( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: conflicting rows/cols values diff --git a/test/basic/tilebuf_asm_error_conflicting_rows.mlir b/test/basic/tilebuf_asm_error_conflicting_rows.mlir new file mode 100644 index 00000000..0edc6134 --- /dev/null +++ b/test/basic/tilebuf_asm_error_conflicting_rows.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_conflicting_rows( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: conflicting rows values diff --git a/test/basic/tilebuf_asm_error_invalid_blayout.mlir b/test/basic/tilebuf_asm_error_invalid_blayout.mlir new file mode 100644 index 00000000..592422d9 --- /dev/null +++ b/test/basic/tilebuf_asm_error_invalid_blayout.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_invalid_blayout( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: unknown blayout: bad diff --git a/test/basic/tilebuf_asm_error_invalid_dim_negative.mlir b/test/basic/tilebuf_asm_error_invalid_dim_negative.mlir new file mode 100644 index 00000000..838ba4ef --- /dev/null +++ b/test/basic/tilebuf_asm_error_invalid_dim_negative.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_invalid_dim_negative( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: rows/cols must be non-negative diff --git a/test/basic/tilebuf_asm_error_invalid_dim_question.mlir b/test/basic/tilebuf_asm_error_invalid_dim_question.mlir new file mode 100644 index 00000000..349e44ee --- /dev/null +++ b/test/basic/tilebuf_asm_error_invalid_dim_question.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_invalid_dim_question( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: conflicting rows values diff --git a/test/basic/tilebuf_asm_error_invalid_dim_second_negative.mlir b/test/basic/tilebuf_asm_error_invalid_dim_second_negative.mlir new file mode 100644 index 00000000..b6a4b32c --- /dev/null +++ b/test/basic/tilebuf_asm_error_invalid_dim_second_negative.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_invalid_dim_second_negative( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: dimension must be '?' or a non-negative integer diff --git a/test/basic/tilebuf_asm_error_invalid_fractal.mlir b/test/basic/tilebuf_asm_error_invalid_fractal.mlir new file mode 100644 index 00000000..8dcffb5e --- /dev/null +++ b/test/basic/tilebuf_asm_error_invalid_fractal.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_invalid_fractal( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: unsupported s_fractal_size: 7 diff --git a/test/basic/tilebuf_asm_error_invalid_pad.mlir b/test/basic/tilebuf_asm_error_invalid_pad.mlir new file mode 100644 index 00000000..fbe593a6 --- /dev/null +++ b/test/basic/tilebuf_asm_error_invalid_pad.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_invalid_pad( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: unknown pad: 9 diff --git a/test/basic/tilebuf_asm_error_invalid_slayout.mlir b/test/basic/tilebuf_asm_error_invalid_slayout.mlir new file mode 100644 index 00000000..1ed9de44 --- /dev/null +++ b/test/basic/tilebuf_asm_error_invalid_slayout.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_invalid_slayout( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: unknown slayout: bad diff --git a/test/basic/tilebuf_asm_error_invalid_valid_neg.mlir b/test/basic/tilebuf_asm_error_invalid_valid_neg.mlir new file mode 100644 index 00000000..54f8ce0e --- /dev/null +++ b/test/basic/tilebuf_asm_error_invalid_valid_neg.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_invalid_valid_neg( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: valid shape expects exactly 2 dimensions diff --git a/test/basic/tilebuf_asm_error_invalid_vcol_value.mlir b/test/basic/tilebuf_asm_error_invalid_vcol_value.mlir new file mode 100644 index 00000000..290e8de2 --- /dev/null +++ b/test/basic/tilebuf_asm_error_invalid_vcol_value.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_invalid_vcol_value( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: v_col must be '?', -1, or a non-negative integer diff --git a/test/basic/tilebuf_asm_error_invalid_vrow_value.mlir b/test/basic/tilebuf_asm_error_invalid_vrow_value.mlir new file mode 100644 index 00000000..f2add3ab --- /dev/null +++ b/test/basic/tilebuf_asm_error_invalid_vrow_value.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_invalid_vrow_value( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: v_row must be '?', -1, or a non-negative integer diff --git a/test/basic/tilebuf_asm_error_missing_dtype.mlir b/test/basic/tilebuf_asm_error_missing_dtype.mlir new file mode 100644 index 00000000..54bf0df7 --- /dev/null +++ b/test/basic/tilebuf_asm_error_missing_dtype.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_missing_dtype( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: missing dtype diff --git a/test/basic/tilebuf_asm_error_missing_loc.mlir b/test/basic/tilebuf_asm_error_missing_loc.mlir new file mode 100644 index 00000000..146d539d --- /dev/null +++ b/test/basic/tilebuf_asm_error_missing_loc.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_missing_loc( + %arg0: !pto.tile_buf<1x16xf32>) { + return + } +} + +// CHECK: error: missing loc diff --git a/test/basic/tilebuf_asm_error_missing_rows_cols.mlir b/test/basic/tilebuf_asm_error_missing_rows_cols.mlir new file mode 100644 index 00000000..f28acb60 --- /dev/null +++ b/test/basic/tilebuf_asm_error_missing_rows_cols.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_missing_rows_cols( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: missing rows/cols diff --git a/test/basic/tilebuf_asm_error_pad_nonint.mlir b/test/basic/tilebuf_asm_error_pad_nonint.mlir new file mode 100644 index 00000000..24e840a0 --- /dev/null +++ b/test/basic/tilebuf_asm_error_pad_nonint.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_pad_nonint( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: expected integer diff --git a/test/basic/tilebuf_asm_error_rows_negative.mlir b/test/basic/tilebuf_asm_error_rows_negative.mlir new file mode 100644 index 00000000..96c9d424 --- /dev/null +++ b/test/basic/tilebuf_asm_error_rows_negative.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_rows_negative( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: rows must be non-negative diff --git a/test/basic/tilebuf_asm_error_unknown_key.mlir b/test/basic/tilebuf_asm_error_unknown_key.mlir new file mode 100644 index 00000000..844e39f1 --- /dev/null +++ b/test/basic/tilebuf_asm_error_unknown_key.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_unknown_key( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: unknown key in tile_buf: foo diff --git a/test/basic/tilebuf_asm_error_unknown_loc.mlir b/test/basic/tilebuf_asm_error_unknown_loc.mlir new file mode 100644 index 00000000..10da613e --- /dev/null +++ b/test/basic/tilebuf_asm_error_unknown_loc.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_unknown_loc( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: unknown loc: foo diff --git a/test/basic/tilebuf_asm_error_valid_rank.mlir b/test/basic/tilebuf_asm_error_valid_rank.mlir new file mode 100644 index 00000000..4403cf8c --- /dev/null +++ b/test/basic/tilebuf_asm_error_valid_rank.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_invalid_valid_rank( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: valid shape expects exactly 2 dimensions diff --git a/test/basic/tilebuf_asm_error_vcol_only.mlir b/test/basic/tilebuf_asm_error_vcol_only.mlir new file mode 100644 index 00000000..67717fc3 --- /dev/null +++ b/test/basic/tilebuf_asm_error_vcol_only.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_vcol_only( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: v_row and v_col must be provided together diff --git a/test/basic/tilebuf_asm_error_vrow_only.mlir b/test/basic/tilebuf_asm_error_vrow_only.mlir new file mode 100644 index 00000000..bbbfae26 --- /dev/null +++ b/test/basic/tilebuf_asm_error_vrow_only.mlir @@ -0,0 +1,10 @@ +// RUN: ptoas --pto-level=level3 %s 2>&1 1>/dev/null | FileCheck %s + +module { + func.func @tilebuf_asm_vrow_only( + %arg0: !pto.tile_buf) { + return + } +} + +// CHECK: error: v_row and v_col must be provided together From 84f32497fffbd73a85a468bcb6e95c3b63952b4b Mon Sep 17 00:00:00 2001 From: PTOAS Date: Sat, 28 Mar 2026 16:55:58 +0800 Subject: [PATCH 2/3] test: switch tilebuf asm tests to .pto --- test/basic/{tilebuf_asm_compact.mlir => tilebuf_asm_compact.pto} | 0 ...ror_cols_negative.mlir => tilebuf_asm_error_cols_negative.pto} | 0 ...nflicting_cols.mlir => tilebuf_asm_error_conflicting_cols.pto} | 0 ...licting_dtype.mlir => tilebuf_asm_error_conflicting_dtype.pto} | 0 ...conflicting_loc.mlir => tilebuf_asm_error_conflicting_loc.pto} | 0 ...pe.mlir => tilebuf_asm_error_conflicting_positional_dtype.pto} | 0 ...pe.mlir => tilebuf_asm_error_conflicting_positional_shape.pto} | 0 ...nflicting_rows.mlir => tilebuf_asm_error_conflicting_rows.pto} | 0 ...invalid_blayout.mlir => tilebuf_asm_error_invalid_blayout.pto} | 0 ...m_negative.mlir => tilebuf_asm_error_invalid_dim_negative.pto} | 0 ...m_question.mlir => tilebuf_asm_error_invalid_dim_question.pto} | 0 ...ive.mlir => tilebuf_asm_error_invalid_dim_second_negative.pto} | 0 ...invalid_fractal.mlir => tilebuf_asm_error_invalid_fractal.pto} | 0 ...m_error_invalid_pad.mlir => tilebuf_asm_error_invalid_pad.pto} | 0 ...invalid_slayout.mlir => tilebuf_asm_error_invalid_slayout.pto} | 0 ...lid_valid_neg.mlir => tilebuf_asm_error_invalid_valid_neg.pto} | 0 ...d_vcol_value.mlir => tilebuf_asm_error_invalid_vcol_value.pto} | 0 ...d_vrow_value.mlir => tilebuf_asm_error_invalid_vrow_value.pto} | 0 ...ror_missing_dtype.mlir => tilebuf_asm_error_missing_dtype.pto} | 0 ...m_error_missing_loc.mlir => tilebuf_asm_error_missing_loc.pto} | 0 ...ing_rows_cols.mlir => tilebuf_asm_error_missing_rows_cols.pto} | 0 ...asm_error_pad_nonint.mlir => tilebuf_asm_error_pad_nonint.pto} | 0 ...ror_rows_negative.mlir => tilebuf_asm_error_rows_negative.pto} | 0 ...m_error_unknown_key.mlir => tilebuf_asm_error_unknown_key.pto} | 0 ...m_error_unknown_loc.mlir => tilebuf_asm_error_unknown_loc.pto} | 0 ...asm_error_valid_rank.mlir => tilebuf_asm_error_valid_rank.pto} | 0 ...f_asm_error_vcol_only.mlir => tilebuf_asm_error_vcol_only.pto} | 0 ...f_asm_error_vrow_only.mlir => tilebuf_asm_error_vrow_only.pto} | 0 28 files changed, 0 insertions(+), 0 deletions(-) rename test/basic/{tilebuf_asm_compact.mlir => tilebuf_asm_compact.pto} (100%) rename test/basic/{tilebuf_asm_error_cols_negative.mlir => tilebuf_asm_error_cols_negative.pto} (100%) rename test/basic/{tilebuf_asm_error_conflicting_cols.mlir => tilebuf_asm_error_conflicting_cols.pto} (100%) rename test/basic/{tilebuf_asm_error_conflicting_dtype.mlir => tilebuf_asm_error_conflicting_dtype.pto} (100%) rename test/basic/{tilebuf_asm_error_conflicting_loc.mlir => tilebuf_asm_error_conflicting_loc.pto} (100%) rename test/basic/{tilebuf_asm_error_conflicting_positional_dtype.mlir => tilebuf_asm_error_conflicting_positional_dtype.pto} (100%) rename test/basic/{tilebuf_asm_error_conflicting_positional_shape.mlir => tilebuf_asm_error_conflicting_positional_shape.pto} (100%) rename test/basic/{tilebuf_asm_error_conflicting_rows.mlir => tilebuf_asm_error_conflicting_rows.pto} (100%) rename test/basic/{tilebuf_asm_error_invalid_blayout.mlir => tilebuf_asm_error_invalid_blayout.pto} (100%) rename test/basic/{tilebuf_asm_error_invalid_dim_negative.mlir => tilebuf_asm_error_invalid_dim_negative.pto} (100%) rename test/basic/{tilebuf_asm_error_invalid_dim_question.mlir => tilebuf_asm_error_invalid_dim_question.pto} (100%) rename test/basic/{tilebuf_asm_error_invalid_dim_second_negative.mlir => tilebuf_asm_error_invalid_dim_second_negative.pto} (100%) rename test/basic/{tilebuf_asm_error_invalid_fractal.mlir => tilebuf_asm_error_invalid_fractal.pto} (100%) rename test/basic/{tilebuf_asm_error_invalid_pad.mlir => tilebuf_asm_error_invalid_pad.pto} (100%) rename test/basic/{tilebuf_asm_error_invalid_slayout.mlir => tilebuf_asm_error_invalid_slayout.pto} (100%) rename test/basic/{tilebuf_asm_error_invalid_valid_neg.mlir => tilebuf_asm_error_invalid_valid_neg.pto} (100%) rename test/basic/{tilebuf_asm_error_invalid_vcol_value.mlir => tilebuf_asm_error_invalid_vcol_value.pto} (100%) rename test/basic/{tilebuf_asm_error_invalid_vrow_value.mlir => tilebuf_asm_error_invalid_vrow_value.pto} (100%) rename test/basic/{tilebuf_asm_error_missing_dtype.mlir => tilebuf_asm_error_missing_dtype.pto} (100%) rename test/basic/{tilebuf_asm_error_missing_loc.mlir => tilebuf_asm_error_missing_loc.pto} (100%) rename test/basic/{tilebuf_asm_error_missing_rows_cols.mlir => tilebuf_asm_error_missing_rows_cols.pto} (100%) rename test/basic/{tilebuf_asm_error_pad_nonint.mlir => tilebuf_asm_error_pad_nonint.pto} (100%) rename test/basic/{tilebuf_asm_error_rows_negative.mlir => tilebuf_asm_error_rows_negative.pto} (100%) rename test/basic/{tilebuf_asm_error_unknown_key.mlir => tilebuf_asm_error_unknown_key.pto} (100%) rename test/basic/{tilebuf_asm_error_unknown_loc.mlir => tilebuf_asm_error_unknown_loc.pto} (100%) rename test/basic/{tilebuf_asm_error_valid_rank.mlir => tilebuf_asm_error_valid_rank.pto} (100%) rename test/basic/{tilebuf_asm_error_vcol_only.mlir => tilebuf_asm_error_vcol_only.pto} (100%) rename test/basic/{tilebuf_asm_error_vrow_only.mlir => tilebuf_asm_error_vrow_only.pto} (100%) diff --git a/test/basic/tilebuf_asm_compact.mlir b/test/basic/tilebuf_asm_compact.pto similarity index 100% rename from test/basic/tilebuf_asm_compact.mlir rename to test/basic/tilebuf_asm_compact.pto diff --git a/test/basic/tilebuf_asm_error_cols_negative.mlir b/test/basic/tilebuf_asm_error_cols_negative.pto similarity index 100% rename from test/basic/tilebuf_asm_error_cols_negative.mlir rename to test/basic/tilebuf_asm_error_cols_negative.pto diff --git a/test/basic/tilebuf_asm_error_conflicting_cols.mlir b/test/basic/tilebuf_asm_error_conflicting_cols.pto similarity index 100% rename from test/basic/tilebuf_asm_error_conflicting_cols.mlir rename to test/basic/tilebuf_asm_error_conflicting_cols.pto diff --git a/test/basic/tilebuf_asm_error_conflicting_dtype.mlir b/test/basic/tilebuf_asm_error_conflicting_dtype.pto similarity index 100% rename from test/basic/tilebuf_asm_error_conflicting_dtype.mlir rename to test/basic/tilebuf_asm_error_conflicting_dtype.pto diff --git a/test/basic/tilebuf_asm_error_conflicting_loc.mlir b/test/basic/tilebuf_asm_error_conflicting_loc.pto similarity index 100% rename from test/basic/tilebuf_asm_error_conflicting_loc.mlir rename to test/basic/tilebuf_asm_error_conflicting_loc.pto diff --git a/test/basic/tilebuf_asm_error_conflicting_positional_dtype.mlir b/test/basic/tilebuf_asm_error_conflicting_positional_dtype.pto similarity index 100% rename from test/basic/tilebuf_asm_error_conflicting_positional_dtype.mlir rename to test/basic/tilebuf_asm_error_conflicting_positional_dtype.pto diff --git a/test/basic/tilebuf_asm_error_conflicting_positional_shape.mlir b/test/basic/tilebuf_asm_error_conflicting_positional_shape.pto similarity index 100% rename from test/basic/tilebuf_asm_error_conflicting_positional_shape.mlir rename to test/basic/tilebuf_asm_error_conflicting_positional_shape.pto diff --git a/test/basic/tilebuf_asm_error_conflicting_rows.mlir b/test/basic/tilebuf_asm_error_conflicting_rows.pto similarity index 100% rename from test/basic/tilebuf_asm_error_conflicting_rows.mlir rename to test/basic/tilebuf_asm_error_conflicting_rows.pto diff --git a/test/basic/tilebuf_asm_error_invalid_blayout.mlir b/test/basic/tilebuf_asm_error_invalid_blayout.pto similarity index 100% rename from test/basic/tilebuf_asm_error_invalid_blayout.mlir rename to test/basic/tilebuf_asm_error_invalid_blayout.pto diff --git a/test/basic/tilebuf_asm_error_invalid_dim_negative.mlir b/test/basic/tilebuf_asm_error_invalid_dim_negative.pto similarity index 100% rename from test/basic/tilebuf_asm_error_invalid_dim_negative.mlir rename to test/basic/tilebuf_asm_error_invalid_dim_negative.pto diff --git a/test/basic/tilebuf_asm_error_invalid_dim_question.mlir b/test/basic/tilebuf_asm_error_invalid_dim_question.pto similarity index 100% rename from test/basic/tilebuf_asm_error_invalid_dim_question.mlir rename to test/basic/tilebuf_asm_error_invalid_dim_question.pto diff --git a/test/basic/tilebuf_asm_error_invalid_dim_second_negative.mlir b/test/basic/tilebuf_asm_error_invalid_dim_second_negative.pto similarity index 100% rename from test/basic/tilebuf_asm_error_invalid_dim_second_negative.mlir rename to test/basic/tilebuf_asm_error_invalid_dim_second_negative.pto diff --git a/test/basic/tilebuf_asm_error_invalid_fractal.mlir b/test/basic/tilebuf_asm_error_invalid_fractal.pto similarity index 100% rename from test/basic/tilebuf_asm_error_invalid_fractal.mlir rename to test/basic/tilebuf_asm_error_invalid_fractal.pto diff --git a/test/basic/tilebuf_asm_error_invalid_pad.mlir b/test/basic/tilebuf_asm_error_invalid_pad.pto similarity index 100% rename from test/basic/tilebuf_asm_error_invalid_pad.mlir rename to test/basic/tilebuf_asm_error_invalid_pad.pto diff --git a/test/basic/tilebuf_asm_error_invalid_slayout.mlir b/test/basic/tilebuf_asm_error_invalid_slayout.pto similarity index 100% rename from test/basic/tilebuf_asm_error_invalid_slayout.mlir rename to test/basic/tilebuf_asm_error_invalid_slayout.pto diff --git a/test/basic/tilebuf_asm_error_invalid_valid_neg.mlir b/test/basic/tilebuf_asm_error_invalid_valid_neg.pto similarity index 100% rename from test/basic/tilebuf_asm_error_invalid_valid_neg.mlir rename to test/basic/tilebuf_asm_error_invalid_valid_neg.pto diff --git a/test/basic/tilebuf_asm_error_invalid_vcol_value.mlir b/test/basic/tilebuf_asm_error_invalid_vcol_value.pto similarity index 100% rename from test/basic/tilebuf_asm_error_invalid_vcol_value.mlir rename to test/basic/tilebuf_asm_error_invalid_vcol_value.pto diff --git a/test/basic/tilebuf_asm_error_invalid_vrow_value.mlir b/test/basic/tilebuf_asm_error_invalid_vrow_value.pto similarity index 100% rename from test/basic/tilebuf_asm_error_invalid_vrow_value.mlir rename to test/basic/tilebuf_asm_error_invalid_vrow_value.pto diff --git a/test/basic/tilebuf_asm_error_missing_dtype.mlir b/test/basic/tilebuf_asm_error_missing_dtype.pto similarity index 100% rename from test/basic/tilebuf_asm_error_missing_dtype.mlir rename to test/basic/tilebuf_asm_error_missing_dtype.pto diff --git a/test/basic/tilebuf_asm_error_missing_loc.mlir b/test/basic/tilebuf_asm_error_missing_loc.pto similarity index 100% rename from test/basic/tilebuf_asm_error_missing_loc.mlir rename to test/basic/tilebuf_asm_error_missing_loc.pto diff --git a/test/basic/tilebuf_asm_error_missing_rows_cols.mlir b/test/basic/tilebuf_asm_error_missing_rows_cols.pto similarity index 100% rename from test/basic/tilebuf_asm_error_missing_rows_cols.mlir rename to test/basic/tilebuf_asm_error_missing_rows_cols.pto diff --git a/test/basic/tilebuf_asm_error_pad_nonint.mlir b/test/basic/tilebuf_asm_error_pad_nonint.pto similarity index 100% rename from test/basic/tilebuf_asm_error_pad_nonint.mlir rename to test/basic/tilebuf_asm_error_pad_nonint.pto diff --git a/test/basic/tilebuf_asm_error_rows_negative.mlir b/test/basic/tilebuf_asm_error_rows_negative.pto similarity index 100% rename from test/basic/tilebuf_asm_error_rows_negative.mlir rename to test/basic/tilebuf_asm_error_rows_negative.pto diff --git a/test/basic/tilebuf_asm_error_unknown_key.mlir b/test/basic/tilebuf_asm_error_unknown_key.pto similarity index 100% rename from test/basic/tilebuf_asm_error_unknown_key.mlir rename to test/basic/tilebuf_asm_error_unknown_key.pto diff --git a/test/basic/tilebuf_asm_error_unknown_loc.mlir b/test/basic/tilebuf_asm_error_unknown_loc.pto similarity index 100% rename from test/basic/tilebuf_asm_error_unknown_loc.mlir rename to test/basic/tilebuf_asm_error_unknown_loc.pto diff --git a/test/basic/tilebuf_asm_error_valid_rank.mlir b/test/basic/tilebuf_asm_error_valid_rank.pto similarity index 100% rename from test/basic/tilebuf_asm_error_valid_rank.mlir rename to test/basic/tilebuf_asm_error_valid_rank.pto diff --git a/test/basic/tilebuf_asm_error_vcol_only.mlir b/test/basic/tilebuf_asm_error_vcol_only.pto similarity index 100% rename from test/basic/tilebuf_asm_error_vcol_only.mlir rename to test/basic/tilebuf_asm_error_vcol_only.pto diff --git a/test/basic/tilebuf_asm_error_vrow_only.mlir b/test/basic/tilebuf_asm_error_vrow_only.pto similarity index 100% rename from test/basic/tilebuf_asm_error_vrow_only.mlir rename to test/basic/tilebuf_asm_error_vrow_only.pto From ba852939951ea94723b3fbc6635905a3c4b17da8 Mon Sep 17 00:00:00 2001 From: PTOAS Date: Sat, 28 Mar 2026 17:09:49 +0800 Subject: [PATCH 3/3] Fix missing PTO parser arch symbols --- lib/PTO/IR/PTOTypeDefs.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/PTO/IR/PTOTypeDefs.cpp b/lib/PTO/IR/PTOTypeDefs.cpp index 4190e3c7..6d5cb22f 100644 --- a/lib/PTO/IR/PTOTypeDefs.cpp +++ b/lib/PTO/IR/PTOTypeDefs.cpp @@ -5,6 +5,29 @@ using namespace mlir; using namespace mlir::pto; +namespace { +thread_local PTOParserTargetArch currentParserTargetArch = + PTOParserTargetArch::Unspecified; +} + +void mlir::pto::setPTOParserTargetArch(PTOParserTargetArch arch) { + currentParserTargetArch = arch; +} + +PTOParserTargetArch mlir::pto::getPTOParserTargetArch() { + return currentParserTargetArch; +} + +mlir::pto::ScopedPTOParserTargetArch::ScopedPTOParserTargetArch( + PTOParserTargetArch arch) + : previousArch(getPTOParserTargetArch()) { + setPTOParserTargetArch(arch); +} + +mlir::pto::ScopedPTOParserTargetArch::~ScopedPTOParserTargetArch() { + setPTOParserTargetArch(previousArch); +} + TileBufConfigAttr TileBufType::getConfigAttr() const { // 情况 A:getConfig() 已经是 TileBufConfigAttr if constexpr (std::is_same_v) {