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
12 changes: 6 additions & 6 deletions lib/Bindings/Python/PTOModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
// 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.

// 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.

//===- DialectPTO.cpp -----------------------------------------------------===//
//
// Python bindings for the PTO dialect types (pybind11 version).
Expand Down Expand Up @@ -52,7 +47,8 @@ void populatePTODialectSubmodule(pybind11::module &m);
void populatePTODialectSubmodule(pybind11::module &m) {
(void)m;
}
PYBIND11_MODULE(_pto, m) {

static void bindPTOModule(pybind11::module &m) {
m.doc() = "PTO dialect Python bindings (pybind11).";

// --------------------------------------------------------------------------
Expand Down Expand Up @@ -744,3 +740,7 @@ PYBIND11_MODULE(_pto, m) {

populatePTODialectSubmodule(m);
}

PYBIND11_MODULE(_pto, m) {
bindPTOModule(m);
}
12 changes: 8 additions & 4 deletions lib/PTO/IR/PTO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "llvm/Support/ErrorHandling.h"

#include <algorithm>
#include <numeric>
Expand Down Expand Up @@ -1205,9 +1206,11 @@ void PTODialect::initialize() {

AddressSpaceAttr mlir::pto::getPTOAddressSpaceAttr(Type type) {
auto memRefType = dyn_cast<BaseMemRefType>(type);
assert(memRefType && "input type must be a memref type");
if (!memRefType)
return {};
auto scopeAttr = dyn_cast<AddressSpaceAttr>(memRefType.getMemorySpace());
assert(scopeAttr && "memory scope should be a pto address scope");
if (!scopeAttr)
return {};
return scopeAttr;
}

Expand Down Expand Up @@ -5151,14 +5154,15 @@ void mlir::pto::TMrgSortOp::print(OpAsmPrinter &p) {
p << " ins(" << getSrc() << ", " << getBlockLen() << " : " << getSrc().getType()
<< ", " << getBlockLen().getType() << ") outs(" << getDst() << " : "
<< getDst().getType() << ")";
} else {
assert(isFormat2());
} else if (isFormat2()) {
p << " ins(" << getSrcs()[0] << ", " << getSrcs()[1] << ", " << getSrcs()[2]
<< ", " << getSrcs()[3] << " {exhausted = " << (getExhausted() ? "true" : "false")
<< "} : " << getSrcs()[0].getType() << ", " << getSrcs()[1].getType() << ", "
<< getSrcs()[2].getType() << ", " << getSrcs()[3].getType() << ") outs("
<< getDst() << ", " << getTmp() << ", " << getExcuted() << " : " << getDst().getType() << ", "
<< getTmp().getType() << ", " << getExcuted().getType() << ")";
} else {
llvm::report_fatal_error("TMrgSortOp print expects format1 or format2");
}
p.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{"operandSegmentSizes", "exhausted"});
}
Expand Down
11 changes: 4 additions & 7 deletions lib/PTO/IR/PTOAttrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
// 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.

// 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.

//===- PTOAttrs.cpp ------------------------------------------------*- C++ -*-===//
#include "PTO/IR/PTO.h"
#include "mlir/IR/Builders.h"
Expand Down Expand Up @@ -132,7 +127,8 @@ Attribute TileBufConfigAttr::parse(AsmParser &p, Type) {
if (succeeded(p.parseOptionalGreater()))
return TileBufConfigAttr::get(ctx, bl, sl, sz, pv, compact);

while (true) {
bool parsedGreater = false;
while (!parsedGreater) {
StringRef key;
if (p.parseKeyword(&key)) return {};
if (p.parseEqual()) return {};
Expand Down Expand Up @@ -166,7 +162,8 @@ Attribute TileBufConfigAttr::parse(AsmParser &p, Type) {
return {};
}

if (succeeded(p.parseOptionalGreater()))
parsedGreater = succeeded(p.parseOptionalGreater());
if (parsedGreater)
break;
if (p.parseComma()) return {};
}
Expand Down
Loading
Loading