[Mlir-commits] [mlir] c0f8115 - [mlir][linalg] Only generate one var for an attrUse.

Hanhan Wang llvmlistbot at llvm.org
Tue Mar 2 12:48:42 PST 2021


Author: Hanhan Wang
Date: 2021-03-02T12:48:20-08:00
New Revision: c0f8115c73b758b992f237b531f4b807c0c1c810

URL: https://github.com/llvm/llvm-project/commit/c0f8115c73b758b992f237b531f4b807c0c1c810
DIFF: https://github.com/llvm/llvm-project/commit/c0f8115c73b758b992f237b531f4b807c0c1c810.diff

LOG: [mlir][linalg] Only generate one var for an attrUse.

Some variables are unused after D97383 landed. We should generate one symbol for one attrUse.

Reviewed By: stellaraccident

Differential Revision: https://reviews.llvm.org/D97794

Added: 
    

Modified: 
    mlir/test/mlir-linalg-ods-gen/test-linalg-ods-gen.tc
    mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-gen.tc b/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-gen.tc
index 8a230857dbf6..fd847e79437b 100644
--- a/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-gen.tc
+++ b/mlir/test/mlir-linalg-ods-gen/test-linalg-ods-gen.tc
@@ -122,16 +122,14 @@ attr(
 // IMPL-LABEL: ArrayAttr Test5Op::indexing_maps() {
 // IMPL: auto cst0 = getAffineConstantExpr(strides().getValue<int>({ 0 }), context);
 // IMPL: auto cst1 = getAffineConstantExpr(strides().getValue<int>({ 1 }), context);
-// IMPL: auto cst2 = getAffineConstantExpr(strides().getValue<int>({ 0 }), context);
-// IMPL: auto cst3 = getAffineConstantExpr(strides().getValue<int>({ 1 }), context);
 // IMPL: auto map0 = AffineMap::get(7, 9, {d0, d1 * s7 + d4, d2 * s8 + d5, d6}, context);
-// IMPL: map0 = map0.replaceDimsAndSymbols({}, { s0, s1, s2, s3, s4, s5, s6, cst2, cst3 }, 7, 0);
+// IMPL: map0 = map0.replaceDimsAndSymbols({}, { s0, s1, s2, s3, s4, s5, s6, cst0, cst1 }, 7, 0);
 // IMPL: map0 = simplifyAffineMap(map0);
 // IMPL: auto map1 = AffineMap::get(7, 9, {d3, d4, d5, d6}, context);
-// IMPL: map1 = map1.replaceDimsAndSymbols({}, { s0, s1, s2, s3, s4, s5, s6, cst2, cst3 }, 7, 0);
+// IMPL: map1 = map1.replaceDimsAndSymbols({}, { s0, s1, s2, s3, s4, s5, s6, cst0, cst1 }, 7, 0);
 // IMPL: map1 = simplifyAffineMap(map1);
 // IMPL: auto map2 = AffineMap::get(7, 7, {d0, d1, d2, d3}, context);
-// IMPL: map2 = map2.replaceDimsAndSymbols({}, { s0, s1, s2, s3, s4, s5, s6, cst2, cst3 }, 7, 0);
+// IMPL: map2 = map2.replaceDimsAndSymbols({}, { s0, s1, s2, s3, s4, s5, s6, cst0, cst1 }, 7, 0);
 // IMPL: map2 = simplifyAffineMap(map2);
 // IMPL: return {{.+}}.getAffineMapArrayAttr({ map0, map1, map2 });
 //

diff  --git a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp
index f557fa88308f..aac72cc05f8d 100644
--- a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp
+++ b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp
@@ -1306,12 +1306,11 @@ TCParser::parseAffineExprs(EagerDiscoveryMode discoveryMode,
       result.symbol = getAffineSymbolExpr(symbols.size(), parser.context);
       symbols.emplace_back("<attr-use>", result.symbol);
       registeredAttrUseToSymbol[result.getKey()] = result.symbol;
+      attrUses.push_back(result);
     } else {
       result.symbol = symbolIt->second;
     }
 
-    attrUses.push_back(result);
-
     return result.symbol;
   };
 


        


More information about the Mlir-commits mailing list