@@ -1216,10 +1220,19 @@ void
ConversionPatternRewriterImpl::resetState(RewriterState state) {
replacedOps.pop_back();
}
-void ConversionPatternRewriterImpl::undoRewrites(unsigned numRewritesToKeep) {
+void ConversionPatternRewriterImpl::undoRewrites(unsigned numRewritesTo
https://github.com/zero9178 approved this pull request.
LGTM!
https://github.com/llvm/llvm-project/pull/136490
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/zero9178 edited
https://github.com/llvm/llvm-project/pull/136490
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
@@ -75,9 +75,11 @@ class ConvertToLLVMPattern : public ConversionPattern {
ValueRange indices,
ConversionPatternRewriter &rewriter) const;
- /// Returns if the given memref has identity maps and the element type is
-
@@ -22,7 +22,7 @@ func.func @bad_address_space(%a: memref<2xindex, "foo">) {
// CHECK-LABEL: @invalid_int_conversion
func.func @invalid_int_conversion() {
- // expected-error@+1 {{conversion of memref memory space 1 : ui64 to
integer address space failed. Consider adding
https://github.com/zero9178 approved this pull request.
LGTM!
https://github.com/llvm/llvm-project/pull/120746
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/zero9178 approved this pull request.
I love the colour red
https://github.com/llvm/llvm-project/pull/121389
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-
@@ -63,80 +113,140 @@ static OpBuilder::InsertPoint computeInsertPoint(Value
value) {
return OpBuilder::InsertPoint(insertBlock, insertPt);
}
+/// Helper function that computes an insertion point where the given values are
+/// defined and can be used without a dominance vi
@@ -1192,51 +1256,28 @@ LogicalResult
ConversionPatternRewriterImpl::remapValues(
});
return failure();
}
-
// If a type is converted to 0 types, there is nothing to do.
if (legalTypes.empty()) {
remapped.push_back({});
continue;
}
@@ -63,80 +113,140 @@ static OpBuilder::InsertPoint computeInsertPoint(Value
value) {
return OpBuilder::InsertPoint(insertBlock, insertPt);
}
+/// Helper function that computes an insertion point where the given values are
+/// defined and can be used without a dominance vi
@@ -63,80 +113,140 @@ static OpBuilder::InsertPoint computeInsertPoint(Value
value) {
return OpBuilder::InsertPoint(insertBlock, insertPt);
}
+/// Helper function that computes an insertion point where the given values are
+/// defined and can be used without a dominance vi
@@ -1478,34 +1497,12 @@ Value
ConversionPatternRewriterImpl::findOrBuildReplacementValue(
}
Value castValue = buildUnresolvedMaterialization(
MaterializationKind::Source, computeInsertPoint(repl), value.getLoc(),
- /*valueToMap=*/value, /*inputs=*/repl, /*output
@@ -1101,18 +1172,18 @@ void CreateOperationRewrite::rollback() {
UnresolvedMaterializationRewrite::UnresolvedMaterializationRewrite(
ConversionPatternRewriterImpl &rewriterImpl, UnrealizedConversionCastOp op,
const TypeConverter *converter, MaterializationKind kind, Ty
@@ -1192,51 +1256,28 @@ LogicalResult
ConversionPatternRewriterImpl::remapValues(
});
return failure();
}
-
// If a type is converted to 0 types, there is nothing to do.
if (legalTypes.empty()) {
remapped.push_back({});
continue;
}
@@ -63,80 +113,140 @@ static OpBuilder::InsertPoint computeInsertPoint(Value
value) {
return OpBuilder::InsertPoint(insertBlock, insertPt);
}
+/// Helper function that computes an insertion point where the given values are
+/// defined and can be used without a dominance vi
@@ -1478,34 +1497,12 @@ Value
ConversionPatternRewriterImpl::findOrBuildReplacementValue(
}
Value castValue = buildUnresolvedMaterialization(
MaterializationKind::Source, computeInsertPoint(repl), value.getLoc(),
zero9178 wrote:
```suggestion
@@ -63,80 +113,140 @@ static OpBuilder::InsertPoint computeInsertPoint(Value
value) {
return OpBuilder::InsertPoint(insertBlock, insertPt);
}
+/// Helper function that computes an insertion point where the given values are
+/// defined and can be used without a dominance vi
@@ -1423,37 +1458,21 @@ ValueRange
ConversionPatternRewriterImpl::buildUnresolvedMaterialization(
builder.setInsertionPoint(ip.getBlock(), ip.getPoint());
auto convertOp =
builder.create(loc, outputTypes, inputs);
- if (valueToMap) {
-assert(outputTypes.size() =
@@ -63,80 +113,140 @@ static OpBuilder::InsertPoint computeInsertPoint(Value
value) {
return OpBuilder::InsertPoint(insertBlock, insertPt);
}
+/// Helper function that computes an insertion point where the given values are
+/// defined and can be used without a dominance vi
@@ -1192,51 +1256,28 @@ LogicalResult
ConversionPatternRewriterImpl::remapValues(
});
return failure();
}
-
// If a type is converted to 0 types, there is nothing to do.
if (legalTypes.empty()) {
remapped.push_back({});
continue;
}
https://github.com/zero9178 approved this pull request.
LGTM!
https://github.com/llvm/llvm-project/pull/120580
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/zero9178 edited
https://github.com/llvm/llvm-project/pull/120580
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
@@ -94,106 +94,111 @@ struct AssertOpLowering : public
ConvertOpToLLVMPattern {
bool abortOnFailedAssert = true;
};
-/// The cf->LLVM lowerings for branching ops require that the blocks they jump
-/// to first have updated types which should be handled by a pattern operatin
https://github.com/zero9178 commented:
I am personally in favour of this and besides the past, there probably isn't a
better time to do this change than now. I also really like that this only
deprecates the old names such that downstream users are notified on their next
bump and it can then be
@@ -113,13 +113,13 @@ struct AttributeLikeVariable : public VariableElement {
return isa(fe) && classof(cast(fe));
}
- /// Returns true if the variable is a UnitAttr or a UnitProperty.
+ /// Returns true if the variable is a UnitAttr or a UnitProp.
bool isUnit() con
@@ -102,8 +102,9 @@ their semantics via a special [TableGen
backend][TableGenBackend]:
constraints over attributes. A notable subclass hierarchy is `Attr`, which
stands for constraints for attributes whose values are of common types.
* The `Property` class hierarchy:
https://github.com/zero9178 edited
https://github.com/llvm/llvm-project/pull/120368
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/zero9178 edited
https://github.com/llvm/llvm-project/pull/120176
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
@@ -63,6 +65,12 @@ class Property {
return convertFromAttribute($_storage, $_attr, $_diag);
}];
+ // The verification predicate for this property. Defaults to And<[]>,
+ // which is trivially true, since properties are always their expected type.
+ // Within the predi
@@ -63,6 +65,12 @@ class Property {
return convertFromAttribute($_storage, $_attr, $_diag);
}];
+ // The verification predicate for this property. Defaults to And<[]>,
+ // which is trivially true, since properties are always their expected type.
+ // Within the predi
https://github.com/zero9178 edited
https://github.com/llvm/llvm-project/pull/120176
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
@@ -342,14 +399,37 @@ class _makePropStorage {
true : "") # ";";
}
+/// Construct a `Pred`icate `ret` that wraps the predicate of the underlying
+/// property `childProp` with:
+///
+/// [](childProp.storageType& s) {
+/// return [](childProp.interfaceType i) {
+
https://github.com/zero9178 edited
https://github.com/llvm/llvm-project/pull/120176
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
@@ -1033,6 +1033,60 @@ while (true) {{
emitVerifier(namedAttr.attr, namedAttr.name, getVarName(namedAttr.name));
}
+static void genPropertyVerifier(const OpOrAdaptorHelper &emitHelper,
+FmtContext &ctx, MethodBody &body) {
+
+ // Code to
@@ -1033,6 +1033,60 @@ while (true) {{
emitVerifier(namedAttr.attr, namedAttr.name, getVarName(namedAttr.name));
}
+static void genPropertyVerifier(const OpOrAdaptorHelper &emitHelper,
+FmtContext &ctx, MethodBody &body) {
+
+ // Code to
@@ -1033,6 +1033,60 @@ while (true) {{
emitVerifier(namedAttr.attr, namedAttr.name, getVarName(namedAttr.name));
}
+static void genPropertyVerifier(const OpOrAdaptorHelper &emitHelper,
+FmtContext &ctx, MethodBody &body) {
+
+ // Code to
@@ -1033,6 +1033,60 @@ while (true) {{
emitVerifier(namedAttr.attr, namedAttr.name, getVarName(namedAttr.name));
}
+static void genPropertyVerifier(const OpOrAdaptorHelper &emitHelper,
+FmtContext &ctx, MethodBody &body) {
+
+ // Code to
@@ -63,6 +65,12 @@ class Property {
return convertFromAttribute($_storage, $_attr, $_diag);
}];
+ // The verification predicate for this property. Defaults to And<[]>,
+ // which is trivially true, since properties are always their expected type.
+ // Within the predi
https://github.com/zero9178 commented:
Looks great to me, thank you! I added a few comments but they're all
implementation details, no conceptual complaints from my side.
Also adding Jeff as a reviewer given the disucssion at
https://github.com/llvm/llvm-project/pull/94732
https://github.com/
https://github.com/zero9178 approved this pull request.
LGTM, thank you!
https://github.com/llvm/llvm-project/pull/116470
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branc
https://github.com/zero9178 approved this pull request.
LGTM, thank you :))
https://github.com/llvm/llvm-project/pull/116532
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-br
@@ -1538,10 +1607,9 @@ void ConversionPatternRewriter::replaceOp(Operation *op,
ValueRange newValues) {
impl->logger.startLine()
<< "** Replace : '" << op->getName() << "'(" << op << ")\n";
});
- SmallVector newVals(newValues.size());
- for (auto [index, val] :
https://github.com/zero9178 edited
https://github.com/llvm/llvm-project/pull/116532
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/zero9178 commented:
Makes sense to me from a defensive programming perspective, but shouldn't a
user add their own argument materialization in this case that can handle their
type conversion and have that be called first?
Is there an easy way we can test this by any chance?
@@ -1538,10 +1607,9 @@ void ConversionPatternRewriter::replaceOp(Operation *op,
ValueRange newValues) {
impl->logger.startLine()
<< "** Replace : '" << op->getName() << "'(" << op << ")\n";
});
- SmallVector newVals(newValues.size());
- for (auto [index, val] :
@@ -1145,15 +1170,32 @@ LogicalResult
ConversionPatternRewriterImpl::remapValues(
return failure();
}
+// If a type is converted to 0 types, there is nothing to do.
+if (legalTypes.empty()) {
+ remapped.push_back({});
+ continue;
+}
+
if (
@@ -1376,14 +1423,36 @@ void
ConversionPatternRewriterImpl::insertNTo1Materialization(
legalOutputType = replacements[0].getType();
}
if (legalOutputType && legalOutputType != originalType) {
+UnrealizedConversionCastOp targetCastOp;
Value targetMat = buildUnr
@@ -537,6 +537,10 @@ class ConversionPattern : public RewritePattern {
ConversionPatternRewriter &rewriter) const {
llvm_unreachable("unimplemented rewrite");
}
+ virtual void rewrite(Operation *op, ArrayRef operands,
zero9178 wrot
@@ -1733,12 +1819,14 @@ ConversionPattern::matchAndRewrite(Operation *op,
getTypeConverter());
// Remap the operands of the operation.
- SmallVector operands;
+ SmallVector> remapped;
if (failed(rewriterImpl.remapValues("oper
@@ -1965,19 +2053,19 @@ OperationLegalizer::legalizeWithFold(Operation *op,
});
// Try to fold the operation.
- SmallVector replacementValues;
+ SmallVector ValueRange;
zero9178 wrote:
```suggestion
SmallVector valueRange;
```
https://github.com/llvm
https://github.com/zero9178 edited
https://github.com/llvm/llvm-project/pull/115816
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
@@ -1390,8 +1412,9 @@ void
ConversionPatternRewriterImpl::notifyOpReplaced(Operation *op,
isUnresolvedMaterialization = true;
// Create mappings for each of the new result values.
- for (auto [newValue, result] : llvm::zip(newValues, op->getResults())) {
-if (!ne
https://github.com/zero9178 commented:
Looks mostly good to me besides some code nits :slightly_smiling_face:
The only very high level conern I have is the use and need of
`InsertionPoint::after`. As I understand, this is a not-yet-implemented
optimization for the future for the purpose of re
@@ -795,12 +795,32 @@ class ConversionPatternRewriter final : public
PatternRewriter {
/// patterns even if a failure is encountered during the rewrite step.
bool canRecoverFromRewriteFailure() const override { return true; }
- /// PatternRewriter hook for replacing an o
@@ -1497,15 +1530,33 @@ void ConversionPatternRewriter::replaceOp(Operation
*op, ValueRange newValues) {
impl->logger.startLine()
<< "** Replace : '" << op->getName() << "'(" << op << ")\n";
});
- impl->notifyOpReplaced(op, newValues);
+ SmallVector newVals(new
@@ -618,21 +618,27 @@ class SparseCallConverter : public
OpConversionPattern {
assert(!sparseFlat.empty());
if (sparseFlat.size() > 1) {
auto flatSize = sparseFlat.size();
-ValueRange fields(iterator_range(
-newCall.result_begin() + retO
@@ -795,12 +795,32 @@ class ConversionPatternRewriter final : public
PatternRewriter {
/// patterns even if a failure is encountered during the rewrite step.
bool canRecoverFromRewriteFailure() const override { return true; }
- /// PatternRewriter hook for replacing an o
@@ -618,21 +618,27 @@ class SparseCallConverter : public
OpConversionPattern {
assert(!sparseFlat.empty());
if (sparseFlat.size() > 1) {
auto flatSize = sparseFlat.size();
-ValueRange fields(iterator_range(
-newCall.result_begin() + retO
@@ -1497,15 +1530,33 @@ void ConversionPatternRewriter::replaceOp(Operation
*op, ValueRange newValues) {
impl->logger.startLine()
<< "** Replace : '" << op->getName() << "'(" << op << ")\n";
});
- impl->notifyOpReplaced(op, newValues);
+ SmallVector newVals(new
@@ -1417,12 +1441,21 @@ void
ConversionPatternRewriterImpl::notifyOpReplaced(Operation *op,
}
// Remap result to replacement value.
-if (newValue)
- mapping.map(result, newValue);
+if (!repl.empty()) {
+ if (repl.size() == 1) {
+// Single rep
@@ -618,21 +618,27 @@ class SparseCallConverter : public
OpConversionPattern {
assert(!sparseFlat.empty());
if (sparseFlat.size() > 1) {
auto flatSize = sparseFlat.size();
-ValueRange fields(iterator_range(
-newCall.result_begin() + retO
zero9178 wrote:
Should the changes here be part of the other PR?
https://github.com/llvm/llvm-project/pull/115816
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/
@@ -409,32 +419,50 @@ class TypeConverter {
/// callback.
///
/// With callback of form:
- /// `Value(OpBuilder &, T, ValueRange, Location, Type)`
+ /// - Value(OpBuilder &, T, ValueRange, Location, Type)
+ /// - SmallVector(OpBuilder &, TypeRange, ValueRange, Location
@@ -409,32 +419,50 @@ class TypeConverter {
/// callback.
///
/// With callback of form:
- /// `Value(OpBuilder &, T, ValueRange, Location, Type)`
+ /// - Value(OpBuilder &, T, ValueRange, Location, Type)
+ /// - SmallVector(OpBuilder &, TypeRange, ValueRange, Location
https://github.com/zero9178 approved this pull request.
https://github.com/llvm/llvm-project/pull/110419
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/zero9178 edited
https://github.com/llvm/llvm-project/pull/104668
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/zero9178 approved this pull request.
LGTM
Slight nit in the PR description: Initially reading paragraph one and two had
me confused whether the `ConversionConfig::buildMaterializations` knob and the
"automatic materilization" as you called it were referring to the same thing
@@ -702,14 +702,8 @@ class UnresolvedMaterializationRewrite : public
OperationRewrite {
return rewrite->getKind() == Kind::UnresolvedMaterialization;
}
- UnrealizedConversionCastOp getOperation() const {
zero9178 wrote:
I think it would be cleaner to
https://github.com/zero9178 edited
https://github.com/llvm/llvm-project/pull/104668
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
@@ -2447,6 +2487,37 @@ LogicalResult
OperationConverter::convertOperations(ArrayRef ops) {
} else {
rewriterImpl.applyRewrites();
}
+
+ // Gather all unresolved materializations.
+ SmallVector allCastOps;
+ DenseMap rewriteMap;
+ for (auto &rewrite : rewriterImpl.r
https://github.com/zero9178 approved this pull request.
https://github.com/llvm/llvm-project/pull/97903
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
zero9178 wrote:
ping
https://github.com/llvm/llvm-project/pull/80421
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/zero9178 approved this pull request.
https://github.com/llvm/llvm-project/pull/81373
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
@@ -25,7 +25,8 @@ include "mlir/IR/BuiltinTypeInterfaces.td"
// Base class for Builtin dialect types.
class Builtin_Type traits = [],
string baseCppClass = "::mlir::Type">
-: TypeDef {
+: TypeDef`) since the
logic currently assumes that verbose types
https://github.com/zero9178 updated
https://github.com/llvm/llvm-project/pull/80421
From e67e980cd077de77bb1683f4a9ad948f13ad4289 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20B=C3=B6ck?=
Date: Fri, 2 Feb 2024 12:47:05 +0100
Subject: [PATCH] [mlir] Start moving some builtin type formats to
https://github.com/zero9178 created
https://github.com/llvm/llvm-project/pull/80421
Most types and attributes in the builtin dialect are parsed and printed using
special-purpose printers and parsers for that type. They also use the low-level
`Printer` rather than the `AsmPrinter`, making the i
https://github.com/zero9178 approved this pull request.
(I think only release managers can merge to the release branch, not sure
however)
https://github.com/llvm/llvm-project/pull/79603
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.ll
https://github.com/zero9178 approved this pull request.
https://github.com/llvm/llvm-project/pull/79863
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
Author: Markus Böck
Date: 2021-08-03T09:14:57+02:00
New Revision: a7eab64b7c45d40154ec6f04d3a1f38b13dacfab
URL:
https://github.com/llvm/llvm-project/commit/a7eab64b7c45d40154ec6f04d3a1f38b13dacfab
DIFF:
https://github.com/llvm/llvm-project/commit/a7eab64b7c45d40154ec6f04d3a1f38b13dacfab.diff
L
79 matches
Mail list logo